diff --git a/src/main/java/com/ai/da/common/config/MyTaskScheduler.java b/src/main/java/com/ai/da/common/config/MyTaskScheduler.java index f505796e..6e443ba9 100644 --- a/src/main/java/com/ai/da/common/config/MyTaskScheduler.java +++ b/src/main/java/com/ai/da/common/config/MyTaskScheduler.java @@ -127,6 +127,11 @@ public class MyTaskScheduler { } catch (IOException e) { e.printStackTrace(); } + }else { + SendEmailUtil.sendNoExcelEmail("1023316923@qq.com", null); + SendEmailUtil.sendNoExcelEmail("calvinwong@aidlab.hk", null); + SendEmailUtil.sendNoExcelEmail("kaicpang.pang@connect.polyu.hk", null); + SendEmailUtil.sendNoExcelEmail("kimwong@code-create.com.hk", null); } } } diff --git a/src/main/java/com/ai/da/common/utils/SendEmailUtil.java b/src/main/java/com/ai/da/common/utils/SendEmailUtil.java index 6653c7da..73c4eb17 100644 --- a/src/main/java/com/ai/da/common/utils/SendEmailUtil.java +++ b/src/main/java/com/ai/da/common/utils/SendEmailUtil.java @@ -134,6 +134,8 @@ public class SendEmailUtil { private final static Long NOTIFICATION_TEMPLATE_ID = 117216L; private final static Long NOTIFICATION_CHINESE_TEMPLATE_ID = 122229L; private final static Long TRIAL_ORDER_LIST_ID = 122273L; + private final static Long NO_TRIAL_ORDER_LIST_ID = 122591L; + public static void sendCustomEmail(String receiverAddress, String senderAddress, TrialOrder trialOrder, int emailType, String country) { try { // 实例化一个认证对象 @@ -227,6 +229,40 @@ public class SendEmailUtil { throw new BusinessException("failed.to.send.mail"); } } + + + public static void sendNoExcelEmail(String receiverAddress, String senderAddress) { + try { + // 实例化一个认证对象 + Credential cred = new Credential(SECRET_ID, SECRET_KEy); + HttpProfile httpProfile = new HttpProfile(); + httpProfile.setEndpoint("ses.tencentcloudapi.com"); + ClientProfile clientProfile = new ClientProfile(); + clientProfile.setHttpProfile(httpProfile); + SesClient client = new SesClient(cred, "ap-hongkong", clientProfile); + SendEmailRequest req = new SendEmailRequest(); + if (StringUtils.isEmpty(senderAddress)) { + senderAddress = SEND_ADDRESS; + } + req.setFromEmailAddress(senderAddress); + req.setDestination(new String[]{receiverAddress}); + + // 根据邮件类型设置不同的主题和模板 + String subject = ""; + Template template = new Template(); + subject = "昨日试用订单数据"; + template.setTemplateID(NO_TRIAL_ORDER_LIST_ID); + + req.setSubject(subject); + req.setTemplate(template); + // 发送邮件 + SendEmailResponse resp = client.SendEmail(req); + log.info("短信发送结果res###{}", SendEmailResponse.toJsonString(resp)); + } catch (TencentCloudSDKException e) { + log.info("邮件发送失败###{}", e.toString()); + throw new BusinessException("failed.to.send.mail"); + } + } private final static Long WILLBEEXPIRED_TEMPLATE_ID = 118178L; public static void sendWillBeExpiredEmail(Account account, String senderAddress) { try {