From 01a7c500a383a919d2d9ebb774aee8de0aeb128c Mon Sep 17 00:00:00 2001 From: linwl <304115325@qq.com> Date: Mon, 18 Jan 2021 17:53:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=B0docker=E5=A4=96?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E7=8E=AF=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../handler/NettyServerHandler.java | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java b/src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java index 73e49e0..86868d7 100644 --- a/src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java +++ b/src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java @@ -27,9 +27,12 @@ import java.time.LocalDateTime; @Slf4j public class NettyServerHandler extends ChannelInboundHandlerAdapter { - private static String AST_TIME_CMD = "54494d45"; - private static String AST_POS_CMD = "504f53"; - private static String AST_EPH_CMD = "455048"; + private static String AST_TIME_CMD = "TIME"; + private static String AST_POS_CMD = "POS"; + private static String AST_EPH_CMD = "EPH"; + private static String AST_TIME_CMD_BYTE = "54494d45"; + private static String AST_POS_CMD_BYTE = "504f53"; + private static String AST_EPH_CMD_BYTE = "455048"; @Autowired private IDipperAstTimeAsyncTaskService dipperTimeAsyncTaskService; @@ -96,15 +99,16 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter { SocketChannel channel = (SocketChannel) ctx.channel(); String ipAddress = channel.remoteAddress().toString(); //String message = " 接收到消息:{0}, 客户端IP:{1}"; - log.info("接收到消息:" + msg + "客户端IP:" + ipAddress); + log.info("接收到消息:" + msg + ",客户端IP:" + ipAddress); String channelAns = ""; // 返回时间指令 //if (Integer.parseInt(timeAsycServerPort) == channel.localAddress().getPort()) { - ByteBuf recvmg = (ByteBuf) msg; + //ByteBuf recvmg = (ByteBuf) msg; ByteBuf buf = null; - String recvmgStr = recvmg.toString(); - if (AST_TIME_CMD.equals(recvmg)) { + //String recvmgStr = recvmg.toString(); + //if (AST_TIME_CMD.equals(recvmg)) { + if (AST_TIME_CMD.equals(msg)) { // 初始时间辅助输入; channelAns = dipperTimeAsyncTaskService.pushAstTime(); } @@ -112,7 +116,8 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter { // 发送SDBP-AST-POS获取辅助位置信息 // if (Integer.parseInt(posAsycServerPort) == channel.localAddress().getPort()) { - if (AST_POS_CMD.equals(recvmg)) { + //if (AST_POS_CMD.equals(recvmg)) { + if (AST_TIME_CMD.equals(msg)) { // channelAns = dipperAstPosAsyncTaskService.pushAstPos(ipAddress, // positionConfig.getCenterProvinceFilePath(), // positionConfig.getCenterProvince(), @@ -127,7 +132,8 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter { // 从缓存获取SDBP-AST-EPH星历数 //if (Integer.parseInt(starsAsycServerPort) == channel.localAddress().getPort()) { - if (AST_POS_CMD.equals(recvmg)) { + //if (AST_POS_CMD.equals(recvmg)) { + if (AST_POS_CMD.equals(msg)) { channelAns = dipperDataAsyncTaskService.getAstEPH(); }