|
@@ -159,7 +159,8 @@ public class EmailParseService {
|
|
emailFileList.addAll(this.parseZipEmail(emailDto));
|
|
emailFileList.addAll(this.parseZipEmail(emailDto));
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
log.error("压缩包解压失败:{}", ExceptionUtil.stacktraceToString(e));
|
|
log.error("压缩包解压失败:{}", ExceptionUtil.stacktraceToString(e));
|
|
- EmailParseInfoDO fail = buildEmailParseInfo(mailboxInfoDTO.getAccount(), dto.getEmailType(), emailInfo, emailDto.getFileSize());
|
|
|
|
|
|
+ EmailParseInfoDO fail = buildEmailParseInfo(mailboxInfoDTO.getAccount(),
|
|
|
|
+ dto.getEmailType(), emailInfo, emailDto.getFileSize());
|
|
fail.setFailReason("压缩包解压失败");
|
|
fail.setFailReason("压缩包解压失败");
|
|
fail.setParseStatus(EmailParseStatusConst.FAIL);
|
|
fail.setParseStatus(EmailParseStatusConst.FAIL);
|
|
fail.setEmailKey(emailEntry.getKey());
|
|
fail.setEmailKey(emailEntry.getKey());
|
|
@@ -232,7 +233,8 @@ public class EmailParseService {
|
|
|
|
|
|
private void handleCompressedFiles(String emailTitle, String filepath, String extension,
|
|
private void handleCompressedFiles(String emailTitle, String filepath, String extension,
|
|
Integer emailType, List<EmailZipFileDTO> resultList) throws IOException {
|
|
Integer emailType, List<EmailZipFileDTO> resultList) throws IOException {
|
|
- String destPath = getDestinationPath(filepath, extension);
|
|
|
|
|
|
+ String parent = FileUtil.getParent(filepath, 2);
|
|
|
|
+ String destPath = parent + File.separator + "archive" + File.separator + FileUtil.mainName(filepath);
|
|
|
|
|
|
File destFile = new File(destPath);
|
|
File destFile = new File(destPath);
|
|
if (!destFile.exists()) {
|
|
if (!destFile.exists()) {
|
|
@@ -426,8 +428,9 @@ public class EmailParseService {
|
|
List<String> images = ListUtil.list(true);
|
|
List<String> images = ListUtil.list(true);
|
|
if (Objects.equals(ReportParserFileType.PDF, fileType)) {
|
|
if (Objects.equals(ReportParserFileType.PDF, fileType)) {
|
|
try {
|
|
try {
|
|
- String output = FileUtil.getParent(filepath, 1) + File.separator + "image";
|
|
|
|
- images = PdfUtil.convertFirstAndLastPagesToPng(filepath, FileUtil.file(output), 300);
|
|
|
|
|
|
+ String output = filepath.replaceAll("archive|original", "image");
|
|
|
|
+ File outputFile = FileUtil.file(FileUtil.getParent(output, 1));
|
|
|
|
+ images = PdfUtil.convertFirstAndLastPagesToPng(filepath, outputFile, 300);
|
|
if (log.isDebugEnabled()) {
|
|
if (log.isDebugEnabled()) {
|
|
log.debug("报告[{}] 生成的图片地址是:\n{}", fileName, images);
|
|
log.debug("报告[{}] 生成的图片地址是:\n{}", fileName, images);
|
|
}
|
|
}
|
|
@@ -880,7 +883,7 @@ public class EmailParseService {
|
|
}
|
|
}
|
|
|
|
|
|
String emailDateStr = DateUtil.format(sendDate, DateConst.YYYYMMDD);
|
|
String emailDateStr = DateUtil.format(sendDate, DateConst.YYYYMMDD);
|
|
- String filePath = path + File.separator + account + File.separator + emailDateStr + File.separator;
|
|
|
|
|
|
+ String filePath = path + File.separator + account + File.separator + emailDateStr + File.separator + "original" + File.separator;
|
|
// 压缩包重名时的后面的压缩包会覆盖前面压缩包的问题(不考虑普通文件)
|
|
// 压缩包重名时的后面的压缩包会覆盖前面压缩包的问题(不考虑普通文件)
|
|
String emailDate = DateUtil.format(sendDate, DateConst.YYYYMMDDHHMMSS24);
|
|
String emailDate = DateUtil.format(sendDate, DateConst.YYYYMMDDHHMMSS24);
|
|
String realName = ArchiveUtil.isArchive(fileName) ? emailDate + fileName : fileName;
|
|
String realName = ArchiveUtil.isArchive(fileName) ? emailDate + fileName : fileName;
|