|
|
@@ -36,10 +36,8 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter { |
|
|
|
private PositionConfig positionConfig; |
|
|
|
@Autowired |
|
|
|
private IDipperAstTimeAsyncTaskService dipperTimeAsyncTaskService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IDipperAstPosAsyncTaskService dipperAstPosAsyncTaskService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IDipperDataAsyncTaskService dipperDataAsyncTaskService; |
|
|
|
|
|
|
@@ -110,6 +108,12 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter { |
|
|
|
String ipAddress = channel.remoteAddress().toString(); |
|
|
|
//String message = " 接收到消息:{0}, 客户端IP:{1}"; |
|
|
|
log.info("接收到消息:" + msg + ",客户端IP:" + ipAddress); |
|
|
|
if (positionConfig != null) { |
|
|
|
log.info("config info is : " + positionConfig.getCenterProvinceFilePath() + positionConfig.getCenterProvince() + positionConfig.getIpPositionRequestPath() + |
|
|
|
positionConfig.getIpPositionRequestKey()); |
|
|
|
} else { |
|
|
|
log.info("positionConfig info is null!!!!!!!!!!!!!! "); |
|
|
|
} |
|
|
|
|
|
|
|
String channelAns = ""; |
|
|
|
// 返回时间指令 |
|
|
@@ -121,18 +125,12 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter { |
|
|
|
if (AST_TIME_CMD.equals(msg)) { |
|
|
|
// 初始时间辅助输入; |
|
|
|
channelAns = nettyServerHandler.dipperTimeAsyncTaskService.pushAstTime(); |
|
|
|
log.info("返回时间:" + channelAns); |
|
|
|
} |
|
|
|
|
|
|
|
// 发送SDBP-AST-POS获取辅助位置信息 |
|
|
|
// if (Integer.parseInt(posAsycServerPort) == channel.localAddress().getPort()) { |
|
|
|
|
|
|
|
//if (AST_POS_CMD.equals(recvmg)) { |
|
|
|
if (positionConfig != null) { |
|
|
|
log.info("config info is : " + positionConfig.getCenterProvinceFilePath() + positionConfig.getCenterProvince() + positionConfig.getIpPositionRequestPath() + |
|
|
|
positionConfig.getIpPositionRequestKey()); |
|
|
|
} else { |
|
|
|
log.info("positionConfig info is null!!!!!!!!!!!!!! "); |
|
|
|
} |
|
|
|
if (AST_POS_CMD.equals(msg)) { |
|
|
|
// channelAns = dipperAstPosAsyncTaskService.pushAstPos(ipAddress, |
|
|
|
// positionConfig.getCenterProvinceFilePath(), |
|
|
@@ -163,11 +161,11 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter { |
|
|
|
log.info(channelAns); |
|
|
|
if (channelAns != null) { |
|
|
|
buf = Unpooled.buffer(channelAns.getBytes().length); |
|
|
|
buf.writeBytes(channelAns.getBytes("GBK")); |
|
|
|
} |
|
|
|
// 最后把SDBP-AST-TIME、SDBP-AST-POS、SDBP-AST-EPH并包一起发给设备。 |
|
|
|
// 设备采用16进制获取数据,则代理服务器也是采用16进制返回数据。 |
|
|
|
// 通知客户端链消息发送成功 |
|
|
|
buf.writeBytes(channelAns.getBytes("GBK")); |
|
|
|
ctx.writeAndFlush(buf); |
|
|
|
//ctx.write("你也好哦"); |
|
|
|
//ctx.flush(); |
|
|
|