diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/domain/SupChargeDetails.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/domain/SupChargeDetails.java index cbaed5c53..855326a89 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/domain/SupChargeDetails.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/domain/SupChargeDetails.java @@ -88,4 +88,15 @@ public class SupChargeDetails { */ @JSONField(name = "DetailSeviceMoney") private BigDecimal detailSeviceMoney; + + /** + * 时段服务费 + * DetailServiceMoney + * 时段服务费金额,单位:元,小数点后4位 + * 否 + * 浮点数 + * ≤8字符,小数点后4位 + */ + @JSONField(name = "DetailServiceMoney") + private BigDecimal detailServiceMoney; } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/GuiZhouPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/GuiZhouPlatformServiceImpl.java index 244275e4a..5d97b4b58 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/GuiZhouPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/service/impl/GuiZhouPlatformServiceImpl.java @@ -655,12 +655,12 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService { // 拼装成平台所需格式对象 ChargeOrderInfo orderInfo = transformChargeOrderInfo(orderBasicInfo, orderDetail); - // List billingList = pileBillingTemplateService.queryBillingPrice(orderBasicInfo.getStationId()); + List billingList = pileBillingTemplateService.queryBillingPrice(orderBasicInfo.getStationId()); // 先将list按照 尖、峰、平、谷 时段排序 - // List collect = billingList.stream().sorted(Comparator.comparing(BillingPriceVO::getTimeType)).collect(Collectors.toList()); + List collect = billingList.stream().sorted(Comparator.comparing(BillingPriceVO::getTimeType)).collect(Collectors.toList()); // 再循环该list,拼装对应的充电价格、费率 - // List chargeDetails = transformSupChargeDetails(orderDetail, billingList); - // orderInfo.setChargeDetails(chargeDetails); + List chargeDetails = transformSupChargeDetails(orderDetail, collect); + orderInfo.setChargeDetails(chargeDetails); // 获取令牌 String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret); @@ -699,12 +699,12 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService { ChargeOrderInfo orderInfo = transformChargeOrderInfo(orderBasicInfo, orderDetail); - // List billingList = pileBillingTemplateService.queryBillingPrice(orderBasicInfo.getStationId()); + List billingList = pileBillingTemplateService.queryBillingPrice(orderBasicInfo.getStationId()); // 先将list按照 尖、峰、平、谷 时段排序 - // List collect = billingList.stream().sorted(Comparator.comparing(BillingPriceVO::getTimeType)).collect(Collectors.toList()); + List collect = billingList.stream().sorted(Comparator.comparing(BillingPriceVO::getTimeType)).collect(Collectors.toList()); // 再循环该list,拼装对应的充电价格、费率 - // List chargeDetails = transformSupChargeDetails(orderDetail, billingList); - // orderInfo.setChargeDetails(chargeDetails); + List chargeDetails = transformSupChargeDetails(orderDetail, collect); + orderInfo.setChargeDetails(chargeDetails); // 获取令牌 String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret); @@ -801,7 +801,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService { connectorStatsInfo.setConnectorId(pileConnectorCode); connectorStatsInfo.setEquipmentClassification(1); - connectorStatsInfo.setConnectorElectricity((vo.getTotalPower() != null) ? vo.getTotalPower() : BigDecimal.ZERO); + connectorStatsInfo.setConnectorElectricity((vo.getTotalPower() != null) ? vo.getTotalPower().setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO); connectorStatsInfo.setConnectorTotalChargeTime((vo.getChargingTime() != null) ? vo.getChargingTime() : Constants.zero); connectorStatsInfo.setConnectorTotalChargeNum(orderVOS.size()); connectorStatsInfo.setConnectorTotalWarningNum(0); @@ -834,7 +834,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService { pileTotalPower = pileTotalPower.add((vo.getTotalPower() != null) ? vo.getTotalPower() : BigDecimal.ZERO); pileChargeTime += (vo.getChargingTime() != null) ? vo.getChargingTime() : Constants.zero; - equipmentStatsInfo.setEquipmentElectricity(pileTotalPower); // 第一次判断时一定不会进入到这里,所以不用判断 equipmentStatsInfo 是否为 null + equipmentStatsInfo.setEquipmentElectricity(pileTotalPower.setScale(2, RoundingMode.HALF_UP)); // 第一次判断时一定不会进入到这里,所以不用判断 equipmentStatsInfo 是否为 null equipmentStatsInfo.setEquipmentTotalChargeTime(pileChargeTime); connectorStatsInfoList.add(connectorStatsInfo); @@ -858,7 +858,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService { .startTime(startTime) .endTime(endTime) .stationElectricity(stationTotalElectricity) - .stationTotalChargeEnergy(stationTotalElectricity) + .stationTotalChargeEnergy(stationTotalElectricity.setScale(2, RoundingMode.HALF_UP)) .stationTotalChargeNum(orderVOS.size()) .stationTotalChargeTime(stationChargeTime) .stationTotalWarningNum(0) @@ -1051,10 +1051,10 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService { .flatElect(orderDetail.getFlatUsedElectricity()) .valleyElect(orderDetail.getValleyUsedElectricity()) .pushTimeStamp(DateUtils.getDateTime()) - .totalElecMoney(orderDetail.getTotalElectricityAmount()) - .totalSeviceMoney(orderDetail.getTotalServiceAmount()) - .totalServiceMoney(orderDetail.getTotalServiceAmount()) - .totalMoney(orderDetail.getTotalOrderAmount()) + .totalElecMoney(orderDetail.getTotalElectricityAmount().setScale(2, RoundingMode.HALF_UP)) + .totalSeviceMoney(orderDetail.getTotalServiceAmount().setScale(2, RoundingMode.HALF_UP)) + .totalServiceMoney(orderDetail.getTotalServiceAmount().setScale(2, RoundingMode.HALF_UP)) + .totalMoney(orderDetail.getTotalOrderAmount().setScale(2, RoundingMode.HALF_UP)) .stopReason(2) .stopDesc(orderBasicInfo.getReason()) .sumPeriod(0) @@ -1095,7 +1095,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService { detail.setSevicePrice(new BigDecimal(billingPriceVO.getServicePrice()).setScale(4, BigDecimal.ROUND_HALF_UP)); detail.setDetailPower(orderDetail.getSharpUsedElectricity()); detail.setDetailElecMoney(orderDetail.getSharpElectricityPrice()); - detail.setDetailSeviceMoney(orderDetail.getSharpServicePrice()); + detail.setDetailServiceMoney(orderDetail.getSharpServicePrice()); } else if (StringUtils.equals(billingPriceVO.getTimeType(), BillingTimeTypeEnum.PEAK.getValue())) { // 峰时段 detail.setDetailStartTime(DateUtils.getDateTime()); @@ -1104,7 +1104,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService { detail.setSevicePrice(new BigDecimal(billingPriceVO.getServicePrice()).setScale(4, BigDecimal.ROUND_HALF_UP)); detail.setDetailPower(orderDetail.getPeakUsedElectricity()); detail.setDetailElecMoney(orderDetail.getPeakElectricityPrice()); - detail.setDetailSeviceMoney(orderDetail.getPeakServicePrice()); + detail.setDetailServiceMoney(orderDetail.getPeakServicePrice()); } else if (StringUtils.equals(billingPriceVO.getTimeType(), BillingTimeTypeEnum.FLAT.getValue())) { // 平时段 detail.setDetailStartTime(DateUtils.getDateTime()); @@ -1113,7 +1113,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService { detail.setSevicePrice(new BigDecimal(billingPriceVO.getServicePrice()).setScale(4, BigDecimal.ROUND_HALF_UP)); detail.setDetailPower(orderDetail.getFlatUsedElectricity()); detail.setDetailElecMoney(orderDetail.getFlatElectricityPrice()); - detail.setDetailSeviceMoney(orderDetail.getFlatServicePrice()); + detail.setDetailServiceMoney(orderDetail.getFlatServicePrice()); } else if (StringUtils.equals(billingPriceVO.getTimeType(), BillingTimeTypeEnum.VALLEY.getValue())) { // 谷时段 detail.setDetailStartTime(DateUtils.getDateTime()); @@ -1122,7 +1122,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService { detail.setSevicePrice(new BigDecimal(billingPriceVO.getServicePrice()).setScale(4, BigDecimal.ROUND_HALF_UP)); detail.setDetailPower(orderDetail.getValleyUsedElectricity()); detail.setDetailElecMoney(orderDetail.getValleyElectricityPrice()); - detail.setDetailSeviceMoney(orderDetail.getValleyServicePrice()); + detail.setDetailServiceMoney(orderDetail.getValleyServicePrice()); } resultList.add(detail); }