|
@@ -16,29 +16,25 @@ public class SendWeChatHandle {
|
|
@Autowired
|
|
@Autowired
|
|
MailLogMapper mailLogMapper;
|
|
MailLogMapper mailLogMapper;
|
|
|
|
|
|
- public boolean SendWeChatByMail(String mail,String message){
|
|
|
|
- boolean result=true;
|
|
|
|
|
|
+ public void sendWeChatByMail(String mail,String message){
|
|
String weChatId=mailLogMapper.getWeChatByMail(mail);
|
|
String weChatId=mailLogMapper.getWeChatByMail(mail);
|
|
if(weChatId.isEmpty()){
|
|
if(weChatId.isEmpty()){
|
|
log.error(String.format("mail's WeChat not found. mail =%s", mail));
|
|
log.error(String.format("mail's WeChat not found. mail =%s", mail));
|
|
//TODO 通知管理员添加邮箱
|
|
//TODO 通知管理员添加邮箱
|
|
- result=false;
|
|
|
|
}else{
|
|
}else{
|
|
CorpWexinUtils.sendMessageByWeChatId(weChatId,message);
|
|
CorpWexinUtils.sendMessageByWeChatId(weChatId,message);
|
|
}
|
|
}
|
|
- return result;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- public void SendWeChatByMails(String mails,String message){
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 发送多人,邮箱逗号隔开
|
|
|
|
+ * @param mails
|
|
|
|
+ * @param message
|
|
|
|
+ */
|
|
|
|
+ public void sendWeChatByMails(String mails,String message){
|
|
List<String> mail= Arrays.asList(mails.split(","));
|
|
List<String> mail= Arrays.asList(mails.split(","));
|
|
mail.forEach(m->{
|
|
mail.forEach(m->{
|
|
- String weChatId=mailLogMapper.getWeChatByMail(m);
|
|
|
|
- if(weChatId.isEmpty()){
|
|
|
|
- log.error(String.format("mail's WeChat not found. mail =%s", m));
|
|
|
|
- //TODO 通知管理员添加邮箱
|
|
|
|
- }else{
|
|
|
|
- CorpWexinUtils.sendMessageByWeChatId(weChatId,message);
|
|
|
|
- }
|
|
|
|
|
|
+ this.sendWeChatByMail(m,message);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|