TRX 1 год назад
Родитель
Сommit
6e6338d8cf

+ 6 - 1
src/main/java/com/zswl/dataservice/service/artemis/OperationMessageService.java

@@ -74,7 +74,7 @@ public class OperationMessageService {
 
     // 保存90天
     @Value("${artemisstore.time}")
-    private Long ttlMill = 90 * 24L * 60 * 60 * 1000L;
+    private Long ttlMill = 30 * 24L * 60 * 60 * 1000L;
 
     @Autowired
     private ExecuteMethodInfoDao executeMethodInfoDao;
@@ -245,6 +245,7 @@ public class OperationMessageService {
                 log.info("获取到执行锁,开始执行");
                 entity.setId(temp.getId());
                 entity.setToken(temp.getToken());
+                entity.setCreateTime(System.currentTimeMillis());
                 addOperationMessage(entity);
             } else {
                 log.warn("未获取到执行锁,跳过执行");
@@ -264,6 +265,10 @@ public class OperationMessageService {
     public ResultContent addOperationMessage(OperationMessage entity) {
         entity.setTime(DateUtils.paresTime(System.currentTimeMillis(), DateUtils.patternyyyySSS));
         entity.setTtl(new Date(System.currentTimeMillis() + ttlMill));
+        if (entity.getEvent().equals("ping")) {
+            Date da = new Date(System.currentTimeMillis() + 10 * 60 * 1000);
+            entity.setTtl(da);
+        }
         if (entity.getIsTimeOut()) {
             entity.setHandleMsg("超时不处理");
         }

+ 3 - 0
src/main/java/com/zswl/dataservice/service/mqtt/DevicePingInfoService.java

@@ -188,6 +188,9 @@ public class DevicePingInfoService extends SuperService {
                         onLineState = OnLineState.OffLine;
                     }
                 }
+                if (ObjectUtils.isEmpty(_list)) {
+                    onLineState = OnLineState.OffLine;
+                }
 
                 if (onLineState != gateWayInfo.getOnLineState()) {
                     log.info("网关在线状态改变:{} {}", gateWayInfo.getGateWayName(), onLineState);