diff --git a/detection/src/main/java/com/njcn/gather/detection/service/impl/PreDetectionServiceImpl.java b/detection/src/main/java/com/njcn/gather/detection/service/impl/PreDetectionServiceImpl.java index d4322eb0..91e0aaa0 100644 --- a/detection/src/main/java/com/njcn/gather/detection/service/impl/PreDetectionServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/detection/service/impl/PreDetectionServiceImpl.java @@ -105,7 +105,7 @@ public class PreDetectionServiceImpl implements PreDetectionService { msg.setOperateCode(SourceOperateCodeEnum.OPER_GATHER.getValue()); msg.setData(JSON.toJSONString(sourceParam)); String s = userPageId + "_Source"; - NettyClient.socketClient(ip, port, new NettySourceClientHandler(s, sourceResponseService)); + NettyClient.socketClient(ip, port,userPageId, new NettySourceClientHandler(s, sourceResponseService)); SocketManager.sendMsg(s,JSON.toJSONString(msg)); @@ -136,7 +136,7 @@ public class PreDetectionServiceImpl implements PreDetectionService { String ddId = param.getUserPageId(); Channel channel = SocketManager.getChannelByUserId(ddId); if( channel== null || !channel.isActive()){ - NettyClient.socketClient(ip, port,new NettySourceClientHandler(ddId, sourceResponseService)); + NettyClient.socketClient(ip, port,param.getUserPageId(),new NettySourceClientHandler(ddId, sourceResponseService)); } SocketManager.sendMsg(ddId,"start\n"); } diff --git a/detection/src/main/java/com/njcn/gather/detection/util/socket/cilent/NettyClient.java b/detection/src/main/java/com/njcn/gather/detection/util/socket/cilent/NettyClient.java index 8bce53d8..a28e0ea9 100644 --- a/detection/src/main/java/com/njcn/gather/detection/util/socket/cilent/NettyClient.java +++ b/detection/src/main/java/com/njcn/gather/detection/util/socket/cilent/NettyClient.java @@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil; import com.njcn.common.pojo.enums.response.CommonResponseEnum; import com.njcn.common.pojo.exception.BusinessException; import com.njcn.gather.detection.util.socket.SocketManager; +import com.njcn.gather.detection.util.socket.WebServiceManager; import io.netty.bootstrap.Bootstrap; import io.netty.channel.*; import io.netty.channel.nio.NioEventLoopGroup; @@ -36,7 +37,7 @@ import java.util.concurrent.TimeUnit; public class NettyClient { - public static void socketClient(String ip, Integer port,SimpleChannelInboundHandler handler) { + public static void socketClient(String ip, Integer port,String userPageId,SimpleChannelInboundHandler handler) { NioEventLoopGroup group = new NioEventLoopGroup(); Bootstrap bootstrap = new Bootstrap(); try { @@ -69,6 +70,7 @@ public class NettyClient { group.shutdownGracefully(); //TODO 通知页面 + }finally { System.out.println("进入clientSocket最后步骤---------------------"); }