修改code
This commit is contained in:
		| @ -36,10 +36,10 @@ public class RentCarThirdPlatformOrderReq { | |||||||
|     private String customerPhone; |     private String customerPhone; | ||||||
|  |  | ||||||
|     @ApiModelProperty(value = "第三方订单号") |     @ApiModelProperty(value = "第三方订单号") | ||||||
|     private String thirdOrderNo; |     private String transactionId; | ||||||
|  |  | ||||||
|     @ApiModelProperty(value = "第三方团购码") |     @ApiModelProperty(value = "第三方团购码") | ||||||
|     private String couponCode; |     private String paymentId; | ||||||
|  |  | ||||||
|     @ApiModelProperty(value = "订单来源") |     @ApiModelProperty(value = "订单来源") | ||||||
|     private String orderSource; |     private String orderSource; | ||||||
| @ -62,4 +62,5 @@ public class RentCarThirdPlatformOrderReq { | |||||||
|  |  | ||||||
|     @ApiModelProperty("是否开通免押") |     @ApiModelProperty("是否开通免押") | ||||||
|     private Boolean isDepositFree = false; |     private Boolean isDepositFree = false; | ||||||
|  |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -107,8 +107,8 @@ public class GroupBuyCouponServiceImpl implements GroupBuyCouponService { | |||||||
|             thirdRentCarOrder.setOrderSource(CouponTypeEnum.MT.getCode()); |             thirdRentCarOrder.setOrderSource(CouponTypeEnum.MT.getCode()); | ||||||
|             thirdRentCarOrder.setCustomerName(userInfoDTO.getUserName()); |             thirdRentCarOrder.setCustomerName(userInfoDTO.getUserName()); | ||||||
|             thirdRentCarOrder.setCustomerPhone(userInfoDTO.getPhoneNumber()); |             thirdRentCarOrder.setCustomerPhone(userInfoDTO.getPhoneNumber()); | ||||||
|             thirdRentCarOrder.setThirdOrderNo(productIdMap.get("mtOrderId")); |             thirdRentCarOrder.setTransactionId(productIdMap.get("mtOrderId")); | ||||||
|             thirdRentCarOrder.setCouponCode(req.getCouponCode()); |             thirdRentCarOrder.setPaymentId(req.getCouponCode()); | ||||||
|             thirdRentCarOrder.setRentBatteyRuleId(carModelPackageDTO.getBatteryRuleId()); |             thirdRentCarOrder.setRentBatteyRuleId(carModelPackageDTO.getBatteryRuleId()); | ||||||
|  |  | ||||||
|         }else if (CouponTypeEnum.DY.getCode().equalsIgnoreCase(req.getCouponType())){ |         }else if (CouponTypeEnum.DY.getCode().equalsIgnoreCase(req.getCouponType())){ | ||||||
| @ -178,8 +178,8 @@ public class GroupBuyCouponServiceImpl implements GroupBuyCouponService { | |||||||
|             thirdRentCarOrder.setOrderSource(CouponTypeEnum.DY.getCode()); |             thirdRentCarOrder.setOrderSource(CouponTypeEnum.DY.getCode()); | ||||||
|             thirdRentCarOrder.setCustomerName(userInfoDTO.getUserName()); |             thirdRentCarOrder.setCustomerName(userInfoDTO.getUserName()); | ||||||
|             thirdRentCarOrder.setCustomerPhone(userInfoDTO.getPhoneNumber()); |             thirdRentCarOrder.setCustomerPhone(userInfoDTO.getPhoneNumber()); | ||||||
|             thirdRentCarOrder.setThirdOrderNo(productIdMap.get("dyCertificateId")); |             thirdRentCarOrder.setTransactionId(productIdMap.get("dyCertificateId")); | ||||||
|             thirdRentCarOrder.setCouponCode(productIdMap.get("dyVerifyId")); |             thirdRentCarOrder.setPaymentId(productIdMap.get("dyVerifyId")); | ||||||
|             thirdRentCarOrder.setRentBatteyRuleId(carModelPackageDTO.getBatteryRuleId()); |             thirdRentCarOrder.setRentBatteyRuleId(carModelPackageDTO.getBatteryRuleId()); | ||||||
|         } |         } | ||||||
|         return thirdRentCarOrder; |         return thirdRentCarOrder; | ||||||
| @ -191,7 +191,7 @@ public class GroupBuyCouponServiceImpl implements GroupBuyCouponService { | |||||||
|             if(paymentType.equals(PaymentTypeEnum.MT.getCode())){ |             if(paymentType.equals(PaymentTypeEnum.MT.getCode())){ | ||||||
|                 meiTuanService.reverseconsume(storeId, paymentId, transactionId); |                 meiTuanService.reverseconsume(storeId, paymentId, transactionId); | ||||||
|             } else if (paymentType.equals(PaymentTypeEnum.DY.getCode())){ |             } else if (paymentType.equals(PaymentTypeEnum.DY.getCode())){ | ||||||
|                 douyinService.cancel(transactionId, paymentId); |                 douyinService.cancel(paymentId,transactionId); | ||||||
|             } else { |             } else { | ||||||
|                 log.info("非团购支付,无需退券"); |                 log.info("非团购支付,无需退券"); | ||||||
|             } |             } | ||||||
|  | |||||||
| @ -493,7 +493,7 @@ public class OrderServiceImpl implements OrderService { | |||||||
|         List<OrderMainPO> currentOrderList = orderMainRepo.list(currentOrderWrapper); |         List<OrderMainPO> currentOrderList = orderMainRepo.list(currentOrderWrapper); | ||||||
|         OrderMainPO waitPayOrder = currentOrderList.stream().filter(order -> order.getOrderStatus().equals(OrderStatusEnum.WAIT_PAY.getCode())).findFirst().orElse(null); |         OrderMainPO waitPayOrder = currentOrderList.stream().filter(order -> order.getOrderStatus().equals(OrderStatusEnum.WAIT_PAY.getCode())).findFirst().orElse(null); | ||||||
|         if(!currentOrderList.isEmpty() && waitPayOrder==null){ |         if(!currentOrderList.isEmpty() && waitPayOrder==null){ | ||||||
|             groupBuyCouponService.cancelVerifyCoupon(rentCarOrderReq.getOrderSource(),rentCarOrderReq.getStoreId().intValue(),rentCarOrderReq.getThirdOrderNo(),rentCarOrderReq.getCouponCode()); |             groupBuyCouponService.cancelVerifyCoupon(rentCarOrderReq.getOrderSource(),rentCarOrderReq.getStoreId().intValue(),rentCarOrderReq.getPaymentId(),rentCarOrderReq.getTransactionId()); | ||||||
|             throw new BizException("您有未完成的订单,请先完成订单"); |             throw new BizException("您有未完成的订单,请先完成订单"); | ||||||
|         } |         } | ||||||
|         if(waitPayOrder!=null){ |         if(waitPayOrder!=null){ | ||||||
| @ -511,14 +511,14 @@ public class OrderServiceImpl implements OrderService { | |||||||
|                 .eq(CarPO::getStoreId, rentCarOrderReq.getStoreId()); |                 .eq(CarPO::getStoreId, rentCarOrderReq.getStoreId()); | ||||||
|         List<CarPO> carPOList = carRepo.list(carWrapper); |         List<CarPO> carPOList = carRepo.list(carWrapper); | ||||||
|         if(CollectionUtils.isEmpty(carPOList)){ |         if(CollectionUtils.isEmpty(carPOList)){ | ||||||
|             groupBuyCouponService.cancelVerifyCoupon(rentCarOrderReq.getOrderSource(),rentCarOrderReq.getStoreId().intValue(),rentCarOrderReq.getThirdOrderNo(),rentCarOrderReq.getCouponCode()); |             groupBuyCouponService.cancelVerifyCoupon(rentCarOrderReq.getOrderSource(),rentCarOrderReq.getStoreId().intValue(),rentCarOrderReq.getPaymentId(),rentCarOrderReq.getTransactionId()); | ||||||
|             throw new BizException("门店没有该车型的车辆可租"); |             throw new BizException("门店没有该车型的车辆可租"); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         //获取门店信息 |         //获取门店信息 | ||||||
|         CompanyStoreDTO companyStoreDTO = storeInteg.getStoreById(Integer.valueOf(rentCarOrderReq.getStoreId().toString())); |         CompanyStoreDTO companyStoreDTO = storeInteg.getStoreById(Integer.valueOf(rentCarOrderReq.getStoreId().toString())); | ||||||
|         if(Objects.isNull(companyStoreDTO)){ |         if(Objects.isNull(companyStoreDTO)){ | ||||||
|             groupBuyCouponService.cancelVerifyCoupon(rentCarOrderReq.getOrderSource(),rentCarOrderReq.getStoreId().intValue(),rentCarOrderReq.getThirdOrderNo(),rentCarOrderReq.getCouponCode()); |             groupBuyCouponService.cancelVerifyCoupon(rentCarOrderReq.getOrderSource(),rentCarOrderReq.getStoreId().intValue(),rentCarOrderReq.getPaymentId(),rentCarOrderReq.getTransactionId()); | ||||||
|             throw new BizException("运营商或门店已下架"); |             throw new BizException("运营商或门店已下架"); | ||||||
|         } |         } | ||||||
|  |  | ||||||
| @ -570,7 +570,7 @@ public class OrderServiceImpl implements OrderService { | |||||||
|                     depositOrder.setAmount(orderMainPO.getDepositPrice()); |                     depositOrder.setAmount(orderMainPO.getDepositPrice()); | ||||||
|                     depositOrder.setCreatedAt(LocalDateTime.now()); |                     depositOrder.setCreatedAt(LocalDateTime.now()); | ||||||
|                     depositOrder.setPaymentMethod(paymentType); |                     depositOrder.setPaymentMethod(paymentType); | ||||||
|                     depositOrder.setTransactionId(rentCarOrderReq.getThirdOrderNo()); |                     depositOrder.setTransactionId(rentCarOrderReq.getTransactionId()); | ||||||
|                     orderSubPOList.add(depositOrder); |                     orderSubPOList.add(depositOrder); | ||||||
|                 } |                 } | ||||||
|                 //如果选择了租电套餐,则还需要生成租电子订单 |                 //如果选择了租电套餐,则还需要生成租电子订单 | ||||||
| @ -583,7 +583,7 @@ public class OrderServiceImpl implements OrderService { | |||||||
|                     depositOrder.setCreatedAt(LocalDateTime.now()); |                     depositOrder.setCreatedAt(LocalDateTime.now()); | ||||||
|                     depositOrder.setPaymentMethod(paymentType); |                     depositOrder.setPaymentMethod(paymentType); | ||||||
|                     depositOrder.setReturnTime(endRentTime); |                     depositOrder.setReturnTime(endRentTime); | ||||||
|                     depositOrder.setTransactionId(rentCarOrderReq.getThirdOrderNo()); |                     depositOrder.setTransactionId(rentCarOrderReq.getTransactionId()); | ||||||
|                     orderSubPOList.add(depositOrder); |                     orderSubPOList.add(depositOrder); | ||||||
|                 } |                 } | ||||||
|                 //生成租车订单 |                 //生成租车订单 | ||||||
| @ -595,14 +595,14 @@ public class OrderServiceImpl implements OrderService { | |||||||
|                 rentOrder.setCreatedAt(LocalDateTime.now()); |                 rentOrder.setCreatedAt(LocalDateTime.now()); | ||||||
|                 rentOrder.setPaymentMethod(paymentType); |                 rentOrder.setPaymentMethod(paymentType); | ||||||
|                 rentOrder.setReturnTime(endRentTime); |                 rentOrder.setReturnTime(endRentTime); | ||||||
|                 rentOrder.setTransactionId(rentCarOrderReq.getThirdOrderNo()); |                 rentOrder.setTransactionId(rentCarOrderReq.getTransactionId()); | ||||||
|                 orderSubPOList.add(rentOrder); |                 orderSubPOList.add(rentOrder); | ||||||
|  |  | ||||||
|                 BigDecimal orderAmount = orderSubPOList.stream().map(OrderSubPO::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |                 BigDecimal orderAmount = orderSubPOList.stream().map(OrderSubPO::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add); | ||||||
|                 orderMainPO.setOrderAmount(orderAmount); |                 orderMainPO.setOrderAmount(orderAmount); | ||||||
|  |  | ||||||
|                 //支付号为团购码 |                 //支付号为团购码 | ||||||
|                 String paymentId = rentCarOrderReq.getCouponCode(); |                 String paymentId = rentCarOrderReq.getPaymentId(); | ||||||
|  |  | ||||||
|  |  | ||||||
|                 for(OrderSubPO orderSubPO : orderSubPOList){ |                 for(OrderSubPO orderSubPO : orderSubPOList){ | ||||||
| @ -630,14 +630,14 @@ public class OrderServiceImpl implements OrderService { | |||||||
|                 return rentCarOrderResultDTO; |                 return rentCarOrderResultDTO; | ||||||
|  |  | ||||||
|             }catch (Exception e){ |             }catch (Exception e){ | ||||||
|                 groupBuyCouponService.cancelVerifyCoupon(rentCarOrderReq.getOrderSource(),rentCarOrderReq.getStoreId().intValue(),rentCarOrderReq.getThirdOrderNo(),rentCarOrderReq.getCouponCode()); |                 groupBuyCouponService.cancelVerifyCoupon(rentCarOrderReq.getOrderSource(),rentCarOrderReq.getStoreId().intValue(),rentCarOrderReq.getPaymentId(),rentCarOrderReq.getTransactionId()); | ||||||
|                 log.warn("下单失败", e); |                 log.warn("下单失败", e); | ||||||
|                 throw e; |                 throw e; | ||||||
|             } finally { |             } finally { | ||||||
|                 redisUtil.deleteRedisLock(redisLockKey); |                 redisUtil.deleteRedisLock(redisLockKey); | ||||||
|             } |             } | ||||||
|         } else { |         } else { | ||||||
|             groupBuyCouponService.cancelVerifyCoupon(rentCarOrderReq.getOrderSource(),rentCarOrderReq.getStoreId().intValue(),rentCarOrderReq.getThirdOrderNo(),rentCarOrderReq.getCouponCode()); |             groupBuyCouponService.cancelVerifyCoupon(rentCarOrderReq.getOrderSource(),rentCarOrderReq.getStoreId().intValue(),rentCarOrderReq.getPaymentId(),rentCarOrderReq.getTransactionId()); | ||||||
|             log.warn("下单失败,锁已被占用"); |             log.warn("下单失败,锁已被占用"); | ||||||
|             throw new InnerException("服务器正在处理,请稍后再试"); |             throw new InnerException("服务器正在处理,请稍后再试"); | ||||||
|         } |         } | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user