| @@ -59,4 +59,10 @@ public class BaseMsg extends BaseEntity { | |||||
| setTenantId(tenantEntity.getTenantId()); | setTenantId(tenantEntity.getTenantId()); | ||||
| } | } | ||||
| public TenantEntity getTenantInfo() { | |||||
| return new TenantEntity() {{ | |||||
| setTenantId(tenantId); | |||||
| }}; | |||||
| } | |||||
| } | } | ||||
| @@ -82,4 +82,10 @@ public class WxMsg extends BaseMsg { | |||||
| public void updateTenantInfo(TenantEntity tenantEntity) { | public void updateTenantInfo(TenantEntity tenantEntity) { | ||||
| setTenantId(tenantEntity.getTenantId()); | setTenantId(tenantEntity.getTenantId()); | ||||
| } | } | ||||
| public TenantEntity getTenantInfo() { | |||||
| return new TenantEntity() {{ | |||||
| setTenantId(tenantId); | |||||
| }}; | |||||
| } | |||||
| } | } | ||||
| @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; | |||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.po.msg.BaseMsg; | import com.iformall.domain.po.msg.BaseMsg; | ||||
| import com.iformall.domain.po.msg.WxMsg; | import com.iformall.domain.po.msg.WxMsg; | ||||
| import com.iformall.enums.EnumMsgSendStatus; | import com.iformall.enums.EnumMsgSendStatus; | ||||
| @@ -53,10 +54,12 @@ public class SendCallBackSmsServiceImpl implements MsgSendService { | |||||
| public void send(BaseMsg baseMsg) throws Exception{ | public void send(BaseMsg baseMsg) throws Exception{ | ||||
| WxMsg record = (WxMsg)baseMsg; | WxMsg record = (WxMsg)baseMsg; | ||||
| TenantEntity tenantEntity = record.getTenantInfo(); | |||||
| WxMsgConfig wxMsgConfig = record.getWxMsgConfig(); | WxMsgConfig wxMsgConfig = record.getWxMsgConfig(); | ||||
| if(wxMsgConfig == null){ | if(wxMsgConfig == null){ | ||||
| wxMsgConfig = new WxMsgConfig(); | wxMsgConfig = new WxMsgConfig(); | ||||
| wxMsgConfig.setTenantId(record.getTenantId()); | |||||
| wxMsgConfig.updateTenantInfo(tenantEntity); | |||||
| List<WxMsgConfig> wxMsgConfigs = wxMsgConfigMapper.findList(wxMsgConfig); | List<WxMsgConfig> wxMsgConfigs = wxMsgConfigMapper.findList(wxMsgConfig); | ||||
| if (wxMsgConfigs.size() == 0) { | if (wxMsgConfigs.size() == 0) { | ||||
| throw new MallinkException(ErrorCode.MSG_CONFIG_NOT_FOUND); | throw new MallinkException(ErrorCode.MSG_CONFIG_NOT_FOUND); | ||||
| @@ -1,6 +1,7 @@ | |||||
| package com.iformall.service.msg.impl; | package com.iformall.service.msg.impl; | ||||
| import com.iformall.domain.po.WxMsgValidationcodeModel; | import com.iformall.domain.po.WxMsgValidationcodeModel; | ||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.po.msg.BaseMsg; | import com.iformall.domain.po.msg.BaseMsg; | ||||
| import com.iformall.domain.po.msg.MailMsg; | import com.iformall.domain.po.msg.MailMsg; | ||||
| import com.iformall.enums.EnumMsgOpen; | import com.iformall.enums.EnumMsgOpen; | ||||
| @@ -9,6 +10,7 @@ import com.iformall.mapper.WxMsgValidationcodeModelMapper; | |||||
| import com.iformall.service.msg.MsgSendService; | import com.iformall.service.msg.MsgSendService; | ||||
| import org.apache.commons.collections.CollectionUtils; | import org.apache.commons.collections.CollectionUtils; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.flowable.task.service.impl.persistence.entity.TaskEntity; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -44,10 +46,12 @@ public class SendEmailServiceImpl implements MsgSendService { | |||||
| @Override | @Override | ||||
| public void send(BaseMsg baseMsg) throws Exception{ | public void send(BaseMsg baseMsg) throws Exception{ | ||||
| MailMsg mailMsg = (MailMsg)baseMsg; | MailMsg mailMsg = (MailMsg)baseMsg; | ||||
| TenantEntity tenantEntity = mailMsg.getTenantInfo(); | |||||
| //根据模板替换动态内容 | //根据模板替换动态内容 | ||||
| if(mailMsg.getModelId() != null){ | if(mailMsg.getModelId() != null){ | ||||
| WxMsgValidationcodeModel msgModel = new WxMsgValidationcodeModel(); | WxMsgValidationcodeModel msgModel = new WxMsgValidationcodeModel(); | ||||
| msgModel.setTenantId(mailMsg.getTenantId()); | |||||
| msgModel.updateTenantInfo(tenantEntity); | |||||
| msgModel.setType(mailMsg.getModelType()); | msgModel.setType(mailMsg.getModelType()); | ||||
| msgModel.setModelId(mailMsg.getModelId()); | msgModel.setModelId(mailMsg.getModelId()); | ||||
| msgModel.setOpen(EnumMsgOpen.OPEN.getCode()); | msgModel.setOpen(EnumMsgOpen.OPEN.getCode()); | ||||
| @@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray; | |||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||
| import com.iformall.domain.po.WxTemplateMsg; | import com.iformall.domain.po.WxTemplateMsg; | ||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.po.msg.BaseMsg; | import com.iformall.domain.po.msg.BaseMsg; | ||||
| import com.iformall.domain.po.msg.MpAppMsg; | import com.iformall.domain.po.msg.MpAppMsg; | ||||
| import com.iformall.mapper.WxTemplateMsgMapper; | import com.iformall.mapper.WxTemplateMsgMapper; | ||||
| @@ -40,11 +41,13 @@ public class SendMpMsgServiceImpl implements MsgSendService { | |||||
| MpAppMsg mpAppMsg = (MpAppMsg)baseMsg; | MpAppMsg mpAppMsg = (MpAppMsg)baseMsg; | ||||
| WxTemplateMsg msg = null; | WxTemplateMsg msg = null; | ||||
| TenantEntity tenantEntity = mpAppMsg.getTenantInfo(); | |||||
| WxMpService wxMpService = openService.getWxOpenComponentService().getWxMpServiceByAppid(mpAppMsg.getAppId()); | WxMpService wxMpService = openService.getWxOpenComponentService().getWxMpServiceByAppid(mpAppMsg.getAppId()); | ||||
| // 查询信息模板 | // 查询信息模板 | ||||
| WxTemplateMsg msgQ = new WxTemplateMsg(); | WxTemplateMsg msgQ = new WxTemplateMsg(); | ||||
| msgQ.setTenantId(mpAppMsg.getTenantId()); | |||||
| msgQ.updateTenantInfo(tenantEntity); | |||||
| msgQ.setType(mpAppMsg.getTemplateType()); | msgQ.setType(mpAppMsg.getTemplateType()); | ||||
| try { | try { | ||||
| msg = wxTemplateMsgMapper.selectOne(new QueryWrapper(msgQ)); | msg = wxTemplateMsgMapper.selectOne(new QueryWrapper(msgQ)); | ||||
| @@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSONObject; | |||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||
| import com.iformall.domain.po.WxAppinfo; | import com.iformall.domain.po.WxAppinfo; | ||||
| import com.iformall.domain.po.WxTemplateMsg; | import com.iformall.domain.po.WxTemplateMsg; | ||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.po.msg.BaseMsg; | import com.iformall.domain.po.msg.BaseMsg; | ||||
| import com.iformall.domain.po.msg.SmartAppMsg; | import com.iformall.domain.po.msg.SmartAppMsg; | ||||
| import com.iformall.mapper.WxTemplateMsgMapper; | import com.iformall.mapper.WxTemplateMsgMapper; | ||||
| @@ -45,6 +46,9 @@ public class SendSmartAppMsgServiceImpl implements MsgSendService { | |||||
| @Override | @Override | ||||
| public void send(BaseMsg baseMsg) throws Exception{ | public void send(BaseMsg baseMsg) throws Exception{ | ||||
| SmartAppMsg smartAppMsg = (SmartAppMsg)baseMsg; | SmartAppMsg smartAppMsg = (SmartAppMsg)baseMsg; | ||||
| TenantEntity tenantEntity = smartAppMsg.getTenantInfo(); | |||||
| WxTemplateMsg msg = null; | WxTemplateMsg msg = null; | ||||
| WxMaTemplateMessage templateMessage; | WxMaTemplateMessage templateMessage; | ||||
| @@ -58,7 +62,7 @@ public class SendSmartAppMsgServiceImpl implements MsgSendService { | |||||
| //查询信息模板 | //查询信息模板 | ||||
| WxTemplateMsg msgQ = new WxTemplateMsg(); | WxTemplateMsg msgQ = new WxTemplateMsg(); | ||||
| msgQ.setTenantId(smartAppMsg.getTenantId()); | |||||
| msgQ.updateTenantInfo(tenantEntity); | |||||
| msgQ.setType(smartAppMsg.getTemplateType()); | msgQ.setType(smartAppMsg.getTemplateType()); | ||||
| List<WxTemplateMsg> list = wxTemplateMsgMapper.selectList(new QueryWrapper(msgQ)); | List<WxTemplateMsg> list = wxTemplateMsgMapper.selectList(new QueryWrapper(msgQ)); | ||||
| if (list.size() > 0) { | if (list.size() > 0) { | ||||
| @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; | |||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.po.msg.BaseMsg; | import com.iformall.domain.po.msg.BaseMsg; | ||||
| import com.iformall.domain.po.msg.WxMsgRecord; | import com.iformall.domain.po.msg.WxMsgRecord; | ||||
| import com.iformall.enums.EnumMsgOpen; | import com.iformall.enums.EnumMsgOpen; | ||||
| @@ -43,9 +44,10 @@ public class SendSmsServiceImpl implements MsgSendService { | |||||
| @Override | @Override | ||||
| public void send(BaseMsg baseMsg) throws Exception{ | public void send(BaseMsg baseMsg) throws Exception{ | ||||
| WxMsgRecord record = (WxMsgRecord)baseMsg; | WxMsgRecord record = (WxMsgRecord)baseMsg; | ||||
| TenantEntity tenantEntity = record.getTenantInfo(); | |||||
| WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); | WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode(); | ||||
| wxMsgValidationcode.setPhone(record.getReceiver()); | wxMsgValidationcode.setPhone(record.getReceiver()); | ||||
| wxMsgValidationcode.setTenantId(record.getTenantId()); | |||||
| wxMsgValidationcode.updateTenantInfo(tenantEntity); | |||||
| wxMsgValidationcode.setType(record.getModelType()); | wxMsgValidationcode.setType(record.getModelType()); | ||||
| //3、从短信配置中查询密钥 bid 等信息 | //3、从短信配置中查询密钥 bid 等信息 | ||||
| @@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSONArray; | |||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||
| import com.iformall.domain.po.WxTemplateMsg; | import com.iformall.domain.po.WxTemplateMsg; | ||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.po.msg.AppUniformMsg; | import com.iformall.domain.po.msg.AppUniformMsg; | ||||
| import com.iformall.domain.po.msg.BaseMsg; | import com.iformall.domain.po.msg.BaseMsg; | ||||
| import com.iformall.mapper.WxTemplateMsgMapper; | import com.iformall.mapper.WxTemplateMsgMapper; | ||||
| @@ -38,13 +39,15 @@ public class SendWeappUniformMsgServiceImpl implements MsgSendService { | |||||
| @Override | @Override | ||||
| public void send(BaseMsg baseMsg) throws Exception{ | public void send(BaseMsg baseMsg) throws Exception{ | ||||
| AppUniformMsg appUniformMsg = (AppUniformMsg)baseMsg; | AppUniformMsg appUniformMsg = (AppUniformMsg)baseMsg; | ||||
| TenantEntity tenantEntity = appUniformMsg.getTenantInfo(); | |||||
| WxTemplateMsg msg = null; | WxTemplateMsg msg = null; | ||||
| WxMaService wxMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appUniformMsg.getAppId()); | WxMaService wxMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appUniformMsg.getAppId()); | ||||
| // 查询信息模板 | // 查询信息模板 | ||||
| WxTemplateMsg msgQ = new WxTemplateMsg(); | WxTemplateMsg msgQ = new WxTemplateMsg(); | ||||
| msgQ.setTenantId(appUniformMsg.getTenantId()); | |||||
| msgQ.updateTenantInfo(tenantEntity); | |||||
| msgQ.setType(appUniformMsg.getTemplateType()); | msgQ.setType(appUniformMsg.getTemplateType()); | ||||
| try { | try { | ||||
| msg = wxTemplateMsgMapper.selectOne(new QueryWrapper(msgQ)); | msg = wxTemplateMsgMapper.selectOne(new QueryWrapper(msgQ)); | ||||