Bladeren bron

fix:暂时去掉图片生成的逻辑+优化产品代码匹配规则

wangzaijun 1 maand geleden
bovenliggende
commit
606fe29102

+ 28 - 5
mo-daq/src/main/java/com/smppw/modaq/domain/dto/report/ReportFundInfoDTO.java

@@ -1,5 +1,6 @@
 package com.smppw.modaq.domain.dto.report;
 
+import com.smppw.modaq.application.components.ReportParseUtils;
 import com.smppw.modaq.domain.entity.report.ReportFundInfoDO;
 import com.smppw.modaq.infrastructure.util.DateUtils;
 import lombok.Getter;
@@ -13,11 +14,11 @@ import java.util.Objects;
  * @description 报告基金基本信息
  */
 @Setter
-@Getter
 public class ReportFundInfoDTO extends BaseReportDTO<ReportFundInfoDO> {
     /**
      * 基金的名称
      */
+    @Getter
     private String fundName;
 
     /**
@@ -28,74 +29,95 @@ public class ReportFundInfoDTO extends BaseReportDTO<ReportFundInfoDO> {
     /**
      * 基金管理人的名称
      */
+    @Getter
     private String companyName;
 
     /**
      * 基金交易使用的货币种类
      */
+    @Getter
     private String currency;
 
     /**
      * 投资顾问
      */
+    @Getter
     private String advisorName;
     /**
      * 基金托管人
      */
+    @Getter
     private String custodianName;
     /**
      * 基金经理描述
      */
+    @Getter
     private String fundManager;
     /**
      * 投资策略
      */
+    @Getter
     private String fundStrategyDescription;
     /**
      * 基金成立日期
      */
+    @Getter
     private String inceptionDate;
     /**
      * 行业趋势
      */
+    @Getter
     private String industryTrend;
     /**
      * 投资目标
      */
+    @Getter
     private String investmentObjective;
     /**
      * 杠杆比例
      */
+    @Getter
     private String leverage;
     /**
      * 杠杆比例描述
      */
+    @Getter
     private String leverageNote;
     /**
      * 基金运作方式
      */
+    @Getter
     private String operationType;
     /**
      * 备案编码
      */
+    @Getter
     private String registerNumber;
     /**
      * 风险收益特征
      */
+    @Getter
     private String riskReturnDesc;
     /**
      * 业绩比较基准
      */
+    @Getter
     private String secondaryBenchmark;
     /**
      * 基金到期日期
      */
+    @Getter
     private String dueDate;
     /**
      * 信息披露报告是否经托管机构复核
      */
+    @Getter
     private String isReviewed;
 
+    public String getFundCode() {
+        return ReportParseUtils.matchFundCode(this.fundCode);
+    }
+
     public ReportFundInfoDTO() {
         super();
     }
@@ -108,7 +130,7 @@ public class ReportFundInfoDTO extends BaseReportDTO<ReportFundInfoDO> {
     public ReportFundInfoDO toEntity() {
         ReportFundInfoDO entity = new ReportFundInfoDO();
         entity.setFileId(this.getFileId());
-        entity.setFundCode(this.fundCode);
+        entity.setFundCode(this.getFundCode());
         entity.setCompanyName(this.companyName);
         entity.setCurrency(this.currency);
         entity.setFundName(this.fundName);
@@ -136,9 +158,10 @@ public class ReportFundInfoDTO extends BaseReportDTO<ReportFundInfoDO> {
     public String toString() {
         return "{" +
                 super.toString() +
-                ", fundName='" + fundName + '\'' +
-                ", fundCode='" + fundCode + '\'' +
-                ", companyName='" + companyName + '\'' +
+                ", fundName='" + this.fundName + '\'' +
+                ", fundCode='" + this.fundCode + '\'' +
+                ", matchFundCode='" + this.getFundCode() + '\'' +
+                ", companyName='" + this.companyName + '\'' +
                 '}';
     }
 }

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

@@ -409,21 +409,21 @@ public class EmailParseService {
         Integer fileId = emailFileInfo.getId();
         String aiFileId = emailFileInfo.getAiFileId();
 
-        // 首页和尾页转为png图片,首页用来识别基金名称和基金代码、尾页用来识别印章和联系人
-        List<String> images = null;
-        try {
-            String output = FileUtil.getParent(filepath, 1) + File.separator + "image";
-            images = PdfUtil.convertFirstAndLastPagesToPng(filepath, FileUtil.file(output), 300);
-            if (log.isInfoEnabled()) {
-                log.info("报告[{}] 生成的图片地址是:{}", fileName, images);
-            }
-        } catch (Exception e) {
-            log.warn("报告[{}] 生成图片失败:{}", fileName, ExceptionUtil.stacktraceToString(e));
-        }
-        // todo 用图片来解析报告印章和联系人
-        if (CollUtil.isNotEmpty(images)) {
-            // do something ...
-        }
+//        // 首页和尾页转为png图片,首页用来识别基金名称和基金代码、尾页用来识别印章和联系人
+//        List<String> images = null;
+//        try {
+//            String output = FileUtil.getParent(filepath, 1) + File.separator + "image";
+//            images = PdfUtil.convertFirstAndLastPagesToPng(filepath, FileUtil.file(output), 300);
+//            if (log.isInfoEnabled()) {
+//                log.info("报告[{}] 生成的图片地址是:{}", fileName, images);
+//            }
+//        } catch (Exception e) {
+//            log.warn("报告[{}] 生成图片失败:{}", fileName, ExceptionUtil.stacktraceToString(e));
+//        }
+//        // todo 用图片来解析报告印章和联系人
+//        if (CollUtil.isNotEmpty(images)) {
+//            // do something ...
+//        }
 
         // 不支持解析的格式文件
         boolean notSupportFile = false;

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

@@ -45,7 +45,7 @@ public class MoDaqApplicationTests {
 //            folderNames.add("其他文件夹/报告公告");
             folderNames.add("INBOX");
             emailParseService.parseEmail(emailInfoDTO, startDate, endDate,
-                    folderNames, ListUtil.toList(EmailTypeConst.REPORT_LETTER_EMAIL_TYPE));
+                    folderNames, EmailTypeConst.REPORT_EMAIL_TYPES);
         } catch (Exception e) {
             throw new RuntimeException(e);
         }