1.模板消息负值不推送问题修复
This commit is contained in:
parent
14f9f36ef5
commit
839a7fe3a6
|
|
@ -129,7 +129,7 @@ public class ConsMsgConsumer {
|
||||||
log.info("开始推送耗材模板消息,rediskey:{}", value);
|
log.info("开始推送耗材模板消息,rediskey:{}", value);
|
||||||
if (Objects.isNull(value)) {
|
if (Objects.isNull(value)) {
|
||||||
JSONObject jsonObject = wxAccountUtil.sendStockWarnMsg("耗材库存不足", tbConsInfo.getConName(),
|
JSONObject jsonObject = wxAccountUtil.sendStockWarnMsg("耗材库存不足", tbConsInfo.getConName(),
|
||||||
tbConsInfo.getStockNumber().subtract(tbConsInfo.getStockConsume()).setScale(2, BigDecimal.ROUND_DOWN).toPlainString(), tbUserShopMsg.getOpenId());
|
tbConsInfo.getStockNumber().subtract(tbConsInfo.getStockConsume()).toBigInteger().intValue(), tbUserShopMsg.getOpenId());
|
||||||
if (jsonObject != null) {
|
if (jsonObject != null) {
|
||||||
log.info("写入redis:{}",key);
|
log.info("写入redis:{}",key);
|
||||||
redisUtil.saveMessage(key, "1", 10 * 60);
|
redisUtil.saveMessage(key, "1", 10 * 60);
|
||||||
|
|
|
||||||
|
|
@ -281,7 +281,7 @@ public class OrderService {
|
||||||
List<TbShopOpenId> shopOpenIds = shopOpenIdMapper.selectByShopId(Integer.valueOf(product.getShopId()));
|
List<TbShopOpenId> shopOpenIds = shopOpenIdMapper.selectByShopId(Integer.valueOf(product.getShopId()));
|
||||||
shopOpenIds.forEach(item -> {
|
shopOpenIds.forEach(item -> {
|
||||||
wxAccountUtil.sendStockWarnMsg("商品库存不足", product.getName(),
|
wxAccountUtil.sendStockWarnMsg("商品库存不足", product.getName(),
|
||||||
product.getIsDistribute() == 1 ? String.valueOf(product.getStockNumber()-num) : String.valueOf(productSku.getStockNumber() - num), item.getOpenId());
|
product.getIsDistribute() == 1 ? product.getStockNumber()-num : (int) (productSku.getStockNumber() - num), item.getOpenId());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,9 @@ public class WxAccountUtil {
|
||||||
throw new RuntimeException(linkedHashMap.getOrDefault(resObj.get("errcode") + "", "未知错误"));
|
throw new RuntimeException(linkedHashMap.getOrDefault(resObj.get("errcode") + "", "未知错误"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSONObject sendStockWarnMsg(String shopName, String productName, String stock, String toUserOpenId) {
|
public JSONObject sendStockWarnMsg(String shopName, String productName, Integer stock, String toUserOpenId) {
|
||||||
|
stock = stock < 0 ? 0 : stock;
|
||||||
|
Integer finalStock = stock;
|
||||||
Map<String, Object> data = new HashMap<String, Object>() {{
|
Map<String, Object> data = new HashMap<String, Object>() {{
|
||||||
put("thing22", new HashMap<String, Object>(){{
|
put("thing22", new HashMap<String, Object>(){{
|
||||||
put("value", shopName);
|
put("value", shopName);
|
||||||
|
|
@ -106,7 +108,7 @@ public class WxAccountUtil {
|
||||||
put("value", productName);
|
put("value", productName);
|
||||||
}});
|
}});
|
||||||
put("number5", new HashMap<String, Object>(){{
|
put("number5", new HashMap<String, Object>(){{
|
||||||
put("value", stock);
|
put("value", finalStock);
|
||||||
}});
|
}});
|
||||||
}};
|
}};
|
||||||
log.info("开始发送库存预警消息, 接收用户openId: {}, 消息数据: {}", toUserOpenId, data);
|
log.info("开始发送库存预警消息, 接收用户openId: {}, 消息数据: {}", toUserOpenId, data);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue