Explorar o código

Merge remote-tracking branch 'origin/master'

xiexiang hai 1 ano
pai
achega
16ff5c4f19

+ 25 - 0
pas.iml

@@ -225,5 +225,30 @@
     <orderEntry type="library" name="Maven: xml-apis:xml-apis:1.0.b2" level="project" />
     <orderEntry type="library" name="Maven: jaxen:jaxen:1.2.0" level="project" />
     <orderEntry type="library" name="Maven: org.springframework:spring-test:6.0.11" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-amqp:3.1.3" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.amqp:spring-rabbit:3.0.8" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.amqp:spring-amqp:3.0.8" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.retry:spring-retry:2.0.2" level="project" />
+    <orderEntry type="library" name="Maven: com.rabbitmq:amqp-client:5.17.1" level="project" />
+    <orderEntry type="library" name="Maven: io.github.draco1023:poi-tl-ext:0.4.2" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.poi:ooxml-schemas:1.4" level="project" />
+    <orderEntry type="library" scope="RUNTIME" name="Maven: net.sourceforge.cssparser:cssparser:0.9.29" level="project" />
+    <orderEntry type="library" scope="RUNTIME" name="Maven: org.w3c.css:sac:1.3" level="project" />
+    <orderEntry type="library" scope="RUNTIME" name="Maven: org.jsoup:jsoup:1.15.3" level="project" />
+    <orderEntry type="library" scope="RUNTIME" name="Maven: net.sf.saxon:Saxon-HE:11.4" level="project" />
+    <orderEntry type="library" scope="RUNTIME" name="Maven: org.xmlresolver:xmlresolver:4.4.3" level="project" />
+    <orderEntry type="library" scope="RUNTIME" name="Maven: org.apache.httpcomponents.client5:httpclient5:5.2.1" level="project" />
+    <orderEntry type="library" scope="RUNTIME" name="Maven: org.apache.httpcomponents.core5:httpcore5-h2:5.2.2" level="project" />
+    <orderEntry type="library" scope="RUNTIME" name="Maven: org.apache.httpcomponents.core5:httpcore5:5.2.2" level="project" />
+    <orderEntry type="library" scope="RUNTIME" name="Maven: org.xmlresolver:xmlresolver:data:4.4.3" level="project" />
+    <orderEntry type="library" scope="RUNTIME" name="Maven: de.rototor.snuggletex:snuggletex-core:1.3.0" level="project" />
+    <orderEntry type="library" scope="RUNTIME" name="Maven: com.twelvemonkeys.imageio:imageio-batik:3.8.3" level="project" />
+    <orderEntry type="library" scope="RUNTIME" name="Maven: com.twelvemonkeys.imageio:imageio-core:3.8.3" level="project" />
+    <orderEntry type="library" scope="RUNTIME" name="Maven: com.twelvemonkeys.common:common-lang:3.8.3" level="project" />
+    <orderEntry type="library" scope="RUNTIME" name="Maven: com.twelvemonkeys.common:common-io:3.8.3" level="project" />
+    <orderEntry type="library" scope="RUNTIME" name="Maven: com.twelvemonkeys.common:common-image:3.8.3" level="project" />
+    <orderEntry type="library" scope="RUNTIME" name="Maven: org.apache.xmlgraphics:batik-rasterizer-ext:1.15" level="project" />
+    <orderEntry type="library" scope="RUNTIME" name="Maven: org.apache.xmlgraphics:batik-svgrasterizer:1.15" level="project" />
+    <orderEntry type="library" scope="RUNTIME" name="Maven: org.apache.xmlgraphics:batik-extension:1.15" level="project" />
   </component>
 </module>

+ 14 - 0
src/main/java/cn/cslg/pas/controller/CommonController.java

@@ -2,6 +2,7 @@ package cn.cslg.pas.controller;
 
 
 import cn.cslg.pas.common.core.base.Constants;
+import cn.cslg.pas.common.dto.es.EsCustomFieldDTO;
 import cn.cslg.pas.common.model.cronModel.Records;
 import cn.cslg.pas.common.utils.Response;
 import cn.cslg.pas.common.utils.StringUtils;
