续租要计算租电订单

This commit is contained in:
2025-09-25 15:09:43 +08:00
parent 1814c5c199
commit cefafddf5a

View File

@ -274,14 +274,14 @@ public class OrderServiceImpl implements OrderService {
int rerentInterval = OrderUtil.calculateRerentRoundsToCoverOverdue(orderMainPO.getOverdueDays(), orderMainPO.getRentalDays());
//获取续租车金额
BigDecimal rentCarOrderAmount = OrderUtil.getReRentCarAmount(rerentInterval, orderMainPO.getRentalPrice());
//获取租电金额
// BigDecimal rentBatteyOrderAmount = BigDecimal.ZERO ;
// RentBatteyRuleDTO rentBatteyRuleDTO = null;
// if(orderMainPO.getRentBatteyRuleId()!=null) {
// rentBatteyRuleDTO = carInteg.getRentBatteyRuleByBatteyRuleId(orderMainPO.getRentBatteyRuleId());
// rentBatteyOrderAmount = Optional.ofNullable(rentBatteyRuleDTO).map(RentBatteyRuleDTO::getRentPrice).orElse(BigDecimal.ZERO);
// rentCarOrderAmount = rentCarOrderAmount.add(rentBatteyOrderAmount);
// }
// 获取租电金额
BigDecimal rentBatteyOrderAmount = BigDecimal.ZERO ;
RentBatteyRuleDTO rentBatteyRuleDTO = null;
if(orderMainPO.getRentBatteyRuleId()!=null) {
rentBatteyRuleDTO = carInteg.getRentBatteyRuleByBatteyRuleId(orderMainPO.getRentBatteyRuleId());
rentBatteyOrderAmount = Optional.ofNullable(rentBatteyRuleDTO).map(RentBatteyRuleDTO::getRentPrice).orElse(BigDecimal.ZERO);
rentCarOrderAmount = rentCarOrderAmount.add(rentBatteyOrderAmount);
}
String paymentId = OrderUtil.generateSubOrderNo(OrderUtil.ZF_PREFIX);
// 起支付返回预支付信息
RentCarRuleDTO rentCarRuleDTO = carInteg.getRentCarRuleByCarRuleId(orderMainPO.getRentCarRuleId());
@ -307,19 +307,19 @@ public class OrderServiceImpl implements OrderService {
orderSubRepo.save(rentOrder);
//生成租电子订单
// if(rentBatteyOrderAmount.compareTo(BigDecimal.ZERO)>0){
// //生成租电子订单
// OrderSubPO rentBatraayOrder = new OrderSubPO();
// rentBatraayOrder.setOrderId(orderMainPO.getOrderId());
// rentBatraayOrder.setSuborderNo(OrderUtil.generateSubOrderNo(OrderUtil.ZC_PREFIX));
// rentBatraayOrder.setPaymentId(paymentId);
// rentBatraayOrder.setSuborderType(SubOrderTypeEnum.RENTBATTEY.getCode());
// rentBatraayOrder.setAmount(rentBatteyOrderAmount);
// rentBatraayOrder.setCreatedAt(LocalDateTime.now());
// rentBatraayOrder.setPaymentMethod(paymentType);
// rentBatraayOrder.setPayStatus(PayStatusEnum.USERPAYING.getCode());
// orderSubRepo.save(rentBatraayOrder);
// }
if(rentBatteyOrderAmount.compareTo(BigDecimal.ZERO)>0){
//生成租电子订单
OrderSubPO rentBatraayOrder = new OrderSubPO();
rentBatraayOrder.setOrderId(orderMainPO.getOrderId());
rentBatraayOrder.setSuborderNo(OrderUtil.generateSubOrderNo(OrderUtil.ZC_PREFIX));
rentBatraayOrder.setPaymentId(paymentId);
rentBatraayOrder.setSuborderType(SubOrderTypeEnum.RENTBATTEY.getCode());
rentBatraayOrder.setAmount(rentBatteyOrderAmount);
rentBatraayOrder.setCreatedAt(LocalDateTime.now());
rentBatraayOrder.setPaymentMethod(paymentType);
rentBatraayOrder.setPayStatus(PayStatusEnum.USERPAYING.getCode());
orderSubRepo.save(rentBatraayOrder);
}