Quellcode durchsuchen

修改到docker外运行环境

tags/v1.0.0^2
林万龙 vor 3 Jahren
Ursprung
Commit
a805975de9
2 geänderte Dateien mit 11 neuen und 3 gelöschten Zeilen
  1. +0
    -1
      src/main/java/com/telpo/dipperposition/DipperPositionApplication.java
  2. +11
    -2
      src/main/java/com/telpo/dipperposition/service/impl/DipperAstPosAsyncTaskServiceImpl.java

+ 0
- 1
src/main/java/com/telpo/dipperposition/DipperPositionApplication.java Datei anzeigen

@@ -31,7 +31,6 @@ 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);


+ 11
- 2
src/main/java/com/telpo/dipperposition/service/impl/DipperAstPosAsyncTaskServiceImpl.java Datei anzeigen

@@ -13,7 +13,9 @@ 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;
import org.springframework.util.ResourceUtils;

import java.io.FileNotFoundException;
import java.io.UnsupportedEncodingException;
import java.util.List;

@@ -46,11 +48,18 @@ public class DipperAstPosAsyncTaskServiceImpl implements IDipperAstPosAsyncTaskS
private String ipPositionRequestKey;

// 从CSV文件读取省会城市中心点位置信息
private void getPosFromFile(String centerAddress) {
private void getPosFromFile(String centerAddress) {
// 不存在说明token是已过期了
String centerProvinceName = "";
String centerProvinceLonAndAlt = "";
List<String> centerAddressSets = CSVUtil.readCSV(this.centerProvinceFilePath);
String appResPath = "";
try {
appResPath = ResourceUtils.getURL("resources:").getPath();
log.debug(appResPath);
} catch (Exception e) {
log.debug("cannot find path");
}
List<String> centerAddressSets = CSVUtil.readCSV(appResPath + this.centerProvinceFilePath);
for (String centerAddressSet:centerAddressSets) {
String[] centerAddressSetArray = centerAddressSet.split(",");
if (centerAddressSetArray.length < 3) {


Laden…
Abbrechen
Speichern