Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -49,6 +49,8 @@ public class ConsMsgConsumer {
|
||||
|
||||
private final WxAccountUtil wxAccountUtil;
|
||||
|
||||
private final TbShopOpenIdMapper shopOpenIdMapper;
|
||||
|
||||
|
||||
@Autowired
|
||||
RedisUtil redisUtil;
|
||||
@@ -64,8 +66,9 @@ public class ConsMsgConsumer {
|
||||
@Value("${subscribe.message.miniprogramState}")
|
||||
private String miniprogramState;
|
||||
|
||||
public ConsMsgConsumer(WxAccountUtil wxAccountUtil) {
|
||||
public ConsMsgConsumer(WxAccountUtil wxAccountUtil, TbShopOpenIdMapper shopOpenIdMapper) {
|
||||
this.wxAccountUtil = wxAccountUtil;
|
||||
this.shopOpenIdMapper = shopOpenIdMapper;
|
||||
}
|
||||
|
||||
|
||||
@@ -117,10 +120,10 @@ public class ConsMsgConsumer {
|
||||
}
|
||||
|
||||
log.info("耗材名称: {}, conwarning:{},stockNumber:{}",tbConsInfo.getConName(),
|
||||
tbConsInfo.getConWarning(),tbConsInfo.getStockNumber().subtract(tbConsInfo.getStockConsume().abs()));
|
||||
if (N.egt(tbConsInfo.getConWarning(), tbConsInfo.getStockNumber().subtract(tbConsInfo.getStockConsume().abs()))) {
|
||||
|
||||
List<TbUserShopMsg> tbUserShopMsgs = tbUserShopMsgMapper.selectAllByShopId(tbConsInfo.getShopId());
|
||||
tbConsInfo.getConWarning(),tbConsInfo.getStockNumber().subtract(tbConsInfo.getStockConsume()));
|
||||
if (N.egt(tbConsInfo.getConWarning(), tbConsInfo.getStockNumber().subtract(tbConsInfo.getStockConsume()))) {
|
||||
List<TbUserShopMsg> tbUserShopMsgs = tbUserShopMsgMapper.selectAllByShopId(tbConsInfo.getShopId());
|
||||
log.info("待推送openId列表: {}", tbUserShopMsgs);
|
||||
if (Objects.nonNull(tbUserShopMsgs) && tbUserShopMsgs.size()>0) {
|
||||
tbUserShopMsgs.parallelStream().forEach(tbUserShopMsg->{
|
||||
String key=RedisCst.ORDER_MESSAGE.concat(tbConsInfo.getShopId().toString()).concat("#").concat(tbConsInfo.getId().toString()).concat("#").concat(tbUserShopMsg.getOpenId());
|
||||
@@ -129,7 +132,7 @@ public class ConsMsgConsumer {
|
||||
log.info("开始推送耗材模板消息,rediskey:{}", value);
|
||||
if (Objects.isNull(value)) {
|
||||
JSONObject jsonObject = wxAccountUtil.sendStockWarnMsg("耗材库存不足", tbConsInfo.getConName(),
|
||||
tbConsInfo.getStockNumber().subtract(tbConsInfo.getStockConsume().abs()).toBigInteger().intValue(), tbUserShopMsg.getOpenId());
|
||||
tbConsInfo.getStockNumber().subtract(tbConsInfo.getStockConsume()).toBigInteger().intValue(), tbUserShopMsg.getOpenId());
|
||||
if (jsonObject != null) {
|
||||
log.info("写入redis:{}",key);
|
||||
redisUtil.saveMessage(key, "1", 30 * 60);
|
||||
|
||||
Reference in New Issue
Block a user