Просмотр исходного кода

修改到docker外运行环境

tags/v1.0.0^2
林万龙 3 лет назад
Родитель
Сommit
7d83bee575
1 измененных файлов: 21 добавлений и 23 удалений
  1. +21
    -23
      src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java

+ 21
- 23
src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java Просмотреть файл

@@ -58,19 +58,19 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter {
//通知客户端链接建立成功
// 默认返回取得时间成功
String ackAckCheckRef = "233E0101020004020A1D";
// if (Integer.parseInt(nettyServerConfig.getPosAsycServerPort()) == channel.localAddress().getPort()) {
// ackAckCheckRef = "233E010102000401091C";
// }
// if (Integer.parseInt(nettyServerConfig.getStarsAsycServerPort()) == channel.localAddress().getPort()) {
// ackAckCheckRef = "233E010102000421293C";
// }

if (9013 == channel.localAddress().getPort()) {
if (Integer.parseInt(nettyServerConfig.getPosAsycServerPort()) == channel.localAddress().getPort()) {
ackAckCheckRef = "233E010102000401091C";
}
if (9012 == channel.localAddress().getPort()) {
if (Integer.parseInt(nettyServerConfig.getStarsAsycServerPort()) == channel.localAddress().getPort()) {
ackAckCheckRef = "233E010102000421293C";
}

// if (9013 == channel.localAddress().getPort()) {
// ackAckCheckRef = "233E010102000401091C";
// }
// if (9012 == channel.localAddress().getPort()) {
// ackAckCheckRef = "233E010102000421293C";
// }
//String str = "通知客户端链接建立成功" + " " + LocalDateTime.now() + " " + channel.localAddress().getHostString() +
// "\r\n";
ByteBuf buf = Unpooled.buffer(ackAckCheckRef.getBytes().length);
@@ -107,34 +107,32 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter {
if (AST_TIME_CMD.equals(recvmg)) {
// 初始时间辅助输入;
channelAns = dipperTimeAsyncTaskService.pushAstTime();
buf = Unpooled.buffer(channelAns.getBytes().length);
}

// 发送SDBP-AST-POS获取辅助位置信息
// if (Integer.parseInt(posAsycServerPort) == channel.localAddress().getPort()) {

if (AST_POS_CMD.equals(recvmg)) {
// channelAns = dipperAstPosAsyncTaskService.pushAstPos(ipAddress,
// positionConfig.getCenterProvinceFilePath(),
// positionConfig.getCenterProvince(),
// positionConfig.getIpPositionRequestPath(),
// positionConfig.getIpPositionRequestKey());
channelAns = dipperAstPosAsyncTaskService.pushAstPos(ipAddress,
"/csv/provinceLonAlt.csv",
"湖北省",
"https://restapi.amap.com/v3/ip",
"65e794b0a1a4b87eeec86f93fea05411");
buf = Unpooled.buffer(channelAns.getBytes().length);
positionConfig.getCenterProvinceFilePath(),
positionConfig.getCenterProvince(),
positionConfig.getIpPositionRequestPath(),
positionConfig.getIpPositionRequestKey());
// channelAns = dipperAstPosAsyncTaskService.pushAstPos(ipAddress,
// "/csv/provinceLonAlt.csv",
// "湖北省",
// "https://restapi.amap.com/v3/ip",
// "65e794b0a1a4b87eeec86f93fea05411");
}

// 从缓存获取SDBP-AST-EPH星历数
//if (Integer.parseInt(starsAsycServerPort) == channel.localAddress().getPort()) {
if (AST_POS_CMD.equals(recvmg)) {
String astEPHBytes = dipperDataAsyncTaskService.getAstEPH();
buf = Unpooled.buffer(astEPHBytes.getBytes().length);
channelAns = dipperDataAsyncTaskService.getAstEPH();
}

log.info(buf.toString());
log.info(channelAns);
buf = Unpooled.buffer(channelAns.getBytes().length);
// 最后把SDBP-AST-TIME、SDBP-AST-POS、SDBP-AST-EPH并包一起发给设备。
// 设备采用16进制获取数据,则代理服务器也是采用16进制返回数据。
// 通知客户端链消息发送成功


Загрузка…
Отмена
Сохранить