瀏覽代碼

Merge branch 'V1' of http://223.75.76.159:9090/xiao547607/smart-community-server

fllmoyu 5 年之前
父節點
當前提交
bad1564b5c

+ 21 - 21
lapi/src/main/java/com/jpsoft/smart/lapi/handler/HeartReportHandler.java

@@ -101,27 +101,27 @@ public class HeartReportHandler extends SimpleChannelInboundHandler<HeartReportI
         String deviceNo = ctx.channel().attr(LapiAttrKeys.DEVICE_NO).get();
 
         if(StringUtils.isNotEmpty(deviceNo)){
-            log.warn(deviceNo + "已离线");
-
-            new Thread(()->{
-                try {
-                    //防止channelRead0和channelInactive同时发生
-                    Thread.sleep(1000);
-                } catch (InterruptedException e) {
-                    e.printStackTrace();
-                }
-
-                SysLog sysLog = new SysLog();
-                sysLog.setPointcut(deviceNo);
-                sysLog.setUrl("/LAPI/V1.0/PACS/Controller/HeartReportInfo");
-                sysLog.setRemark("设备离线");
-                SocketAddress remoteAddress = ctx.channel().remoteAddress();
-                sysLog.setRemoteIp(remoteAddress.toString());
-                sysLog.setCreateTime(new Date());
-                sysLogService.insert(sysLog);
-
-                deviceInfoService.updateByDeviceNo(deviceNo,false);
-            }).start();
+            log.warn(deviceNo + "channelInactive");
+
+//            new Thread(()->{
+//                try {
+//                    //防止channelRead0和channelInactive同时发生
+//                    Thread.sleep(1000);
+//                } catch (InterruptedException e) {
+//                    e.printStackTrace();
+//                }
+//
+//                SysLog sysLog = new SysLog();
+//                sysLog.setPointcut(deviceNo);
+//                sysLog.setUrl("/LAPI/V1.0/PACS/Controller/HeartReportInfo");
+//                sysLog.setRemark("设备离线");
+//                SocketAddress remoteAddress = ctx.channel().remoteAddress();
+//                sysLog.setRemoteIp(remoteAddress.toString());
+//                sysLog.setCreateTime(new Date());
+//                sysLogService.insert(sysLog);
+//
+//                deviceInfoService.updateByDeviceNo(deviceNo,false);
+//            }).start();
         }
     }
 }

+ 2 - 2
web/src/main/java/com/jpsoft/smart/schduled/HeartbeatDetectionTask.java

@@ -25,8 +25,8 @@ public class HeartbeatDetectionTask {
     @Autowired
     private ILapiService lapiService;
 
-    //每10分钟执行一次->同时在unactive方法中执行
-    @Scheduled(cron = "0 0/10 * * * ?")
+    //每2分钟执行一次->同时在unactive方法中执行
+    @Scheduled(cron = "0 0/2 * * * ?")
     public void run() {
         log.warn("设备在线定时任务启动");
         List<DeviceInfo> deviceInfoList = deviceInfoService.listOnline();