12345678910111213141516171819202122232425262728 |
- package cn.com.ctop.notice.handler;
- import cn.com.ctop.common.module.mapper.MailLogMapper;
- import cn.com.ctop.common.module.utils.CorpWexinUtils;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- @Slf4j
- @Service
- public class SendWeChatHandle {
- @Autowired
- MailLogMapper mailLogMapper;
- public boolean SendWeChatByMail(String mail,String message){
- boolean result=true;
- String weChatId=mailLogMapper.getWeChatByMail(mail);
- if(weChatId.isEmpty()){
- log.error(String.format("mail's WeChat not found. mail =%s", mail));
- //TODO 通知管理员添加邮箱
- result=false;
- }else{
- CorpWexinUtils.sendMessageByWeChatId(weChatId,message);
- }
- return result;
- }
- }
|