1
0
wangzaijun 7 місяців тому
батько
коміт
609ef3653f

+ 1 - 0
service-base/src/main/java/com/simuwang/base/config/ShiroConfig.java

@@ -146,6 +146,7 @@ public class ShiroConfig {
     private Map<String, String> filterChainDefinition() {
         Map<String, String> map = MapUtil.newHashMap(20, true);
         map.put("/static/**", "anon");
+        map.put("/v1/test/**", "anon");
         map.put("/v1/login", "anon");
         map.put("/v1/rsa-key", "anon");
         map.put("/v1/**", "jwt");

+ 16 - 6
service-daq/src/main/java/com/simuwang/daq/components/PDMonthlyReportParser.java

@@ -54,7 +54,7 @@ public class PDMonthlyReportParser extends AbstractReportParser<MonthlyReportNav
             List<String> textList = StrUtil.split(text, "\r\n");
             if (CollUtil.isNotEmpty(textList)) {
                 List<String> wkList = this.watermarkListMap.get("report_name");
-                String name = this.processString(wkList, textList.get(0));
+                String name = this.processString(wkList, textList.get(0) + textList.get(1));
                 this.reportName = this.matchReportName(name);
                 if (StrUtil.isBlank(this.reportName)) {
                     throw new APIException("未匹配到报告名称");
@@ -131,7 +131,9 @@ public class PDMonthlyReportParser extends AbstractReportParser<MonthlyReportNav
     }
 
     private void buildInfo(Map<String, Object> extInfoMap, Object info) {
-        extInfoMap.forEach((k, v) -> {
+        for (Map.Entry<String, Object> entry : extInfoMap.entrySet()) {
+            String k = entry.getKey();
+            Object v = entry.getValue();
             String fieldValue = StrUtil.toStringOrNull(v);
             if (fieldValue.startsWith("-") || fieldValue.endsWith("-")) {
                 fieldValue = null;
@@ -143,17 +145,25 @@ public class PDMonthlyReportParser extends AbstractReportParser<MonthlyReportNav
                 String fieldName = vo.getValue();
                 List<String> labels = StrUtil.split(vo.getLabel(), ",");
                 if (labels.contains(k)) {
-                    ReflectUtil.setFieldValue(info, fieldName, fieldValue);
+                    try {
+                        ReflectUtil.setFieldValue(info, fieldName, fieldValue);
+                    } catch (Exception e) {
+                        this.logger.warn("{} 字段值设置错误:{}", fieldName, e.getMessage());
+                    }
                     break;
                 }
                 for (String label : labels) {
                     if (k.contains(label)) {
-                        ReflectUtil.setFieldValue(info, fieldName, fieldValue);
+                        try {
+                            ReflectUtil.setFieldValue(info, fieldName, fieldValue);
+                        } catch (Exception e) {
+                            this.logger.warn("{} 字段值设置错误:{}", fieldName, e.getMessage());
+                        }
                         break;
                     }
                 }
             }
-        });
+        }
     }
 
     @Override
@@ -257,7 +267,7 @@ public class PDMonthlyReportParser extends AbstractReportParser<MonthlyReportNav
         } else if (matcher3.find()) {
             reportName = matcher3.group();
         } else {
-            return null;
+            reportName = text;
         }
         return reportName.replace("(", "(").replace(")", ")");
     }

+ 21 - 0
service-manage/src/main/java/com/simuwang/manage/api/test/ReportParseTestApi.java

@@ -0,0 +1,21 @@
+package com.simuwang.manage.api.test;
+
+import com.simuwang.daq.service.ReportParseService;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/v1/test/parse")
+public class ReportParseTestApi {
+    private final ReportParseService service;
+
+    public ReportParseTestApi(ReportParseService service) {
+        this.service = service;
+    }
+
+    @GetMapping("monthly")
+    public void monthly() {
+        this.service.parse();
+    }
+}