FengChaoYu 7 miesięcy temu
rodzic
commit
5e21ca2f7b

+ 3 - 0
mall-server-api/src/main/java/com/gree/mall/manager/logic/material/manage/WebsitSalesLogic.java

@@ -258,6 +258,9 @@ public class WebsitSalesLogic {
             if (!goodsMap.containsKey(item.getGoodsId())) {
                 throw new RemoteServiceException("找不到商品信息:" + item.getGoodsName());
             }
+            if (item.getPrice().compareTo(BigDecimal.ZERO) <= 0) {
+                throw new RemoteServiceException(item.getGoodsName() + "售价不能为0");
+            }
             WebsitGoods goods = goodsMap.get(item.getGoodsId());
             item.setGoodsSalesUnit(goods.getGoodsSalesUnit())
                     .setGoodsStockUnit(goods.getGoodsStockUnit())