@@ -16,6 +17,7 @@ import cn.cslg.pas.service.business.AssoScenarioMatterService;
 import cn.cslg.pas.service.business.CommonService;
 import cn.cslg.pas.service.business.ScenarioService;
 import cn.cslg.pas.service.business.SystemDictService;
+import cn.cslg.pas.service.business.es.EsCustomFieldService;
 import cn.cslg.pas.service.common.PersonFieldService;
 import io.swagger.v3.oas.annotations.Operation;
 import lombok.extern.slf4j.Slf4j;
@@ -41,6 +43,9 @@ public class CommonController {
     private AssoScenarioMatterService assoScenarioMatterService;
     @Autowired
     private PersonFieldService personFieldService;
+    @Autowired
+    private EsCustomFieldService esCustomFieldService;
+
 
     @PostMapping("getOsSystemDict")
     @Operation(summary = "根据类型获取所有字典项")
@@ -130,4 +135,13 @@ public class CommonController {
         records.setData(commonService.getExcelConfig());
         return Response.success(records);
     }
+
+    @PostMapping("/addCustomField")
+    @Operation(summary = "添加自定义栏位")
+    public Response addCustomField(@RequestBody EsCustomFieldDTO vo) throws Exception {
+        String field = esCustomFieldService.addCustomField(vo);
+        Records records = new Records();
+        records.setData(field);
+        return Response.success(records);
+    }
 }

+ 17 - 10
src/main/java/cn/cslg/pas/service/business/es/EsCustomFieldService.java

