瀏覽代碼

fix:长城证券确认单解析支持

wangzaijun 1 月之前
父節點
當前提交
855e7b790e

+ 0 - 28
mo-daq/logs/error.log

@@ -1,28 +0,0 @@
-2025-03-08 17:22:40.554 [main] - [] ERROR com.smppw.modaq.domain.service.EmailParseService:515  - 获取邮箱的邮件报错,堆栈信息:cn.hutool.core.io.IORuntimeException: FileSystemException: \home\wwwroot\mo_report_file\wangzaijun@simuwang.com\20250308\20250308171325谢醒华_SSJ498_441900198210216175_202503067a9115fb216640a6883150edef05c9b1.pdf: 另一个程序正在使用此文件,进程无法访问。
-	at cn.hutool.core.io.FileUtil.del(FileUtil.java:781)
-	at com.smppw.modaq.application.util.EmailUtil.collectMimeMultipart(EmailUtil.java:93)
-	at com.smppw.modaq.domain.service.EmailParseService.realEmail(EmailParseService.java:480)
-	at com.smppw.modaq.domain.service.EmailParseService.parseEmail(EmailParseService.java:107)
-	at com.smppw.modaq.MoDaqApplicationTests.reportTest(MoDaqApplicationTests.java:41)
-	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
-	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
-	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
-	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
-	at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:767)
-	at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
-	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
-	at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156)
-	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147)
-	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:86)
-	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103)
-	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93)
-	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
-	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
-	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
-	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
-	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92)
-	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86)
-	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$8(TestMethodTestDescriptor.java:217)
-	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
-	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:213)
-	at org.junit.jupiter.engine.desc

+ 0 - 0
mo-daq/logs/error/2025-03-06_0.log


File diff suppressed because it is too large
+ 0 - 55
mo-daq/logs/info.log


File diff suppressed because it is too large
+ 0 - 29
mo-daq/logs/info/2025-03-06_0.log


+ 0 - 7
mo-daq/logs/warn.log

@@ -1,7 +0,0 @@
-2025-03-08 17:16:48.479 [main] - [] WARN  org.apache.pdfbox.pdmodel.font.PDCIDFontType0:159  - Using fallback DengXian for CID-keyed font STSongStd-Light
-2025-03-08 17:18:53.178 [HikariCP-daq housekeeper] - [] WARN  com.zaxxer.hikari.pool.HikariPool:797  - HikariCP-daq - Thread starvation or clock leap detected (housekeeper delta=2m22s551ms920µs900ns).
-2025-03-08 17:18:56.512 [main] - [] WARN  org.apache.pdfbox.pdmodel.font.PDCIDFontType0:159  - Using fallback DengXian for CID-keyed font STSongStd-Light
-2025-03-08 17:23:48.576 [main] - [] WARN  org.apache.pdfbox.pdmodel.font.PDCIDFontType0:159  - Using fallback DengXian for CID-keyed font STSongStd-Light
-2025-03-08 17:25:29.185 [HikariCP-daq housekeeper] - [] WARN  com.zaxxer.hikari.pool.HikariPool:797  - HikariCP-daq - Thread starvation or clock leap detected (housekeeper delta=1m43s354ms280µs400ns).
-2025-03-08 17:25:29.344 [main] - [] WARN  org.apache.pdfbox.pdmodel.font.PDCIDFontType0:159  - Using fallback DengXian for CID-keyed font STSongStd-Light
-2025-03-08 17:25:29.593 [main] - [] WARN  org.apache.pdfbox.pdmodel.font.PDCIDFontType0:159  - Using fallback DengXian for CID-keyed font STSongStd-Light

+ 0 - 13
mo-daq/logs/warn/2025-03-06_0.log

@@ -1,13 +0,0 @@
-2025-03-06 14:12:47.667 [HikariCP-daq housekeeper] - [] WARN  com.zaxxer.hikari.pool.HikariPool:797  - HikariCP-daq - Thread starvation or clock leap detected (housekeeper delta=51s658ms181µs).
-2025-03-06 14:12:48.132 [main] - [] WARN  org.apache.pdfbox.pdmodel.font.PDCIDFontType0:159  - Using fallback HYZhongHei-197 for CID-keyed font STSong-Light
-2025-03-06 14:12:48.291 [main] - [] WARN  org.apache.pdfbox.pdmodel.font.PDCIDFontType0:159  - Using fallback DengXian for CID-keyed font STSongStd-Light
-2025-03-06 14:12:48.722 [main] - [] WARN  org.apache.pdfbox.pdmodel.font.PDCIDFontType0:159  - Using fallback HYZhongHei-197 for CID-keyed font STSong-Light
-2025-03-06 14:12:48.726 [main] - [] WARN  org.apache.pdfbox.pdmodel.font.PDCIDFontType0:159  - Using fallback DengXian for CID-keyed font STSongStd-Light
-2025-03-06 14:12:48.945 [main] - [] WARN  org.apache.pdfbox.pdmodel.font.PDCIDFontType0:159  - Using fallback HYZhongHei-197 for CID-keyed font STSong-Light
-2025-03-06 14:12:48.947 [main] - [] WARN  org.apache.pdfbox.pdmodel.font.PDCIDFontType0:159  - Using fallback DengXian for CID-keyed font STSongStd-Light
-2025-03-06 14:12:49.179 [main] - [] WARN  org.apache.pdfbox.pdmodel.font.PDCIDFontType0:159  - Using fallback HYZhongHei-197 for CID-keyed font STSong-Light
-2025-03-06 14:12:49.181 [main] - [] WARN  org.apache.pdfbox.pdmodel.font.PDCIDFontType0:159  - Using fallback DengXian for CID-keyed font STSongStd-Light
-2025-03-06 14:12:49.414 [main] - [] WARN  org.apache.pdfbox.pdmodel.font.PDCIDFontType0:159  - Using fallback HYZhongHei-197 for CID-keyed font STSong-Light
-2025-03-06 14:12:49.418 [main] - [] WARN  org.apache.pdfbox.pdmodel.font.PDCIDFontType0:159  - Using fallback DengXian for CID-keyed font STSongStd-Light
-2025-03-06 14:12:49.611 [main] - [] WARN  org.apache.pdfbox.pdmodel.font.PDCIDFontType0:159  - Using fallback HYZhongHei-197 for CID-keyed font STSong-Light
-2025-03-06 14:12:49.613 [main] - [] WARN  org.apache.pdfbox.pdmodel.font.PDCIDFontType0:159  - Using fallback DengXian for CID-keyed font STSongStd-Light

+ 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);