From 64460a0f201234d1954acea9b6e90751ecff1030 Mon Sep 17 00:00:00 2001 From: linwl <304115325@qq.com> Date: Tue, 19 Jan 2021 09:49:57 +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 --- .../dipperposition/handler/NettyServerHandler.java | 14 ++++++++------ .../server/DipperPositionServer.java | 6 ++++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java b/src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java index 7895106..103e7c7 100644 --- a/src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java +++ b/src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java @@ -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); diff --git a/src/main/java/com/telpo/dipperposition/server/DipperPositionServer.java b/src/main/java/com/telpo/dipperposition/server/DipperPositionServer.java index 634dd69..edcf67f 100644 --- a/src/main/java/com/telpo/dipperposition/server/DipperPositionServer.java +++ b/src/main/java/com/telpo/dipperposition/server/DipperPositionServer.java @@ -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");