This commit is contained in:
2023-06-25 10:34:28 +08:00
parent 59195d1d03
commit 08da801286
2 changed files with 20 additions and 29 deletions

View File

@@ -614,8 +614,6 @@ public class PileConnectorInfoServiceImpl implements IPileConnectorInfoService {
* @return
*/
public Map<String, Integer> getPileTypeNum(Long stationId) {
StopWatch sw = new StopWatch();
sw.start("高德查询-根据站点id查询快、慢充设备数量");
int fastTotal = 0;
int fastFree = 0;
int slowTotal = 0;
@@ -641,8 +639,6 @@ public class PileConnectorInfoServiceImpl implements IPileConnectorInfoService {
map.put("fastFree", fastFree);
map.put("slowTotal", slowTotal);
map.put("slowFree", slowFree);
sw.stop();
log.info(sw.prettyPrint());
return map;
}
}

View File

@@ -1,5 +1,6 @@
package com.jsowell.thirdparty.amap.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import com.jsowell.common.exception.BusinessException;
@@ -93,23 +94,23 @@ public class AMapServiceImpl implements AMapService {
sw.start("拼装高德格式数据");
// 使用自定义ForkJoinPool
// List<AMapStationInfo> resultList = new ForkJoinPool(10).submit(() ->
// stationInfos.parallelStream().map(x -> {
// try {
// return assembleAMapData(x);
// } catch (ExecutionException | InterruptedException e) {
// throw new RuntimeException(e);
// }
// }).collect(Collectors.toList())
// ).fork().join();
List<AMapStationInfo> resultList = new ForkJoinPool(4).submit(() ->
stationInfos.parallelStream().map(x -> {
try {
return assembleAMapData(x);
} catch (ExecutionException | InterruptedException e) {
throw new RuntimeException(e);
}
}).collect(Collectors.toList())
).fork().join();
List<AMapStationInfo> resultList = pageInfo.getList().parallelStream().map(x -> {
try {
return assembleAMapData(x);
} catch (ExecutionException | InterruptedException e) {
throw new RuntimeException(e);
}
}).collect(Collectors.toList());
// List<AMapStationInfo> resultList = pageInfo.getList().parallelStream().map(x -> {
// try {
// return assembleAMapData(x);
// } catch (ExecutionException | InterruptedException e) {
// throw new RuntimeException(e);
// }
// }).collect(Collectors.toList());
sw.stop();
log.info("接口耗时:{}, 详情:{}", sw.getTotalTimeMillis(), sw.prettyPrint());
return resultList;
@@ -178,7 +179,9 @@ public class AMapServiceImpl implements AMapService {
stopWatch.stop();
log.info("高德查询-拼装高德数据耗时:{}, 详细:{}", stopWatch.getTotalTimeMillis(), stopWatch.prettyPrint());
if (stopWatch.getTotalTimeMillis() > 100) {
log.info("高德查询-拼装高德数据耗时大于100ms:{}, 详细:{}, stationInfo:{}", stopWatch.getTotalTimeMillis(), stopWatch.prettyPrint(), JSON.toJSONString(stationInfo));
}
return aMapInfo;
}
@@ -275,8 +278,6 @@ public class AMapServiceImpl implements AMapService {
* @return
*/
private List<AMapPriceChargingInfo> getPriceInfoByStationId(String StationId) {
StopWatch sw = new StopWatch();
sw.start("高德查询-根据站点id查询计费模板");
List<AMapPriceChargingInfo> priceList = new ArrayList<>();
// 查询计费模板
List<BillingPriceVO> billingPriceList = pileBillingTemplateService.queryBillingPrice(StationId);
@@ -288,8 +289,6 @@ public class AMapServiceImpl implements AMapService {
priceList.add(info);
}
sw.stop();
log.info(sw.prettyPrint());
return priceList;
}
@@ -300,8 +299,6 @@ public class AMapServiceImpl implements AMapService {
* @return
*/
private List<AMapEquipmentInfo> getPileListByStationId(String stationId) {
StopWatch sw = new StopWatch();
sw.start("高德查询-根据站点查询站点下所有桩");
List<AMapEquipmentInfo> pileList = new ArrayList<>();
// 根据站点查询站点下所有桩
List<PileBasicInfo> pileBasicInfoList = pileBasicInfoService.getPileListByStationId(String.valueOf(stationId));
@@ -326,8 +323,6 @@ public class AMapServiceImpl implements AMapService {
pileList.add(info);
}
sw.stop();
log.info(sw.prettyPrint());
return pileList;
}