Browse Source

修改到docker外运行环境

tags/v1.0.0^2
林万龙 3 years ago
parent
commit
01a7c500a3
1 changed files with 15 additions and 9 deletions
  1. +15
    -9
      src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java

+ 15
- 9
src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java View File

@@ -27,9 +27,12 @@ import java.time.LocalDateTime;
@Slf4j @Slf4j
public class NettyServerHandler extends ChannelInboundHandlerAdapter { 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 @Autowired
private IDipperAstTimeAsyncTaskService dipperTimeAsyncTaskService; private IDipperAstTimeAsyncTaskService dipperTimeAsyncTaskService;
@@ -96,15 +99,16 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter {
SocketChannel channel = (SocketChannel) ctx.channel(); SocketChannel channel = (SocketChannel) ctx.channel();
String ipAddress = channel.remoteAddress().toString(); String ipAddress = channel.remoteAddress().toString();
//String message = " 接收到消息:{0}, 客户端IP:{1}"; //String message = " 接收到消息:{0}, 客户端IP:{1}";
log.info("接收到消息:" + msg + "客户端IP:" + ipAddress);
log.info("接收到消息:" + msg + ",客户端IP:" + ipAddress);


String channelAns = ""; String channelAns = "";
// 返回时间指令 // 返回时间指令
//if (Integer.parseInt(timeAsycServerPort) == channel.localAddress().getPort()) { //if (Integer.parseInt(timeAsycServerPort) == channel.localAddress().getPort()) {
ByteBuf recvmg = (ByteBuf) msg;
//ByteBuf recvmg = (ByteBuf) msg;
ByteBuf buf = null; 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(); channelAns = dipperTimeAsyncTaskService.pushAstTime();
} }
@@ -112,7 +116,8 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter {
// 发送SDBP-AST-POS获取辅助位置信息 // 发送SDBP-AST-POS获取辅助位置信息
// if (Integer.parseInt(posAsycServerPort) == channel.localAddress().getPort()) { // 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, // channelAns = dipperAstPosAsyncTaskService.pushAstPos(ipAddress,
// positionConfig.getCenterProvinceFilePath(), // positionConfig.getCenterProvinceFilePath(),
// positionConfig.getCenterProvince(), // positionConfig.getCenterProvince(),
@@ -127,7 +132,8 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter {


// 从缓存获取SDBP-AST-EPH星历数 // 从缓存获取SDBP-AST-EPH星历数
//if (Integer.parseInt(starsAsycServerPort) == channel.localAddress().getPort()) { //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(); channelAns = dipperDataAsyncTaskService.getAstEPH();
} }




Loading…
Cancel
Save