Ver código fonte

修改到docker外运行环境

tags/v1.0.0^2
林万龙 3 anos atrás
pai
commit
64460a0f20
2 arquivos alterados com 14 adições e 6 exclusões
  1. +8
    -6
      src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java
  2. +6
    -0
      src/main/java/com/telpo/dipperposition/server/DipperPositionServer.java

+ 8
- 6
src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java Ver arquivo

@@ -20,6 +20,7 @@ import io.netty.channel.ChannelInboundHandlerAdapter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.io.InputStream;
import java.time.LocalDateTime;
@@ -31,6 +32,7 @@ import java.time.LocalDateTime;
* @create: 2021-01-13 13:56
**/
@Slf4j
@Component
public class NettyServerHandler extends ChannelInboundHandlerAdapter {

private static String AST_TIME_CMD = "TIME";
@@ -40,11 +42,11 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter {
private static String AST_POS_CMD_BYTE = "504f53";
private static String AST_EPH_CMD_BYTE = "455048";

private DipperAstTimeAsyncTaskController dipperTimeAsyncTaskController = new DipperAstTimeAsyncTaskController();
private IDipperAstTimeAsyncTaskService dipperTimeAsyncTaskService;

private DipperAstPosAsyncTaskController dipperAstPosAsyncTaskController = new DipperAstPosAsyncTaskController();
private IDipperAstPosAsyncTaskService dipperAstPosAsyncTaskService;

private DipperDataAsyncTaskController dipperDataAsyncTaskController = new DipperDataAsyncTaskController();
private IDipperDataAsyncTaskService dipperDataAsyncTaskService;

@Autowired
private NettyServerConfig nettyServerConfig;
@@ -119,7 +121,7 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter {
// if (dipperTimeAsyncTaskService == null) {
// dipperTimeAsyncTaskService = new DipperAstTimeAsyncTaskServiceImpl();
// }
channelAns = dipperTimeAsyncTaskController.pushAstTime();
channelAns = dipperTimeAsyncTaskService.pushAstTime();
}

// 发送SDBP-AST-POS获取辅助位置信息
@@ -141,7 +143,7 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter {
// if (dipperAstPosAsyncTaskService == null) {
// dipperAstPosAsyncTaskService = new DipperAstPosAsyncTaskServiceImpl();
// }
channelAns = dipperAstPosAsyncTaskController.pushAstPos(ipAddress);
channelAns = dipperAstPosAsyncTaskService.pushAstPos(ipAddress);
// (ipAddress,
// "/csv/provinceLonAlt.csv",
// "湖北省",
@@ -156,7 +158,7 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter {
// if (dipperDataAsyncTaskService == null) {
// dipperDataAsyncTaskService = new DipperDataAsyncTaskServiceImpl();
// }
// channelAns = dipperDataAsyncTaskController.getAstEPH();
channelAns = dipperDataAsyncTaskService.getAstEPH();
}

log.info(channelAns);


+ 6
- 0
src/main/java/com/telpo/dipperposition/server/DipperPositionServer.java Ver arquivo

@@ -13,7 +13,9 @@ import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.stereotype.Component;

import java.net.InetSocketAddress;

@@ -24,8 +26,11 @@ import java.net.InetSocketAddress;
* @create: 2021-01-13 14:01
*/
@Slf4j
@Component
public class DipperPositionServer {

@Value("position-server.serverAddr")
private String myServerAddr;
private String serverAddr;
private Integer starsAsycPort;

@@ -62,6 +67,7 @@ public class DipperPositionServer {

ChannelFuture channelFuture3 = bootstrap.bind(socketAddress).sync();
log.info("星历服务器启动开始监听端口: {}", starsAsycPort);
log.info("服务器: {}", myServerAddr);
channelFuture3.addListener(future -> {
if (future.isSuccess()){
System.out.println("start success");


Carregando…
Cancelar
Salvar