diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java index ddfe44c13..db823057a 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileConnectorInfoServiceImpl.java @@ -614,6 +614,8 @@ public class PileConnectorInfoServiceImpl implements IPileConnectorInfoService { * @return */ public Map getPileTypeNum(Long stationId) { + StopWatch sw = new StopWatch(); + sw.start("高德查询-根据站点id查询快、慢充设备数量"); int fastTotal = 0; int fastFree = 0; int slowTotal = 0; @@ -639,7 +641,8 @@ 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; } } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/amap/service/impl/AMapServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/amap/service/impl/AMapServiceImpl.java index efb87bc50..b26e969bc 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/amap/service/impl/AMapServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/amap/service/impl/AMapServiceImpl.java @@ -121,6 +121,8 @@ public class AMapServiceImpl implements AMapService { * @return 高度需要的数据格式 */ private AMapStationInfo assembleAMapData(PileStationInfo stationInfo) throws ExecutionException, InterruptedException { + StopWatch stopWatch = new StopWatch(); + stopWatch.start("拼装高德需要的格式数据-设置参数"); AMapStationInfo aMapInfo = new AMapStationInfo(); Long stationInfoId = stationInfo.getId(); aMapInfo.setStationID(String.valueOf(stationInfoId)); @@ -146,7 +148,9 @@ public class AMapServiceImpl implements AMapService { } aMapInfo.setConstruction(Integer.parseInt(construction)); aMapInfo.setBusineHours(stationInfo.getBusinessHours()); + stopWatch.stop(); + stopWatch.start("拼装高德需要的格式数据-查询数据"); // 根据站点id查询计费模板 // List priceList = getPriceInfoByStationId(String.valueOf(stationInfoId)); CompletableFuture> future1 = CompletableFuture.supplyAsync(() -> getPriceInfoByStationId(String.valueOf(stationInfoId))); @@ -163,13 +167,18 @@ public class AMapServiceImpl implements AMapService { // .join()和.get()都会阻塞并获取线程的执行情况 // .join()会抛出未经检查的异常,不会强制开发者处理异常 .get()会抛出检查异常,需要开发者处理 all.join(); - all.get(); + // all.get(); + aMapInfo.setPriceChargingInfo(future1.get()); Map pileNumMap = future2.get(); aMapInfo.setFastEquipmentNum(pileNumMap.get("fastTotal")); aMapInfo.setSlowEquipmentNum(pileNumMap.get("slowTotal")); aMapInfo.setEquipmentInfos(future3.get()); + + stopWatch.stop(); + + log.info("高德查询-拼装高德数据耗时:{}, 详细:{}", stopWatch.getTotalTimeMillis(), stopWatch.prettyPrint()); return aMapInfo; } @@ -266,6 +275,8 @@ public class AMapServiceImpl implements AMapService { * @return */ private List getPriceInfoByStationId(String StationId) { + StopWatch sw = new StopWatch(); + sw.start("高德查询-根据站点id查询计费模板"); List priceList = new ArrayList<>(); // 查询计费模板 List billingPriceList = pileBillingTemplateService.queryBillingPrice(StationId); @@ -277,6 +288,8 @@ public class AMapServiceImpl implements AMapService { priceList.add(info); } + sw.stop(); + log.info(sw.prettyPrint()); return priceList; } @@ -287,6 +300,8 @@ public class AMapServiceImpl implements AMapService { * @return */ private List getPileListByStationId(String stationId) { + StopWatch sw = new StopWatch(); + sw.start("高德查询-根据站点查询站点下所有桩"); List pileList = new ArrayList<>(); // 根据站点查询站点下所有桩 List pileBasicInfoList = pileBasicInfoService.getPileListByStationId(String.valueOf(stationId)); @@ -311,6 +326,8 @@ public class AMapServiceImpl implements AMapService { pileList.add(info); } + sw.stop(); + log.info(sw.prettyPrint()); return pileList; }