Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
@@ -134,6 +134,8 @@ public class TbProduct implements Serializable {
|
||||
|
||||
private Integer stockNumber;
|
||||
|
||||
private Integer warnLine = 0;
|
||||
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private int orderCount;
|
||||
@@ -150,5 +152,4 @@ public class TbProduct implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -35,8 +35,6 @@ public class TbProductSku implements Serializable {
|
||||
|
||||
private String coverImg;
|
||||
|
||||
private Integer warnLine;
|
||||
|
||||
private Double weight;
|
||||
|
||||
private Float volume;
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user