Selaa lähdekoodia

fix(app):
1.定时取消订单

wzq 3 viikkoa sitten
vanhempi
commit
047a9041d2

+ 9 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/service/impl/OrderServiceImpl.java

@@ -932,6 +932,7 @@ public class OrderServiceImpl implements IOrderService {
                 appOrderProInfo.setType(CommonConstant.ORDER_PRO_INFO_TYPE_6);
 
                 appOrderProInfo.setPrice(insureOrderInfo.getMoney());
+                appOrderProInfo.setOriginalPrice(insureOrderInfo.getMoney());
                 appOrderProInfo.setQuantity(1);
                 FamilyMembers familyMembers = familyMembersMapper.selectById(insureOrderInfo.getFamilyMembersId());
                 appOrderProInfo.setFamilyUserId(familyMembers.getId());
@@ -1492,6 +1493,14 @@ public class OrderServiceImpl implements IOrderService {
             if (ObjectUtil.isNotEmpty(appOrder)) {
                 appOrder.setOrderStatus(1);
                 appOrderMapper.updateById(appOrder);
+                List<AppOrderProInfo> proInfoList = appOrderProInfoMapper.selectList(Wrappers.<AppOrderProInfo>lambdaQuery().eq(AppOrderProInfo::getOrderId, appOrder.getId()));
+                if (CollUtil.isNotEmpty(proInfoList)){
+                    for (AppOrderProInfo appOrderProInfo : proInfoList) {
+                        appOrderProInfo.setOrderStatus(1);
+                        appOrderProInfoMapper.updateById(appOrderProInfo);
+                    }
+                }
+
                 return "100001";//支付成功
             }
         }

+ 16 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/redission/RedissonDelayQueue.java

@@ -1,8 +1,12 @@
 package org.jeecg.modules.redission;
 
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.modules.system.app.entity.AppOrder;
+import org.jeecg.modules.system.app.entity.AppOrderProInfo;
+import org.jeecg.modules.system.app.service.IAppOrderProInfoService;
 import org.jeecg.modules.system.app.service.IAppOrderService;
 import org.redisson.api.RBlockingQueue;
 import org.redisson.api.RDelayedQueue;
@@ -12,6 +16,7 @@ import org.springframework.stereotype.Component;
 import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
 import java.util.Arrays;
+import java.util.List;
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
@@ -30,6 +35,9 @@ public class RedissonDelayQueue {
     @Resource
     private IAppOrderService appOrderService;
 
+    @Resource
+    IAppOrderProInfoService appOrderProInfoService;
+
     private RDelayedQueue<String> delayQueue;
     private RBlockingQueue<String> blockingQueue;
 
@@ -62,6 +70,14 @@ public class RedissonDelayQueue {
                             appOrder.setOrderStatus(4);
                             appOrderService.updateById(appOrder);
                         }
+                        //修改子订单状态
+                        List<AppOrderProInfo> appOrderProInfoList = appOrderProInfoService.list(Wrappers.<AppOrderProInfo>lambdaQuery().eq(AppOrderProInfo::getOrderId, orderId));
+                        if (CollUtil.isNotEmpty(appOrderProInfoList)){
+                            for (AppOrderProInfo appOrderProInfo : appOrderProInfoList) {
+                                appOrderProInfo.setOrderStatus(4);
+                                appOrderProInfoService.updateById(appOrderProInfo);
+                            }
+                        }
                     }
                 } catch (Exception e) {
                     e.printStackTrace();

+ 1 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/entity/AppOrderProInfo.java

@@ -72,7 +72,7 @@ public class AppOrderProInfo implements Serializable{
     private BigDecimal originalPrice;
     @Schema(description = "实际价格/元")
     private BigDecimal price;
-    @Schema(description = "订单状态 0-待使用 1-已使用 2-已取消")
+    @Schema(description = "0-待付款 1-待使用 2-已使用 3-已到期 4-已取消 5-退款中 6已退款")
     private Integer orderStatus;
     @Schema(description = "售后状态")
     private Integer afterSaleStatus;