Przeglądaj źródła

bug 团购库存数为0 增加库存数变更状态为进行中

qxy 1 miesiąc temu
rodzic
commit
1668eca80a

+ 8 - 0
alien-store/src/main/java/shop/alien/store/service/LifeUserOrderService.java

@@ -561,6 +561,14 @@ public class LifeUserOrderService extends ServiceImpl<LifeUserOrderMapper, LifeU
                 lifeGroupBuyMainMapper.update(null, new LambdaUpdateWrapper<LifeGroupBuyMain>()
                         .setSql("inventory_num=inventory_num+" + refundCouponAmount)
                         .eq(LifeGroupBuyMain::getId, couponId));
+
+                //判断当前时间在开始时间start_date和结束时间end_date之间,并且库存single_qty大于0,则修改状态status为5
+                lifeGroupBuyMainMapper.update(null, new LambdaUpdateWrapper<LifeGroupBuyMain>()
+                        .set(LifeGroupBuyMain::getStatus, 5)
+                        .eq(LifeGroupBuyMain::getId, couponId)
+                        .le(LifeGroupBuyMain::getStartTimeValue, LocalDateTime.now())
+                        .ge(LifeGroupBuyMain::getEndTime, LocalDateTime.now())
+                        .gt(LifeGroupBuyMain::getInventoryNum, 0));
             }
         } catch (Exception e) {
             log.error("LifeUserOrderService,恢复团购券/代金券数量报错={}", e);