From e2ffbefd3303e78eec1da105e830795f9f32f63b Mon Sep 17 00:00:00 2001 From: ZZ Date: Wed, 17 Nov 2021 16:26:27 +0800 Subject: [PATCH] missing fees --- .../xhpc/evcs/api/QueryStationsInfoController.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/QueryStationsInfoController.java b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/QueryStationsInfoController.java index fefd9b3b..12994b7b 100644 --- a/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/QueryStationsInfoController.java +++ b/evcs-modules/evcs-core/src/main/java/com/xhpc/evcs/api/QueryStationsInfoController.java @@ -135,7 +135,7 @@ public class QueryStationsInfoController { //运营商id String operatorIdEvcs = xhpcChargingStation.getOperatorIdEvcs(); chargingStationDto.setOperatorId(operatorIdEvcs == null ? "MA6DFCTD5" - : operatorIdEvcs.length() == 9 ? operatorId : operatorIdEvcs.substring(9, 19)); + : operatorIdEvcs.length() == 9 ? operatorId : operatorIdEvcs.substring(9, 18)); //详细地址 chargingStationDto.setAddress(xhpcChargingStation.getAddress()); //充电站省直辖区编码 @@ -162,8 +162,10 @@ public class QueryStationsInfoController { stationInfo.setStationLat(chargingStationDto.getLat()); stationInfo.setConstruction(chargingStationDto.getConstruction()); String[] fees = getFees(chargingStationDto.getRateModelId()); - stationInfo.setElectricityFee(fees[0]); - stationInfo.setServiceFee(fees[1]); + if (fees != null) { + stationInfo.setElectricityFee(fees[0]); + stationInfo.setServiceFee(fees[1]); + } //获取该充电站的下的所有充电设备列表 Set piles = chargingStationDto.getPiles(); List equipmentInfos = getEquipmentInfos(piles); @@ -182,6 +184,10 @@ public class QueryStationsInfoController { private String[] getFees(Long rateModelId) { CacheRateModel cacheRateModel = REDIS.getCacheObject("rateModel:".concat(rateModelId.toString())); + if (cacheRateModel == null) { + log.error("rate model missing: {}", rateModelId); + return null; + } if (cacheRateModel.getPp() != null) { return cacheRateModel.getPp(); }