@@ -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) { | |||
@@ -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()) { | |||
@@ -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(); | |||
} | |||
@@ -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(","); | |||
@@ -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; | |||
} | |||