mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 03:25:12 +08:00
update
This commit is contained in:
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.PageUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.spring.SpringUtils;
|
||||
import com.jsowell.pile.domain.OrderBasicInfo;
|
||||
import com.jsowell.pile.domain.PileBasicInfo;
|
||||
import com.jsowell.pile.domain.PileStationInfo;
|
||||
@@ -28,6 +29,9 @@ import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
/**
|
||||
* 高德地图Service
|
||||
@@ -57,6 +61,11 @@ public class AMapServiceImpl implements AMapService {
|
||||
@Autowired
|
||||
private IOrderBasicInfoService orderBasicInfoService;
|
||||
|
||||
/**
|
||||
* 异步操作任务调度线程池
|
||||
*/
|
||||
private ScheduledExecutorService executor = SpringUtils.getBean("scheduledExecutorService");
|
||||
|
||||
/**
|
||||
* 高德拉取充电站静态数据
|
||||
* @param dto
|
||||
@@ -83,8 +92,17 @@ public class AMapServiceImpl implements AMapService {
|
||||
// 拼装高德格式数据
|
||||
sw.start("拼装高德格式数据");
|
||||
for (PileStationInfo stationInfo : stationInfos) {
|
||||
AMapStationInfo aMapStationInfo = assembleAMapData(stationInfo);
|
||||
resultList.add(aMapStationInfo);
|
||||
CompletableFuture<AMapStationInfo> completableFuture = CompletableFuture.supplyAsync(() -> assembleAMapData(stationInfo), executor);
|
||||
try {
|
||||
AMapStationInfo aMapStationInfo = completableFuture.get();
|
||||
resultList.add(aMapStationInfo);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
// AMapStationInfo aMapStationInfo = assembleAMapData(stationInfo);
|
||||
// resultList.add(aMapStationInfo);
|
||||
}
|
||||
sw.stop();
|
||||
log.info("接口耗时:{}, 详情:{}", sw.getTotalTimeMillis(), sw.prettyPrint());
|
||||
@@ -140,7 +158,7 @@ public class AMapServiceImpl implements AMapService {
|
||||
List<AMapEquipmentInfo> aMapEquipmentInfos = getPileListByStationId(String.valueOf(stationInfo.getId()));
|
||||
aMapInfo.setEquipmentInfos(aMapEquipmentInfos);
|
||||
sw.stop();
|
||||
log.info("组装高德数据格式耗时详细:{}", prettyPrintBySecond(sw));
|
||||
log.info("组装高德数据格式耗时详细:{}, 线程名:{}", prettyPrintBySecond(sw), Thread.currentThread().getName());
|
||||
return aMapInfo;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user