ソースを参照

修改到docker外运行环境

tags/v1.0.0^2
林万龙 3年前
コミット
7bbba44863
5個のファイルの変更9行の追加22行の削除
  1. +1
    -1
      src/main/java/com/telpo/dipperposition/DipperPositionApplication.java
  2. +1
    -1
      src/main/java/com/telpo/dipperposition/common/CSVUtil.java
  3. +3
    -19
      src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java
  4. +3
    -0
      src/main/java/com/telpo/dipperposition/service/impl/DipperAstPosAsyncTaskServiceImpl.java
  5. +1
    -1
      src/main/java/com/telpo/dipperposition/service/impl/DipperAstTimeAsyncTaskServiceImpl.java

+ 1
- 1
src/main/java/com/telpo/dipperposition/DipperPositionApplication.java ファイルの表示

@@ -31,9 +31,9 @@ public class DipperPositionApplication {
log.info("北斗定位服务开始!");
ConfigurableApplicationContext applicationContext = SpringApplication.run(DipperPositionApplication.class, args);
log.info("北斗定位服务启动!");
log.info(applicationContext.getResource("bootstrap.yaml").getFile().getAbsolutePath());
//启动服务端
ConfigurableEnvironment environment = applicationContext.getEnvironment();

DipperPositionServer nettyServer = new DipperPositionServer(environment);
nettyServer.start();
} catch (Exception e) {


+ 1
- 1
src/main/java/com/telpo/dipperposition/common/CSVUtil.java ファイルの表示

@@ -27,7 +27,7 @@ public class CSVUtil {
List<String> listData = new ArrayList<>();
try {
filePath = readPath;
CsvReader csvReader = new CsvReader(filePath);
CsvReader csvReader = new CsvReader(filePath,',',Charset.forName("UTF-8"));
// 读表头
boolean re = csvReader.readHeaders();
while (csvReader.readRecord()) {


+ 3
- 19
src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java ファイルの表示

@@ -108,9 +108,9 @@ 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());
if (nettyServerHandler.positionConfig != null) {
log.info("config info is : " + nettyServerHandler.positionConfig.getCenterProvinceFilePath() + nettyServerHandler.positionConfig.getCenterProvince() + nettyServerHandler.positionConfig.getIpPositionRequestPath() +
nettyServerHandler.positionConfig.getIpPositionRequestKey());
} else {
log.info("positionConfig info is null!!!!!!!!!!!!!! ");
}
@@ -132,29 +132,13 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter {

//if (AST_POS_CMD.equals(recvmg)) {
if (AST_POS_CMD.equals(msg)) {
// channelAns = dipperAstPosAsyncTaskService.pushAstPos(ipAddress,
// positionConfig.getCenterProvinceFilePath(),
// positionConfig.getCenterProvince(),
// positionConfig.getIpPositionRequestPath(),
// positionConfig.getIpPositionRequestKey());
// if (dipperAstPosAsyncTaskService == null) {
// dipperAstPosAsyncTaskService = new DipperAstPosAsyncTaskServiceImpl();
// }
channelAns = nettyServerHandler.dipperAstPosAsyncTaskService.pushAstPos(ipAddress);
// (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)) {
if (AST_POS_CMD.equals(msg)) {
// if (dipperDataAsyncTaskService == null) {
// dipperDataAsyncTaskService = new DipperDataAsyncTaskServiceImpl();
// }
channelAns = nettyServerHandler.dipperDataAsyncTaskService.getAstEPH();
}



+ 3
- 0
src/main/java/com/telpo/dipperposition/service/impl/DipperAstPosAsyncTaskServiceImpl.java ファイルの表示

@@ -9,6 +9,7 @@ import com.telpo.dipperposition.service.IDipperAstPosAsyncTaskService;
import com.telpo.dipperposition.service.IpProvinceService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.logging.log4j.util.PropertiesUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
@@ -49,6 +50,8 @@ public class DipperAstPosAsyncTaskServiceImpl implements IDipperAstPosAsyncTaskS
// 不存在说明token是已过期了
String centerProvinceName = "";
String centerProvinceLonAndAlt = "";
//ClassLoader classLoader = PropertiesUtil.class.getClassLoader();
//String classPath = classLoader.get
List<String> centerAddressSets = CSVUtil.readCSV(this.centerProvinceFilePath);
for (String centerAddressSet:centerAddressSets) {
String[] centerAddressSetArray = centerAddressSet.split(",");


+ 1
- 1
src/main/java/com/telpo/dipperposition/service/impl/DipperAstTimeAsyncTaskServiceImpl.java ファイルの表示

@@ -84,7 +84,7 @@ public class DipperAstTimeAsyncTaskServiceImpl implements IDipperAstTimeAsyncTas
astTimeCmd += "00286BEE";

String hexIn = astTimeCmd + HexConvert.makeChecksum(astTimeCmd);
log.info("返回时间:" + hexIn);
log.info("DipperAstTimeAsyncTaskServiceImpl 返回时间:" + hexIn);

return hexIn;
}


読み込み中…
キャンセル
保存