feat:领取商品增加是否上架和库存校验

This commit is contained in:
不睡觉的月亮 2025-12-11 17:47:49 +08:00
parent ad097d5c97
commit 906e8ee2e2

View File

@ -892,6 +892,16 @@ public class StorePinkServiceImpl extends ServiceImpl<StorePinkMapper, StorePink
if (ObjectUtil.isNull(storeProduct)) { if (ObjectUtil.isNull(storeProduct)) {
throw new YztException("商品不存在"); throw new YztException("商品不存在");
} }
// 校验商品是否上架
if (!storeProduct.getIsShow()) {
throw new YztException("商品已下架,无法领取");
}
// 校验商品库存
if (storeProduct.getStock() == null || storeProduct.getStock() < 1) {
throw new YztException("商品库存不足,无法领取");
}
// 生成订单号 // 生成订单号
String orderNo = YztUtil.getOrderNo("claim"); String orderNo = YztUtil.getOrderNo("claim");