mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-19 06:39:50 +08:00
update 加缓存
This commit is contained in:
@@ -462,7 +462,9 @@ public class PileBillingTemplateServiceImpl implements IPileBillingTemplateServi
|
|||||||
if (billingTemplateVO == null) {
|
if (billingTemplateVO == null) {
|
||||||
return Lists.newArrayList();
|
return Lists.newArrayList();
|
||||||
}
|
}
|
||||||
|
//
|
||||||
EchoBillingTemplateVO echoBillingTemplateVO = queryPileBillingTemplateById(Long.parseLong(billingTemplateVO.getTemplateId()));
|
EchoBillingTemplateVO echoBillingTemplateVO = queryPileBillingTemplateById(Long.parseLong(billingTemplateVO.getTemplateId()));
|
||||||
|
// 时段清单
|
||||||
List<BillingTimeDTO> timeArray = echoBillingTemplateVO.getTimeArray();
|
List<BillingTimeDTO> timeArray = echoBillingTemplateVO.getTimeArray();
|
||||||
log.info("计费模板时段:{}", JSONObject.toJSONString(timeArray));
|
log.info("计费模板时段:{}", JSONObject.toJSONString(timeArray));
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import org.springframework.util.CollectionUtils;
|
|||||||
import org.springframework.util.StopWatch;
|
import org.springframework.util.StopWatch;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -78,12 +79,26 @@ public class AMapServiceImpl implements AMapService {
|
|||||||
if (CollectionUtils.isEmpty(stationInfos)) {
|
if (CollectionUtils.isEmpty(stationInfos)) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
AMapStationInfo aMapInfo;
|
|
||||||
// 拼装高德格式数据
|
// 拼装高德格式数据
|
||||||
sw.start("拼装高德格式数据");
|
sw.start("拼装高德格式数据");
|
||||||
for (PileStationInfo stationInfo : stationInfos) {
|
for (PileStationInfo stationInfo : stationInfos) {
|
||||||
aMapInfo = new AMapStationInfo();
|
AMapStationInfo aMapStationInfo = assembleAMapData(stationInfo);
|
||||||
|
resultList.add(aMapStationInfo);
|
||||||
|
}
|
||||||
|
sw.stop();
|
||||||
|
log.info("接口耗时:{}, 详情:{}", sw.getTotalTimeMillis(), sw.prettyPrint());
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼装高德需要的格式数据
|
||||||
|
* @param stationInfo 站点信息
|
||||||
|
* @return 高度需要的数据格式
|
||||||
|
*/
|
||||||
|
private AMapStationInfo assembleAMapData(PileStationInfo stationInfo) {
|
||||||
|
StopWatch sw = new StopWatch();
|
||||||
|
sw.start("set数据");
|
||||||
|
AMapStationInfo aMapInfo = new AMapStationInfo();
|
||||||
aMapInfo.setStationID(String.valueOf(stationInfo.getId()));
|
aMapInfo.setStationID(String.valueOf(stationInfo.getId()));
|
||||||
aMapInfo.setOperatorID("");
|
aMapInfo.setOperatorID("");
|
||||||
aMapInfo.setEquipmentOwnerID("");
|
aMapInfo.setEquipmentOwnerID("");
|
||||||
@@ -98,8 +113,8 @@ public class AMapServiceImpl implements AMapService {
|
|||||||
Integer openType = Integer.parseInt(stationInfo.getPublicFlag()) == 0 ? 7 : 0;
|
Integer openType = Integer.parseInt(stationInfo.getPublicFlag()) == 0 ? 7 : 0;
|
||||||
aMapInfo.setOpenType(openType);
|
aMapInfo.setOpenType(openType);
|
||||||
aMapInfo.setParkNums(0);
|
aMapInfo.setParkNums(0);
|
||||||
aMapInfo.setStationLng(new BigDecimal(stationInfo.getStationLng()).setScale(6, BigDecimal.ROUND_HALF_UP));
|
aMapInfo.setStationLng(new BigDecimal(stationInfo.getStationLng()).setScale(6, RoundingMode.HALF_UP));
|
||||||
aMapInfo.setStationLat(new BigDecimal(stationInfo.getStationLat()).setScale(6, BigDecimal.ROUND_HALF_UP));
|
aMapInfo.setStationLat(new BigDecimal(stationInfo.getStationLat()).setScale(6, RoundingMode.HALF_UP));
|
||||||
String construction = stationInfo.getConstruction();
|
String construction = stationInfo.getConstruction();
|
||||||
if (StringUtils.equals("12", construction) || StringUtils.equals("13", construction) ||
|
if (StringUtils.equals("12", construction) || StringUtils.equals("13", construction) ||
|
||||||
StringUtils.equals("14", construction) || StringUtils.equals("15", construction)) {
|
StringUtils.equals("14", construction) || StringUtils.equals("15", construction)) {
|
||||||
@@ -107,22 +122,25 @@ public class AMapServiceImpl implements AMapService {
|
|||||||
}
|
}
|
||||||
aMapInfo.setConstruction(Integer.parseInt(construction));
|
aMapInfo.setConstruction(Integer.parseInt(construction));
|
||||||
aMapInfo.setBusineHours(stationInfo.getBusinessHours());
|
aMapInfo.setBusineHours(stationInfo.getBusinessHours());
|
||||||
|
sw.stop();
|
||||||
// 根据站点id查询计费模板
|
// 根据站点id查询计费模板
|
||||||
|
sw.start("根据站点id查询计费模板");
|
||||||
List<AMapPriceChargingInfo> priceList = getPriceInfoByStationId(String.valueOf(stationInfo.getId()));
|
List<AMapPriceChargingInfo> priceList = getPriceInfoByStationId(String.valueOf(stationInfo.getId()));
|
||||||
aMapInfo.setPriceChargingInfo(priceList);
|
aMapInfo.setPriceChargingInfo(priceList);
|
||||||
|
sw.stop();
|
||||||
// 根据站点id查询快、慢充设备数量
|
// 根据站点id查询快、慢充设备数量
|
||||||
|
sw.start("根据站点id查询快、慢充设备数量");
|
||||||
Map<String, Integer> pileNumMap = pileConnectorInfoService.getPileTypeNum(stationInfo.getId());
|
Map<String, Integer> pileNumMap = pileConnectorInfoService.getPileTypeNum(stationInfo.getId());
|
||||||
aMapInfo.setFastEquipmentNum(pileNumMap.get("fastTotal"));
|
aMapInfo.setFastEquipmentNum(pileNumMap.get("fastTotal"));
|
||||||
aMapInfo.setSlowEquipmentNum(pileNumMap.get("slowTotal"));
|
aMapInfo.setSlowEquipmentNum(pileNumMap.get("slowTotal"));
|
||||||
|
sw.stop();
|
||||||
// 根据站点查询站点下所有桩
|
// 根据站点查询站点下所有桩
|
||||||
|
sw.start("根据站点查询站点下所有桩");
|
||||||
List<AMapEquipmentInfo> aMapEquipmentInfos = getPileListByStationId(String.valueOf(stationInfo.getId()));
|
List<AMapEquipmentInfo> aMapEquipmentInfos = getPileListByStationId(String.valueOf(stationInfo.getId()));
|
||||||
aMapInfo.setEquipmentInfos(aMapEquipmentInfos);
|
aMapInfo.setEquipmentInfos(aMapEquipmentInfos);
|
||||||
|
|
||||||
resultList.add(aMapInfo);
|
|
||||||
}
|
|
||||||
sw.stop();
|
sw.stop();
|
||||||
log.info("接口耗时:{}, 详情:{}", sw.getTotalTimeMillis(), sw.prettyPrint());
|
log.info("组装高德数据格式耗时:{}, 详细:{}", sw.getTotalTimeMillis(), sw.prettyPrint());
|
||||||
return resultList;
|
return aMapInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -195,8 +213,8 @@ public class AMapServiceImpl implements AMapService {
|
|||||||
for (BillingPriceVO billingPriceVO : billingPriceList) {
|
for (BillingPriceVO billingPriceVO : billingPriceList) {
|
||||||
AMapPriceChargingInfo info = new AMapPriceChargingInfo();
|
AMapPriceChargingInfo info = new AMapPriceChargingInfo();
|
||||||
info.setFeeTime(billingPriceVO.getStartTime() + "-" + billingPriceVO.getEndTime()); // 时间段
|
info.setFeeTime(billingPriceVO.getStartTime() + "-" + billingPriceVO.getEndTime()); // 时间段
|
||||||
info.setElectricityFee(new BigDecimal(billingPriceVO.getElectricityPrice()).setScale(4, BigDecimal.ROUND_HALF_UP)); // 电费
|
info.setElectricityFee(new BigDecimal(billingPriceVO.getElectricityPrice()).setScale(4, RoundingMode.HALF_UP)); // 电费
|
||||||
info.setServiceFee(new BigDecimal(billingPriceVO.getServicePrice()).setScale(4, BigDecimal.ROUND_HALF_UP)); // 服务费
|
info.setServiceFee(new BigDecimal(billingPriceVO.getServicePrice()).setScale(4, RoundingMode.HALF_UP)); // 服务费
|
||||||
|
|
||||||
priceList.add(info);
|
priceList.add(info);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user