|  |  | 
 |  |  |     @Autowired | 
 |  |  |     private ConfigService configService; | 
 |  |  |  | 
 |  |  |     public synchronized boolean notify(String notifyType, Integer device, String taskNo, NotifyMsgType msgType) { | 
 |  |  |         return append(notifyType, device, taskNo, msgType, null); | 
 |  |  |     public synchronized boolean notify(String notifyType, Integer device, String taskNo, String superTaskNo, NotifyMsgType msgType) { | 
 |  |  |         return append(notifyType, device, taskNo, superTaskNo, msgType, null); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public synchronized boolean notify(String notifyType, Integer device, String taskNo, NotifyMsgType msgType, String data) { | 
 |  |  |         return append(notifyType, device, taskNo, msgType, data); | 
 |  |  |     public synchronized boolean notify(String notifyType, Integer device, String taskNo, String superTaskNo, NotifyMsgType msgType, String data) { | 
 |  |  |         return append(notifyType, device, taskNo, superTaskNo, msgType, data); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public synchronized List<String> takeKeys(String deviceType, Integer device) { | 
 |  |  |         String key = getKey(deviceType, device); | 
 |  |  |     public synchronized List<String> takeKeys(String notifyType, Integer device) { | 
 |  |  |         String key = getKey(notifyType, device); | 
 |  |  |         if(key == null){ | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  | 
 |  |  |         return list; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public String getKey(String deviceType, Integer device) { | 
 |  |  |         SlaveType type = SlaveType.findInstance(deviceType); | 
 |  |  |         if (type == null) { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |         String key = null; | 
 |  |  |         switch (type) { | 
 |  |  |             case Shuttle: | 
 |  |  |                 key = RedisKeyType.QUEUE_SHUTTLE.key + device; | 
 |  |  |                 break; | 
 |  |  |             case ForkLift: | 
 |  |  |                 key = RedisKeyType.QUEUE_FORK_LIFT.key + device; | 
 |  |  |                 break; | 
 |  |  |             default: | 
 |  |  |                 return null; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         return key; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     private boolean append(String notifyType, Integer device, String taskNo, NotifyMsgType msgType, String data) { | 
 |  |  |     public String getKey(String notifyType, Integer device) { | 
 |  |  |         String key = null; | 
 |  |  |         if (notifyType.equals(String.valueOf(SlaveType.Shuttle))) { | 
 |  |  |             key = RedisKeyType.QUEUE_SHUTTLE.key + device; | 
 |  |  | 
 |  |  |         } else if (notifyType.equals("task")) { | 
 |  |  |             key = RedisKeyType.QUEUE_TASK.key + device; | 
 |  |  |         } else { | 
 |  |  |             return null; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         return key; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     private boolean append(String notifyType, Integer device, String taskNo, String superTaskNo, NotifyMsgType msgType, String data) { | 
 |  |  |         boolean notifyEnable = true; | 
 |  |  |         Config notifyEnableConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "notifyEnable")); | 
 |  |  |         if (notifyEnableConfig != null) { | 
 |  |  |             notifyEnable = notifyEnableConfig.getValue().equals("Y"); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         if (!notifyEnable) { | 
 |  |  |             return false; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         String key = getKey(notifyType, device); | 
 |  |  |         if (key == null) { | 
 |  |  |             return false; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  | 
 |  |  |         dto.setMsgDesc(msgType.desc); | 
 |  |  |         dto.setData(data); | 
 |  |  |         dto.setTaskNo(taskNo); | 
 |  |  |         dto.setSuperTaskNo(superTaskNo); | 
 |  |  |  | 
 |  |  |         //重试次数 | 
 |  |  |         Config notifyFailTimesConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "notifyFailTimes")); |