瀏覽代碼

fix:优化报告类型识别

wangzaijun 1 月之前
父節點
當前提交
5e3541c016

+ 19 - 6
mo-daq/src/main/java/com/smppw/modaq/application/components/ReportParseUtils.java

@@ -575,21 +575,34 @@ public final class ReportParseUtils {
 //        reportType = matchReportType(emailType, text);
 //        System.out.println(emailType + ",reportType=" + reportType + ",reportDate=" + matchReportDate(reportType, text));
 
-        text = "潼骁长益3号私募证券投资基金分红预通知公告20250520.pdf";
+//        text = "潼骁长益3号私募证券投资基金分红预通知公告20250520.pdf";
+//        emailType = EmailUtil.getEmailTypeBySubject(text);
+//        reportType = matchReportType(emailType, text);
+//        System.out.println(emailType + ",reportType=" + reportType + ",reportDate=" + matchReportDate(reportType, text));
+//
+//        text = "ST9332_伏犀奇点2号私募投资基金_2024年年报.pdf";
+//        emailType = EmailUtil.getEmailTypeBySubject(text);
+//        reportType = matchReportType(emailType, text);
+//        System.out.println(emailType + ",reportType=" + reportType + ",reportDate=" + matchReportDate(reportType, text));
+//
+//        text = "SZK953_私募基金季报PDF_香元梅花9号行业精选私募证券投资基金_20250331102500.pdf";
+//        emailType = EmailUtil.getEmailTypeBySubject(text);
+//        reportType = matchReportType(emailType, text);
+//        System.out.println(emailType + ",reportType=" + reportType + ",reportDate=" + matchReportDate(reportType, text));
+
+        text = "大岩市场中性2号私募证券投资基金_2025年_4月_月报.pdf";
         emailType = EmailUtil.getEmailTypeBySubject(text);
         reportType = matchReportType(emailType, text);
         System.out.println(emailType + ",reportType=" + reportType + ",reportDate=" + matchReportDate(reportType, text));
 
-        text = "ST9332_伏犀奇点2号私募投资基金_2024年年报.pdf";
+        text = "查理投资2025年04月披露-23号.pdf"; // monthly ?
         emailType = EmailUtil.getEmailTypeBySubject(text);
         reportType = matchReportType(emailType, text);
         System.out.println(emailType + ",reportType=" + reportType + ",reportDate=" + matchReportDate(reportType, text));
 
-        text = "SZK953_私募基金季报PDF_香元梅花9号行业精选私募证券投资基金_20250331102500.pdf";
+        text = "投资策略调整.pdf"; // monthly ?
         emailType = EmailUtil.getEmailTypeBySubject(text);
         reportType = matchReportType(emailType, text);
-        String reportDate = matchReportDate(reportType, text);
-        System.out.println(emailType + ",reportType=" + reportType + ",reportDate=" + reportDate);
-
+        System.out.println(emailType + ",reportType=" + reportType + ",reportDate=" + matchReportDate(reportType, text));
     }
 }

+ 11 - 0
mo-daq/src/main/java/com/smppw/modaq/common/conts/EmailTypeConst.java

@@ -45,6 +45,17 @@ public class EmailTypeConst {
             REPORT_OTHER_TYPE,
             REPORT_WEEKLY_TYPE);
 
+    /**
+     * 所有非其他公告的报告
+     */
+    public final static List<Integer> SUPPORT_NO_OTHER_TYPES = ListUtil.of(
+            REPORT_EMAIL_TYPE,
+            REPORT_LETTER_EMAIL_TYPE,
+            REPORT_WEEKLY_TYPE);
+
+    /**
+     * 所有除确认单的报告
+     */
     public final static List<Integer> REPORT_EMAIL_TYPES = ListUtil.of(
             REPORT_EMAIL_TYPE,
             REPORT_OTHER_TYPE,

+ 11 - 5
mo-daq/src/main/java/com/smppw/modaq/domain/service/EmailParseService.java

@@ -32,7 +32,6 @@ import com.smppw.modaq.domain.entity.EmailParseInfoDO;
 import com.smppw.modaq.domain.mapper.EmailFileInfoMapper;
 import com.smppw.modaq.domain.mapper.EmailParseInfoMapper;
 import com.smppw.modaq.infrastructure.util.ArchiveUtil;
-import com.smppw.modaq.infrastructure.util.PdfUtil;
 import jakarta.mail.*;
 import jakarta.mail.internet.MimeUtility;
 import jakarta.mail.search.ComparisonTerm;
@@ -218,8 +217,13 @@ public class EmailParseService {
             emailContentInfoDTO.setEmailType(emailType);
         }
 
-        if (log.isInfoEnabled()) {
-            log.info("当前邮件{} 所有解压缩文件解压完成:{}", emailTitle, resultList);
+        if (CollUtil.isNotEmpty(resultList)) {
+            for (EmailZipFileDTO dto : resultList) {
+                dto.setEmailType(emailType);
+            }
+            if (log.isInfoEnabled()) {
+                log.info("当前邮件{} 所有解压缩文件解压完成:{}", emailTitle, resultList);
+            }
         }
 
         return resultList;
@@ -293,8 +297,10 @@ public class EmailParseService {
             }
             // 重新判断类型
             for (EmailZipFileDTO dto : dtos) {
-                Integer emailType = EmailUtil.getEmailTypeBySubject(emailTitle + dto.getFilename());
-                dto.setEmailType(emailType);
+                if (!EmailTypeConst.SUPPORT_NO_OTHER_TYPES.contains(dto.getEmailType())) {
+                    Integer emailType = EmailUtil.getEmailTypeBySubject(emailTitle + dto.getFilename());
+                    dto.setEmailType(emailType);
+                }
             }
 
             // 数据库已存在的数据过滤

+ 3 - 3
mo-daq/src/test/java/com/smppw/modaq/MoDaqApplicationTests.java

@@ -37,9 +37,9 @@ public class MoDaqApplicationTests {
 
     @Test
     public void reportTest() {
-        MailboxInfoDTO emailInfoDTO = this.buildMailbox("**@simuwang.com", "***");
-        Date startDate = DateUtil.parse("2025-05-16 11:23:00", DateConst.YYYY_MM_DD_HH_MM_SS);
-        Date endDate = DateUtil.parse("2025-05-24 15:58:00", DateConst.YYYY_MM_DD_HH_MM_SS);
+        MailboxInfoDTO emailInfoDTO = this.buildMailbox("**@simuwang.com", "**");
+        Date startDate = DateUtil.parse("2025-05-23 15:50:00", DateConst.YYYY_MM_DD_HH_MM_SS);
+        Date endDate = DateUtil.parse("2025-05-23 15:58:00", DateConst.YYYY_MM_DD_HH_MM_SS);
         try {
             List<String> folderNames = ListUtil.list(false);
 //            folderNames.add("其他文件夹/报告公告");