zelong.shao

task|邮件调整

Showing 29 changed files with 608 additions and 220 deletions
...@@ -10,8 +10,8 @@ import java.util.List; ...@@ -10,8 +10,8 @@ import java.util.List;
10 */ 10 */
11 public enum EmailTypeEnum { 11 public enum EmailTypeEnum {
12 PUSH_CON_FILE("emailType_01","Push Pre-Customs Clearance Files","推送预清关文件"), 12 PUSH_CON_FILE("emailType_01","Push Pre-Customs Clearance Files","推送预清关文件"),
13 - NOTIFICATION_SENDER("emailType_02","notificationSender","提醒发件人"), 13 + NOTIFICATION_SENDER("emailType_02","Remind Sender","提醒发件人"),
14 - SEND_FAILED_EMAIL("emailType_03","sendFailedEmail","错误邮件预警"), 14 + SEND_FAILED_EMAIL("emailType_03", "Error Email Alert","错误邮件预警"),
15 15
16 ; 16 ;
17 17
......
...@@ -29,7 +29,7 @@ public class ClearanceEmailTemplate implements EmailTemplate { ...@@ -29,7 +29,7 @@ public class ClearanceEmailTemplate implements EmailTemplate {
29 } 29 }
30 30
31 interface CLEARANCE_TITLE{ 31 interface CLEARANCE_TITLE{
32 - String TITLE = ""; 32 + String TITLE = "Push Pre-Customs Clearance Files";
33 } 33 }
34 34
35 interface CLEARANCE_BODY{ 35 interface CLEARANCE_BODY{
......
1 +package com.fedex.connect.common.dependencies.template.clearanceEmail;
2 +
3 +import org.springframework.stereotype.Component;
4 +
5 +import java.text.MessageFormat;
6 +@Component
7 +public class DuplicateEmailTemplate implements EmailTemplate {
8 + /**
9 + * 模板标题格式化返回内容
10 + */
11 + @Override
12 + public String getTitle(Object ... arguments) {
13 + return MessageFormat.format(DuplicateEmailTemplate.CLEARANCE_TITLE.TITLE,arguments);
14 + }
15 + /**
16 + * 邮件说明
17 + */
18 + @Override
19 + public String getDescription(Object... arguments) {
20 + return CLEARANCE_BODY.DESCRIPTION;
21 + }
22 + /**
23 + * 模板内容
24 + */
25 + @Override
26 + public String getBody(Object ... arguments) {
27 + return MessageFormat.format(DuplicateEmailTemplate.CLEARANCE_BODY.BODY,arguments);
28 + }
29 +
30 + interface CLEARANCE_TITLE{
31 + String TITLE = "Sender Reminder:";
32 + }
33 +
34 + interface CLEARANCE_BODY{
35 + String DESCRIPTION = "<p>Sender Reminder: The task will poll every {0} minutes after the system starts.</p>\n";
36 +
37 + String BODY = "<div><div style='margin-left:4%;'>" +
38 + "<p align='center'><img src='{0}'></p>" +
39 + "<p align='center'><img src='{1}'></p>" +
40 + "<p>Import Pre-Clearance System Notification:</p>" +
41 + "<p>&nbsp;&nbsp;&nbsp;&nbsp;{2}The consignment has been created and uploaded by another user.</p>" +
42 + "</font><br/><br/>";
43 + }
44 +}
...@@ -19,7 +19,7 @@ public class SendFailedEmailTemplate implements EmailTemplate { ...@@ -19,7 +19,7 @@ public class SendFailedEmailTemplate implements EmailTemplate {
19 */ 19 */
20 @Override 20 @Override
21 public String getBody(Object ... arguments) { 21 public String getBody(Object ... arguments) {
22 - return FAILED_EMAIL_BODY.TABLE; 22 + return MessageFormat.format(FAILED_EMAIL_BODY.TABLE,arguments);
23 } 23 }
24 24
25 /** 25 /**
...@@ -32,28 +32,28 @@ public class SendFailedEmailTemplate implements EmailTemplate { ...@@ -32,28 +32,28 @@ public class SendFailedEmailTemplate implements EmailTemplate {
32 32
33 33
34 interface FAILED_EMAIL_TITLE{ 34 interface FAILED_EMAIL_TITLE{
35 - String TITLE = "失败预警"; 35 + String TITLE = "Failure Alert";
36 } 36 }
37 37
38 interface FAILED_EMAIL_BODY{ 38 interface FAILED_EMAIL_BODY{
39 - String DESCRIPTION = "<p>1.【文件推送】任务,系统启动后每{0}分钟轮巡一次。</p>\n" + 39 + String DESCRIPTION = "<p>1.[File Push] Task: The system performs a polling every {0} minutes after startup.</p>\n" +
40 - " <p>2.【推送预清关文件】任务,系统启动后每{1}分钟轮巡一次。</p>\n" + 40 + " <p>2.[Push Pre-Clearance File] Task: The system performs a polling every {1} minutes after startup.</p>\n" +
41 - " <p>3.【提醒发件人】任务,系统启动后每{2}分钟轮巡一次。</p>\n" + 41 + " <p>3.[Remind Sender] Task: The system performs a polling every {2} minutes after startup.</p>\n" +
42 - " <p>备注:邮件发送机制:</p>\n" + 42 + " <p>Note: Email Sending Mechanism:</p>\n" +
43 - " <p>该预警邮件任务,系统启动后每{3}分钟执行一次,当日上述3个定时任务,有任何一个任务的最终判定为失败的记录数量大于{4},则自动发送邮件通知FedEX IT,每个接口显示最新{5}条失败运单号、当日调用总次数、当日调用失败总次数。</p>\n" + 43 + " <p>This alert email task is executed every {3} minutes after the system starts. If any of the three scheduled tasks mentioned above have a final determination of failed records exceeding {4} for the day, an email notification will be automatically sent to FedEx IT. Each interface will display the latest {5} failed tracking numbers, the total number of calls made during the day, and the total number of failed calls for the day.</p>\n" +
44 - " <p style=\"font-size:10px;\">(注:所有任务相关的数字均可以在系统配置界面调整)</p>"; 44 + " <p style=\"font-size:10px;\">(Note: All task-related numbers can be adjusted in the system configuration interface.)</p>";
45 45
46 String TABLE = "<table style=\"width: 100%;table-layout: fixed;padding: 20px;width: 100%;border-collapse: collapse;\">\n" + 46 String TABLE = "<table style=\"width: 100%;table-layout: fixed;padding: 20px;width: 100%;border-collapse: collapse;\">\n" +
47 "<tr>\n" + 47 "<tr>\n" +
48 "<td style=\"border: 0px;text-align: left;padding: 8px;\">\n" + 48 "<td style=\"border: 0px;text-align: left;padding: 8px;\">\n" +
49 "<div style=\"margin: auto;padding: 20px;\">\n" + 49 "<div style=\"margin: auto;padding: 20px;\">\n" +
50 - "<h2 style=\"text-align: center;\">接口调用失败详情</h2>\n" + 50 + "<h2 style=\"text-align: center;\">Task Push Failure Details</h2>\n" +
51 "<table style=\"width: 100%;border-collapse: collapse;\">\n" + 51 "<table style=\"width: 100%;border-collapse: collapse;\">\n" +
52 "<tr>\n" + 52 "<tr>\n" +
53 - "<th style=\"border: 1px solid #dddddd;text-align: left;padding: 8px;background-color: #593BB7;color: white;\">任务名称</th>\n" + 53 + "<th style=\"border: 1px solid #dddddd;text-align: left;padding: 8px;background-color: #593BB7;color: white;\">Task Name</th>\n" +
54 - "<th style=\"border: 1px solid #dddddd;text-align: left;padding: 8px;background-color: #593BB7;color: white;\">失败的运单号</th>\n" + 54 + "<th style=\"border: 1px solid #dddddd;text-align: left;padding: 8px;background-color: #593BB7;color: white;\">Failed Tracking Number</th>\n" +
55 - "<th style=\"border: 1px solid #dddddd;text-align: left;padding: 8px;background-color: #593BB7;color: white;\">总数</th>\n" + 55 + "<th style=\"border: 1px solid #dddddd;text-align: left;padding: 8px;background-color: #593BB7;color: white;\">Total Number</th>\n" +
56 - "<th style=\"border: 1px solid #dddddd;text-align: left;padding: 8px;background-color: #593BB7;color: white;\">失败数量</th>\n" + 56 + "<th style=\"border: 1px solid #dddddd;text-align: left;padding: 8px;background-color: #593BB7;color: white;\">Failure Count</th>\n" +
57 "</tr>\n" + 57 "</tr>\n" +
58 "{0}\n" + 58 "{0}\n" +
59 "</table>\n" + 59 "</table>\n" +
......
1 package com.fedex.connect.task.aspect; 1 package com.fedex.connect.task.aspect;
2 2
3 -import com.fedex.connect.common.dependencies.util.DateUtil;
4 import com.fedex.connect.common.model.sys.ParamConfig; 3 import com.fedex.connect.common.model.sys.ParamConfig;
5 import com.fedex.connect.task.annotation.ProcessingInterval; 4 import com.fedex.connect.task.annotation.ProcessingInterval;
6 import com.fedex.connect.task.repository.repo.sys.IParamConfigRepository; 5 import com.fedex.connect.task.repository.repo.sys.IParamConfigRepository;
...@@ -11,14 +10,11 @@ import org.aspectj.lang.annotation.Around; ...@@ -11,14 +10,11 @@ import org.aspectj.lang.annotation.Around;
11 import org.aspectj.lang.annotation.Aspect; 10 import org.aspectj.lang.annotation.Aspect;
12 import org.aspectj.lang.annotation.Pointcut; 11 import org.aspectj.lang.annotation.Pointcut;
13 import org.aspectj.lang.reflect.MethodSignature; 12 import org.aspectj.lang.reflect.MethodSignature;
14 -import org.slf4j.Logger;
15 -import org.slf4j.LoggerFactory;
16 import org.springframework.beans.factory.annotation.Autowired; 13 import org.springframework.beans.factory.annotation.Autowired;
17 import org.springframework.stereotype.Component; 14 import org.springframework.stereotype.Component;
18 import org.springframework.util.StringUtils; 15 import org.springframework.util.StringUtils;
19 16
20 import java.lang.reflect.Method; 17 import java.lang.reflect.Method;
21 -import java.time.temporal.ChronoUnit;
22 import java.util.Date; 18 import java.util.Date;
23 import java.util.Objects; 19 import java.util.Objects;
24 20
...@@ -44,7 +40,7 @@ public class ExecuteAspect { ...@@ -44,7 +40,7 @@ public class ExecuteAspect {
44 * @param pjp 40 * @param pjp
45 * @return 41 * @return
46 */ 42 */
47 - @Around(value = "executePointCut()") 43 + @Around(value = "@annotation(processingTime)")
48 public Object executeAround(ProceedingJoinPoint pjp, ProcessingInterval processingTime){ 44 public Object executeAround(ProceedingJoinPoint pjp, ProcessingInterval processingTime){
49 Object obj = null; 45 Object obj = null;
50 try { 46 try {
......
...@@ -20,4 +20,59 @@ public class PropertiesConfig { ...@@ -20,4 +20,59 @@ public class PropertiesConfig {
20 20
21 @Value("${rpc.url.rpcKafkaReceive2}") 21 @Value("${rpc.url.rpcKafkaReceive2}")
22 private String rpcKafkaReceive146; 22 private String rpcKafkaReceive146;
23 +
24 + /**
25 + * 发件人的邮箱的SMTP服务器地址
26 + */
27 + @Value("${export.mail.smtp.host}")
28 + private String host ;
29 +
30 + /**
31 + * auth 需要请求认证
32 + */
33 + @Value("${export.mail.needauth}")
34 + private String auth ;
35 +
36 + /**
37 + * 发送服务器的端口号
38 + * @return
39 + */
40 + @Value("${export.mail.smtp.port}")
41 + private String port;
42 +
43 + /**
44 + * 是否启用代理(uat,prod 在外网,需要使用代理)
45 + */
46 + @Value("${export.mail.proxy.startFlag}")
47 + private String proxyStartFlag;
48 +
49 + /**
50 + * 代理服务器地址
51 + */
52 + @Value("${export.mail.proxy.host}")
53 + private String proxyHost;
54 +
55 + /**
56 + * 代理服务器端口
57 + */
58 + @Value("${export.mail.proxy.port}")
59 + private String proxyPort;
60 +
61 + @Value("${export.mail.mailAccountFlag}")
62 + private String mailAccountFlag;
63 +
64 + @Value("${url.baseUrl}")
65 + String baseUrl;
66 +
67 + @Value("${url.fedex}")
68 + String fedex;
69 +
70 + @Value("${url.line}")
71 + String line;
72 +
73 + @Value("${export.mail.sendEmail.account}")
74 + String emailAccount;
75 +
76 + @Value("${export.mail.sendEmail.password}")
77 + String emailPassword;
23 } 78 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -6,4 +6,7 @@ import lombok.Data; ...@@ -6,4 +6,7 @@ import lombok.Data;
6 public class PortFileDto { 6 public class PortFileDto {
7 private String destIataCode; 7 private String destIataCode;
8 private String zipPath; 8 private String zipPath;
9 + private String shipperContactName;
10 + private String shipperEmail;
11 + private String shipperPhone;
9 } 12 }
......
...@@ -5,4 +5,7 @@ import lombok.Data; ...@@ -5,4 +5,7 @@ import lombok.Data;
5 public class PushZipEmailDto { 5 public class PushZipEmailDto {
6 private String destIataCode; 6 private String destIataCode;
7 private String filePath; 7 private String filePath;
8 + private String shipperContactName;
9 + private String shipperEmail;
10 + private String shipperPhone;
8 } 11 }
......
...@@ -25,11 +25,11 @@ public class EmailJob { ...@@ -25,11 +25,11 @@ public class EmailJob {
25 * @param 25 * @param
26 * @return void 26 * @return void
27 */ 27 */
28 - @ProcessingInterval(paramCode = ParamConfigConstants.TASK_PARAM_KEYS.NOTIFICATION_SENDER_EMAIL_INTERVAL) 28 + //@ProcessingInterval(paramCode = ParamConfigConstants.TASK_PARAM_KEYS.NOTIFICATION_SENDER_EMAIL_INTERVAL)
29 - @Scheduled(cron = "${export.task.allocation.sendOb}") 29 + //@Scheduled(cron = "${export.task.allocation.sendOb}")
30 - public void notificationSenderTask() { 30 + //public void notificationSenderTask() {
31 - duplicateConsignmentEmailService.duplicateConsignmentEmail(); 31 + // duplicateConsignmentEmailService.duplicateConsignmentEmail();
32 - } 32 + //}
33 33
34 /** 34 /**
35 * @Author Szl 35 * @Author Szl
...@@ -47,11 +47,11 @@ public class EmailJob { ...@@ -47,11 +47,11 @@ public class EmailJob {
47 /** 47 /**
48 * 发送失败邮件提醒 48 * 发送失败邮件提醒
49 */ 49 */
50 - @ProcessingInterval(paramCode = ParamConfigConstants.TASK_PARAM_KEYS.SEND_FAIL_ALERT_INTERVAL) 50 + //@ProcessingInterval(paramCode = ParamConfigConstants.TASK_PARAM_KEYS.SEND_FAIL_ALERT_INTERVAL)
51 - @Scheduled(cron = "${export.task.allocation.warningEmail}") 51 + //@Scheduled(cron = "${export.task.allocation.sendOb}")
52 - public void sendingFailedEmailAlert() { 52 + //public void sendingFailedEmailAlert() {
53 - sendWarningEmail.sendFailedEmail(); 53 + // sendWarningEmail.sendFailedEmail();
54 - } 54 + //}
55 55
56 56
57 } 57 }
......
...@@ -24,7 +24,7 @@ public class Imp001Job { ...@@ -24,7 +24,7 @@ public class Imp001Job {
24 @ProcessingInterval(paramCode = ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_INTERVAL) 24 @ProcessingInterval(paramCode = ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_INTERVAL)
25 @Scheduled(cron = "${export.task.allocation.sendOb}") 25 @Scheduled(cron = "${export.task.allocation.sendOb}")
26 public void sendObTask() { 26 public void sendObTask() {
27 - sendObService.sendOb(); 27 + //sendObService.sendOb();
28 } 28 }
29 29
30 /** 30 /**
...@@ -33,6 +33,6 @@ public class Imp001Job { ...@@ -33,6 +33,6 @@ public class Imp001Job {
33 @ProcessingInterval 33 @ProcessingInterval
34 @Scheduled(cron = "${export.task.allocation.sendObRetry}") 34 @Scheduled(cron = "${export.task.allocation.sendObRetry}")
35 public void sendObRetryTask() { 35 public void sendObRetryTask() {
36 - sendObService.sendObRetry(); 36 + //sendObService.sendObRetry();
37 } 37 }
38 } 38 }
......
...@@ -39,4 +39,6 @@ public class AbstractDaoRepository { ...@@ -39,4 +39,6 @@ public class AbstractDaoRepository {
39 protected ParamConfigExtMapper paramConfigExtMapper; 39 protected ParamConfigExtMapper paramConfigExtMapper;
40 @Autowired 40 @Autowired
41 protected ConsignmentMapper consignmentMapper; 41 protected ConsignmentMapper consignmentMapper;
42 + @Autowired
43 + protected EmailHistoryExtMapper emailHistoryExtMapper;
42 } 44 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -9,7 +9,7 @@ import java.util.List; ...@@ -9,7 +9,7 @@ import java.util.List;
9 @Mapper 9 @Mapper
10 public interface AttachmentExtMapper { 10 public interface AttachmentExtMapper {
11 11
12 - @Select("SELECT a.FILE_PATH, c.DEST_IATA_CODE, c.CONSIGNMENT_CODE " + 12 + @Select("SELECT a.FILE_PATH, c.DEST_IATA_CODE, c.CONSIGNMENT_CODE, c.SHIPPER_CONTACT_NAME, c.SHIPPER_EMAIL, c.SHIPPER_PHONE " +
13 "FROM T_BIZ_ATTACHMENT a " + 13 "FROM T_BIZ_ATTACHMENT a " +
14 "JOIN T_BIZ_CONSIGNMENT c ON a.BIZ_ID = c.ID " + 14 "JOIN T_BIZ_CONSIGNMENT c ON a.BIZ_ID = c.ID " +
15 "WHERE a.BIZ_ID = #{bizId}") 15 "WHERE a.BIZ_ID = #{bizId}")
......
1 +package com.fedex.connect.task.repository.dao;
2 +
3 +import com.fedex.connect.common.model.log.EmailHistory;
4 +import org.apache.ibatis.annotations.Mapper;
5 +import org.apache.ibatis.annotations.Param;
6 +import org.apache.ibatis.annotations.Select;
7 +
8 +import java.util.List;
9 +
10 +@Mapper
11 +public interface EmailHistoryExtMapper {
12 + @Select("<script>" +
13 + "SELECT * " +
14 + "FROM T_LOG_EMAIL_HISTORY " +
15 + "WHERE MODIFY_TIME >= TO_DATE(#{modifyTime}, 'YYYY-MM-DD')" +
16 + "</script>")
17 + List<EmailHistory> findEmailsByModifyTime(@Param("modifyTime") String modifyTime);
18 +}
...@@ -28,8 +28,8 @@ public interface PushObMapperExt { ...@@ -28,8 +28,8 @@ public interface PushObMapperExt {
28 28
29 @Select("<script>" + 29 @Select("<script>" +
30 "SELECT * " + 30 "SELECT * " +
31 - "FROM T_BIZ_EMAIL " + 31 + "FROM T_BIZ_PUSH_OB " +
32 - "WHERE MODIFY_TIME &gt;= #{modifyTime}" + 32 + "WHERE MODIFY_TIME >= TO_DATE(#{modifyTime}, 'YYYY-MM-DD')" +
33 "</script>") 33 "</script>")
34 List<PushOb> findPushObByModifyTime(@Param("modifyTime") String modifyTime); 34 List<PushOb> findPushObByModifyTime(@Param("modifyTime") String modifyTime);
35 } 35 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
8 FROM T_BIZ_EMAIL 8 FROM T_BIZ_EMAIL
9 WHERE TYPE_CODE = #{typeCode} 9 WHERE TYPE_CODE = #{typeCode}
10 AND STATUS_CODE = #{statusCode} 10 AND STATUS_CODE = #{statusCode}
11 - ORDER BY CREATED_DATE DESC 11 + ORDER BY CREATE_TIME DESC
12 ) 12 )
13 WHERE ROWNUM &lt; #{rowLimit} 13 WHERE ROWNUM &lt; #{rowLimit}
14 </select> 14 </select>
......
...@@ -2,6 +2,11 @@ package com.fedex.connect.task.repository.repo.log; ...@@ -2,6 +2,11 @@ package com.fedex.connect.task.repository.repo.log;
2 2
3 import com.fedex.connect.common.model.log.EmailHistory; 3 import com.fedex.connect.common.model.log.EmailHistory;
4 4
5 +import java.util.List;
6 +
5 public interface IEmailHistoryRepository { 7 public interface IEmailHistoryRepository {
6 void saveOrUpdate(EmailHistory entity); 8 void saveOrUpdate(EmailHistory entity);
9 +
10 + List<EmailHistory> findEmailsByModifyTime(String modifyTime);
11 +
7 } 12 }
......
1 package com.fedex.connect.task.repository.repo.log.impl; 1 package com.fedex.connect.task.repository.repo.log.impl;
2 2
3 -import com.fedex.connect.common.model.biz.Email;
4 import com.fedex.connect.common.model.log.EmailHistory; 3 import com.fedex.connect.common.model.log.EmailHistory;
5 import com.fedex.connect.task.repository.base.AbstractDaoRepository; 4 import com.fedex.connect.task.repository.base.AbstractDaoRepository;
6 import com.fedex.connect.task.repository.repo.log.IEmailHistoryRepository; 5 import com.fedex.connect.task.repository.repo.log.IEmailHistoryRepository;
...@@ -21,4 +20,9 @@ public class EmailHistoryRepositoryImpl extends AbstractDaoRepository implements ...@@ -21,4 +20,9 @@ public class EmailHistoryRepositoryImpl extends AbstractDaoRepository implements
21 } 20 }
22 } 21 }
23 } 22 }
23 +
24 + @Override
25 + public List<EmailHistory> findEmailsByModifyTime(String modifyTime) {
26 + return emailHistoryExtMapper.findEmailsByModifyTime(modifyTime);
27 + }
24 } 28 }
......
1 package com.fedex.connect.task.service.biz; 1 package com.fedex.connect.task.service.biz;
2 2
3 public interface IPushObService { 3 public interface IPushObService {
4 - /** 4 + ///**
5 - * @Author mt 5 + // * @Author mt
6 - * @Description 推送Imp001报文数据zip包文件 6 + // * @Description 推送Imp001报文数据zip包文件
7 - * @Date 2024/8/2 7 + // * @Date 2024/8/2
8 - * @param 8 + // * @param
9 - * @return void 9 + // * @return void
10 - */ 10 + // */
11 - void sendOb(); 11 + //void sendOb();
12 - /** 12 + ///**
13 - * @Author mt 13 + // * @Author mt
14 - * @Description 推送Imp001文件错误重试 14 + // * @Description 推送Imp001文件错误重试
15 - * @Date 2024/8/2 15 + // * @Date 2024/8/2
16 - * @param 16 + // * @param
17 - * @return void 17 + // * @return void
18 - */ 18 + // */
19 - void sendObRetry(); 19 + //void sendObRetry();
20 } 20 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -38,7 +38,7 @@ public class DuplicateConsignmentEmailServiceImpl extends BaseService implements ...@@ -38,7 +38,7 @@ public class DuplicateConsignmentEmailServiceImpl extends BaseService implements
38 * 查询邮件发送日志表中状态为待推送且类型为“提醒发件人”的数据 38 * 查询邮件发送日志表中状态为待推送且类型为“提醒发件人”的数据
39 */ 39 */
40 List<Email> emails = iEmailExtRepository.findEmailsByDic(cacheSystem.getDicEmailType(EmailTypeEnum.NOTIFICATION_SENDER.getCode()).getCode(), 40 List<Email> emails = iEmailExtRepository.findEmailsByDic(cacheSystem.getDicEmailType(EmailTypeEnum.NOTIFICATION_SENDER.getCode()).getCode(),
41 - cacheSystem.getDicEmailStatus(EmailStatusEnum.PENDING.getEnMsg()).getCode(), ParamConfigConstants.TASK_PARAM_KEYS.NOTIFICATION_SENDER_EMAIL_NUMBER); 41 + cacheSystem.getDicEmailStatus(EmailStatusEnum.PENDING.getCode()).getCode(), ParamConfigConstants.TASK_PARAM_KEYS.NOTIFICATION_SENDER_EMAIL_NUMBER);
42 /** 42 /**
43 * 发送邮件 43 * 发送邮件
44 */ 44 */
...@@ -47,7 +47,7 @@ public class DuplicateConsignmentEmailServiceImpl extends BaseService implements ...@@ -47,7 +47,7 @@ public class DuplicateConsignmentEmailServiceImpl extends BaseService implements
47 * 构造邮件dto 47 * 构造邮件dto
48 */ 48 */
49 MailConfigDto mailConfigDto = new MailConfigDto(); 49 MailConfigDto mailConfigDto = new MailConfigDto();
50 - duplicateEmailUtil.createMailConfigDto(mailConfigDto); 50 + duplicateEmailUtil.createMailConfigDto(mailConfigDto,email);
51 /** 51 /**
52 * 发送邮件 52 * 发送邮件
53 */ 53 */
......
...@@ -56,21 +56,27 @@ public class PushConsignmentFileServiceImpl extends BaseService implements IPush ...@@ -56,21 +56,27 @@ public class PushConsignmentFileServiceImpl extends BaseService implements IPush
56 String tempPath = ""; 56 String tempPath = "";
57 String finalPath = ""; 57 String finalPath = "";
58 //查询需要发送的数据 58 //查询需要发送的数据
59 - List<Email> conPushEmails = iEmailExtRepository.findEmailsByDic(cacheSystem.getDicEmailType(EmailTypeEnum.PUSH_CON_FILE.getEnMsg()).getCode(), 59 + List<Email> conPushEmails = iEmailExtRepository.findEmailsByDic(cacheSystem.getDicEmailType(EmailTypeEnum.PUSH_CON_FILE.getCode()).getCode(),
60 - cacheSystem.getDicEmailStatus(EmailStatusEnum.PENDING.getEnMsg()).getCode(),ParamConfigConstants.TASK_PARAM_KEYS.PUSH_CON_NUMBER); 60 + cacheSystem.getDicEmailStatus(EmailStatusEnum.PENDING.getCode()).getCode(),ParamConfigConstants.TASK_PARAM_KEYS.PUSH_CON_NUMBER);
61 61
62 for (Email conPushEmail : conPushEmails) { 62 for (Email conPushEmail : conPushEmails) {
63 + boolean result = true;
64 + try {
63 //获取待发送的文件并打zip包 65 //获取待发送的文件并打zip包
64 PortFileDto portFileDto = new PortFileDto(); 66 PortFileDto portFileDto = new PortFileDto();
65 List<PushZipEmailDto> attachmentDetailsByBizId = attachmentExtRepository.findAttachmentDetailsByBizId(conPushEmail.getBizId()); 67 List<PushZipEmailDto> attachmentDetailsByBizId = attachmentExtRepository.findAttachmentDetailsByBizId(conPushEmail.getBizId());
66 portFileDto = conFileEmailUtil.getPortZipMap(portFileDto, attachmentDetailsByBizId, tempPath, finalPath, zipUtils); 68 portFileDto = conFileEmailUtil.getPortZipMap(portFileDto, attachmentDetailsByBizId, tempPath, finalPath, zipUtils);
67 //发送邮件 69 //发送邮件
68 MailConfigDto mailMessageReqDto = new MailConfigDto(); 70 MailConfigDto mailMessageReqDto = new MailConfigDto();
69 - boolean result = conFileEmailUtil.sendEmail(portFileDto, emailUtil,mailMessageReqDto); 71 + result = conFileEmailUtil.sendEmail(portFileDto, emailUtil,mailMessageReqDto,conPushEmail);
70 //根据是否成功发送邮件对文件进行备份 72 //根据是否成功发送邮件对文件进行备份
71 String filePath = conFileEmailUtil.backFile(portFileDto.getZipPath(), nioFileUtils,result); 73 String filePath = conFileEmailUtil.backFile(portFileDto.getZipPath(), nioFileUtils,result);
72 //更新邮件记录表 74 //更新邮件记录表
73 conFileEmailUtil.createEmail(cacheSystem,conPushEmail,mailMessageReqDto,result,filePath); 75 conFileEmailUtil.createEmail(cacheSystem,conPushEmail,mailMessageReqDto,result,filePath);
76 + }catch (Exception e){
77 + log.error("推送清关文件邮件异常",e);
78 + result = false;
79 + }
74 //保存入库 80 //保存入库
75 conFileEmailUtil.saveEmail(conPushEmail,result); 81 conFileEmailUtil.saveEmail(conPushEmail,result);
76 } 82 }
......
...@@ -8,9 +8,7 @@ import com.fedex.connect.common.model.sys.ParamConfig; ...@@ -8,9 +8,7 @@ import com.fedex.connect.common.model.sys.ParamConfig;
8 import com.fedex.connect.task.data.bo.Imp001GenerateBo; 8 import com.fedex.connect.task.data.bo.Imp001GenerateBo;
9 import com.fedex.connect.task.service.base.BaseService; 9 import com.fedex.connect.task.service.base.BaseService;
10 import com.fedex.connect.task.service.biz.IPushObService; 10 import com.fedex.connect.task.service.biz.IPushObService;
11 -import com.fedex.connect.task.utils.biz.imp001.Imp001GenerateUtil; 11 +
12 -import com.fedex.connect.task.utils.biz.imp001.Imp001PushUtil;
13 -import com.fedex.connect.task.utils.biz.imp001.Imp001RecordLogUtil;
14 import lombok.extern.slf4j.Slf4j; 12 import lombok.extern.slf4j.Slf4j;
15 import org.springframework.beans.factory.annotation.Autowired; 13 import org.springframework.beans.factory.annotation.Autowired;
16 import org.springframework.stereotype.Service; 14 import org.springframework.stereotype.Service;
...@@ -27,87 +25,87 @@ import java.util.Objects; ...@@ -27,87 +25,87 @@ import java.util.Objects;
27 @Slf4j 25 @Slf4j
28 @Service 26 @Service
29 public class PushObServiceImpl extends BaseService implements IPushObService { 27 public class PushObServiceImpl extends BaseService implements IPushObService {
30 - @Autowired 28 + //@Autowired
31 - Imp001GenerateUtil imp001GenerateUtil; 29 + //Imp001GenerateUtil imp001GenerateUtil;
32 - @Autowired 30 + //@Autowired
33 - Imp001PushUtil imp001PushUtil; 31 + //Imp001PushUtil imp001PushUtil;
34 - @Autowired 32 + //@Autowired
35 - Imp001RecordLogUtil imp001RecordLogUtil; 33 + //Imp001RecordLogUtil imp001RecordLogUtil;
36 - 34 + //
37 - /** 35 + ///**
38 - * 推送OB报文数据zip包文件 36 + // * 推送OB报文数据zip包文件
39 - */ 37 + // */
40 - @Override 38 + //@Override
41 - public void sendOb() { 39 + //public void sendOb() {
42 - //获取每次处理数据量量参数 40 + // //获取每次处理数据量量参数
43 - ParamConfig paramConfig = paramConfigRepository.findValueByCode(ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_NUMBER); 41 + // ParamConfig paramConfig = paramConfigRepository.findValueByCode(ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_NUMBER);
44 - Long rownum = Long.parseLong(paramConfig.getValue()); 42 + // Long rownum = Long.parseLong(paramConfig.getValue());
45 - //获取需要处理的记录 43 + // //获取需要处理的记录
46 - List<PushOb> pushObList = pushObRepository.findPushOb(PushObStatusEnum.TO_BE_SENT.getCode(),rownum); 44 + // List<PushOb> pushObList = pushObRepository.findPushOb(PushObStatusEnum.TO_BE_SENT.getCode(),rownum);
47 - //推送imp001数据 45 + // //推送imp001数据
48 - this.pushOb(pushObList); 46 + // this.pushOb(pushObList);
49 - } 47 + //}
50 - 48 + //
51 - /** 49 + ///**
52 - * 推送OB文件错误重试 50 + // * 推送OB文件错误重试
53 - */ 51 + // */
54 - @Override 52 + //@Override
55 - public void sendObRetry() { 53 + //public void sendObRetry() {
56 - //获取每次处理数据量量参数 54 + // //获取每次处理数据量量参数
57 - Map<String,ParamConfig> paramConfig = paramConfigRepository.findValueByCodes(ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_NUMBER, 55 + // Map<String,ParamConfig> paramConfig = paramConfigRepository.findValueByCodes(ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_NUMBER,
58 - ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_RETRY_NUMBER); 56 + // ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_RETRY_NUMBER);
59 - //推送IMP001重试处理数量 57 + // //推送IMP001重试处理数量
60 - ParamConfig retryNumConfig = paramConfig.get(ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_RETRY_NUMBER); 58 + // ParamConfig retryNumConfig = paramConfig.get(ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_RETRY_NUMBER);
61 - Long retryNum = Long.parseLong(retryNumConfig.getCode()); 59 + // Long retryNum = Long.parseLong(retryNumConfig.getCode());
62 - //推送IMP001定时任务处理数量 60 + // //推送IMP001定时任务处理数量
63 - ParamConfig rownumConfig = paramConfig.get(ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_NUMBER); 61 + // ParamConfig rownumConfig = paramConfig.get(ParamConfigConstants.TASK_PARAM_KEYS.PUSH_IMP001_NUMBER);
64 - Long rownum = Long.parseLong(rownumConfig.getCode()); 62 + // Long rownum = Long.parseLong(rownumConfig.getCode());
65 - //获取需要重新处理的记录:处理4次以下,并且推送失败的 63 + // //获取需要重新处理的记录:处理4次以下,并且推送失败的
66 - List<PushOb> errPushObLog = pushObRepository.findErrPushOb(retryNum, PushObStatusEnum.PUSH_FAILED.getCode(),rownum); 64 + // List<PushOb> errPushObLog = pushObRepository.findErrPushOb(retryNum, PushObStatusEnum.PUSH_FAILED.getCode(),rownum);
67 - if (errPushObLog!=null && !errPushObLog.isEmpty()){ 65 + // if (errPushObLog!=null && !errPushObLog.isEmpty()){
68 - log.info("sendObRetryTask : sendObRetry size: "+errPushObLog.size()); 66 + // log.info("sendObRetryTask : sendObRetry size: "+errPushObLog.size());
69 - //重新推送tw001数据 67 + // //重新推送tw001数据
70 - this.pushOb(errPushObLog); 68 + // this.pushOb(errPushObLog);
71 - }else{ 69 + // }else{
72 - log.info("sendObRetryTask : No data found for sendObRetry!"); 70 + // log.info("sendObRetryTask : No data found for sendObRetry!");
73 - } 71 + // }
74 - } 72 + //}
75 - 73 + //
76 - /** 74 + ///**
77 - * @Author mt 75 + // * @Author mt
78 - * @Description 推送tw001数据 76 + // * @Description 推送tw001数据
79 - * @Date 2024/5/29 77 + // * @Date 2024/5/29
80 - * @param pushObList 78 + // * @param pushObList
81 - * @return void 79 + // * @return void
82 - */ 80 + // */
83 - private void pushOb(List<PushOb> pushObList){ 81 + //private void pushOb(List<PushOb> pushObList){
84 - Utils.listOf(pushObList).stream().filter(Objects::nonNull).forEach(ob ->{ 82 + // Utils.listOf(pushObList).stream().filter(Objects::nonNull).forEach(ob ->{
85 - boolean flag = false; 83 + // boolean flag = false;
86 - String errorMsg = ""; 84 + // String errorMsg = "";
87 - Imp001GenerateBo imp001GenerateBo = null; 85 + // Imp001GenerateBo imp001GenerateBo = null;
88 - try { 86 + // try {
89 - //生成tw001 json对象dto 87 + // //生成tw001 json对象dto
90 - imp001GenerateBo = imp001GenerateUtil.generateImp001Json(ob); 88 + // imp001GenerateBo = imp001GenerateUtil.generateImp001Json(ob);
91 - //根据tw001 json对象生成并且推送zip包 89 + // //根据tw001 json对象生成并且推送zip包
92 - imp001PushUtil.pushImp001(imp001GenerateBo); 90 + // imp001PushUtil.pushImp001(imp001GenerateBo);
93 - flag = true; 91 + // flag = true;
94 - }catch(Exception ex){ 92 + // }catch(Exception ex){
95 - log.error("pushOb error : ",ex); 93 + // log.error("pushOb error : ",ex);
96 - errorMsg = ex.getMessage(); 94 + // errorMsg = ex.getMessage();
97 - flag = false; 95 + // flag = false;
98 - }finally{ 96 + // }finally{
99 - /** 97 + // /**
100 - * 如果生成失败,推送失败,则不会记录推送日志明细,更新推送日志表。 98 + // * 如果生成失败,推送失败,则不会记录推送日志明细,更新推送日志表。
101 - * 记录日志,并且备份 99 + // * 记录日志,并且备份
102 - */ 100 + // */
103 - if(flag){ 101 + // if(flag){
104 - //推送成功 102 + // //推送成功
105 - imp001RecordLogUtil.pushSuccessRecordLog(imp001GenerateBo, ob); 103 + // imp001RecordLogUtil.pushSuccessRecordLog(imp001GenerateBo, ob);
106 - }else{ 104 + // }else{
107 - //推送失败 105 + // //推送失败
108 - imp001RecordLogUtil.pushFailRecordLog(imp001GenerateBo, ob, errorMsg); 106 + // imp001RecordLogUtil.pushFailRecordLog(imp001GenerateBo, ob, errorMsg);
109 - } 107 + // }
110 - } 108 + // }
111 - }); 109 + // });
112 - } 110 + //}
113 } 111 }
...\ No newline at end of file ...\ No newline at end of file
......
1 package com.fedex.connect.task.service.sys.impl; 1 package com.fedex.connect.task.service.sys.impl;
2 2
3 import com.fedex.connect.common.dependencies.util.DateUtil; 3 import com.fedex.connect.common.dependencies.util.DateUtil;
4 -import com.fedex.connect.common.model.biz.Email;
5 import com.fedex.connect.common.model.biz.PushOb; 4 import com.fedex.connect.common.model.biz.PushOb;
5 +import com.fedex.connect.common.model.log.EmailHistory;
6 import com.fedex.connect.common.model.sys.ParamConfig; 6 import com.fedex.connect.common.model.sys.ParamConfig;
7 +import com.fedex.connect.task.config.PropertiesConfig;
7 import com.fedex.connect.task.data.dto.MailConfigDto; 8 import com.fedex.connect.task.data.dto.MailConfigDto;
8 import com.fedex.connect.task.data.dto.SendFailedEmailDto; 9 import com.fedex.connect.task.data.dto.SendFailedEmailDto;
9 import com.fedex.connect.task.service.base.BaseService; 10 import com.fedex.connect.task.service.base.BaseService;
...@@ -28,6 +29,9 @@ public class SendFailedEmailAlertServiceImpl extends BaseService implements ISen ...@@ -28,6 +29,9 @@ public class SendFailedEmailAlertServiceImpl extends BaseService implements ISen
28 @Autowired 29 @Autowired
29 private EmailUtil emailUtil; 30 private EmailUtil emailUtil;
30 31
32 + @Autowired
33 + private PropertiesConfig propertiesConfig;
34 +
31 /** 35 /**
32 * @Author Szl 36 * @Author Szl
33 * @Description 功能说明 推送错误预警邮件 37 * @Description 功能说明 推送错误预警邮件
...@@ -45,7 +49,7 @@ public class SendFailedEmailAlertServiceImpl extends BaseService implements ISen ...@@ -45,7 +49,7 @@ public class SendFailedEmailAlertServiceImpl extends BaseService implements ISen
45 * 查询需要发送邮件的记录 49 * 查询需要发送邮件的记录
46 */ 50 */
47 String date = DateUtil.format(new Date()); 51 String date = DateUtil.format(new Date());
48 - List<Email> emails = sendFailedEmailUtil.getEmails(date); 52 + List<EmailHistory> emails = sendFailedEmailUtil.getEmails(date);
49 /** 53 /**
50 * 查询推送文件集合 54 * 查询推送文件集合
51 */ 55 */
...@@ -61,7 +65,7 @@ public class SendFailedEmailAlertServiceImpl extends BaseService implements ISen ...@@ -61,7 +65,7 @@ public class SendFailedEmailAlertServiceImpl extends BaseService implements ISen
61 /** 65 /**
62 * 构建发送邮件dto 66 * 构建发送邮件dto
63 */ 67 */
64 - MailConfigDto mailConfigDto = sendFailedEmailUtil.createMailConfigDto(emailBody); 68 + MailConfigDto mailConfigDto = sendFailedEmailUtil.createMailConfigDto(emailBody,propertiesConfig);
65 /** 69 /**
66 * 发送邮件 70 * 发送邮件
67 */ 71 */
......
...@@ -4,6 +4,7 @@ import com.fedex.connect.common.dependencies.cache.CacheSystem; ...@@ -4,6 +4,7 @@ import com.fedex.connect.common.dependencies.cache.CacheSystem;
4 import com.fedex.connect.common.dependencies.contants.BaseConstants; 4 import com.fedex.connect.common.dependencies.contants.BaseConstants;
5 import com.fedex.connect.common.dependencies.contants.BaseSeparatorConstants; 5 import com.fedex.connect.common.dependencies.contants.BaseSeparatorConstants;
6 import com.fedex.connect.common.dependencies.enums.biz.EmailStatusEnum; 6 import com.fedex.connect.common.dependencies.enums.biz.EmailStatusEnum;
7 +import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil;
7 import com.fedex.connect.common.dependencies.template.clearanceEmail.ClearanceEmailTemplate; 8 import com.fedex.connect.common.dependencies.template.clearanceEmail.ClearanceEmailTemplate;
8 import com.fedex.connect.common.dependencies.util.DateUtil; 9 import com.fedex.connect.common.dependencies.util.DateUtil;
9 import com.fedex.connect.common.dependencies.util.NIOFileUtils; 10 import com.fedex.connect.common.dependencies.util.NIOFileUtils;
...@@ -11,6 +12,7 @@ import com.fedex.connect.common.dependencies.util.ZipUtils; ...@@ -11,6 +12,7 @@ import com.fedex.connect.common.dependencies.util.ZipUtils;
11 import com.fedex.connect.common.model.bi.DictionaryEntries; 12 import com.fedex.connect.common.model.bi.DictionaryEntries;
12 import com.fedex.connect.common.model.biz.Email; 13 import com.fedex.connect.common.model.biz.Email;
13 import com.fedex.connect.common.model.log.EmailHistory; 14 import com.fedex.connect.common.model.log.EmailHistory;
15 +import com.fedex.connect.task.config.PropertiesConfig;
14 import com.fedex.connect.task.data.bo.MailAttachmentBo; 16 import com.fedex.connect.task.data.bo.MailAttachmentBo;
15 import com.fedex.connect.task.data.dto.MailConfigDto; 17 import com.fedex.connect.task.data.dto.MailConfigDto;
16 import com.fedex.connect.task.data.dto.PortFileDto; 18 import com.fedex.connect.task.data.dto.PortFileDto;
...@@ -24,6 +26,7 @@ import org.springframework.beans.BeanUtils; ...@@ -24,6 +26,7 @@ import org.springframework.beans.BeanUtils;
24 import org.springframework.beans.factory.annotation.Autowired; 26 import org.springframework.beans.factory.annotation.Autowired;
25 import org.springframework.stereotype.Component; 27 import org.springframework.stereotype.Component;
26 import org.springframework.transaction.annotation.Transactional; 28 import org.springframework.transaction.annotation.Transactional;
29 +import org.springframework.util.CollectionUtils;
27 30
28 import java.io.File; 31 import java.io.File;
29 import java.io.FileOutputStream; 32 import java.io.FileOutputStream;
...@@ -32,6 +35,7 @@ import java.nio.file.Paths; ...@@ -32,6 +35,7 @@ import java.nio.file.Paths;
32 import java.util.ArrayList; 35 import java.util.ArrayList;
33 import java.util.Date; 36 import java.util.Date;
34 import java.util.List; 37 import java.util.List;
38 +import java.util.Optional;
35 39
36 /** 40 /**
37 * @Author Szl 41 * @Author Szl
...@@ -54,6 +58,12 @@ public class ConFileEmailUtil { ...@@ -54,6 +58,12 @@ public class ConFileEmailUtil {
54 @Autowired 58 @Autowired
55 private IEmailHistoryRepository emailHistoryRepository; 59 private IEmailHistoryRepository emailHistoryRepository;
56 60
61 + @Autowired
62 + private PropertiesConfig propertiesConfig;
63 +
64 + @Autowired
65 + protected LocaleMessageUtil lmUtil;
66 +
57 /** 67 /**
58 * @Author Szl 68 * @Author Szl
59 * @Description 功能说明 根据运单打包,一票一个zip包 69 * @Description 功能说明 根据运单打包,一票一个zip包
...@@ -75,12 +85,17 @@ public class ConFileEmailUtil { ...@@ -75,12 +85,17 @@ public class ConFileEmailUtil {
75 if (file.exists()) { 85 if (file.exists()) {
76 filesList.add(file); 86 filesList.add(file);
77 } 87 }
88 + portFileDto.setShipperContactName(pushZipEmailDto.getShipperContactName());
89 + portFileDto.setShipperEmail(pushZipEmailDto.getShipperEmail());
90 + portFileDto.setShipperPhone(pushZipEmailDto.getShipperPhone());
78 } 91 }
79 String date = DateUtil.yyyyMMddHHmmss(new Date()); 92 String date = DateUtil.yyyyMMddHHmmss(new Date());
80 String fileName = date + BaseSeparatorConstants.SEPARATOR_UNDERLINE + portCode + BaseConstants.FILE_SUFFIX_KEYS.ZIP; 93 String fileName = date + BaseSeparatorConstants.SEPARATOR_UNDERLINE + portCode + BaseConstants.FILE_SUFFIX_KEYS.ZIP;
81 String fileNameTemp = date + BaseSeparatorConstants.SEPARATOR_UNDERLINE + portCode + BaseConstants.FILE_SUFFIX_KEYS.ZIP + BaseConstants.FILE_SUFFIX_KEYS.TEMP; 94 String fileNameTemp = date + BaseSeparatorConstants.SEPARATOR_UNDERLINE + portCode + BaseConstants.FILE_SUFFIX_KEYS.ZIP + BaseConstants.FILE_SUFFIX_KEYS.TEMP;
82 FileOutputStream fos = null; 95 FileOutputStream fos = null;
83 - 96 + if (CollectionUtils.isEmpty(filesList)){
97 + return portFileDto;
98 + }
84 try { 99 try {
85 fos = new FileOutputStream(tempPath + fileNameTemp); 100 fos = new FileOutputStream(tempPath + fileNameTemp);
86 zipUtils.toZip(filesList, fos); 101 zipUtils.toZip(filesList, fos);
...@@ -118,7 +133,7 @@ public class ConFileEmailUtil { ...@@ -118,7 +133,7 @@ public class ConFileEmailUtil {
118 * @param portFileDto 133 * @param portFileDto
119 * @return void 134 * @return void
120 */ 135 */
121 - public boolean sendEmail(PortFileDto portFileDto,EmailUtil emailUtil,MailConfigDto mailMessageReqDto){ 136 + public boolean sendEmail(PortFileDto portFileDto,EmailUtil emailUtil,MailConfigDto mailMessageReqDto,Email conPushEmail){
122 /** 137 /**
123 * 获取邮件地址 138 * 获取邮件地址
124 */ 139 */
...@@ -126,7 +141,7 @@ public class ConFileEmailUtil { ...@@ -126,7 +141,7 @@ public class ConFileEmailUtil {
126 /** 141 /**
127 * 构建发送邮件对象 142 * 构建发送邮件对象
128 */ 143 */
129 - this.createMailMessageReqDto(emailAddress, portFileDto,mailMessageReqDto); 144 + this.createMailMessageReqDto(emailAddress, portFileDto,mailMessageReqDto,propertiesConfig,conPushEmail);
130 /** 145 /**
131 * 发送邮件 146 * 发送邮件
132 */ 147 */
...@@ -143,32 +158,75 @@ public class ConFileEmailUtil { ...@@ -143,32 +158,75 @@ public class ConFileEmailUtil {
143 * @param portFileDto 158 * @param portFileDto
144 * @return com.fedex.connect.task.data.dto.MailMessageReqDto 159 * @return com.fedex.connect.task.data.dto.MailMessageReqDto
145 */ 160 */
146 - private MailConfigDto createMailMessageReqDto(String emailAddress, PortFileDto portFileDto,MailConfigDto mailConfigDto){ 161 + private MailConfigDto createMailMessageReqDto(String emailAddress, PortFileDto portFileDto,MailConfigDto mailConfigDto,PropertiesConfig propertiesConfig,Email conPushEmail){
147 - mailConfigDto.setHost(""); 162 +
148 - mailConfigDto.setPort(""); 163 + mailConfigDto.setHost(propertiesConfig.getHost());
149 - mailConfigDto.setAuth(""); 164 + mailConfigDto.setPort(propertiesConfig.getPort());
165 + mailConfigDto.setAuth(propertiesConfig.getAuth());
150 //设置代理 166 //设置代理
151 - mailConfigDto.setProxyStartFlag(""); 167 + mailConfigDto.setProxyStartFlag(propertiesConfig.getProxyStartFlag());
152 - mailConfigDto.setProxyHost(""); 168 + mailConfigDto.setProxyHost(propertiesConfig.getProxyHost());
153 - mailConfigDto.setProxyPort(""); 169 + mailConfigDto.setProxyPort(propertiesConfig.getProxyPort());
154 - //发件人 170 +
155 - mailConfigDto.setFrom("");
156 - //发件人密码
157 - mailConfigDto.setPassword("");
158 //ce接收人 171 //ce接收人
159 mailConfigDto.setTo(emailAddress); 172 mailConfigDto.setTo(emailAddress);
160 //设置邮件标题 173 //设置邮件标题
161 mailConfigDto.setSubject(clearanceEmailTemplate.getTitle()); 174 mailConfigDto.setSubject(clearanceEmailTemplate.getTitle());
162 //设置邮件内容 175 //设置邮件内容
163 - mailConfigDto.setContent(clearanceEmailTemplate.getBody()); 176 + String body = this.generateContent("zelong.shao@erry.com", propertiesConfig.getEmailAccount(), portFileDto, conPushEmail.getBizCode());
177 + mailConfigDto.setContent(body);
164 //放入文件列表 178 //放入文件列表
179 + if (!StringUtils.isEmpty(portFileDto.getZipPath())){
165 List<MailAttachmentBo> srcFiles = new ArrayList<>(); 180 List<MailAttachmentBo> srcFiles = new ArrayList<>();
166 File file = new File(portFileDto.getZipPath()); 181 File file = new File(portFileDto.getZipPath());
167 srcFiles.add(new MailAttachmentBo(file, "")); 182 srcFiles.add(new MailAttachmentBo(file, ""));
168 mailConfigDto.setFileList(srcFiles); 183 mailConfigDto.setFileList(srcFiles);
184 + }
185 +
186 + if (propertiesConfig.getEnv().equalsIgnoreCase("dev")
187 + || propertiesConfig.getEnv().equalsIgnoreCase("test")
188 + ) {
189 + //ce接收人
190 + mailConfigDto.setTo("zelong.shao@erry.com");
191 + mailConfigDto.setCcAccount("");
192 + mailConfigDto.setReceiveAccount("zelong.shao@erry.com");
193 + //发件人
194 + mailConfigDto.setFrom(propertiesConfig.getEmailAccount());
195 + //发件人密码
196 + mailConfigDto.setPassword(propertiesConfig.getEmailPassword());
197 + mailConfigDto.setMailAccountFlag(propertiesConfig.getMailAccountFlag());
198 + mailConfigDto.setSenderAccount(propertiesConfig.getEmailAccount());
199 + mailConfigDto.setSenderPassword(propertiesConfig.getEmailPassword());
200 + }
169 return mailConfigDto; 201 return mailConfigDto;
170 } 202 }
171 203
204 + private String generateContent( String to,String from, PortFileDto portFileDto,String consignmentCode){
205 + //String consignmentCodeMessage = Optional.ofNullable(lmUtil.getMessage("business_field_31009")).orElse("Consignment Code");
206 + //String liaisons = Optional.ofNullable(lmUtil.getMessage("business_field_31010")).orElse("Contact Person");
207 + //String email = Optional.ofNullable(lmUtil.getMessage("business_field_31011")).orElse("Contact Person's Email");
208 + //String tel = Optional.ofNullable(lmUtil.getMessage("business_field_31012")).orElse("Contact Phone");
209 +
210 + StringBuilder content = new StringBuilder();
211 + content.append("<font size=\"4\"><br/> " );
212 + content.append("Consignment Code" + ":" + Optional.ofNullable(consignmentCode).orElse(""));
213 + content.append("<br/> " );
214 + content.append("Contact Person" + ":" + Optional.ofNullable(portFileDto.getShipperContactName()).orElse(""));
215 + content.append("<br/> " );
216 + content.append("Contact Person's Email" + ":" + Optional.ofNullable(portFileDto.getShipperEmail()).orElse(""));
217 + content.append("<br/> " );
218 + content.append("Contact Phone" + ":" + Optional.ofNullable(portFileDto.getShipperPhone()).orElse(""));
219 +
220 + content.append("</font><br/><br/> " );
221 + content.append("<div style=\"color:#808080;font-style:Arial;font-size:14px;\">" +
222 + "This email was to send declaration files uploaded by customer on the FedEx online declaration platform to " +
223 + Optional.ofNullable(to).orElse("edd@fedex.com") +
224 + " through " +
225 + Optional.ofNullable(from).orElse("donotreply@fedex.com") +
226 + ", please do not reply</div>");
227 + return content.toString();
228 + }
229 +
172 /** 230 /**
173 * @Author Szl 231 * @Author Szl
174 * @Description 功能说明 根据口岸获取邮件地址 232 * @Description 功能说明 根据口岸获取邮件地址
...@@ -177,7 +235,7 @@ public class ConFileEmailUtil { ...@@ -177,7 +235,7 @@ public class ConFileEmailUtil {
177 * @return java.lang.String 235 * @return java.lang.String
178 */ 236 */
179 private String getEmailAddress(PortFileDto portFileDto){ 237 private String getEmailAddress(PortFileDto portFileDto){
180 - if (BaseConstants.CONSIGNMENT_TABLE_COLUMN_KEYS.DEST_IATA_CODE.equals(portFileDto.getDestIataCode())){ 238 + if (BaseConstants.CONSIGNMENT_TABLE_COLUMN_KEYS.DEST_IATA_CODE.equals(portFileDto.getDestIataCode()) || StringUtils.isEmpty(portFileDto.getDestIataCode())){
181 portFileDto.setDestIataCode("OTHER"); 239 portFileDto.setDestIataCode("OTHER");
182 } 240 }
183 String emailByPortCode = portclearEmailMappingExtRepository.findEmailByPortCode(portFileDto.getDestIataCode()); 241 String emailByPortCode = portclearEmailMappingExtRepository.findEmailByPortCode(portFileDto.getDestIataCode());
...@@ -198,9 +256,9 @@ public class ConFileEmailUtil { ...@@ -198,9 +256,9 @@ public class ConFileEmailUtil {
198 * @return void 256 * @return void
199 */ 257 */
200 public void createEmail(CacheSystem cacheSystem, Email conPushEmail, MailConfigDto mailMessageReqDto, boolean result,String filePath){ 258 public void createEmail(CacheSystem cacheSystem, Email conPushEmail, MailConfigDto mailMessageReqDto, boolean result,String filePath){
201 - DictionaryEntries pending = cacheSystem.getDicEmailStatus(EmailStatusEnum.PENDING.getEnMsg()); 259 + DictionaryEntries pending = cacheSystem.getDicEmailStatus(EmailStatusEnum.PENDING.getCode());
202 - DictionaryEntries success = cacheSystem.getDicEmailStatus(EmailStatusEnum.SUCCESS.getEnMsg()); 260 + DictionaryEntries success = cacheSystem.getDicEmailStatus(EmailStatusEnum.SUCCESS.getCode());
203 - DictionaryEntries failed = cacheSystem.getDicEmailStatus(EmailStatusEnum.FAILED.getEnMsg()); 261 + DictionaryEntries failed = cacheSystem.getDicEmailStatus(EmailStatusEnum.FAILED.getCode());
204 conPushEmail.setToAddress(mailMessageReqDto.getTo()); 262 conPushEmail.setToAddress(mailMessageReqDto.getTo());
205 conPushEmail.setCcAddress(mailMessageReqDto.getCc()); 263 conPushEmail.setCcAddress(mailMessageReqDto.getCc());
206 conPushEmail.setSubject(mailMessageReqDto.getSubject()); 264 conPushEmail.setSubject(mailMessageReqDto.getSubject());
......
1 package com.fedex.connect.task.utils.sys; 1 package com.fedex.connect.task.utils.sys;
2 2
3 import com.fedex.connect.common.dependencies.cache.CacheSystem; 3 import com.fedex.connect.common.dependencies.cache.CacheSystem;
4 +import com.fedex.connect.common.dependencies.contants.ParamConfigConstants;
4 import com.fedex.connect.common.dependencies.enums.biz.EmailStatusEnum; 5 import com.fedex.connect.common.dependencies.enums.biz.EmailStatusEnum;
6 +import com.fedex.connect.common.dependencies.template.clearanceEmail.DuplicateEmailTemplate;
5 import com.fedex.connect.common.model.bi.DictionaryEntries; 7 import com.fedex.connect.common.model.bi.DictionaryEntries;
6 import com.fedex.connect.common.model.biz.Email; 8 import com.fedex.connect.common.model.biz.Email;
7 import com.fedex.connect.common.model.log.EmailHistory; 9 import com.fedex.connect.common.model.log.EmailHistory;
10 +import com.fedex.connect.common.model.sys.ParamConfig;
11 +import com.fedex.connect.task.config.PropertiesConfig;
8 import com.fedex.connect.task.data.dto.MailConfigDto; 12 import com.fedex.connect.task.data.dto.MailConfigDto;
9 import com.fedex.connect.task.repository.repo.biz.IEmailRepository; 13 import com.fedex.connect.task.repository.repo.biz.IEmailRepository;
10 import com.fedex.connect.task.repository.repo.log.IEmailHistoryRepository; 14 import com.fedex.connect.task.repository.repo.log.IEmailHistoryRepository;
15 +import com.fedex.connect.task.repository.repo.sys.IParamConfigRepository;
11 import org.springframework.beans.BeanUtils; 16 import org.springframework.beans.BeanUtils;
12 import org.springframework.beans.factory.annotation.Autowired; 17 import org.springframework.beans.factory.annotation.Autowired;
13 import org.springframework.stereotype.Component; 18 import org.springframework.stereotype.Component;
...@@ -24,6 +29,15 @@ public class DuplicateEmailUtil { ...@@ -24,6 +29,15 @@ public class DuplicateEmailUtil {
24 @Autowired 29 @Autowired
25 private IEmailHistoryRepository emailHistoryRepository; 30 private IEmailHistoryRepository emailHistoryRepository;
26 31
32 + @Autowired
33 + private PropertiesConfig propertiesConfig;
34 +
35 + @Autowired
36 + private DuplicateEmailTemplate duplicateEmailTemplate;
37 +
38 + @Autowired
39 + private IParamConfigRepository paramConfigRepository;
40 +
27 /** 41 /**
28 * @Author Szl 42 * @Author Szl
29 * @Description 功能说明 初始化邮件dto 43 * @Description 功能说明 初始化邮件dto
...@@ -31,29 +45,74 @@ public class DuplicateEmailUtil { ...@@ -31,29 +45,74 @@ public class DuplicateEmailUtil {
31 * @param mailConfigDto 45 * @param mailConfigDto
32 * @return com.fedex.connect.task.data.dto.MailConfigDto 46 * @return com.fedex.connect.task.data.dto.MailConfigDto
33 */ 47 */
34 - public MailConfigDto createMailConfigDto(MailConfigDto mailConfigDto){ 48 + public MailConfigDto createMailConfigDto(MailConfigDto mailConfigDto,Email email){
35 - mailConfigDto.setHost(""); 49 + mailConfigDto.setHost(propertiesConfig.getHost());
36 - mailConfigDto.setPort(""); 50 + mailConfigDto.setPort(propertiesConfig.getPort());
37 - mailConfigDto.setAuth(""); 51 + mailConfigDto.setAuth(propertiesConfig.getAuth());
38 //设置代理 52 //设置代理
39 - mailConfigDto.setProxyStartFlag(""); 53 + mailConfigDto.setProxyStartFlag(propertiesConfig.getProxyStartFlag());
40 - mailConfigDto.setProxyHost(""); 54 + mailConfigDto.setProxyHost(propertiesConfig.getProxyHost());
41 - mailConfigDto.setProxyPort(""); 55 + mailConfigDto.setProxyPort(propertiesConfig.getProxyPort());
42 - //发件人
43 - mailConfigDto.setFrom("");
44 - //发件人密码
45 - mailConfigDto.setPassword("");
46 //ce接收人 56 //ce接收人
47 - mailConfigDto.setTo(""); 57 + mailConfigDto.setTo(email.getToAddress());
58 + mailConfigDto.setCcAccount(email.getCcAddress());
59 + mailConfigDto.setReceiveAccount(email.getToAddress());
60 +
48 //设置邮件标题 61 //设置邮件标题
49 - mailConfigDto.setSubject(""); 62 + mailConfigDto.setSubject(duplicateEmailTemplate.getTitle());
50 - //设置邮件内容 63 + String emailBody = this.createEmailBody(email.getBizCode());
51 - mailConfigDto.setContent(""); 64 + mailConfigDto.setContent(emailBody);
65 +
66 + if (propertiesConfig.getEnv().equalsIgnoreCase("dev")
67 + || propertiesConfig.getEnv().equalsIgnoreCase("test")
68 + ) {
69 + //发件人
70 + mailConfigDto.setFrom(propertiesConfig.getEmailAccount());
71 + //发件人密码
72 + mailConfigDto.setPassword(propertiesConfig.getEmailPassword());
73 + mailConfigDto.setMailAccountFlag(propertiesConfig.getMailAccountFlag());
74 + mailConfigDto.setSenderAccount(propertiesConfig.getEmailAccount());
75 + mailConfigDto.setSenderPassword(propertiesConfig.getEmailPassword());
76 + }
52 return mailConfigDto; 77 return mailConfigDto;
53 } 78 }
54 79
55 /** 80 /**
56 * @Author Szl 81 * @Author Szl
82 + * @Description 功能说明 构建邮件body
83 + * @Date 2024/11/22
84 + * @param bizCode
85 + * @return void
86 + */
87 + private String createEmailBody(String bizCode){
88 + /**
89 + * 邮件备注
90 + */
91 + StringBuffer remarks = new StringBuffer();
92 + ParamConfig paramConfig = paramConfigRepository.findValueByCode(ParamConfigConstants.TASK_PARAM_KEYS.NOTIFICATION_SENDER_EMAIL_INTERVAL);
93 + this.buildBottom(remarks,paramConfig.getValue());
94 + /**
95 + * 添加模板
96 + */
97 + return duplicateEmailTemplate.getBody(propertiesConfig.getBaseUrl()+propertiesConfig.getLine(),
98 + propertiesConfig.getBaseUrl()+propertiesConfig.getFedex(),
99 + bizCode, remarks);
100 + }
101 +
102 +
103 + /**
104 + * @Author Szl
105 + * @Description 功能说明 构建底部备注
106 + * @Date 2024/11/21
107 + * @param remarks
108 + * @return void
109 + */
110 + private void buildBottom(StringBuffer remarks, String paramConfig){
111 + remarks.append(duplicateEmailTemplate.getDescription(paramConfig));
112 + }
113 +
114 + /**
115 + * @Author Szl
57 * @Description 功能说明 更新Email状态 116 * @Description 功能说明 更新Email状态
58 * @Date 2024/11/20 117 * @Date 2024/11/20
59 * @param result 118 * @param result
...@@ -62,21 +121,21 @@ public class DuplicateEmailUtil { ...@@ -62,21 +121,21 @@ public class DuplicateEmailUtil {
62 * @return com.fedex.connect.common.model.biz.Email 121 * @return com.fedex.connect.common.model.biz.Email
63 */ 122 */
64 public void updateEmail(boolean result, Email email, CacheSystem cacheSystem){ 123 public void updateEmail(boolean result, Email email, CacheSystem cacheSystem){
65 - DictionaryEntries pending = cacheSystem.getDicEmailStatus(EmailStatusEnum.PENDING.getEnMsg()); 124 + DictionaryEntries pending = cacheSystem.getDicEmailStatus(EmailStatusEnum.PENDING.getCode());
66 - DictionaryEntries success = cacheSystem.getDicEmailStatus(EmailStatusEnum.SUCCESS.getEnMsg()); 125 + DictionaryEntries success = cacheSystem.getDicEmailStatus(EmailStatusEnum.SUCCESS.getCode());
67 - DictionaryEntries failed = cacheSystem.getDicEmailStatus(EmailStatusEnum.FAILED.getEnMsg()); 126 + DictionaryEntries failed = cacheSystem.getDicEmailStatus(EmailStatusEnum.FAILED.getCode());
68 email.setSendTime(new Date()); 127 email.setSendTime(new Date());
69 if (result){ 128 if (result){
70 - email.setTypeCode(success.getCode()); 129 + email.setStatusCode(success.getCode());
71 - email.setTypeName(success.getEnglishName()); 130 + email.setStatusName(success.getEnglishName());
72 }else { 131 }else {
73 if (email.getSendNum()<3){ 132 if (email.getSendNum()<3){
74 - email.setTypeCode(pending.getCode()); 133 + email.setStatusCode(pending.getCode());
75 - email.setTypeName(pending.getEnglishName()); 134 + email.setStatusName(pending.getEnglishName());
76 email.setSendNum(email.getSendNum()+1); 135 email.setSendNum(email.getSendNum()+1);
77 }else { 136 }else {
78 - email.setTypeCode(failed.getCode()); 137 + email.setStatusCode(failed.getCode());
79 - email.setTypeName(failed.getEnglishName()); 138 + email.setStatusName(failed.getEnglishName());
80 } 139 }
81 } 140 }
82 } 141 }
......
...@@ -7,10 +7,10 @@ import com.fedex.connect.common.dependencies.enums.biz.EmailTypeEnum; ...@@ -7,10 +7,10 @@ import com.fedex.connect.common.dependencies.enums.biz.EmailTypeEnum;
7 import com.fedex.connect.common.dependencies.enums.biz.PushObStatusEnum; 7 import com.fedex.connect.common.dependencies.enums.biz.PushObStatusEnum;
8 import com.fedex.connect.common.dependencies.template.clearanceEmail.SendFailedEmailTemplate; 8 import com.fedex.connect.common.dependencies.template.clearanceEmail.SendFailedEmailTemplate;
9 import com.fedex.connect.common.dependencies.util.AssignmentFieldUtils; 9 import com.fedex.connect.common.dependencies.util.AssignmentFieldUtils;
10 -import com.fedex.connect.common.model.biz.Email;
11 import com.fedex.connect.common.model.biz.PushOb; 10 import com.fedex.connect.common.model.biz.PushOb;
12 import com.fedex.connect.common.model.log.EmailHistory; 11 import com.fedex.connect.common.model.log.EmailHistory;
13 import com.fedex.connect.common.model.sys.ParamConfig; 12 import com.fedex.connect.common.model.sys.ParamConfig;
13 +import com.fedex.connect.task.config.PropertiesConfig;
14 import com.fedex.connect.task.data.dto.MailConfigDto; 14 import com.fedex.connect.task.data.dto.MailConfigDto;
15 import com.fedex.connect.task.data.dto.SendFailedEmailDto; 15 import com.fedex.connect.task.data.dto.SendFailedEmailDto;
16 import com.fedex.connect.task.repository.repo.biz.IEmailRepository; 16 import com.fedex.connect.task.repository.repo.biz.IEmailRepository;
...@@ -44,8 +44,8 @@ public class SendFailedEmailUtil { ...@@ -44,8 +44,8 @@ public class SendFailedEmailUtil {
44 * @param 44 * @param
45 * @return java.util.List<com.fedex.connect.common.model.biz.Email> 45 * @return java.util.List<com.fedex.connect.common.model.biz.Email>
46 */ 46 */
47 - public List<Email> getEmails(String date){ 47 + public List<EmailHistory> getEmails(String date){
48 - return emailRepository.findEmailsByModifyTime(date); 48 + return emailHistoryRepository.findEmailsByModifyTime(date);
49 } 49 }
50 50
51 /** 51 /**
...@@ -64,7 +64,7 @@ public class SendFailedEmailUtil { ...@@ -64,7 +64,7 @@ public class SendFailedEmailUtil {
64 * @param emails 64 * @param emails
65 * @return java.util.List<com.fedex.connect.task.data.dto.SendFailedEmailDto> 65 * @return java.util.List<com.fedex.connect.task.data.dto.SendFailedEmailDto>
66 */ 66 */
67 - public List<SendFailedEmailDto> createSendFailedEmailDto(List<Email> emails,List<PushOb> obs,Map<String, ParamConfig> paramConfig){ 67 + public List<SendFailedEmailDto> createSendFailedEmailDto(List<EmailHistory> emails,List<PushOb> obs,Map<String, ParamConfig> paramConfig){
68 List<SendFailedEmailDto> emailDto = this.getEmailDto(emails,paramConfig.get(ParamConfigConstants.TASK_PARAM_KEYS.FAILED_EMAIL_CON_NUMBER).getValue()); 68 List<SendFailedEmailDto> emailDto = this.getEmailDto(emails,paramConfig.get(ParamConfigConstants.TASK_PARAM_KEYS.FAILED_EMAIL_CON_NUMBER).getValue());
69 if (!CollectionUtils.isEmpty(obs)){ 69 if (!CollectionUtils.isEmpty(obs)){
70 SendFailedEmailDto obDto = this.getObDto(obs,paramConfig.get(ParamConfigConstants.TASK_PARAM_KEYS.FAILED_EMAIL_CON_NUMBER).getValue()); 70 SendFailedEmailDto obDto = this.getObDto(obs,paramConfig.get(ParamConfigConstants.TASK_PARAM_KEYS.FAILED_EMAIL_CON_NUMBER).getValue());
...@@ -98,18 +98,18 @@ public class SendFailedEmailUtil { ...@@ -98,18 +98,18 @@ public class SendFailedEmailUtil {
98 * @param emails 98 * @param emails
99 * @return java.util.List<com.fedex.connect.task.data.dto.SendFailedEmailDto> 99 * @return java.util.List<com.fedex.connect.task.data.dto.SendFailedEmailDto>
100 */ 100 */
101 - private List<SendFailedEmailDto> getEmailDto(List<Email> emails,String size){ 101 + private List<SendFailedEmailDto> getEmailDto(List<EmailHistory> emails,String size){
102 // 定义所有可能的 TYPE_CODE 102 // 定义所有可能的 TYPE_CODE
103 List<String> allTypeCodes = EmailTypeEnum.getFailedAlertCodes(); 103 List<String> allTypeCodes = EmailTypeEnum.getFailedAlertCodes();
104 104
105 // 按 TYPE_CODE 分组 105 // 按 TYPE_CODE 分组
106 - Map<String, List<Email>> groupedEmails = emails.stream() 106 + Map<String, List<EmailHistory>> groupedEmails = emails.stream()
107 - .collect(Collectors.groupingBy(Email::getTypeCode)); 107 + .collect(Collectors.groupingBy(EmailHistory::getTypeCode));
108 108
109 // 处理每个 TYPE_CODE 109 // 处理每个 TYPE_CODE
110 List<SendFailedEmailDto> results = allTypeCodes.stream() 110 List<SendFailedEmailDto> results = allTypeCodes.stream()
111 .map(typeCode -> { 111 .map(typeCode -> {
112 - List<Email> emailList = groupedEmails.getOrDefault(typeCode, Collections.emptyList()); 112 + List<EmailHistory> emailList = groupedEmails.getOrDefault(typeCode, Collections.emptyList());
113 113
114 // 1. 统计 STATUS_CODE 为 FAILED 的数量 114 // 1. 统计 STATUS_CODE 为 FAILED 的数量
115 long statusCodeCount = emailList.stream() 115 long statusCodeCount = emailList.stream()
...@@ -118,9 +118,9 @@ public class SendFailedEmailUtil { ...@@ -118,9 +118,9 @@ public class SendFailedEmailUtil {
118 118
119 // 2. 获取 MODIFY_TIME 最晚的 10 个 BIZ_CODE 119 // 2. 获取 MODIFY_TIME 最晚的 10 个 BIZ_CODE
120 List<String> latestBizCodes = emailList.stream() 120 List<String> latestBizCodes = emailList.stream()
121 - .sorted(Comparator.comparing(Email::getModifyTime).reversed()) 121 + .sorted(Comparator.comparing(EmailHistory::getModifyTime).reversed())
122 .limit(Long.parseLong(size)) 122 .limit(Long.parseLong(size))
123 - .map(Email::getBizCode) 123 + .map(EmailHistory::getBizCode)
124 .collect(Collectors.toList()); 124 .collect(Collectors.toList());
125 125
126 // 3. 统计 TYPE_CODE 的总数量 126 // 3. 统计 TYPE_CODE 的总数量
...@@ -168,9 +168,13 @@ public class SendFailedEmailUtil { ...@@ -168,9 +168,13 @@ public class SendFailedEmailUtil {
168 */ 168 */
169 private StringBuilder getTableRows(List<SendFailedEmailDto> sendFailedEmailDto,StringBuilder tableRows){ 169 private StringBuilder getTableRows(List<SendFailedEmailDto> sendFailedEmailDto,StringBuilder tableRows){
170 for (SendFailedEmailDto failedEmailDto : sendFailedEmailDto) { 170 for (SendFailedEmailDto failedEmailDto : sendFailedEmailDto) {
171 + String bizCodesStr = failedEmailDto.getBizCodes().stream()
172 + .filter(Objects::nonNull) // 过滤掉 null 值
173 + .map(String::trim) // 去除每个元素的前后空格
174 + .collect(Collectors.joining(","));
171 tableRows.append("<tr>" + 175 tableRows.append("<tr>" +
172 "<td style=\"border: 1px solid #dddddd;text-align: left;padding: 8px;\">"+EmailTypeEnum.getEnMsgByCode(failedEmailDto.getTypeCode())+"</td>" + 176 "<td style=\"border: 1px solid #dddddd;text-align: left;padding: 8px;\">"+EmailTypeEnum.getEnMsgByCode(failedEmailDto.getTypeCode())+"</td>" +
173 - "<td style=\"border: 1px solid #dddddd;text-align: left;padding: 8px;\">"+ failedEmailDto.getBizCodes() +"</td>" + 177 + "<td style=\"border: 1px solid #dddddd;text-align: left;padding: 8px;\">"+ bizCodesStr +"</td>" +
174 "<td style=\"border: 1px solid #dddddd;text-align: left;padding: 8px;\">"+ failedEmailDto.getTotalCount() +"</td>" + 178 "<td style=\"border: 1px solid #dddddd;text-align: left;padding: 8px;\">"+ failedEmailDto.getTotalCount() +"</td>" +
175 "<td style=\"border: 1px solid #dddddd;text-align: left;padding: 8px;\">"+ failedEmailDto.getStatusCodeCount() +"</td>" + 179 "<td style=\"border: 1px solid #dddddd;text-align: left;padding: 8px;\">"+ failedEmailDto.getStatusCodeCount() +"</td>" +
176 "</tr>"); 180 "</tr>");
...@@ -205,25 +209,36 @@ public class SendFailedEmailUtil { ...@@ -205,25 +209,36 @@ public class SendFailedEmailUtil {
205 * @param body 209 * @param body
206 * @return com.fedex.connect.task.data.dto.MailConfigDto 210 * @return com.fedex.connect.task.data.dto.MailConfigDto
207 */ 211 */
208 - public MailConfigDto createMailConfigDto(String body){ 212 + public MailConfigDto createMailConfigDto(String body, PropertiesConfig propertiesConfig){
209 MailConfigDto mailConfigDto = new MailConfigDto(); 213 MailConfigDto mailConfigDto = new MailConfigDto();
210 - mailConfigDto.setHost(""); 214 + mailConfigDto.setHost(propertiesConfig.getHost());
211 - mailConfigDto.setPort(""); 215 + mailConfigDto.setPort(propertiesConfig.getPort());
212 - mailConfigDto.setAuth(""); 216 + mailConfigDto.setAuth(propertiesConfig.getAuth());
213 //设置代理 217 //设置代理
214 - mailConfigDto.setProxyStartFlag(""); 218 + mailConfigDto.setProxyStartFlag(propertiesConfig.getProxyStartFlag());
215 - mailConfigDto.setProxyHost(""); 219 + mailConfigDto.setProxyHost(propertiesConfig.getProxyHost());
216 - mailConfigDto.setProxyPort(""); 220 + mailConfigDto.setProxyPort(propertiesConfig.getProxyPort());
217 - //发件人 221 +
218 - mailConfigDto.setFrom(""); 222 +
219 - //发件人密码
220 - mailConfigDto.setPassword("");
221 - //ce接收人
222 - mailConfigDto.setTo("");
223 //设置邮件标题 223 //设置邮件标题
224 - mailConfigDto.setSubject(""); 224 + mailConfigDto.setSubject(sendFailedEmailTemplate.getTitle());
225 - //设置邮件内容
226 mailConfigDto.setContent(body); 225 mailConfigDto.setContent(body);
226 +
227 + if (propertiesConfig.getEnv().equalsIgnoreCase("dev")
228 + || propertiesConfig.getEnv().equalsIgnoreCase("test")
229 + ) {
230 + //ce接收人
231 + mailConfigDto.setTo("zelong.shao@erry.com");
232 + mailConfigDto.setCcAccount("");
233 + mailConfigDto.setReceiveAccount("zelong.shao@erry.com");
234 + //发件人
235 + mailConfigDto.setFrom(propertiesConfig.getEmailAccount());
236 + //发件人密码
237 + mailConfigDto.setPassword(propertiesConfig.getEmailPassword());
238 + mailConfigDto.setMailAccountFlag(propertiesConfig.getMailAccountFlag());
239 + mailConfigDto.setSenderAccount(propertiesConfig.getEmailAccount());
240 + mailConfigDto.setSenderPassword(propertiesConfig.getEmailPassword());
241 + }
227 return mailConfigDto; 242 return mailConfigDto;
228 } 243 }
229 244
...@@ -242,13 +257,13 @@ public class SendFailedEmailUtil { ...@@ -242,13 +257,13 @@ public class SendFailedEmailUtil {
242 email.setSubject(mailConfigDto.getSubject()); 257 email.setSubject(mailConfigDto.getSubject());
243 email.setBody(mailConfigDto.getContent()); 258 email.setBody(mailConfigDto.getContent());
244 email.setTypeCode(EmailTypeEnum.SEND_FAILED_EMAIL.getCode()); 259 email.setTypeCode(EmailTypeEnum.SEND_FAILED_EMAIL.getCode());
245 - email.setTypeName(EmailTypeEnum.SEND_FAILED_EMAIL.getMsg()); 260 + email.setTypeName(EmailTypeEnum.SEND_FAILED_EMAIL.getEnMsg());
246 if (result){ 261 if (result){
247 email.setStatusCode(EmailStatusEnum.SUCCESS.getCode()); 262 email.setStatusCode(EmailStatusEnum.SUCCESS.getCode());
248 - email.setStatusName(EmailStatusEnum.SUCCESS.getMsg()); 263 + email.setStatusName(EmailStatusEnum.SUCCESS.getEnMsg());
249 }else { 264 }else {
250 email.setStatusCode(EmailStatusEnum.FAILED.getCode()); 265 email.setStatusCode(EmailStatusEnum.FAILED.getCode());
251 - email.setStatusName(EmailStatusEnum.FAILED.getMsg()); 266 + email.setStatusName(EmailStatusEnum.FAILED.getEnMsg());
252 } 267 }
253 email.setSendNum(DigitConstants.DIGIT_ONE_LONG); 268 email.setSendNum(DigitConstants.DIGIT_ONE_LONG);
254 email.setSendTime(new Date()); 269 email.setSendTime(new Date());
......
...@@ -20,6 +20,19 @@ export: ...@@ -20,6 +20,19 @@ export:
20 sendObRetry: 0 0/1 * * * ? 20 sendObRetry: 0 0/1 * * * ?
21 #发送邮件到预清关组 21 #发送邮件到预清关组
22 pushConFile: 0 0/1 * * * ? 22 pushConFile: 0 0/1 * * * ?
23 + mail:
24 + smtp:
25 + host: smtp.qiye.aliyun.com
26 + port: 25
27 + needauth: true
28 + proxy:
29 + startFlag: false
30 + host: sin-proxy.apac.fedex.com
31 + port: 3128
32 + mailAccountFlag: true
33 + sendEmail:
34 + account: tao.mo@erry.com
35 + password: xiaozhen!1
23 36
24 rpc: 37 rpc:
25 url: 38 url:
...@@ -38,3 +51,8 @@ tw001: ...@@ -38,3 +51,8 @@ tw001:
38 bak: ${tw001.path.basePath}BAK/ 51 bak: ${tw001.path.basePath}BAK/
39 #异常目录 52 #异常目录
40 error: ${tw001.path.basePath}ERROR/ 53 error: ${tw001.path.basePath}ERROR/
54 +
55 +url:
56 + baseUrl: http://localhost:8084/ImpPer/
57 + fedex: fedex.png
58 + line: line.png
...\ No newline at end of file ...\ No newline at end of file
......
1 +#******************系统操作日志记录,中文展示******************
2 +business_log_20001=添加运单
3 +business_log_20002=提交运单
4 +business_log_20003=运单查询
5 +business_log_20004=运单详细信息查询
6 +business_log_20005=根据运单ID查询用户上传记录
7 +business_log_20006=运单历史上传记录查询
8 +system_exception_20003=提示信息过长,未保存成功
9 +
10 +#******************鉴权相关提示,需要做国际化******************
11 +#authentication包
12 +system_exception_10001=没有访问权限
13 +system_exception_10002=没有通过权限认证
14 +system_exception_10003=登录身份异常
15 +system_exception_10004=登录超过8小时,请重新登录
16 +system_exception_10005=登录已过期
17 +system_exception_10006=登录已过期,请重新登录
18 +
19 +#******************业务相关、需要做国际化******************
20 +#*********用于字段描述使用,不单独使用**********
21 +business_field_31001=发货人计费账号
22 +business_field_31002=运单ID
23 +business_field_31003=运单号
24 +business_field_31004=原产国编码
25 +business_field_31005=原产国名称
26 +business_field_31006=目的国编码
27 +business_field_31007=目的国全称
28 +business_field_31008=文件业务类型
29 +business_field_31009=Consignment Code
30 +business_field_31010=Contact Person
31 +business_field_31011=Contact Person's Email
32 +business_field_31012=Contact Phone
33 +
34 +#*********具体响应到前端**********
35 +business_exception_30001=#{0}必填字段未填写
36 +business_exception_30002=单次最多可查询1000个运单号码
37 +business_exception_30003=#{0}不正确,请重新输入
38 +business_exception_30004=The waybill you entered is generated by another user, whether continue uploading? Confirm, Cancel. No more prompts in the future for the same situation.
39 +business_exception_30005=The waybill you entered is generated by another account, whether continue uploading? Confirm, Cancel. No more prompts in the future for the same situation.
40 +business_exception_30006=附件上传不符合标准
41 +business_exception_30007=所有上传文件数量不超过#{0}个文件
42 +business_exception_30008=所有上传文件总大小不超过#{0}M
43 +business_exception_30009=运单或发票未上传
44 +business_exception_30010=文件类型不在:运单、发票、箱单、其他
45 +business_exception_30011=该运单已被其他人创建,不可以重复创建
46 +business_exception_30012=UUID不一致
47 +business_exception_30013=文件名为:#{0},上传失败,请检查后重试
48 +business_exception_30014=运单信息加载失败,请稍后重试
49 +business_success_30015=提交成功
50 +business_exception_30016=运单提交失败
...\ No newline at end of file ...\ No newline at end of file
1 +#******************系统操作日志记录,中文展示******************
2 +business_log_20001=添加运单
3 +business_log_20002=提交运单
4 +business_log_20003=运单查询
5 +business_log_20004=运单详细信息查询
6 +business_log_20005=根据运单ID查询用户上传记录
7 +business_log_20006=运单历史上传记录查询
8 +system_exception_20003=提示信息过长,未保存成功
9 +
10 +#******************鉴权相关提示,需要做国际化******************
11 +#authentication包
12 +system_exception_10001=没有访问权限
13 +system_exception_10002=没有通过权限认证
14 +system_exception_10003=登录身份异常
15 +system_exception_10004=登录超过8小时,请重新登录
16 +system_exception_10005=登录已过期
17 +system_exception_10006=登录已过期,请重新登录
18 +
19 +#******************业务相关、需要做国际化******************
20 +#*********用于字段描述使用,不单独使用**********
21 +business_field_31001=发货人计费账号
22 +business_field_31002=运单ID
23 +business_field_31003=运单号
24 +business_field_31004=原产国编码
25 +business_field_31005=原产国名称
26 +business_field_31006=目的国编码
27 +business_field_31007=目的国全称
28 +business_field_31008=文件业务类型
29 +business_field_31009=Consignment Code
30 +business_field_31010=Contact Person
31 +business_field_31011=Contact Person's Email
32 +business_field_31012=Contact Phone
33 +
34 +#*********具体响应到前端**********
35 +business_exception_30001=${0}必填字段未填写
36 +business_exception_30002=单次最多可查询1000个运单号码
37 +business_exception_30003=${0}不正确,请重新输入
38 +business_exception_30004=The waybill you entered is generated by another user, whether continue uploading? Confirm, Cancel. No more prompts in the future for the same situation.
39 +business_exception_30005=The waybill you entered is generated by another account, whether continue uploading? Confirm, Cancel. No more prompts in the future for the same situation.
40 +business_exception_30006=附件上传不符合标准
41 +business_exception_30007=所有上传文件数量不超过50个文件
42 +business_exception_30008=所有上传文件总大小不超过50M
43 +business_exception_30009=运单或发票未上传
44 +business_exception_30010=文件类型不在:运单、发票、箱单、其他
45 +business_exception_30011=该运单已被其他人创建,不可以重复创建
46 +business_exception_30012=UUID不一致
47 +business_exception_30013=文件名为:#{0},上传失败,请检查后重试
48 +business_exception_30014=运单信息加载失败,请稍后重试
49 +business_success_30015=提交成功
50 +business_exception_30016=运单提交失败
...\ No newline at end of file ...\ No newline at end of file