| @@ -75,6 +75,9 @@ public class WxMsgServiceImpl implements WxMsgService { | |||||
| @Autowired | @Autowired | ||||
| WxAppinfoService wxAppinfoService; | WxAppinfoService wxAppinfoService; | ||||
| @Autowired | |||||
| WxCUserService wxCUserService; | |||||
| @Override | @Override | ||||
| public PageInfo<WxMsg> listAsPage(WxMsg record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxMsg> listAsPage(WxMsg record, Integer pageIndex, Integer pageSize) { | ||||
| PageHelper.startPage(pageIndex, pageSize); | PageHelper.startPage(pageIndex, pageSize); | ||||
| @@ -371,6 +374,10 @@ public class WxMsgServiceImpl implements WxMsgService { | |||||
| smartAppMsg.setAppId(cAppInfo.getAppId()); | smartAppMsg.setAppId(cAppInfo.getAppId()); | ||||
| WxTemplateMsg wxTemplateMsg = wxTemplateMsgMapper.selectById(wxMsg.getModelId()); | WxTemplateMsg wxTemplateMsg = wxTemplateMsgMapper.selectById(wxMsg.getModelId()); | ||||
| // if(1 == wxTemplateMsg.getOnOff().intValue()){ | |||||
| // logger.error("订阅消息模板关闭。"); | |||||
| // return; | |||||
| // } | |||||
| smartAppMsg.setTemplateType(wxTemplateMsg.getType()); | smartAppMsg.setTemplateType(wxTemplateMsg.getType()); | ||||
| JSONObject customParam = JSON.parseObject(wxMsg.getMsg()); | JSONObject customParam = JSON.parseObject(wxMsg.getMsg()); | ||||
| @@ -415,13 +422,23 @@ public class WxMsgServiceImpl implements WxMsgService { | |||||
| }else{ | }else{ | ||||
| WxCUser wxCUserQ = new WxCUser(); | WxCUser wxCUserQ = new WxCUser(); | ||||
| wxCUserQ.updateTenantInfo(tenantEntity); | wxCUserQ.updateTenantInfo(tenantEntity); | ||||
| List<WxCUser> list = wxCUserMapper.findList(wxCUserQ); | |||||
| wxMsg.setExpectSendNumber(list.size()); | |||||
| for (WxCUser u:list) { | |||||
| PageInfo<WxCUser> wxCUserPageInfo = wxCUserService.listAsPage(wxCUserQ, 1, 1000); | |||||
| // List<WxCUser> list = wxCUserService.findList(wxCUserQ); | |||||
| wxMsg.setExpectSendNumber((int) wxCUserPageInfo.getTotal()); | |||||
| for (WxCUser u:wxCUserPageInfo.getList()) { | |||||
| smartAppMsg.setTo(u.getOpenId()); | smartAppMsg.setTo(u.getOpenId()); | ||||
| mqBaseProducer.sendMessage(smartAppMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | mqBaseProducer.sendMessage(smartAppMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | ||||
| } | } | ||||
| if(wxCUserPageInfo.getPages() > 1){ | |||||
| for(int i=2;i<=wxCUserPageInfo.getPages();i++){ | |||||
| wxCUserPageInfo = wxCUserService.listAsPage(wxCUserQ, i, 1000); | |||||
| for (WxCUser u:wxCUserPageInfo.getList()) { | |||||
| smartAppMsg.setTo(u.getOpenId()); | |||||
| mqBaseProducer.sendMessage(smartAppMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | } | ||||
| } | } | ||||