刘俊驰 6 月之前
父节点
当前提交
ddb9a7f5c8

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

@@ -233,29 +233,6 @@ public class UserPaymentCoreServiceImpl implements UserPaymentCoreService {
                 throw new BizException("无效的支付订单");
             }
 
-            // 订单已关闭返回异常信息,更新订单状态为已支付,后续流程不处理,允许用户进行退款操作
-            if (EPaymentStatus.CLOSED == paymentOrder.getStatus()) {
-
-                // 支付成功
-                if (PaymentStatus.SUCCESSED == paymentResp.getPaymentStatus()) {
-
-
-                    // 根据支付回调消息,更新订单状态
-                    executePaymentSuccess(UserPaymentOrderWrapper.UserPaymentOrder.from(JSON.toJSONString(paymentOrder)), paymentResp);
-
-//                    UserPaymentOrderWrapper.UserPaymentOrder order = UserPaymentOrderWrapper.UserPaymentOrder
-//                        .builder()
-//                        .transNo(paymentResp.getTransNo())
-//                        .id(paymentOrder.getId())
-//                        .status(PAID)
-//                        .updateTime(DateTime.now().toDate())
-//                        .build();
-//                    userPaymentOrderService.updateById(order);
-
-                    log.error("executePaymentCallback 关单异常,更新订单状态为已支付, error={}, status={}, paymentResp={}", paymentOrder.getErrorMsg(),
-                        paymentOrder.getStatus(), JSON.toJSONString(paymentResp));
-                }
-            } else
             // 订单状态为待支付、支付中时,更新订单状态;
             if (EPaymentStatus.WAIT_PAY == paymentOrder.getStatus() || EPaymentStatus.PAYING == paymentOrder.getStatus()) {
 
@@ -284,6 +261,13 @@ public class UserPaymentCoreServiceImpl implements UserPaymentCoreService {
 
                 log.info("executePaymentCallback WAIT_PAY, status={}, paymentResp={}", paymentOrder.getStatus(),
                     JSON.toJSONString(paymentResp));
+            } else {
+
+                // 支付成功
+                if (PaymentStatus.SUCCESSED == paymentResp.getPaymentStatus()) {
+                    // 根据支付回调消息,更新订单状态
+                    refundOnly("订单已超时,金额原路退回", paymentOrder.getOrderNo());
+                }
             }
 
         }, 60L, TimeUnit.SECONDS);
@@ -1326,9 +1310,6 @@ public class UserPaymentCoreServiceImpl implements UserPaymentCoreService {
         if (Objects.isNull(paymentOrder)) {
             throw new BizException("订单信息不存在");
         }
-        if (!OrderStatusEnum.PAID.getCode().equals(paymentOrder.getStatus().getCode())) {
-            throw  new BizException("订单状态异常");
-        }
         UserOrderVo detail = userOrderService.detail(paymentOrder.getId());
         if (Objects.isNull(detail)) {
             throw new BizException("订单信息不存在");