diff --git a/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java b/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java index fbc22d18..79958a7e 100644 --- a/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java +++ b/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java @@ -459,7 +459,7 @@ public class SocketDevResponseService { double diff = Math.abs(num1 - num2); double larger = Math.max(num1, num2); if(DicDataEnum.V.getCode().equals(type)){ - return BigDecimal.valueOf(diff / larger).setScale(4, RoundingMode.HALF_UP); + return BigDecimal.valueOf(num1 - num2).setScale(4, RoundingMode.HALF_UP); }else { return BigDecimal.valueOf(diff / larger).multiply(BigDecimal.valueOf(100)).setScale(4, RoundingMode.HALF_UP); } diff --git a/detection/src/main/java/com/njcn/gather/detection/util/socket/web/WebSocketHandler.java b/detection/src/main/java/com/njcn/gather/detection/util/socket/web/WebSocketHandler.java index 5d720081..31c0eabf 100644 --- a/detection/src/main/java/com/njcn/gather/detection/util/socket/web/WebSocketHandler.java +++ b/detection/src/main/java/com/njcn/gather/detection/util/socket/web/WebSocketHandler.java @@ -108,7 +108,7 @@ public class WebSocketHandler extends SimpleChannelInboundHandler { * 这个时候我们只需要访问 ws://127.0.0.1:7777/hello 就可以了 * 这个handler是将http协议升级为websocket 并且使用 101 作为响应码 * */ - pipeline.addLast(new IdleStateHandler(10, -1, -1, TimeUnit.SECONDS)); + pipeline.addLast(new IdleStateHandler(13, 0, 0, TimeUnit.SECONDS)); pipeline.addLast(new WebSocketHandler()); pipeline.addLast(new WebSocketServerProtocolHandler("/hello"));