add 用户增加邮箱密码字段,发送邮箱改为查询发件人的邮箱,没有邮箱或邮箱密码时,默认使用admin的邮箱

This commit is contained in:
lijiarao
2021-09-27 15:48:46 +08:00
parent 90aa46c375
commit a30b5b0d75
8 changed files with 98 additions and 25 deletions
@@ -9,6 +9,8 @@ import com.jero.common.enums.MessageUrlEnums;
import com.jero.common.exception.JeroBootException;
import com.jero.common.service.SendMessageService;
import com.jero.common.system.api.ISysBaseAPI;
import com.jero.common.system.vo.LoginUser;
import com.jero.common.util.PasswordUtil;
import com.jero.common.util.oConvertUtils;
import com.jero.modules.message.entity.SysMessageTemplate;
import com.jero.modules.message.handle.impl.EmailSendMsgHandle;
@@ -83,9 +85,21 @@ public class SendMessageServiceImpl implements SendMessageService {
// 1短信 2邮件 3系统
// 发送邮件 true
if(templateType.contains(ProjectCommon.MESSAGE_TYPE2) && !StringUtils.isEmpty(sendMessageDTO.getEmail())){
String fromUser = sendMessageDTO.getFromUser();
LoginUser loginUser = sysBaseAPI.getUserByName(fromUser);
if(templateType.contains(ProjectCommon.MESSAGE_TYPE2) && Objects.nonNull(loginUser)){
try {
EmailSendMsgHandle emailHandle = new EmailSendMsgHandle();
String email = loginUser.getEmail();
String emailPassword = loginUser.getEmailPassword();
//如果发件人没有邮箱或邮箱密码则使用admin账户的邮箱密码
if (StringUtils.isBlank(email) || StringUtils.isBlank(emailPassword)) {
loginUser = sysBaseAPI.getUserByName("admin");
email = loginUser.getEmail();
emailPassword = loginUser.getEmailPassword();
}
email = PasswordUtil.decrypt(email);
emailPassword = PasswordUtil.decrypt(emailPassword);
EmailSendMsgHandle emailHandle = new EmailSendMsgHandle(email,emailPassword);
// 发送带附件邮箱
if(!CollectionUtils.isEmpty(sendMessageDTO.getListFile())){
emailHandle.SendMsgAndFile(sendMessageDTO.getEmail(), title, content,sendMessageDTO.getListFile());
@@ -99,7 +113,6 @@ public class SendMessageServiceImpl implements SendMessageService {
// 发送消息
if(templateType.contains(ProjectCommon.MESSAGE_TYPE3) && !StringUtils.isEmpty(sendMessageDTO.getToUser())){
try {
String fromUser = sendMessageDTO.getFromUser();
String toUser = sendMessageDTO.getToUser();
String busId = sendMessageDTO.getBusId();
String busType = sendMessageDTO.getBusType();
@@ -590,6 +590,13 @@ public class PayMeetingSituationServiceImpl extends ServiceImpl<PayMeetingSituat
}
saveOrUpdate(payMeetingSituation1);
//判断凭证是否修改
String paymentRecord = oldObject.getPaymentRecord();
String paymentRecord1 = payMeetingSituation1.getPaymentRecord();
if (Objects.equals(paymentRecord,paymentRecord1)){
//上传付款凭证发送邮件提醒审批
SendPaymentRecordMessage(payMeetingSituation1, payMeeting);
}
}
/**