|
@@ -78,7 +78,6 @@ public class EmailParseService {
|
|
// 按需添加其他类型...
|
|
// 按需添加其他类型...
|
|
);
|
|
);
|
|
|
|
|
|
- // private final EmailFieldMappingMapper emailFieldMapper;
|
|
|
|
private final EmailParseInfoMapper emailParseInfoMapper;
|
|
private final EmailParseInfoMapper emailParseInfoMapper;
|
|
private final EmailFileInfoMapper emailFileInfoMapper;
|
|
private final EmailFileInfoMapper emailFileInfoMapper;
|
|
/* 报告解析和入库的方法 */
|
|
/* 报告解析和入库的方法 */
|
|
@@ -859,6 +858,7 @@ public class EmailParseService {
|
|
log.warn("{} 获取不到邮件 -> 邮箱信息:{},开始时间:{},结束时间:{}", folderName, mailboxInfoDTO, startDate, endDate);
|
|
log.warn("{} 获取不到邮件 -> 邮箱信息:{},开始时间:{},结束时间:{}", folderName, mailboxInfoDTO, startDate, endDate);
|
|
return MapUtil.newHashMap();
|
|
return MapUtil.newHashMap();
|
|
}
|
|
}
|
|
|
|
+ String emailAddress = mailboxInfoDTO.getAccount();
|
|
Map<String, List<EmailContentInfoDTO>> emailMessageMap = MapUtil.newHashMap();
|
|
Map<String, List<EmailContentInfoDTO>> emailMessageMap = MapUtil.newHashMap();
|
|
for (Message message : messages) {
|
|
for (Message message : messages) {
|
|
long start = System.currentTimeMillis();
|
|
long start = System.currentTimeMillis();
|
|
@@ -874,14 +874,13 @@ public class EmailParseService {
|
|
if (log.isInfoEnabled()) {
|
|
if (log.isInfoEnabled()) {
|
|
log.info("{} 邮件{} 数据获取中,邮件时间:{}", folderName, emailTitle, emailDateStr);
|
|
log.info("{} 邮件{} 数据获取中,邮件时间:{}", folderName, emailTitle, emailDateStr);
|
|
}
|
|
}
|
|
-
|
|
|
|
boolean isNotParseConditionSatisfied = emailDate == null
|
|
boolean isNotParseConditionSatisfied = emailDate == null
|
|
|| (endDate != null && emailDate.compareTo(endDate) > 0)
|
|
|| (endDate != null && emailDate.compareTo(endDate) > 0)
|
|
|| (startDate != null && emailDate.compareTo(startDate) < 0);
|
|
|| (startDate != null && emailDate.compareTo(startDate) < 0);
|
|
if (isNotParseConditionSatisfied) {
|
|
if (isNotParseConditionSatisfied) {
|
|
String st = DateUtil.formatDateTime(startDate);
|
|
String st = DateUtil.formatDateTime(startDate);
|
|
String ed = DateUtil.formatDateTime(endDate);
|
|
String ed = DateUtil.formatDateTime(endDate);
|
|
- log.warn("{} 邮件[{}]日期{}不在区间内【{} ~ {}】", folderName, emailTitle, emailDateStr, st, ed);
|
|
|
|
|
|
+ log.warn("{} 邮件{} 发送时间{}不在区间内【{} ~ {}】", folderName, emailTitle, emailDateStr, st, ed);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
String senderEmail = getSenderEmail(message);
|
|
String senderEmail = getSenderEmail(message);
|
|
@@ -890,15 +889,23 @@ public class EmailParseService {
|
|
log.warn("{} 邮件不满足解析条件 -> 邮件主题:{},邮件日期:{}", folderName, emailTitle, emailDateStr);
|
|
log.warn("{} 邮件不满足解析条件 -> 邮件主题:{},邮件日期:{}", folderName, emailTitle, emailDateStr);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
+ // 成功解析的邮件不用重复下载
|
|
|
|
+ Integer okNum = this.emailParseInfoMapper.countEmailByInfoAndStatus(emailTitle, senderEmail, emailAddress, emailDateStr);
|
|
|
|
+ if (okNum > 0) {
|
|
|
|
+ if (log.isInfoEnabled()) {
|
|
|
|
+ log.info("{} 邮件{} 已经存在解析完成的记录,不要重复下载了。", folderName, emailTitle);
|
|
|
|
+ }
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
if (log.isInfoEnabled()) {
|
|
if (log.isInfoEnabled()) {
|
|
log.info("{} 邮件{} 基本信息获取完成,开始下载附件!邮件日期:{}", folderName, emailTitle, emailDateStr);
|
|
log.info("{} 邮件{} 基本信息获取完成,开始下载附件!邮件日期:{}", folderName, emailTitle, emailDateStr);
|
|
}
|
|
}
|
|
Object content = message.getContent();
|
|
Object content = message.getContent();
|
|
|
|
|
|
if (content instanceof Multipart multipart) {
|
|
if (content instanceof Multipart multipart) {
|
|
- this.reMultipart(mailboxInfoDTO.getAccount(), emailTitle, emailDate, multipart, dtos);
|
|
|
|
|
|
+ this.reMultipart(emailAddress, emailTitle, emailDate, multipart, dtos);
|
|
} else if (content instanceof Part part) {
|
|
} else if (content instanceof Part part) {
|
|
- this.rePart(mailboxInfoDTO.getAccount(), emailTitle, emailDate, part, dtos);
|
|
|
|
|
|
+ this.rePart(emailAddress, emailTitle, emailDate, part, dtos);
|
|
} else {
|
|
} else {
|
|
log.warn("{} 不支持的邮件数据 {}", folderName, emailTitle);
|
|
log.warn("{} 不支持的邮件数据 {}", folderName, emailTitle);
|
|
}
|
|
}
|