This commit is contained in:
2025-09-02 20:09:37 +08:00
parent feca192f53
commit a59acb0903
21 changed files with 140 additions and 50 deletions

View File

@@ -1,5 +1,6 @@
package com.ai.da.common.utils;
import com.ai.da.common.constant.CommonConstant;
import com.ai.da.model.dto.BasicEmailParamDTO;
import com.alibaba.fastjson.JSONObject;
import com.sun.mail.smtp.SMTPTransport;
@@ -132,7 +133,8 @@ public class MailUtil {
*/
public BasicEmailParamDTO setBasicEmailParams(List<String> mailTo, JSONObject jsonObject, String templatePath, String title) throws AddressException {
BasicEmailParamDTO basicEmailParamDTO = new BasicEmailParamDTO();
basicEmailParamDTO.setSenderUserMail("info@aida.com.hk");
// basicEmailParamDTO.setSenderUserMail("info@aida.com.hk");
basicEmailParamDTO.setSenderUserMail(CommonConstant.senderEmail);
basicEmailParamDTO.setMailTo(getInternetAddressList(mailTo));
basicEmailParamDTO.setSubject(title);
// todo 邮件模板不存在的报错与重试机制

View File

@@ -372,9 +372,11 @@ public class SendEmailUtil {
return jsonObject.toJSONString();
}
private final static Long UPGRADE_NOTIFICATION_ID = 118855L;
private final static Long UPGRADE_NOTIFICATION_ID = 146605L;
// private final static Long UPGRADE_NOTIFICATION_ID = 146551L;
private final static Long UPGRADE_SUCCESS_NOTIFICATION_ID = 118856L;
private final static Long UPGRADE_NOTIFICATION_ID_CHINESE = 122898L;
private final static Long UPGRADE_NOTIFICATION_ID_CHINESE = 146604L;
// private final static Long UPGRADE_NOTIFICATION_ID_CHINESE = 146552L;
private final static Long UPGRADE_SUCCESS_NOTIFICATION_ID_CHINESE = 122899L;
public static void sendUpgradeNotification(Account account, String senderAddress, Integer type) {
@@ -396,20 +398,20 @@ public class SendEmailUtil {
// 根据邮件类型设置不同的主题和模板
String subject = "";
Template template = new Template();
// if (type == 1) {
// subject = "Upcoming System Upgrade for AiDA 3.0";
// template.setTemplateID(UPGRADE_NOTIFICATION_ID);
// }else {
// subject = "即将到来的AiDA 3.0系统升级";
// template.setTemplateID(UPGRADE_NOTIFICATION_ID_CHINESE);
// }
if (type == 1) {
subject = "Successful System Upgrade and New Features in AiDA 3.0";
template.setTemplateID(UPGRADE_SUCCESS_NOTIFICATION_ID);
subject = "AiDA 3.1.0 System Maintenance Announcement";
template.setTemplateID(UPGRADE_NOTIFICATION_ID);
}else {
subject = "系统升级成功和AiDA 3.0新功能";
template.setTemplateID(UPGRADE_SUCCESS_NOTIFICATION_ID_CHINESE);
subject = "AiDA 3.1.0 系统维护公告";
template.setTemplateID(UPGRADE_NOTIFICATION_ID_CHINESE);
}
// if (type == 1) {
// subject = "Successful System Upgrade and New Features in AiDA 3.0";
// template.setTemplateID(UPGRADE_SUCCESS_NOTIFICATION_ID);
// }else {
// subject = "系统升级成功和AiDA 3.0新功能";
// template.setTemplateID(UPGRADE_SUCCESS_NOTIFICATION_ID_CHINESE);
// }
template.setTemplateData(buildAccountData(account));
req.setSubject(subject);
@@ -417,8 +419,8 @@ public class SendEmailUtil {
// 发送邮件
SendEmailResponse resp = client.SendEmail(req);
log.info(senderAddress);
log.info("短信发送结果res###{}", SendEmailResponse.toJsonString(resp));
// log.info(senderAddress);
// log.info("短信发送结果res###{}", SendEmailResponse.toJsonString(resp));
} catch (TencentCloudSDKException e) {
log.info(senderAddress);
log.info("邮件发送失败###{}", e.toString());
@@ -764,7 +766,7 @@ public class SendEmailUtil {
try {
String merchantEmail = "kimwong@code-create.com.hk";
String developer = "xupei3360@163.com";
String[] receiverEmail = {/*merchantEmail,*/ developer};
String[] receiverEmail = {merchantEmail, developer};
Credential cred = new Credential(SECRET_ID, SECRET_KEy);
// 实例化一个http选项可选的没有特殊需求可以跳过
HttpProfile httpProfile = new HttpProfile();
@@ -934,7 +936,7 @@ public class SendEmailUtil {
req.setFromEmailAddress(SEND_ADDRESS);
String merchantEmail = "kimwong@code-create.com.hk";
String developerEmail = "xupei@code-create.com.hk";
req.setDestination(new String[]{/*merchantEmail,*/ developerEmail});
req.setDestination(new String[]{merchantEmail, developerEmail});
Template template = new Template();
req.setSubject("New Credit Purchase Order");
template.setTemplateID(CREDITS_PURCHASE_MERCHANT);