From 7d8877663338f8d3fa8b547b1a0eb4ff3931630a Mon Sep 17 00:00:00 2001 From: wr <1754607820@qq.com> Date: Thu, 19 Dec 2024 10:13:59 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pojo/enums/SourceOperateCodeEnum.java | 3 +++ .../util/socket/cilent/NettyClient.java | 2 +- .../socket/cilent/NettyDevClientHandler.java | 3 --- .../cilent/NettySourceClientHandler.java | 27 +++++++++++++++++++ .../device/device/pojo/vo/PreDetection.java | 12 +++++++++ .../device/service/impl/PqDevServiceImpl.java | 2 ++ .../mapper/mapping/PqMonitorMapper.xml | 4 ++- 7 files changed, 48 insertions(+), 5 deletions(-) diff --git a/detection/src/main/java/com/njcn/gather/detection/pojo/enums/SourceOperateCodeEnum.java b/detection/src/main/java/com/njcn/gather/detection/pojo/enums/SourceOperateCodeEnum.java index f0566165..8f60172f 100644 --- a/detection/src/main/java/com/njcn/gather/detection/pojo/enums/SourceOperateCodeEnum.java +++ b/detection/src/main/java/com/njcn/gather/detection/pojo/enums/SourceOperateCodeEnum.java @@ -17,6 +17,7 @@ public enum SourceOperateCodeEnum { INIT_GATHER("INIT_GATHER", "源初始化"), OPER_GATHER("OPER_GATHER", "源输出"), CLOSE_GATHER("CLOSE_GATHER", "源停止"), + HEARTBEAT("HeartBeat", "心跳报文"), /** * 终端 INIT_GATHER$01 INIT_GATHER采集初始化,01 统计采集、02 暂态采集、03 实时采集 @@ -30,6 +31,8 @@ public enum SourceOperateCodeEnum { DEV_DATA_REQUEST_03("DATA_REQUEST$03", "暂态采集申请"), + + YJC_YTXJY("yjc_ytxjy", "预检测_源通讯检测"), YJC_SBTXJY("yjc_sbtxjy", "预检测_设备通讯检测"), YJC_XYJY("yjc_xyjy", "预检测_协议校验"), 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 dd40856c..38a35485 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 @@ -48,7 +48,7 @@ public class NettyClient { .handler(new ChannelInitializer() { @Override protected void initChannel(NioSocketChannel ch) { - if(port==10086){ + if(handler instanceof NettySourceClientHandler){ ch.pipeline() //空闲状态的handler // 添加LineBasedFrameDecoder来按行分割数据 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 321cb74b..a76867b9 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 @@ -3,11 +3,8 @@ package com.njcn.gather.detection.util.socket.cilent; import com.njcn.gather.detection.handler.SocketDevResponseService; import com.njcn.gather.detection.pojo.param.PreDetectionParam; import com.njcn.gather.detection.util.socket.SocketManager; -import com.njcn.gather.detection.util.socket.WebServiceManager; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.SimpleChannelInboundHandler; -import io.netty.handler.timeout.IdleState; -import io.netty.handler.timeout.IdleStateEvent; import io.netty.handler.timeout.TimeoutException; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Value; 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 af50c46d..d0af664e 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 @@ -5,8 +5,12 @@ import com.njcn.gather.detection.pojo.param.PreDetectionParam; import com.njcn.gather.detection.util.socket.SocketManager; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.SimpleChannelInboundHandler; +import io.netty.handler.timeout.TimeoutException; import lombok.RequiredArgsConstructor; +import java.io.IOException; +import java.net.ConnectException; +import java.net.ProtocolException; /** @@ -85,7 +89,30 @@ public class NettySourceClientHandler extends SimpleChannelInboundHandler implements monitorListDTO=new PreDetection.MonitorListDTO(); monitorListDTO.setLineId(preDetection.getDevIP()+"_"+i); monitorListDTO.setLine(i); + monitorListDTO.setPt(1); + monitorListDTO.setPt(1); monitorList.add(monitorListDTO); } preDetection.setMonitorList(monitorList); diff --git a/device/src/main/java/com/njcn/gather/device/monitor/mapper/mapping/PqMonitorMapper.xml b/device/src/main/java/com/njcn/gather/device/monitor/mapper/mapping/PqMonitorMapper.xml index abda3aa7..56f9e3e2 100644 --- a/device/src/main/java/com/njcn/gather/device/monitor/mapper/mapping/PqMonitorMapper.xml +++ b/device/src/main/java/com/njcn/gather/device/monitor/mapper/mapping/PqMonitorMapper.xml @@ -6,7 +6,9 @@ resultType="com.njcn.gather.device.device.pojo.vo.PreDetection$MonitorListDTO"> SELECT Id as lineId, - Num as line + Num as line, + pt as pt, + ct as ct FROM pq_monitor WHERE