|
@@ -514,7 +514,6 @@ public class EmailParseService {
|
|
|
this.checkEmailFileInfo(emailTitle, dtos);
|
|
|
// 解析邮件报告
|
|
|
for (EmailZipFileDTO zipFile : dtos) {
|
|
|
-// EmailFileInfoDO emailFile = this.saveEmailFileInfo(emailId, zipFile.getFilename(), zipFile.getFilepath());
|
|
|
// 解析并保存报告
|
|
|
ParseResult<ReportData> parseResult = this.parseReportAndHandleResult(emailTitle, emailInfo.getSenderEmail(), zipFile);
|
|
|
if (!Objects.equals(1, parseResult.getStatus())) {
|
|
@@ -658,7 +657,7 @@ public class EmailParseService {
|
|
|
}
|
|
|
}
|
|
|
// ocr信息提取(印章、联系人、基金名称和产品代码)
|
|
|
- reportData = this.ocrReportData(fileId, reportType, reportData, fileName, senderEmail, images);
|
|
|
+ reportData = this.ocrReportData(fileId, reportType, monthlyType, reportData, fileName, senderEmail, images);
|
|
|
result.setData(reportData);
|
|
|
if (log.isInfoEnabled()) {
|
|
|
log.info("报告{} 解析耗时{}ms,结果是:{}", fileName, (System.currentTimeMillis() - start), reportData);
|
|
@@ -723,12 +722,17 @@ public class EmailParseService {
|
|
|
/**
|
|
|
* ocr 提取信息(包括首页的基金名称或报告日期,尾页的印章或联系人等信息)
|
|
|
*
|
|
|
- * @param reportData 报告解析结果
|
|
|
- * @param fileName 报告名称
|
|
|
- * @param images 报告的收益和尾页png图片
|
|
|
+ * @param fileId 文件表ID
|
|
|
+ * @param reportType 报告类型
|
|
|
+ * @param monthlyType 月报类型
|
|
|
+ * @param reportData 报告解析结果
|
|
|
+ * @param fileName 报告名称
|
|
|
+ * @param senderEmail 邮件发送人邮箱
|
|
|
+ * @param images 报告的收益和尾页png图片
|
|
|
*/
|
|
|
private ReportData ocrReportData(Integer fileId,
|
|
|
ReportType reportType,
|
|
|
+ ReportMonthlyType monthlyType,
|
|
|
ReportData reportData,
|
|
|
String fileName,
|
|
|
String senderEmail,
|
|
@@ -751,18 +755,25 @@ public class EmailParseService {
|
|
|
}
|
|
|
// ocr识别尾页是否包含印章和联系人信息
|
|
|
if (parseRes != null && reportData.getBaseInfo() != null) {
|
|
|
- if (TG_EMAIL_LIST.contains(senderEmail)) {
|
|
|
- reportData.getBaseInfo().setWithSeals(true);
|
|
|
- } else {
|
|
|
- reportData.getBaseInfo().setWithSeals(parseRes.getWithSeals());
|
|
|
- if (fileName.contains("用印") && !Objects.equals(true, reportData.getBaseInfo().getWithSeals())) {
|
|
|
+ // 协会报告才设置印章标识
|
|
|
+ boolean isAmac = reportType == ReportType.ANNUALLY || reportType == ReportType.QUARTERLY
|
|
|
+ || (reportType == ReportType.MONTHLY && ReportMonthlyType.AMAC == monthlyType);
|
|
|
+ if (isAmac) {
|
|
|
+ if (TG_EMAIL_LIST.contains(senderEmail)) {
|
|
|
reportData.getBaseInfo().setWithSeals(true);
|
|
|
+ } else {
|
|
|
+ reportData.getBaseInfo().setWithSeals(parseRes.getWithSeals());
|
|
|
+ if (fileName.contains("用印") && !Objects.equals(true, reportData.getBaseInfo().getWithSeals())) {
|
|
|
+ reportData.getBaseInfo().setWithSeals(true);
|
|
|
+ }
|
|
|
}
|
|
|
+ } else {
|
|
|
+ // 管理人报告才设置联系人标识
|
|
|
+ reportData.getBaseInfo().setWithContacts(parseRes.getWithContacts());
|
|
|
}
|
|
|
- reportData.getBaseInfo().setWithContacts(parseRes.getWithContacts());
|
|
|
}
|
|
|
// 首页和尾页不相等时解析首页的数据
|
|
|
- if (images.size() != 1) {
|
|
|
+ if (images.size() != 1 || parseRes == null) {
|
|
|
try {
|
|
|
parseRes = new OCRReportParser().parse(fileName, this.ocrParserUrl, images.get(0));
|
|
|
} catch (Exception e) {
|