Преглед на файлове

Merge branch 'develop' of http://112.74.196.215:3000/backend/mo-daq-all into test

wangzaijun преди 1 месец
родител
ревизия
b94c2554fb

+ 24 - 7
mo-daq/src/main/java/com/smppw/modaq/application/components/report/parser/pdf/PDLetterReportParser.java

@@ -42,15 +42,25 @@ public class PDLetterReportParser extends AbstractPDReportParser<LetterReportDat
         }
         int rowCount = table.getRowCount();
         int colCount = table.getColCount();
-        for (int i = 0; i < rowCount; i++) {
-            int t = colCount / 2;
-            for (int j = 0; j < t; j++) {
-                String key = table.getCell(i, j * 2).getText().replaceAll("[a-zA-Z]", "");
-                key = ReportParseUtils.cleaningValue(key);
+        if (rowCount == 2) {
+            for (int i = 0; i < colCount; i++) {
+                String key = ReportParseUtils.cleaningValue(table.getCell(0, i).getText());
                 if (StrUtil.isBlank(key)) {
                     continue;
                 }
-                this.allInfoMap.put(key, ReportParseUtils.cleaningValue(table.getCell(i, j * 2 + 1).getText()));
+                this.allInfoMap.put(key, ReportParseUtils.cleaningValue(table.getCell(1, i).getText()));
+            }
+        } else if (colCount % 2 == 0) {
+            for (int i = 0; i < rowCount; i++) {
+                int t = colCount / 2;
+                for (int j = 0; j < t; j++) {
+                    String key = table.getCell(i, j * 2).getText().replaceAll("[a-zA-Z]", "");
+                    key = ReportParseUtils.cleaningValue(key);
+                    if (StrUtil.isBlank(key)) {
+                        continue;
+                    }
+                    this.allInfoMap.put(key, ReportParseUtils.cleaningValue(table.getCell(i, j * 2 + 1).getText()));
+                }
             }
         }
     }
@@ -59,7 +69,14 @@ public class PDLetterReportParser extends AbstractPDReportParser<LetterReportDat
     protected ReportFundInfoDTO buildFundInfo(ReportParserParams params) {
         ReportFundInfoDTO fundInfo = this.buildDto(params.getFileId(), ReportFundInfoDTO.class, this.allInfoMap);
         if (CollUtil.isNotEmpty(this.textList) && fundInfo.getFundName() == null) {
-            fundInfo.setFundName(this.textList.get(0));
+            String fundName = this.textList.get(0);
+            if (fundName.contains("_")) {
+                fundInfo.setFundCode(fundName.substring(0, fundName.indexOf("_")));
+                fundName = StrUtil.split(fundName, "_").get(1);
+                this.allInfoMap.put("基金代码", fundInfo.getFundCode());
+                this.allInfoMap.put("基金名称", fundName);
+            }
+            fundInfo.setFundName(fundName);
         }
         return fundInfo;
     }

+ 3 - 0
mo-daq/src/main/java/com/smppw/modaq/infrastructure/util/ExcelUtil.java

@@ -58,6 +58,9 @@ public class ExcelUtil {
             int i = 1;
             while ((entry = ais.getNextEntry()) != null) {
                 String name = entry.getName();
+                if (name.startsWith("__MACOSX/")) {
+                    continue;
+                }
                 File entryFile;
                 try {
                     entryFile = FileUtil.file(destFilePath, name);