陶杰
2024-09-11 2181e2419cdcc4659f9fbd368ccc9e3c6f6f79dd
src/main/java/com/mzl/flower/service/point/PointGoodsService.java
@@ -140,7 +140,7 @@
            }
            CustomerPoint cp = customerPointMapper.selectOne(new LambdaQueryWrapper<CustomerPoint>()
                    .eq(CustomerPoint::getUserId, SecurityUtils.getUserId()));
            if(cp == null || (cp.getTotalPoint()-cp.getUsedPoint()-cp.getExpiredPoint()) < p.getPoint() * dto.getNum()){
            if(cp == null || (cp.getTotalPoint()-cp.getUsedPoint()-cp.getExpiredPoint()-cp.getDeductionPoint()) < p.getPoint() * dto.getNum()){
                throw new ValidationException("积分不足");
            }
            //记录兑换记录
@@ -151,12 +151,13 @@
            record.setNum(dto.getNum());
            record.setPoint(p.getPoint());
            record.setName(p.getName());
            record.setPictures(p.getPictures());
            record.setPictures(p.getCover());
            record.setDescription(p.getDescription());
            record.setTotalPoint(p.getPoint() * dto.getNum());
            record.setCover(p.getCover());
            record.setRedeemCode(UUIDGenerator.getUUID());
            record.setStatus(Constants.POINT_GOODS_RECORD_STATUS.A.name());//未使用
            record.create(SecurityUtils.getUserId());
            pointGoodsRecordMapper.insert(record);
            //更新积分汇总