Pārlūkot izejas kodu

feat:年报解析bug修复

wangzaijun 6 mēneši atpakaļ
vecāks
revīzija
8fc01bb48d

+ 1 - 1
service-base/src/main/java/com/simuwang/base/pojo/dto/report/ReportFinancialIndicatorsDTO.java

@@ -67,7 +67,7 @@ public class ReportFinancialIndicatorsDTO extends BaseReportLevelDTO<ReportFinan
         entity.setRealizedIncome(this.toBigDecimal(this.realizedIncome));
         entity.setUndistributedProfit(this.toBigDecimal(this.undistributedProfit));
         if (StrUtil.isNotBlank(this.yearly)) {
-            Matcher matcher = Pattern.compile("\\d").matcher(this.yearly);
+            Matcher matcher = Pattern.compile("\\d+").matcher(this.yearly);
             if (matcher.find()) {
                 entity.setEndDate(Integer.parseInt(matcher.group()));
             }

+ 7 - 9
service-daq/src/main/java/com/simuwang/daq/components/report/parser/pdf/PDAnnuallyReportParser.java

@@ -51,22 +51,26 @@ public class PDAnnuallyReportParser extends PDQuarterlyReportParser<AnnuallyRepo
                 this.fundInfoTables.add(table);
                 continue;
             }
+            // 用表格的第一列的数据判断是否主要财务指标数据
+            List<String> texts = this.getTableColTexts(table, 0);
+            if (CollUtil.containsAny(texts, FINANCIAL_INDICATORS_COLUMN_NAMES)) {
+                this.financialIndicatorsTables.add(table);
+                continue;
+            }
             int colCount = table.getColCount();
             if (colCount == 2) {
                 // 用表格的第一列的数据判断是否份额变动记录
-                List<String> texts = this.getTableColTexts(table, 0);
                 if (CollUtil.containsAny(texts, SHARE_CHANGE_COLUMN_NAMES)) {
                     this.shareChangeTables.add(table);
                 }
             } else if (colCount == 4) {
                 // 用表格的第二列的数据判断是否行业配置数据(内地)
-                List<String> texts = this.getTableColTexts(table, 1);
+                texts = this.getTableColTexts(table, 1);
                 if (CollUtil.containsAny(texts, INDUSTRY_COLUMN_NAMES)) {
                     this.investmentIndustryTables.add(table);
                 }
             } else if (colCount == 3) {
                 // 用表格的第一列的数据判断是否行业配置数据(港股通)
-                List<String> texts = this.getTableColTexts(table, 0);
                 if (CollUtil.containsAny(texts, INDUSTRY_COLUMN_NAMES)) {
                     this.investmentIndustryTables.add(table);
                     continue;
@@ -76,12 +80,6 @@ public class PDAnnuallyReportParser extends PDQuarterlyReportParser<AnnuallyRepo
                 if (CollUtil.containsAny(texts, ListUtil.of("股权投资", "股票投资", "债券投资", "另类投资", "其他资产", "其他融资总额"))) {
                     this.assetAllocationTables.add(table);
                 }
-            } else {
-                // 用表格的第一列的数据判断是否主要财务指标数据
-                List<String> texts = this.getTableColTexts(table, 0);
-                if (CollUtil.containsAny(texts, ListUtil.of("期间数据和指标", "期末数据和指标", "累计期末指标"))) {
-                    this.financialIndicatorsTables.add(table);
-                }
             }
         }
     }