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