|
@@ -171,19 +171,7 @@ public class EmailParseService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// 重新判断类型
|
|
// 重新判断类型
|
|
- for (EmailZipFileDTO emailFile : emailFileList) {
|
|
|
|
- if (EmailTypeConst.SUPPORT_NO_OTHER_TYPES.contains(emailFile.getEmailType())) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- Integer type = EmailUtil.getEmailTypeBySubject(emailTitle + emailFile.getFilename());
|
|
|
|
- // 特殊月报
|
|
|
|
- if ((Objects.equals(EmailTypeConst.NAV_EMAIL_TYPE, type) || Objects.equals(EmailTypeConst.REPORT_OTHER_TYPE, type))
|
|
|
|
- && ReportParseUtils.containsAny(emailTitle, ReportParseUtils.MONTHLY_REPORT_KEYWORDS)) {
|
|
|
|
- type = EmailTypeConst.REPORT_EMAIL_TYPE;
|
|
|
|
- }
|
|
|
|
- emailFile.setEmailType(type);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ this.recheckEmailType(emailTitle, emailFileList);
|
|
Iterator<EmailZipFileDTO> entryIterator = emailFileList.iterator();
|
|
Iterator<EmailZipFileDTO> entryIterator = emailFileList.iterator();
|
|
while (entryIterator.hasNext()) {
|
|
while (entryIterator.hasNext()) {
|
|
EmailZipFileDTO entry = entryIterator.next();
|
|
EmailZipFileDTO entry = entryIterator.next();
|
|
@@ -334,13 +322,14 @@ public class EmailParseService {
|
|
*/
|
|
*/
|
|
public List<UploadReportResult> uploadReportResults(UploadReportParams params) {
|
|
public List<UploadReportResult> uploadReportResults(UploadReportParams params) {
|
|
List<ParseResult<ReportData>> dataList = ListUtil.list(false);
|
|
List<ParseResult<ReportData>> dataList = ListUtil.list(false);
|
|
|
|
+ String emailTitle = params.getTitle();
|
|
List<UploadReportParams.ReportInfo> reportInfos = params.getReportInfos();
|
|
List<UploadReportParams.ReportInfo> reportInfos = params.getReportInfos();
|
|
List<EmailZipFileDTO> dtos = ListUtil.list(false);
|
|
List<EmailZipFileDTO> dtos = ListUtil.list(false);
|
|
for (UploadReportParams.ReportInfo e : reportInfos) {
|
|
for (UploadReportParams.ReportInfo e : reportInfos) {
|
|
String reportPath = e.getReportPath();
|
|
String reportPath = e.getReportPath();
|
|
if (ArchiveUtil.isArchive(reportPath)) {
|
|
if (ArchiveUtil.isArchive(reportPath)) {
|
|
try {
|
|
try {
|
|
- this.handleCompressedFiles(params.getTitle(), reportPath, e.getReportType(), dtos);
|
|
|
|
|
|
+ this.handleCompressedFiles(emailTitle, reportPath, e.getReportType(), dtos);
|
|
} catch (Exception ex) {
|
|
} catch (Exception ex) {
|
|
log.warn("报告{} 压缩包解压失败:{}", reportPath, ExceptionUtil.stacktraceToString(ex));
|
|
log.warn("报告{} 压缩包解压失败:{}", reportPath, ExceptionUtil.stacktraceToString(ex));
|
|
ReportData reportData = new ReportData.DefaultReportData();
|
|
ReportData reportData = new ReportData.DefaultReportData();
|
|
@@ -348,10 +337,12 @@ public class EmailParseService {
|
|
dataList.add(new ParseResult<>(ReportParseStatus.ARCHIVE_FAIL, reportData));
|
|
dataList.add(new ParseResult<>(ReportParseStatus.ARCHIVE_FAIL, reportData));
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- dtos.add(new EmailZipFileDTO(params.getTitle(), reportPath, e.getReportType()));
|
|
|
|
|
|
+ dtos.add(new EmailZipFileDTO(emailTitle, reportPath, e.getReportType()));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- EmailInfoDTO emailInfo = new EmailInfoDTO(params.getTitle(), dtos);
|
|
|
|
|
|
+ // 重新判断类型
|
|
|
|
+ this.recheckEmailType(emailTitle, dtos);
|
|
|
|
+ EmailInfoDTO emailInfo = new EmailInfoDTO(emailTitle, dtos);
|
|
// 附件文件检查
|
|
// 附件文件检查
|
|
Long totalSize = this.checkEmailFileInfo(emailInfo);
|
|
Long totalSize = this.checkEmailFileInfo(emailInfo);
|
|
if (totalSize == null) {
|
|
if (totalSize == null) {
|
|
@@ -367,6 +358,27 @@ public class EmailParseService {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * 重新校验邮件附件的类型(用邮件主题+附件名称)
|
|
|
|
+ *
|
|
|
|
+ * @param emailTitle 邮件主题
|
|
|
|
+ * @param dtos 所有附件
|
|
|
|
+ */
|
|
|
|
+ private void recheckEmailType(String emailTitle, List<EmailZipFileDTO> dtos) {
|
|
|
|
+ for (EmailZipFileDTO emailFile : dtos) {
|
|
|
|
+ if (EmailTypeConst.SUPPORT_NO_OTHER_TYPES.contains(emailFile.getEmailType())) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ Integer type = EmailUtil.getEmailTypeBySubject(emailTitle + emailFile.getFilename());
|
|
|
|
+ // 特殊月报
|
|
|
|
+ if ((Objects.equals(EmailTypeConst.NAV_EMAIL_TYPE, type) || Objects.equals(EmailTypeConst.REPORT_OTHER_TYPE, type))
|
|
|
|
+ && ReportParseUtils.containsAny(emailTitle, ReportParseUtils.MONTHLY_REPORT_KEYWORDS)) {
|
|
|
|
+ type = EmailTypeConst.REPORT_EMAIL_TYPE;
|
|
|
|
+ }
|
|
|
|
+ emailFile.setEmailType(type);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
* 邮件信息前置处理,在解析操作执行之前的过滤逻辑和校验逻辑。返回所有附件大小汇总
|
|
* 邮件信息前置处理,在解析操作执行之前的过滤逻辑和校验逻辑。返回所有附件大小汇总
|
|
*
|
|
*
|
|
* @param emailInfo 邮件信息(包含所有解压后的文件)
|
|
* @param emailInfo 邮件信息(包含所有解压后的文件)
|