From 9d2f7ee6bcef26b55108821dc2dc08dbb1eb4c0a Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期三, 12 二月 2025 09:51:32 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/utils/NotifyUtils.java    |   35 ++++++++++++-----------------------
 src/main/java/com/zy/asrs/task/NotifyScheduler.java |   10 +++++-----
 2 files changed, 17 insertions(+), 28 deletions(-)

diff --git a/src/main/java/com/zy/asrs/task/NotifyScheduler.java b/src/main/java/com/zy/asrs/task/NotifyScheduler.java
index 601d9aa..0c786e3 100644
--- a/src/main/java/com/zy/asrs/task/NotifyScheduler.java
+++ b/src/main/java/com/zy/asrs/task/NotifyScheduler.java
@@ -47,7 +47,7 @@
         }
     }
 
-    private synchronized void notifyMsg(String deviceType, Integer device) {
+    private synchronized void notifyMsg(String notifyType, Integer device) {
         Config notifyEnableConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "notifyEnable"));
         if(notifyEnableConfig == null){
             return;
@@ -69,7 +69,7 @@
         }
         String notifyUriPath = notifyUriPathConfig.getValue();
 
-        List<String> keys = notifyUtils.takeKeys(deviceType, device);
+        List<String> keys = notifyUtils.takeKeys(notifyType, device);
         if(keys == null){
             return;
         }
@@ -102,7 +102,7 @@
                 if(code == 200){
                     //閫氱煡鎴愬姛
                     redisUtil.del(key);
-                    return;
+                    continue;
                 }
             }catch (Exception e){
                 e.printStackTrace();
@@ -113,13 +113,13 @@
             if (times >= notifyDto.getFailTimes()) {
                 //瓒呰繃娆℃暟
                 redisUtil.del(key);
-                return;
+                continue;
             }
 
             notifyDto.setLastRetryTime(System.currentTimeMillis());
             notifyDto.setRetryTimes(times);
             redisUtil.set(key, notifyDto);
-            return;
+            continue;
         }
     }
 
diff --git a/src/main/java/com/zy/asrs/utils/NotifyUtils.java b/src/main/java/com/zy/asrs/utils/NotifyUtils.java
index 8fb8930..431bf18 100644
--- a/src/main/java/com/zy/asrs/utils/NotifyUtils.java
+++ b/src/main/java/com/zy/asrs/utils/NotifyUtils.java
@@ -35,8 +35,8 @@
         return append(notifyType, device, taskNo, 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;
         }
@@ -53,27 +53,7 @@
         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;
@@ -82,6 +62,15 @@
         } 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, NotifyMsgType msgType, String data) {
+        String key = getKey(notifyType, device);
+        if(key == null){
             return false;
         }
 

--
Gitblit v1.9.1