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 76d250a2..838b357e 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 @@ -117,6 +117,8 @@ public class SocketDevResponseService { break; case UNPROCESSED_BUSINESS: break; + case NO_INIT_DEV: + break; default: WebSocketVO webSocketVO = new WebSocketVO(); diff --git a/detection/src/main/java/com/njcn/gather/detection/pojo/enums/SourceResponseCodeEnum.java b/detection/src/main/java/com/njcn/gather/detection/pojo/enums/SourceResponseCodeEnum.java index 9f61e605..e41cf4a8 100644 --- a/detection/src/main/java/com/njcn/gather/detection/pojo/enums/SourceResponseCodeEnum.java +++ b/detection/src/main/java/com/njcn/gather/detection/pojo/enums/SourceResponseCodeEnum.java @@ -31,6 +31,7 @@ public enum SourceResponseCodeEnum { RE_OPERATE(10552,"重复的初始化操作"), COMMUNICATION_ERR(10553,"通讯模块通讯异常"), DATA_RESOLVE(10554,"报文解析异常"), + NO_INIT_DEV(10556,"不存在上线的设备"), //自定义前端展示消息 SOCKET_ERROR(20000,"连接服务端失败") diff --git a/detection/src/main/java/com/njcn/gather/detection/util/socket/cilent/NettyDevClientHandler.java b/detection/src/main/java/com/njcn/gather/detection/util/socket/cilent/NettyDevClientHandler.java index a76867b9..85332878 100644 --- a/detection/src/main/java/com/njcn/gather/detection/util/socket/cilent/NettyDevClientHandler.java +++ b/detection/src/main/java/com/njcn/gather/detection/util/socket/cilent/NettyDevClientHandler.java @@ -41,6 +41,8 @@ public class NettyDevClientHandler extends SimpleChannelInboundHandler { @Override public void channelActive(ChannelHandlerContext ctx) throws Exception { System.out.println("客户端通道已建立" + ctx.channel().remoteAddress()); + SocketManager.addUser(param.getUserPageId()+"_Dev",ctx.channel()); + } /** @@ -78,7 +80,6 @@ public class NettyDevClientHandler extends SimpleChannelInboundHandler { @Override public void handlerAdded(ChannelHandlerContext ctx) { - SocketManager.addUser(param.getUserPageId()+"_Dev",ctx.channel()); System.out.println("有通道接入" + ctx.channel()); } diff --git a/detection/src/main/java/com/njcn/gather/detection/util/socket/cilent/NettySourceClientHandler.java b/detection/src/main/java/com/njcn/gather/detection/util/socket/cilent/NettySourceClientHandler.java index d0af664e..6b601c91 100644 --- a/detection/src/main/java/com/njcn/gather/detection/util/socket/cilent/NettySourceClientHandler.java +++ b/detection/src/main/java/com/njcn/gather/detection/util/socket/cilent/NettySourceClientHandler.java @@ -32,6 +32,8 @@ public class NettySourceClientHandler extends SimpleChannelInboundHandler