Explorar o código

支付中订单不能切换支付渠道

刘俊驰 hai 3 días
pai
achega
8fbe44810e

+ 5 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserPaymentCoreServiceImpl.java

@@ -530,6 +530,7 @@ public class UserPaymentCoreServiceImpl implements UserPaymentCoreService {
     @Transactional
     @Override
     public UserPaymentOrderWrapper.PaymentConfig executeOrder(UserPaymentOrderWrapper.UserPaymentOrder orderReq) {
+        log.info("executeOrder orderReq={}", orderReq.jsonString());
 
         // 填充订单基本信息
         String defaultService = paymentServiceContext.defaultService();
@@ -1077,6 +1078,7 @@ DISCOUNT("畅学卡")
     @Transactional
     @Override
     public UserPaymentOrderWrapper.PaymentReq executePayment(UserPaymentOrderWrapper.PaymentOrderReqConfig reqConfig) {
+        log.info("executePayment reqConfig={}", reqConfig.jsonString());
 
         // 查询订单状态
         UserPaymentOrderWrapper.UserPaymentOrder userPaymentOrder = userPaymentOrderService.getUserPaymentOrderByUserId(Long.parseLong(reqConfig.getUserId()),
@@ -1085,6 +1087,9 @@ DISCOUNT("畅学卡")
         // 默认支付三方
         if (StringUtils.isNotEmpty(reqConfig.getPaymentVendor())
                 && !reqConfig.getPaymentVendor().equals(userPaymentOrder.getPaymentVendor())) {
+            if (EPaymentStatus.PAYING == userPaymentOrder.getStatus()) {
+                throw new BizException("订单支付发起中,请勿切换支付方式");
+            }
             // 原生支付拉起支付时,可以切换支付渠道
             UserPaymentOrderWrapper.UserPaymentOrder update = UserPaymentOrderWrapper.UserPaymentOrder
                 .builder()