From c1ff1058eeb0067c224ee53e1dc61ace051375c8 Mon Sep 17 00:00:00 2001 From: 陶杰 <1378534974@qq.com> Date: 星期三, 11 九月 2024 17:14:02 +0800 Subject: [PATCH] 1.异常抛出信息修改 --- src/main/java/com/mzl/flower/service/point/PointGoodsService.java | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/mzl/flower/service/point/PointGoodsService.java b/src/main/java/com/mzl/flower/service/point/PointGoodsService.java index 8c17d47..d0ee148 100644 --- a/src/main/java/com/mzl/flower/service/point/PointGoodsService.java +++ b/src/main/java/com/mzl/flower/service/point/PointGoodsService.java @@ -114,6 +114,12 @@ continue; } + if(Constants.POINT_GOODS_STATUS.A.name().equals(status)){ + if(p.getStock() == null || p.getStock() <= 0){ + throw new ValidationException("商品" + p.getName() + "库存为0不能上架"); + } + } + p.setStatus(status); p.update(SecurityUtils.getUserId()); pointGoodsMapper.updateById(p); @@ -151,12 +157,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); //更新积分汇总 -- Gitblit v1.9.3