liujc 1 سال پیش
والد
کامیت
9501823150

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

@@ -120,6 +120,12 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
     @Autowired
     private TenantAlbumService tenantAlbumService;
 
+    @Autowired
+    private UserPaymentCoreService userPaymentCoreService;
+
+    @Autowired
+    private UserPaymentOrderService userPaymentOrderService;
+
     //验证订单是否可以下单,获取订单金额信息
     private static final Map<GoodTypeEnum, Function<OrderReq.OrderReqInfo, HttpResponseResult<OrderCreateRes>>> orderCreate = new HashMap<>();
     //插入订单后执行
@@ -261,6 +267,7 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
     @Transactional(rollbackFor = Exception.class)
     public void setSuccessStatus() {
         OrderSearch query = new OrderSearch();
+        query.setPaymentVersion(EPaymentVersion.V1);
         query.setStatus("WAIT_PAY,PAYING");
         List<UserOrderVo> userOrderVos = selectAllList(query);
          for (UserOrderVo userOrderVo : userOrderVos) {
@@ -268,6 +275,15 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
                      .runIfLockCanGet(CacheNameEnum.LOCK_EXECUTE_ORDER.getRedisKey(userOrderVo.getOrderNo())
                              , () -> testOrderSuccess(userOrderVo.getOrderNo()), 60L, TimeUnit.SECONDS);
         }
+
+        query.setPaymentVersion(EPaymentVersion.V2);
+         userOrderVos = selectAllList(query);
+        for (UserOrderVo userOrderVo : userOrderVos) {
+            DistributedLock.of(redissonClient)
+                    .runIfLockCanGet(CacheNameEnum.LOCK_EXECUTE_ORDER.getRedisKey(userOrderVo.getOrderNo())
+                            , () -> userPaymentCoreService.executePaymentSuccess(userPaymentOrderService.getUserPaymentOrderByOrderNo(userOrderVo.getOrderNo()),null),
+                            60L, TimeUnit.SECONDS);
+        }
     }
 
     @Override

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

@@ -630,9 +630,9 @@ public class UserPaymentCoreServiceImpl implements UserPaymentCoreService {
         redisCacheService.saveUserOrderConfig(String.valueOf(orderReq.getUserId()), orderReq.getOrderType().getCode(), reqConfig.jsonString());
 
         // 若订单无需支付,直接完成订单,VIP购买
-//        if (BigDecimal.ZERO.compareTo(orderReq.getPaymentCashAmount()) == 0) {
+        if (BigDecimal.ZERO.compareTo(orderReq.getPaymentCashAmount()) == 0) {
             executePaymentSuccess(orderReq, null);
-//        }
+        }
 
         return UserPaymentOrderWrapper.PaymentConfig.builder()
             .orderNo(orderReq.getOrderNo())