From ce531d3bb32f5221b35f9e24d027ef83450ebbc6 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期二, 21 十月 2025 16:58:34 +0800
Subject: [PATCH] 修改bug

---
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TSysGoodsServiceImpl.java |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TSysGoodsServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TSysGoodsServiceImpl.java
index a435987..bb6767a 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TSysGoodsServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TSysGoodsServiceImpl.java
@@ -48,10 +48,10 @@
         // 判断已经购买的了多少
         List<TSysGoodsExchange> list = sysGoodsExchangeMapper.selectList(new LambdaQueryWrapper<TSysGoodsExchange>().eq(TSysGoodsExchange::getGoodsId, dto.getGoodsId()));
         int sum = list.stream().mapToInt(TSysGoodsExchange::getGoodsCount).sum();
-        if(sum+dto.getCount()>tSysGoods.getGoodsTotal()){
+        if(tSysGoods.getGoodsTotal()!=null && sum+dto.getCount()>tSysGoods.getGoodsTotal()){
             throw new RuntimeException("商品库存不足");
         }
-        if(sum+dto.getCount()>tSysGoods.getConvertibleQuantity()){
+        if(tSysGoods.getConvertibleQuantity()!=null && sum+dto.getCount()>tSysGoods.getConvertibleQuantity()){
             throw new RuntimeException("可兑换数量不足");
         }
         List<TCrmClinicPoints> points = crmClinicPointsMapper.selectList(new LambdaQueryWrapper<TCrmClinicPoints>().eq(TCrmClinicPoints::getClinicId, crmClinic.getId()).ge(TCrmClinicPoints::getExpireTime, new Date()).last(" and points > use_points ORDER BY create_time ASC"));

--
Gitblit v1.7.1