商品库存警戒线
This commit is contained in:
parent
43e832826b
commit
f72b7c3fa0
|
|
@ -444,7 +444,7 @@ public class OrderService {
|
|||
private void checkWarnLineAndSendMsg(TbProductSku productSku, TbProduct product, Integer shopId, Integer num) {
|
||||
log.info("下单,开始校验库存预警,商品信息:{}, {}, {}", product, productSku, num);
|
||||
|
||||
if (productSku.getWarnLine() == null) {
|
||||
if (product.getWarnLine() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -452,20 +452,18 @@ public class OrderService {
|
|||
return;
|
||||
}
|
||||
|
||||
if (productSku.getStockNumber() == null) {
|
||||
productSku.setStockNumber((double) 0);
|
||||
}
|
||||
|
||||
if (product.getStockNumber() == null) {
|
||||
product.setStockNumber(0);
|
||||
}
|
||||
if (
|
||||
(product.getIsDistribute() == 1 && product.getStockNumber() - num <= productSku.getWarnLine())
|
||||
|| (product.getIsDistribute() != 1) && productSku.getStockNumber() - num <= productSku.getWarnLine()
|
||||
(product.getIsDistribute() == 1 && product.getStockNumber() - num <= product.getWarnLine())
|
||||
|| (product.getIsDistribute() != 1) && productSku.getStockNumber() - num <= product.getWarnLine()
|
||||
) {
|
||||
List<TbShopOpenId> shopOpenIds = shopOpenIdMapper.selectStateByShopIdAndType(product.getShopId(), ShopWxMsgTypeEnum.STOCK_MSG.getType());
|
||||
shopOpenIds.forEach(item -> wxAccountUtil.sendStockWarnMsg("商品库存不足", product.getName(),
|
||||
product.getIsDistribute() == 1 ? product.getStockNumber() - num : (int) (productSku.getStockNumber() - num), item.getOpenId(), ShopWxMsgTypeEnum.STOCK_MSG, shopId));
|
||||
shopOpenIds.forEach(item -> {
|
||||
wxAccountUtil.sendStockWarnMsg("商品库存不足", product.getName(),
|
||||
product.getStockNumber() - num , item.getOpenId(), ShopWxMsgTypeEnum.STOCK_MSG, shopId);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue