|
@@ -529,7 +529,7 @@ public class EmailParseService {
|
|
|
try {
|
|
|
String output = filepath.replaceAll("archive|original", "image");
|
|
|
File outputFile = FileUtil.file(FileUtil.getParent(output, 1));
|
|
|
- images = PdfUtil.convertFirstAndLastPagesToPng(filepath, outputFile, 300);
|
|
|
+ images = PdfUtil.convertFirstAndLastPagesToPng(filepath, outputFile, 300, zipFile.getPdfPwd());
|
|
|
if (log.isDebugEnabled()) {
|
|
|
log.debug("报告{} 生成的图片地址是:\n{}", fileName, images);
|
|
|
}
|
|
@@ -995,13 +995,13 @@ public class EmailParseService {
|
|
|
if (log.isInfoEnabled()) {
|
|
|
log.info("{} 邮件{} 基本信息获取完成,开始下载附件!邮件日期:{}", folderName, emailTitle, emailDateStr);
|
|
|
}
|
|
|
- Object content = message.getContent();
|
|
|
|
|
|
- if (content instanceof Multipart multipart) {
|
|
|
- this.reMultipart(emailAddress, emailTitle, emailDate, multipart, dtos);
|
|
|
- } else if (content instanceof Part part) {
|
|
|
- this.rePart(emailAddress, emailTitle, emailDate, part, dtos);
|
|
|
+ Object messageContent = message.getContent();
|
|
|
+ String content;
|
|
|
+ if (messageContent instanceof Multipart multipart) {
|
|
|
+ content = this.reMultipart(emailAddress, emailTitle, emailDate, multipart, dtos);
|
|
|
} else {
|
|
|
+ content = null;
|
|
|
log.warn("{} 邮件{} 获取不了附件", folderName, emailTitle);
|
|
|
}
|
|
|
if (CollUtil.isEmpty(dtos)) {
|
|
@@ -1011,6 +1011,7 @@ public class EmailParseService {
|
|
|
dtos.forEach(e -> {
|
|
|
e.setEmailType(emailType);
|
|
|
e.setSenderEmail(senderEmail);
|
|
|
+ e.setEmailContent(content);
|
|
|
});
|
|
|
emailMessageMap.put(IdUtil.simpleUUID(), dtos);
|
|
|
} catch (Exception e) {
|
|
@@ -1095,23 +1096,26 @@ public class EmailParseService {
|
|
|
return FileUtil.file(filePath + realName);
|
|
|
}
|
|
|
|
|
|
- private void reMultipart(String account, String subject, Date emailDate, Multipart multipart,
|
|
|
+ private String reMultipart(String account, String subject, Date emailDate, Multipart multipart,
|
|
|
List<EmailContentInfoDTO> emailContentInfoDTOList) throws Exception {
|
|
|
+ String content = null;
|
|
|
for (int i = 0; i < multipart.getCount(); i++) {
|
|
|
Part bodyPart = multipart.getBodyPart(i);
|
|
|
- Object content = bodyPart.getContent();
|
|
|
- if (content instanceof String) {
|
|
|
+ Object bodyPartContent = bodyPart.getContent();
|
|
|
+ if (bodyPartContent instanceof String) {
|
|
|
if (log.isDebugEnabled()) {
|
|
|
- log.debug("邮件{} 获取的正文不做解析,内容是 {}", subject, content);
|
|
|
+ log.debug("邮件{} 获取的正文不做解析,内容是 {}", subject, bodyPartContent);
|
|
|
}
|
|
|
+ content = bodyPartContent.toString();
|
|
|
continue;
|
|
|
}
|
|
|
- if (content instanceof Multipart mp) {
|
|
|
+ if (bodyPartContent instanceof Multipart mp) {
|
|
|
this.reMultipart(account, subject, emailDate, mp, emailContentInfoDTOList);
|
|
|
} else {
|
|
|
this.rePart(account, subject, emailDate, bodyPart, emailContentInfoDTOList);
|
|
|
}
|
|
|
}
|
|
|
+ return content;
|
|
|
}
|
|
|
|
|
|
private String getSenderEmail(Message message) {
|