liujie
3 天以前 ce531d3bb32f5221b35f9e24d027ef83450ebbc6
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"));