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 db823057a..fd1bf9038 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,8 +614,6 @@ 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; @@ -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; } } 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 b26e969bc..3845e08ef 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 @@ -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 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 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 resultList = pageInfo.getList().parallelStream().map(x -> { - try { - return assembleAMapData(x); - } catch (ExecutionException | InterruptedException e) { - throw new RuntimeException(e); - } - }).collect(Collectors.toList()); + // List 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 getPriceInfoByStationId(String StationId) { - StopWatch sw = new StopWatch(); - sw.start("高德查询-根据站点id查询计费模板"); List priceList = new ArrayList<>(); // 查询计费模板 List 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 getPileListByStationId(String stationId) { - StopWatch sw = new StopWatch(); - sw.start("高德查询-根据站点查询站点下所有桩"); List pileList = new ArrayList<>(); // 根据站点查询站点下所有桩 List 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; }