Просмотр исходного кода

2023-3-1 修改给一体机推送的消息,延迟推送。

chaiyunlong лет назад: 2
Родитель
Сommit
309ef94c96

+ 3 - 4
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mqtt/service/impl/SubMessageSendManager.java

@@ -121,11 +121,10 @@ public class SubMessageSendManager {
             return;
         }
         MessageBody messageBody = getMessageBody(subFunction);
-        String key = getFunctionSubTopic(subId);
         //仅发送一次
-        if (redisService.getCacheObject(key)==null){
-            redisService.setCacheObject(key,key,15L, TimeUnit.SECONDS);
-            commonSend.send(key, messageBody, SendMode.ONCE);
+        if (redisService.getCacheObject(subId+"")==null){
+            redisService.setCacheObject(subId+"",subId+"",15L, TimeUnit.SECONDS);
+            commonSend.send(getFunctionSubTopic(subId), messageBody, SendMode.ONCE);
         }
     }