Helius
2022-09-23 7c6f033b8754b07bf5c75ae8745a982d76f9abb4
src/main/java/cc/mrbird/febs/mall/quartz/OrderOvertimeJob.java
@@ -12,6 +12,7 @@
import cn.hutool.core.date.DateUtil;
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 +25,7 @@
 **/
@Slf4j
@Component
@ConditionalOnProperty(prefix = "system", name = "job", havingValue = "true")
public class OrderOvertimeJob {
    @Autowired
@@ -60,17 +62,17 @@
                            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());
                        Integer goodsResult = mallGoodsMapper.updateStockAndVolumeByGoodsId(mallGoods.getId(), mallOrderItem.getCnt());
                        if(1 != goodsResult){
                            throw new FebsException(mallGoods.getGoodsName() + "库存不足");
                        }
                        Integer skuResult = mallGoodsSkuMapper.upDateStockAndVolumeBySkuId(sku.getId(),mallOrderItem.getCnt());
                        Integer skuResult = mallGoodsSkuMapper.updateStockAndVolumeBySkuId(sku.getId(),mallOrderItem.getCnt());
                        if(1 != skuResult){
                            throw new FebsException(sku.getSkuName() + "库存不足");
                        }