From ea0233fa9f33169d7be786878988f0eba588d3da Mon Sep 17 00:00:00 2001 From: Guoqs <123@jsowell.com> Date: Fri, 2 Aug 2024 15:45:15 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E9=A2=84=E7=BA=A6=E5=85=85=E7=94=B5?= =?UTF-8?q?=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/jsowell/common/util/YKCUtils.java | 7 +++ ...servationChargingStartupResultHandler.java | 2 +- .../TransactionRecordsRequestHandler.java | 2 +- .../jsowell/pile/dto/StartPersonPileDTO.java | 5 ++ .../impl/OrderBasicInfoServiceImpl.java | 55 +++++++++++-------- .../impl/PileBasicInfoServiceImpl.java | 2 + .../DelayMerchantProgramLogic.java | 5 ++ 7 files changed, 52 insertions(+), 26 deletions(-) diff --git a/jsowell-common/src/main/java/com/jsowell/common/util/YKCUtils.java b/jsowell-common/src/main/java/com/jsowell/common/util/YKCUtils.java index e0da8e82b..9cd038c4c 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/util/YKCUtils.java +++ b/jsowell-common/src/main/java/com/jsowell/common/util/YKCUtils.java @@ -145,4 +145,11 @@ public class YKCUtils { } return "一"; } + + /** + * 解析vin + */ + public static String parseVin(byte[] vinCodeByteArr) { + return BytesUtil.ascii2Str(vinCodeByteArr); + } } diff --git a/jsowell-netty/src/main/java/com/jsowell/netty/handler/yunkuaichong/ReservationChargingStartupResultHandler.java b/jsowell-netty/src/main/java/com/jsowell/netty/handler/yunkuaichong/ReservationChargingStartupResultHandler.java index badcd2d5d..d12d14c02 100644 --- a/jsowell-netty/src/main/java/com/jsowell/netty/handler/yunkuaichong/ReservationChargingStartupResultHandler.java +++ b/jsowell-netty/src/main/java/com/jsowell/netty/handler/yunkuaichong/ReservationChargingStartupResultHandler.java @@ -65,7 +65,7 @@ public class ReservationChargingStartupResultHandler extends AbstractHandler{ startIndex += length; length = 17; byte[] vinCodeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length); - String vinCode = BytesUtil.bcd2Str(vinCodeByteArr); + String vinCode = YKCUtils.parseVin(vinCodeByteArr); // 解析vin // 启动结果 0x00失败 0x01成功 startIndex += length; diff --git a/jsowell-netty/src/main/java/com/jsowell/netty/handler/yunkuaichong/TransactionRecordsRequestHandler.java b/jsowell-netty/src/main/java/com/jsowell/netty/handler/yunkuaichong/TransactionRecordsRequestHandler.java index f9ce58077..46cf5e9b3 100644 --- a/jsowell-netty/src/main/java/com/jsowell/netty/handler/yunkuaichong/TransactionRecordsRequestHandler.java +++ b/jsowell-netty/src/main/java/com/jsowell/netty/handler/yunkuaichong/TransactionRecordsRequestHandler.java @@ -475,7 +475,7 @@ public class TransactionRecordsRequestHandler extends AbstractHandler { startIndex += length; length = 17; byte[] vinCodeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length); - String vinCode = BytesUtil.ascii2Str(vinCodeByteArr); + String vinCode = YKCUtils.parseVin(vinCodeByteArr); // 解析vin /** * 交易标识 diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/dto/StartPersonPileDTO.java b/jsowell-pile/src/main/java/com/jsowell/pile/dto/StartPersonPileDTO.java index 456ea8309..4d13209ed 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/dto/StartPersonPileDTO.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/dto/StartPersonPileDTO.java @@ -16,6 +16,11 @@ public class StartPersonPileDTO extends BaseDTO { */ private String merchantId; + /** + * 充电桩所属站点id + */ + private String stationId; + /** * 启动类型 * @see com.jsowell.common.enums.ykc.StartTypeEnum diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java index 1f3a44dd6..118192819 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java @@ -3596,33 +3596,40 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService { // 订单详情 BillingTemplateVO billingTemplate = dto.getBillingTemplate(); logger.info("订单使用的计费模板-orderCode:{}, billingTemplate:{}", orderCode, JSON.toJSONString(billingTemplate)); - OrderDetail orderDetail = null; + BigDecimal sharpElectricityPrice = BigDecimal.ZERO; // 尖时段电费单价 + BigDecimal sharpServicePrice = BigDecimal.ZERO; // 尖时段服务费单价 + BigDecimal peakElectricityPrice = BigDecimal.ZERO; // 峰时段电费单价 + BigDecimal peakServicePrice = BigDecimal.ZERO; // 峰时段服务费单价 + BigDecimal flatElectricityPrice = BigDecimal.ZERO; // 平时段电费单价 + BigDecimal flatServicePrice = BigDecimal.ZERO; // 平时段服务费单价 + BigDecimal valleyElectricityPrice = BigDecimal.ZERO; // 谷时段电费单价 + BigDecimal valleyServicePrice = BigDecimal.ZERO; // 谷时段服务费单价 if (billingTemplate != null) { - BigDecimal sharpElectricityPrice = billingTemplate.getSharpElectricityPrice() != null ? billingTemplate.getSharpElectricityPrice() : BigDecimal.ZERO; - BigDecimal sharpServicePrice = billingTemplate.getSharpServicePrice() != null ? billingTemplate.getSharpServicePrice() : BigDecimal.ZERO; - BigDecimal peakElectricityPrice = billingTemplate.getPeakElectricityPrice() != null ? billingTemplate.getPeakElectricityPrice() : BigDecimal.ZERO; - BigDecimal peakServicePrice = billingTemplate.getPeakServicePrice() != null ? billingTemplate.getPeakServicePrice() : BigDecimal.ZERO; - BigDecimal flatElectricityPrice = billingTemplate.getFlatElectricityPrice() != null ? billingTemplate.getFlatElectricityPrice() : BigDecimal.ZERO; - BigDecimal flatServicePrice = billingTemplate.getFlatServicePrice() != null ? billingTemplate.getFlatServicePrice() : BigDecimal.ZERO; - BigDecimal valleyElectricityPrice = billingTemplate.getValleyElectricityPrice() != null ? billingTemplate.getValleyElectricityPrice() : BigDecimal.ZERO; - BigDecimal valleyServicePrice = billingTemplate.getValleyServicePrice() != null ? billingTemplate.getValleyServicePrice() : BigDecimal.ZERO; + sharpElectricityPrice = billingTemplate.getSharpElectricityPrice() != null ? billingTemplate.getSharpElectricityPrice() : BigDecimal.ZERO; + sharpServicePrice = billingTemplate.getSharpServicePrice() != null ? billingTemplate.getSharpServicePrice() : BigDecimal.ZERO; + peakElectricityPrice = billingTemplate.getPeakElectricityPrice() != null ? billingTemplate.getPeakElectricityPrice() : BigDecimal.ZERO; + peakServicePrice = billingTemplate.getPeakServicePrice() != null ? billingTemplate.getPeakServicePrice() : BigDecimal.ZERO; + flatElectricityPrice = billingTemplate.getFlatElectricityPrice() != null ? billingTemplate.getFlatElectricityPrice() : BigDecimal.ZERO; + flatServicePrice = billingTemplate.getFlatServicePrice() != null ? billingTemplate.getFlatServicePrice() : BigDecimal.ZERO; + valleyElectricityPrice = billingTemplate.getValleyElectricityPrice() != null ? billingTemplate.getValleyElectricityPrice() : BigDecimal.ZERO; + valleyServicePrice = billingTemplate.getValleyServicePrice() != null ? billingTemplate.getValleyServicePrice() : BigDecimal.ZERO; - orderDetail = OrderDetail.builder() - .orderCode(orderCode) - .sharpPrice(sharpElectricityPrice.add(sharpServicePrice)) - .sharpElectricityPrice(sharpElectricityPrice) - .sharpServicePrice(sharpServicePrice) - .peakPrice(peakElectricityPrice.add(peakServicePrice)) - .peakElectricityPrice(peakElectricityPrice) - .peakServicePrice(peakServicePrice) - .flatPrice(flatElectricityPrice.add(flatServicePrice)) - .flatElectricityPrice(flatElectricityPrice) - .flatServicePrice(flatServicePrice) - .valleyPrice(valleyElectricityPrice.add(valleyServicePrice)) - .valleyElectricityPrice(valleyElectricityPrice) - .valleyServicePrice(valleyServicePrice) - .build(); } + OrderDetail orderDetail = OrderDetail.builder() + .orderCode(orderCode) + .sharpPrice(sharpElectricityPrice.add(sharpServicePrice)) + .sharpElectricityPrice(sharpElectricityPrice) + .sharpServicePrice(sharpServicePrice) + .peakPrice(peakElectricityPrice.add(peakServicePrice)) + .peakElectricityPrice(peakElectricityPrice) + .peakServicePrice(peakServicePrice) + .flatPrice(flatElectricityPrice.add(flatServicePrice)) + .flatElectricityPrice(flatElectricityPrice) + .flatServicePrice(flatServicePrice) + .valleyPrice(valleyElectricityPrice.add(valleyServicePrice)) + .valleyElectricityPrice(valleyElectricityPrice) + .valleyServicePrice(valleyServicePrice) + .build(); // 保存到数据库 OrderTransactionDTO createOrderTransactionDTO = OrderTransactionDTO.builder() diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java index 06013e9ce..717d272bb 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java @@ -1208,6 +1208,8 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService { if (pileConnectorDetailVO == null) { throw new BusinessException("", ""); } + dto.setMerchantId(pileConnectorDetailVO.getMerchantId()); + dto.setStationId(pileConnectorDetailVO.getStationId()); // 获取处理逻辑 // String mode = pileMerchantInfoService.getDelayModeByAppIdAndRequestSource(dto.getAppId(), dto.getRequestSource()); String mode = pileMerchantInfoService.getDelayModeByMerchantId(pileConnectorDetailVO.getMerchantId()); diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/programlogic/DelayMerchantProgramLogic.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/programlogic/DelayMerchantProgramLogic.java index afdb35846..9c35dc1e0 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/programlogic/DelayMerchantProgramLogic.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/programlogic/DelayMerchantProgramLogic.java @@ -31,6 +31,7 @@ import com.jsowell.pile.dto.*; import com.jsowell.pile.transaction.dto.OrderTransactionDTO; import com.jsowell.pile.vo.uniapp.customer.MemberVO; import com.jsowell.pile.vo.web.BalanceDeductionAmountVO; +import com.jsowell.pile.vo.web.BillingTemplateVO; import com.jsowell.pile.vo.web.OrderDetailInfoVO; import com.jsowell.pile.vo.web.UpdateMemberBalanceDTO; import com.jsowell.wxpay.dto.WechatSendMsgDTO; @@ -858,6 +859,10 @@ public class DelayMerchantProgramLogic extends AbstractProgramLogic { generateOrderDTO.setPileSn(pileSn); generateOrderDTO.setConnectorCode(connectorCode); + // 通过站点id查询计费模板 + BillingTemplateVO billingTemplateVO = pileBillingTemplateService.queryUsedBillingTemplate(dto.getStationId()); + generateOrderDTO.setBillingTemplate(billingTemplateVO); + OrderBasicInfo orderBasicInfo; try { orderBasicInfo = generateOrder(generateOrderDTO);