|
@@ -34,6 +34,13 @@ public class HeartReportHandler extends SimpleChannelInboundHandler<HeartReportI
|
|
|
@Autowired
|
|
|
private SysLogService sysLogService;
|
|
|
|
|
|
+ private final String X_FRAME_OPTIONS = "X-Frame-Options";
|
|
|
+ private final String SAMEORIGIN = "SAMEORIGIN";
|
|
|
+ private final String JSON_PLAIN = "application/json";
|
|
|
+ private final String CONTENT_LENGTH = "Content-Length";
|
|
|
+ private final String CONTENT_TYPE = "Content-Type";
|
|
|
+ private final String CONNECTION = "Connection";
|
|
|
+
|
|
|
@Override
|
|
|
protected void channelRead0(ChannelHandlerContext ctx, HeartReportInfo heartReportInfo) throws Exception {
|
|
|
log.warn(heartReportInfo.toString());
|
|
@@ -103,25 +110,25 @@ public class HeartReportHandler extends SimpleChannelInboundHandler<HeartReportI
|
|
|
if(StringUtils.isNotEmpty(deviceNo)){
|
|
|
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();
|
|
|
+ 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();
|
|
|
}
|
|
|
}
|
|
|
}
|