Selaa lähdekoodia

设置五分钟离线状态

Zimo 1 päivä sitten
vanhempi
commit
d65718f481

+ 21 - 19
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/job/TdCronJob.java

@@ -60,20 +60,22 @@ public class TdCronJob implements JobHandler {
                         device.setLastInlineTime(format);
                     }
                 }
-                if (e.getStatus()==1) {
-//                        if (StringUtils.isNotBlank(device.getLastInlineTime())) {
-//                            try {
-//                                if (DateUtils.checkIfFullDayDifference(device.getLastInlineTime())) {
-//                                    device.setIfInline(4);
-//                                } else {
-//                                    device.setIfInline(3);
-//                                }
-//                            } catch (Exception ex) {
-//                                throw new RuntimeException(ex.getMessage());
-//                            }
-//                        } else {
-//                            device.setIfInline(4);
-//                        }
+                if (e.getStatus()==1) {//未激活状态
+
+                    if (StringUtils.isNotBlank(device.getLastInlineTime())) {
+                        try {
+                            if (DateUtils.checkIfFullDayDifference(device.getLastInlineTime())) {
+                                device.setIfInline(4);
+                            } else {
+                                device.setIfInline(3);
+                            }
+                        } catch (Exception ex) {
+                            throw new RuntimeException(ex.getMessage());
+                        }
+                    } else {
+                        device.setIfInline(4);
+                    }
+
                     Object lat = redisTemplate.opsForHash().get("TSLV:" + device.getDeviceCode(), "lat");
                     if (Objects.nonNull(lat)) {
                         JSONObject jsonObject = JSON.parseObject(lat.toString());
@@ -92,11 +94,11 @@ public class TdCronJob implements JobHandler {
                     }
                 } else {
                         if (StringUtils.isNotBlank(device.getLastInlineTime())) {
-//                            if (DateUtils.checkIfFullDayDifference(device.getLastInlineTime())) {
-//                                device.setIfInline(4);
-//                            } else {
+                            if (DateUtils.checkIfFullDayDifference(device.getLastInlineTime())) {
+                                device.setIfInline(4);
+                            } else {
                                 device.setIfInline(e.getStatus());
-//                            }
+                            }
                         } else {
                             device.setIfInline(4);
                         }
@@ -109,7 +111,7 @@ public class TdCronJob implements JobHandler {
 
 
     public static void main(String[] args) {
-        String abc = "2025-07-14 20:07:40";
+        String abc = "2026-01-21 10:25:40";
         System.out.println(DateUtils.checkIfFullDayDifference(abc));
     }
 }