From a1d01d25e2c5f48bc51557da55f40e8748d94532 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Wed, 03 Sep 2025 11:02:41 +0800
Subject: [PATCH] feat(ai): 优化对话输入方式并添加思考内容

---
 src/main/java/cc/mrbird/febs/mall/quartz/OrderOvertimeJob.java |   39 ++++++++++++++++++++++++++-------------
 1 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/mall/quartz/OrderOvertimeJob.java b/src/main/java/cc/mrbird/febs/mall/quartz/OrderOvertimeJob.java
index 2ff512f..bab9b03 100644
--- a/src/main/java/cc/mrbird/febs/mall/quartz/OrderOvertimeJob.java
+++ b/src/main/java/cc/mrbird/febs/mall/quartz/OrderOvertimeJob.java
@@ -2,16 +2,16 @@
 
 import cc.mrbird.febs.common.enumerates.OrderStatusEnum;
 import cc.mrbird.febs.common.exception.FebsException;
-import cc.mrbird.febs.mall.entity.MallGoods;
-import cc.mrbird.febs.mall.entity.MallGoodsSku;
-import cc.mrbird.febs.mall.entity.MallOrderInfo;
-import cc.mrbird.febs.mall.entity.MallOrderItem;
+import cc.mrbird.febs.common.utils.RedisUtils;
+import cc.mrbird.febs.mall.entity.*;
 import cc.mrbird.febs.mall.mapper.*;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.date.DateUnit;
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.ObjectUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
@@ -24,6 +24,7 @@
  **/
 @Slf4j
 @Component
+@ConditionalOnProperty(prefix = "system", name = "job", havingValue = "false")
 public class OrderOvertimeJob {
 
     @Autowired
@@ -40,6 +41,9 @@
 
     @Autowired
     private MallGoodsSkuMapper mallGoodsSkuMapper;
+
+    @Autowired
+    private MallMemberCouponMapper mallMemberCouponMapper;
 
     @Scheduled(cron = "0 0/5 * * * ? ")
     public void overtimeJob() {
@@ -60,9 +64,9 @@
                             throw new FebsException("购买商品或sku不存在");
                         }
 
-                        if (sku.getStock() < mallOrderItem.getCnt()) {
-                            throw new FebsException(sku.getSkuName() + "库存不足");
-                        }
+//                        if (sku.getStock() < mallOrderItem.getCnt()) {
+//                            throw new FebsException(sku.getSkuName() + "库存不足");
+//                        }
 
                         MallGoods mallGoods = mallGoodsMapper.selectById(sku.getGoodsId());
                         Integer goodsResult = mallGoodsMapper.updateStockAndVolumeByGoodsId(mallGoods.getId(), mallOrderItem.getCnt());
@@ -74,6 +78,12 @@
                         if(1 != skuResult){
                             throw new FebsException(sku.getSkuName() + "库存不足");
                         }
+                        Long memberCouponId = mallOrderItem.getMemberCouponId();
+                        MallMemberCoupon mallMemberCoupon = mallMemberCouponMapper.selectById(memberCouponId);
+                        if(ObjectUtil.isNotEmpty(mallMemberCoupon)){
+                            mallMemberCoupon.setState(1);
+                            mallMemberCouponMapper.updateById(mallMemberCoupon);
+                        }
                     }
                 }
             }
@@ -81,10 +91,13 @@
 
     }
 
-//    @Scheduled(cron = "0/5 * * * * ? ")
-//    public void wakeup() {
-//        log.info("本地保持唤醒状态");
-//        Long id = 5L;
-//        mallMemberMapper.selectById(id);
-//    }
+
+
+    @Autowired
+    private RedisUtils redisUtils;
+
+    @Scheduled(cron = "0/5 * * * * ? ")
+    public void wakeup() {
+        redisUtils.set("wakeup", "wakeup");
+    }
 }

--
Gitblit v1.9.1