@@ -43,7 +43,7 @@ public class EsCustomFieldService {
     private final TreeNodeService treeNodeService;
 
     //添加自定义栏位值
-    public void addCustomField(EsCustomFieldDTO esCustomFieldDTO) throws Exception {
+    public String addCustomField(EsCustomFieldDTO esCustomFieldDTO) throws Exception {
         ESCustomField esCustomField = new ESCustomField();
         String id = "";
         //判断类型
@@ -81,6 +81,7 @@ public class EsCustomFieldService {
             esCustomField.setTaskId(taskId);
         }
         List<String> values = esCustomField.getFieldValue();
+
         //设置值
         switch (fieldType) {
             case 0:
@@ -91,26 +92,33 @@ public class EsCustomFieldService {
                 ;
             case 2:              //文本类型
                 if (optionType.equals(1) || optionType.equals(2)) {
-                    if (addValues != null && addValues.size() == 1 && !values.contains(addValues))
+                    if (addValues != null && addValues.size() == 1)
                         esCustomField.setFieldValue(esCustomFieldDTO.getFieldValue());
+                        esCustomField.setStatsValue(addValues);
                 } else if (optionType.equals(0)) {
-                    esCustomField.setFieldType(null);
+                    esCustomField.setFieldValue(new ArrayList<>());
+                    esCustomField.setStatsValue(new ArrayList<>());
                 }
                 break;
             case 4:     //单选
                 if (optionType.equals(1) || optionType.equals(2)) {
-                    if (addValues != null && addValues.size() == 1 && !values.contains(addValues)) {
+                    if (addValues != null && addValues.size() == 1) {
+                        esCustomField.setFieldValue(addValues);
                         esCustomField.setStatsValue(addValues);
                     }
                 } else if (optionType.equals(0)) {
-                    esCustomField.setFieldValue(null);
-                    esCustomField.setStatsValue(null);
+                    esCustomField.setFieldValue(new ArrayList<>());
+                    esCustomField.setStatsValue(new ArrayList<>());
                 }
                 break;
             case 5:
                 if (optionType.equals(1)) {
-                    if (addValues != null && addValues.size() == 1 && !values.contains(addValues)) {
+                    if (addValues != null && addValues.size() > 0 ) {
+                        esCustomField.setFieldValue(addValues);
                         esCustomField.setStatsValue(addValues);
+                    }else {
+                        esCustomField.setFieldValue(new ArrayList<>());
+                        esCustomField.setStatsValue(new ArrayList<>());
                     }
                 }
                 break;
@@ -208,12 +216,11 @@ public class EsCustomFieldService {
             esCustomFieldHistory.setPersonId("1");
             esCustomFieldHistory.setProjectId(projectId);
             esCustomFieldHistory.setCustomFieldId(id);
-            String a = this.addCustomFieldHistory(esCustomFieldHistory);
-            System.out.println("---" + a);
+            this.addCustomFieldHistory(esCustomFieldHistory);
         } else {
             String b = this.addEsCustomFieldToEs(esCustomField, patentNo);
-            System.out.println("+++++++++" + b);
         }
+        return id;
     }
 
 

+ 38 - 62
src/main/resources/jsons/patent.json

@@ -38,7 +38,7 @@
   {
     "name": "授权号",
     "type": "String",
-    "value": "GN",
+    "value": "grantNo",
     "field": "GN",
     "esField": "grant_no.keyword",
     "esClass": "wildcardQueryBuilder",
@@ -49,8 +49,8 @@
   },
   {
     "name": "公开日",
-    "type": "String",
-    "value": "PD",
+    "type": "Date",
+    "value": "publicDate",
     "field": "PD",
     "esField": "public_date",
     "esClass": "dateQueryBuilder",
@@ -62,7 +62,7 @@
   {
     "name": "申请日",
     "type": "String",
-    "value": "AD",
+    "value": "appDate",
     "field": "AD",
     "esField": "app_date",
     "esClass": "dateQueryBuilder",
@@ -74,7 +74,7 @@
   {
     "name": "授权日",
     "type": "String",
-    "value": "GD",
+    "value": "grantDate",
     "field": "GD",
     "esField": "grant_date",
     "esClass": "dateQueryBuilder",
@@ -109,44 +109,20 @@
   },
   {
     "name": "摘要",
-    "type": "String",
-    "value": "TX",
-    "field": "abstractStr",
-    "esField": "abstract_str",
-    "esClass": "matchQueryBuilder",
-    "ifSearch": "false",
-    "ifGroup": "false",
-    "ifShow": "false",
-    "ifAsCondition": "true"
-  },
-  {
-    "name": "摘要内容",
-    "type": "String",
-    "value": "AB",
+    "type": "Object",
+    "value": "abstractStr",
     "field": "AB",
     "esField": "abstract_str.text_content",
     "esClass": "matchQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "false",
+    "ifShow": "true",
     "ifAsCondition": "true"
   },
   {
     "name": "标题",
-    "type": "String",
-    "value": "TX",
-    "field": "TX",
-    "esField": "title",
-    "esClass": "matchQueryBuilder",
-    "ifSearch": "false",
-    "ifGroup": "false",
-    "ifShow": "false",
-    "ifAsCondition": "true"
-  },
-  {
-    "name": "标题内容",
-    "type": "String",
-    "value": "TI",
+    "type": "Object",
+    "value": "title",
     "field": "TI",
     "esField": "title.text_content",
     "esClass": "matchQueryBuilder",
@@ -169,8 +145,8 @@
   },
   {
     "name": "申请人",
-    "type": "String",
-    "value": "PA",
+    "type": "Array",
+    "value": "applicant",
     "field": "PA",
     "esField": "applicant.name",
     "esClass": "nestedQueryBuilder",
@@ -181,8 +157,8 @@
   },
   {
     "name": "发明人",
-    "type": "String",
-    "value": "IN",
+    "type": "Array",
+    "value": "inventor",
     "field": "IN",
     "esField": "inventor.name",
     "esClass": "nestedQueryBuilder",
@@ -193,8 +169,8 @@
   },
   {
     "name": "权利人",
-    "type": "String",
-    "value": "PE",
+    "type": "Array",
+    "value": "rightHolder",
     "field": "PE",
     "esField": "right_holder.name",
     "esClass": "nestedQueryBuilder",
@@ -212,7 +188,7 @@
     "esClass": "matchQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifAsCondition": "true"
   },
   {
@@ -224,13 +200,13 @@
     "esClass": "matchQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifAsCondition": "true"
   },
   {
     "name": "代理机构",
     "type": "String",
-    "value": "AGN",
+    "value": "agency",
     "field": "AGN",
     "esField": "agency",
     "esClass": "matchQueryBuilder",
@@ -241,7 +217,7 @@
   },
   {
     "name": "代理人名称",
-    "type": "String",
+    "type": "Array",
     "value": "agent",
     "field": "agent",
     "esField": "agent",
@@ -284,7 +260,7 @@
     "esClass": "matchQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifAsCondition": "true"
   },
   {
@@ -296,7 +272,7 @@
     "esClass": "keyWordQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifAsCondition": "true"
   },
   {
@@ -308,7 +284,7 @@
     "esClass": "keyWordQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifAsCondition": "true"
   },
   {
@@ -320,7 +296,7 @@
     "esClass": "prefixQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifAsCondition": "true"
   },
   {
@@ -332,7 +308,7 @@
     "esClass": "prefixQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifAsCondition": "true"
   },
   {
@@ -344,7 +320,7 @@
     "esClass": "prefixQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifAsCondition": "true"
   },
   {
@@ -356,7 +332,7 @@
     "esClass": "matchQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifAsCondition": "true"
   },
   {
@@ -368,7 +344,7 @@
     "esClass": "keyWordQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifAsCondition": "true"
   },
   {
@@ -380,7 +356,7 @@
     "esClass": "prefixQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifAsCondition": "true"
   },
   {
@@ -392,7 +368,7 @@
     "esClass": "prefixQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifAsCondition": "true"
   },
   {
@@ -404,7 +380,7 @@
     "esClass": "prefixQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifAsCondition": "true"
   },
   {
@@ -428,7 +404,7 @@
     "esClass": "keyWordQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifAsCondition": "true"
   },
   {
@@ -440,7 +416,7 @@
     "esClass": "keyWordQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifAsCondition": "true"
   },
   {
@@ -452,7 +428,7 @@
     "esClass": "keyWordQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifAsCondition": "true"
   },
   {
@@ -464,7 +440,7 @@
     "esClass": "keyWordQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifAsCondition": "true"
   },
   {
@@ -476,7 +452,7 @@
     "esClass": "keyWordQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifAsCondition": "true"
   },
   {
@@ -488,7 +464,7 @@
     "esClass": "matchQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifAsCondition": "true"
   },
   {
@@ -500,7 +476,7 @@
     "esClass": "matchQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifAsCondition": "true"
   },
   {

+ 13 - 3
src/test/java/cn/cslg/pas/service/EventServiceTests.java

@@ -37,6 +37,8 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.util.*;
+import java.util.function.Function;
+import java.util.stream.Collectors;
 
 
 /**
@@ -252,6 +254,14 @@ public class EventServiceTests {
         vo.setPatentNo("CN201910069334.7");
         PatentDetailDTO columnDTO = patentService.selectPatentDetail(vo);
         System.out.println(columnDTO);
+
+//        String s = "asfassafsafe";
+//        Map<Character, Long> map = s.chars().mapToObj(c->(char)c).collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
+//        System.out.println(map);
+//
+//        List<String> stringList = Arrays.asList("apple", "apple", "balana", "origin", "apple", "balana");
+//        Map<String, Long> collect = stringList.stream().collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
+//        System.out.println("----" + collect);
     }
 
     @Test
@@ -277,9 +287,9 @@ public class EventServiceTests {
     void test15() throws Exception {
         EsCustomFieldDTO dto = new EsCustomFieldDTO();
         dto.setProjectId(83);
-        dto.setFieldType(6);
-        dto.setFieldId("101");
-        dto.setFieldValue(Arrays.asList("1010"));
+        dto.setFieldType(5);
+        dto.setFieldId("303");
+        dto.setFieldValue(Arrays.asList("多选1","多选2"));
         dto.setOptionType(1);
         dto.setPatentNo("CN201910069334.7");
         esCustomFieldService.addCustomField(dto);