Quellcode durchsuchen

Merge remote-tracking branch 'origin/master'

xiexiang vor 1 Jahr
Ursprung
Commit
c82873dc11
43 geänderte Dateien mit 1326 neuen und 319 gelöschten Zeilen
  1. 5 5
      src/main/java/cn/cslg/pas/common/config/ElasticSearchClientConfig.java
  2. 4 4
      src/main/java/cn/cslg/pas/common/config/WebSocketConfig.java
  3. 22 0
      src/main/java/cn/cslg/pas/common/dto/PatentColumnDTO.java
  4. 4 0
      src/main/java/cn/cslg/pas/common/dto/UploadPatentWebDTO.java
  5. 1 0
      src/main/java/cn/cslg/pas/common/dto/es/RefreshPatentDTO.java
  6. 2 0
      src/main/java/cn/cslg/pas/common/vo/ImportTaskAMVO.java
  7. 1 0
      src/main/java/cn/cslg/pas/common/vo/PersonSelfFieldVO.java
  8. 1 0
      src/main/java/cn/cslg/pas/common/vo/QueryFiledVO.java
  9. 1 0
      src/main/java/cn/cslg/pas/common/vo/business/FTOCompareRecordVO.java
  10. 5 0
      src/main/java/cn/cslg/pas/common/vo/business/TortVO.java
  11. 1 1
      src/main/java/cn/cslg/pas/common/vo/invalidVO/QueryEvidenceReasonVO.java
  12. 1 0
      src/main/java/cn/cslg/pas/common/vo/patentCount/GetAllPatentCountVO.java
  13. 11 9
      src/main/java/cn/cslg/pas/controller/FTOController.java
  14. 10 5
      src/main/java/cn/cslg/pas/controller/PatentController.java
  15. 7 0
      src/main/java/cn/cslg/pas/domain/business/CustomAnalysisItemSetting.java
  16. 0 1
      src/main/java/cn/cslg/pas/factorys/EsCountAnalyseBuilderFactory/ChildCountAnalysisBuilder.java
  17. 167 0
      src/main/java/cn/cslg/pas/factorys/EsCountAnalyseBuilderFactory/ChildNestedAnalyseBuilder.java
  18. 272 0
      src/main/java/cn/cslg/pas/factorys/EsCountAnalyseBuilderFactory/PrioritiesCountAnalysisBuilder.java
  19. 39 20
      src/main/java/cn/cslg/pas/service/ReportExportService.java
  20. 3 1
      src/main/java/cn/cslg/pas/service/business/AssoProjectPersonService.java
  21. 85 52
      src/main/java/cn/cslg/pas/service/business/CustomFieldService.java
  22. 57 16
      src/main/java/cn/cslg/pas/service/business/FTOCompareRecordService.java
  23. 5 1
      src/main/java/cn/cslg/pas/service/business/FeatureService.java
  24. 9 7
      src/main/java/cn/cslg/pas/service/business/ImportTaskService.java
  25. 9 4
      src/main/java/cn/cslg/pas/service/business/MergePersonService.java
  26. 1 1
      src/main/java/cn/cslg/pas/service/business/ProjectTaskService.java
  27. 55 3
      src/main/java/cn/cslg/pas/service/business/TreeNodeService.java
  28. 51 6
      src/main/java/cn/cslg/pas/service/business/es/EsCountService.java
  29. 10 9
      src/main/java/cn/cslg/pas/service/business/es/EsCustomFieldService.java
  30. 24 11
      src/main/java/cn/cslg/pas/service/business/es/EsPatentService.java
  31. 46 15
      src/main/java/cn/cslg/pas/service/business/es/EsService.java
  32. 2 1
      src/main/java/cn/cslg/pas/service/business/invalidReport/EvidenceReasonService.java
  33. 2 1
      src/main/java/cn/cslg/pas/service/business/invalidReport/PatentClaimService.java
  34. 4 3
      src/main/java/cn/cslg/pas/service/importPatent/GetCataloguingFromWebThread.java
  35. 10 5
      src/main/java/cn/cslg/pas/service/importPatent/GetPatentFromExcelThread.java
  36. 3 7
      src/main/java/cn/cslg/pas/service/importPatent/ImportFromWebToEsService.java
  37. 101 16
      src/main/java/cn/cslg/pas/service/importPatent/ImportSinglePatentService.java
  38. 38 11
      src/main/java/cn/cslg/pas/service/importPatent/SavePatentToEsThread.java
  39. 6 0
      src/main/java/cn/cslg/pas/service/importPatent/SchedulingTaskService.java
  40. 2 2
      src/main/java/cn/cslg/pas/service/importPatent/TaskThread.java
  41. 6 6
      src/main/resources/jsons/esCountAnalysis.json
  42. 240 91
      src/main/resources/jsons/patent.json
  43. 3 5
      src/test/java/cn/cslg/pas/service/CommonServiceTests.java

+ 5 - 5
src/main/java/cn/cslg/pas/common/config/ElasticSearchClientConfig.java

@@ -41,13 +41,13 @@ public class ElasticSearchClientConfig {
             return new ElasticsearchClient(transport);
         }
 //                @Bean
-//        public ElasticsearchClient elasticsearchClient() throws Exception {
-//            RestClientBuilder builder = RestClient.builder(new HttpHost("47.101.137.223", 9200, "http"));
-//            RestClient client =builder.build();
-//            ElasticsearchTransport transport = new RestClientTransport(client,new JacksonJsonpMapper());
+//                public ElasticsearchClient elasticsearchClient() throws Exception {
+//                    RestClientBuilder builder = RestClient.builder(new HttpHost("47.101.137.223", 9200, "http"));
+//                    RestClient client = builder.build();
+//                    ElasticsearchTransport transport = new RestClientTransport(client, new JacksonJsonpMapper());
 //
 //                    return new ElasticsearchClient(transport);
-//        }
+//                }
 
 
     }

+ 4 - 4
src/main/java/cn/cslg/pas/common/config/WebSocketConfig.java

@@ -6,8 +6,8 @@ import org.springframework.web.socket.server.standard.ServerEndpointExporter;
 
 @Configuration
 public class WebSocketConfig {
-    @Bean
-    public ServerEndpointExporter serverEndpointExporter() {
-        return new ServerEndpointExporter();
-    }
+//    @Bean
+//    public ServerEndpointExporter serverEndpointExporter() {
+//        return new ServerEndpointExporter();
+//    }
 }

+ 22 - 0
src/main/java/cn/cslg/pas/common/dto/PatentColumnDTO.java

@@ -44,6 +44,28 @@ public class PatentColumnDTO {
      */
     private PersonAddress applicantAddr;
 
+    //申请人地址
+    private String appAddress;
+    //申请人国家
+    private String applicantCountry;
+    //申请人省份
+    private String appProvince;
+    //申请人市
+    private String appCity;
+    //申请人县
+    private String appDistrict;
+
+    //权利人地址
+    private String rightAddress;
+    //权利人国家
+    private String rightCountry;
+    //权利人省份
+    private String rightProvince;
+    //权利人市
+    private String rightCity;
+    //权利人县
+    private String rightDistrict;
+
     /**
      * 权利人地址
      */

+ 4 - 0
src/main/java/cn/cslg/pas/common/dto/UploadPatentWebDTO.java

@@ -1,5 +1,6 @@
 package cn.cslg.pas.common.dto;
 
+import cn.cslg.pas.common.dto.es.EsCustomFieldDTO;
 import cn.cslg.pas.common.vo.StarPatentVO;
 import cn.cslg.pas.common.vo.UploadParamsVO;
 import cn.cslg.pas.domain.es.Patent;
@@ -8,6 +9,8 @@ import lombok.Data;
 import lombok.Synchronized;
 import org.apache.poi.ss.usermodel.PictureData;
 
+import java.util.List;
+
 @Data
 
 public class UploadPatentWebDTO {
@@ -18,4 +21,5 @@ public class UploadPatentWebDTO {
     private PictureData pictureData;
     private Integer haveSaveCounter;
     private Integer index;
+    private List<EsCustomFieldDTO> esCustomFieldDTOList;
 }

+ 1 - 0
src/main/java/cn/cslg/pas/common/dto/es/RefreshPatentDTO.java

@@ -10,4 +10,5 @@ public class RefreshPatentDTO {
     private String patentNo;
      //1基本信息 2说明书 3权利要求 4附图 5pdf文档
     private List<Integer> refreshContent;
+    private Integer projectId;
 }

+ 2 - 0
src/main/java/cn/cslg/pas/common/vo/ImportTaskAMVO.java

@@ -1,5 +1,6 @@
 package cn.cslg.pas.common.vo;
 
+import cn.cslg.pas.common.dto.es.EsCustomFieldDTO;
 import com.baomidou.mybatisplus.annotation.TableField;
 import lombok.Data;
 
@@ -93,4 +94,5 @@ public class ImportTaskAMVO {
 
     private Integer messageThreadCounter;
     private String patentNoStr;
+    private List<EsCustomFieldDTO> fieldDTOS;
 }

+ 1 - 0
src/main/java/cn/cslg/pas/common/vo/PersonSelfFieldVO.java

@@ -30,5 +30,6 @@ public class PersonSelfFieldVO {
     private Integer createType;
     private Boolean  defaultHidden;
     private Boolean ifPersonal;
+    private Boolean ifSort;
 
 }

+ 1 - 0
src/main/java/cn/cslg/pas/common/vo/QueryFiledVO.java

@@ -19,4 +19,5 @@ public class QueryFiledVO {
     private String group;
     private String groupBy;
     private Integer filedType;
+    private Object children;
 }

+ 1 - 0
src/main/java/cn/cslg/pas/common/vo/business/FTOCompareRecordVO.java

@@ -29,4 +29,5 @@ public class FTOCompareRecordVO {
      * 0字面相同 1等同 2不等同 3待确定
      */
     private Integer compareResult;
+    private  String resultStr;
 }

+ 5 - 0
src/main/java/cn/cslg/pas/common/vo/business/TortVO.java

@@ -30,6 +30,7 @@ public class TortVO {
      *
      */
     private Integer rightSort;
+    private  String rightName;
 
     private Integer rightType;
 
@@ -59,4 +60,8 @@ public class TortVO {
      * 创建时间
      */
     private Date CreateTime;
+
+    private  String resultStr;
+
+    private String targetDescription;
 }

+ 1 - 1
src/main/java/cn/cslg/pas/common/vo/invalidVO/QueryEvidenceReasonVO.java

@@ -17,7 +17,7 @@ public class QueryEvidenceReasonVO {
     private String evidenceText;
     private String evidenceDescription;
     private Integer evidenceReasonId;
-
+    private  Integer featureGen;
     private List<CompareLiterature> literatures;
     private List<AssoGroupFeature> featureHistories;
     /**

+ 1 - 0
src/main/java/cn/cslg/pas/common/vo/patentCount/GetAllPatentCountVO.java

@@ -31,4 +31,5 @@ public class GetAllPatentCountVO {
     private Boolean defaultShowStats;
     private String field;
     private String groupBy;
+    private Object children;
 }

+ 11 - 9
src/main/java/cn/cslg/pas/controller/FTOController.java

@@ -28,6 +28,7 @@ import java.util.List;
 
 /**
  * FTOTort
+ *
  * @Author xiexiang
  * @Date 2023/12/8
  */
@@ -50,12 +51,13 @@ public class FTOController {
 
     @Operation(summary = "保存FTO对比结果")
     @PostMapping("/addFTOCompareRecord")
-    public Response addFTOCompareRecord(@RequestBody TortCompareRecordDTO tortCompareRecordDTO){
+    public Response addFTOCompareRecord(@RequestBody TortCompareRecordDTO tortCompareRecordDTO) {
         if (tortCompareRecordDTO != null) {
             List<Integer> ids = new ArrayList<>();
             try {
                 ids = ftoCompareRecordService.addFTOCompareRecord(tortCompareRecordDTO);
-            } catch (Exception e) {
+            }
+            catch (Exception e) {
                 if (e instanceof XiaoShiException) {
                     return Response.error(e.getMessage());
                 } else if (e instanceof UnLoginException) {
@@ -74,7 +76,7 @@ public class FTOController {
 
     @Operation(summary = "添加FTO协同任务")
     @PostMapping("/addFTOAssitTask")
-    public Response addFTOAssitTask(@RequestBody TortTaskDTO tortTaskDTO){
+    public Response addFTOAssitTask(@RequestBody TortTaskDTO tortTaskDTO) {
         Integer id = projectTaskService.addFTOAssitTask(tortTaskDTO);
         Records records = new Records();
         records.setData(id);
@@ -83,7 +85,7 @@ public class FTOController {
 
     @Operation(summary = "保存FTO协同任务对比结果")
     @PostMapping("/addFTOAssitTaskResult")
-    public Response addFTOAssitTaskResult(@RequestBody TortCompareRecordDTO tortCompareRecordDTO){
+    public Response addFTOAssitTaskResult(@RequestBody TortCompareRecordDTO tortCompareRecordDTO) {
         List<Integer> ids = ftoCompareRecordService.addFTOAssitTaskResult(tortCompareRecordDTO);
         Records records = new Records();
         records.setData(ids);
@@ -92,7 +94,7 @@ public class FTOController {
 
     @Operation(summary = "查询fto协同前后对比结果")
     @GetMapping("/getFTOAssitResult")
-    public Response getFTOAssitResult(String patentNo, Integer taskId){
+    public Response getFTOAssitResult(String patentNo, Integer taskId) {
         Integer type = 1;
         TortCompareRecordVO tortCompareRecordVO = ftoCompareRecordService.getFTOAssitResult(patentNo, taskId, type);
         return Response.success(tortCompareRecordVO);
@@ -100,7 +102,7 @@ public class FTOController {
 
     @Operation(summary = "保存最终对比结果")
     @PostMapping("/addFinalAssitResult")
-    public Response addFinalAssitResult(@RequestBody TortCompareRecordDTO tortCompareRecordDTO){
+    public Response addFinalAssitResult(@RequestBody TortCompareRecordDTO tortCompareRecordDTO) {
         List<Integer> ids = ftoCompareRecordService.addFinalAssitResult(tortCompareRecordDTO);
         Records records = new Records();
         records.setData(ids);
@@ -109,15 +111,15 @@ public class FTOController {
 
     @Operation(summary = "查询最终结果")
     @GetMapping("/getFTOFinalResult")
-    public Response getFTOFinalResult(String patentNo, Integer taskId){
+    public Response getFTOFinalResult(String patentNo, Integer taskId) {
         Integer type = 2;
-        TortCompareRecordVO tortCompareRecordVO = ftoCompareRecordService.getFTOAssitResult(patentNo,taskId, type);
+        TortCompareRecordVO tortCompareRecordVO = ftoCompareRecordService.getFTOAssitResult(patentNo, taskId, type);
         return Response.success(tortCompareRecordVO);
     }
 
     @Operation(summary = "查询报告专利最新对比结果")
     @GetMapping("/getLastRecord")
-    public Response getLastRecord(Integer projectId, String patentNo){
+    public Response getLastRecord(Integer projectId, String patentNo) {
         TortCompareRecordVO tortCompareRecordVO = ftoCompareRecordService.getLastRecord(projectId, patentNo);
         return Response.success(tortCompareRecordVO);
     }

+ 10 - 5
src/main/java/cn/cslg/pas/controller/PatentController.java

@@ -191,7 +191,7 @@ public class PatentController {
         try {
             personId = mergePersonService.mergePerson(personVO);
         } catch (Exception e) {
-            return Response.success(e.getMessage());
+            return Response.error(e.getMessage());
         }
         return Response.success(personId);
     }
@@ -199,7 +199,12 @@ public class PatentController {
     @Operation(summary = "专利列表上再次新增发明人/权利人/申请人合并")
     @PostMapping("/mergePersonAgain")
     public Response mergePersonAgain(@RequestBody MergePersonAgainVO againVO) throws Exception {
-        Integer personId = mergePersonService.mergePersonAgain(againVO);
+        Integer personId = null;
+        try {
+            personId = mergePersonService.mergePersonAgain(againVO);
+        } catch (Exception e) {
+            return Response.error(e.getMessage());
+        }
         return Response.success(personId);
     }
 
@@ -210,7 +215,7 @@ public class PatentController {
         try {
             personId = mergePersonService.updateMergePerson(personVO);
         } catch (Exception e) {
-            return Response.success(e.getMessage());
+            return Response.error(e.getMessage());
         }
         return Response.success(personId);
     }
@@ -243,7 +248,7 @@ public class PatentController {
         try {
             id = mergePersonService.delMergedName(vo);
         } catch (Exception e) {
-            return Response.success(e.getMessage());
+            return Response.error(e.getMessage());
         }
         return Response.success(id);
     }
@@ -255,7 +260,7 @@ public class PatentController {
         try {
             id = mergePersonService.delMergePerson(vo);
         } catch (Exception e) {
-            return Response.success(e.getMessage());
+            return Response.error(e.getMessage());
         }
         return Response.success(id);
     }

+ 7 - 0
src/main/java/cn/cslg/pas/domain/business/CustomAnalysisItemSetting.java

@@ -398,4 +398,11 @@ public class CustomAnalysisItemSetting extends BaseEntity<CustomAnalysisItemSett
      */
     @TableField(value = "scatter_size")
     private String scatterSize;
+
+    @TableField(value = "background_color")
+    private String backgroundColor;
+
+    @TableField(value = "grid_background_color")
+    private String gridBackgroundColor;
+
 }

+ 0 - 1
src/main/java/cn/cslg/pas/factorys/EsCountAnalyseBuilderFactory/ChildCountAnalysisBuilder.java

@@ -37,7 +37,6 @@ public class ChildCountAnalysisBuilder implements IEsCountAnalysisBuilder {
 
             if (!CollectionUtils.isEmpty(values)) {
                 termAgg = AggregationBuilders.terms(i -> i.field("custom_field.stats_value.raw").include(j -> j.terms(values)).size(topN));
-//                termAgg = AggregationBuilders.terms(i -> i.field(field).include(j -> j.terms(values)).size(topN));
             } else {
                 if (StringUtils.isNotEmpty(valueOne) && StringUtils.isEmpty(valueTwo)) {
                     String str = "*";

+ 167 - 0
src/main/java/cn/cslg/pas/factorys/EsCountAnalyseBuilderFactory/ChildNestedAnalyseBuilder.java

@@ -0,0 +1,167 @@
+package cn.cslg.pas.factorys.EsCountAnalyseBuilderFactory;
+
+import co.elastic.clients.elasticsearch._types.aggregations.*;
+import co.elastic.clients.elasticsearch._types.query_dsl.Query;
+import co.elastic.clients.elasticsearch._types.query_dsl.QueryBuilders;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Component;
+import org.springframework.util.CollectionUtils;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+@Component
+public class ChildNestedAnalyseBuilder implements IEsCountAnalysisBuilder{
+    public String field = "";
+    public String valueOne = "";
+    public String valueTwo = "";
+    public Integer topN = 10;
+    public String path = "";
+    public Boolean ifHaveChild = false;
+    public String fieldType = null;
+    public String fieldId = null;
+    private String format;
+    public List<String> values = new ArrayList<>();
+
+    public Aggregation createCountAnalyseAgg() throws Exception {
+        Aggregation terms = null;
+        if (StringUtils.isNotEmpty(valueOne)) {
+            String str = "*";
+            String s = str.concat(valueOne).concat("*");
+            Query query = QueryBuilders.wildcard(i -> i.field(field).value(s));
+            Aggregation filter = AggregationBuilders.filter(n -> n.bool(k -> k.must(query)));
+            terms = new Aggregation.Builder().terms(new TermsAggregation.Builder()
+                    .field(field).size(topN).build())
+                    .aggregations(new HashMap() {{
+                        put("filter_agg", filter);
+                    }}).build();
+        } else if (!CollectionUtils.isEmpty(values)) {
+            terms = AggregationBuilders.terms(i -> i.field(field).include(j -> j.terms(values)).size(topN));
+        } else {
+            terms = AggregationBuilders.terms(j -> j.field(field).size(topN));
+        }
+        Aggregation finalTerms = terms;
+        Aggregation aggregation = new Aggregation.Builder().nested(new NestedAggregation.Builder().
+                path(path).build())
+                .aggregations(new HashMap() {{
+                    put("terms_agg", finalTerms);
+                }}).build();
+
+        Aggregation agg = null;
+        if (path.equals("merge_applicant")) {
+            agg = new Aggregation.Builder().children(new ChildrenAggregation.Builder()
+                    .type("merge_applicat").build())
+                    .aggregations(new HashMap() {{
+                        put("childAgg", aggregation);
+                    }}).build();
+        } else {
+            agg = new Aggregation.Builder().children(new ChildrenAggregation.Builder()
+                    .type(path).build())
+                    .aggregations(new HashMap() {{
+                        put("childAgg", aggregation);
+                    }}).build();
+        }
+        return agg;
+    }
+
+    @Override
+    public String getField() {
+        return field;
+    }
+
+    @Override
+    public void setField(String field) {
+        this.field = field;
+    }
+
+    @Override
+    public String getValueOne() {
+        return valueOne;
+    }
+
+    @Override
+    public void setValueOne(String valueOne) {
+        this.valueOne = valueOne;
+    }
+
+    @Override
+    public String getValueTwo() {
+        return valueTwo;
+    }
+
+    @Override
+    public void setValueTwo(String valueTwo) {
+        this.valueTwo = valueTwo;
+    }
+
+    @Override
+    public Integer getTopN() {
+        return topN;
+    }
+
+    @Override
+    public void setTopN(Integer topN) {
+        this.topN = topN;
+    }
+
+    @Override
+    public String getPath() {
+        return path;
+    }
+
+    @Override
+    public void setPath(String path) {
+        this.path = path;
+    }
+
+    @Override
+    public Boolean getIfHaveChild() {
+        return ifHaveChild;
+    }
+
+    @Override
+    public void setIfHaveChild(Boolean ifHaveChild) {
+        this.ifHaveChild = ifHaveChild;
+    }
+
+    @Override
+    public String getFieldType() {
+        return fieldType;
+    }
+
+    @Override
+    public void setFieldType(String fieldType) {
+        this.fieldType = fieldType;
+    }
+
+    @Override
+    public String getFieldId() {
+        return fieldId;
+    }
+
+    @Override
+    public void setFieldId(String fieldId) {
+        this.fieldId = fieldId;
+    }
+
+    @Override
+    public String getFormat() {
+        return format;
+    }
+
+    @Override
+    public void setFormat(String format) {
+        this.format = format;
+    }
+
+    @Override
+    public List<String> getValues() {
+        return values;
+    }
+
+    @Override
+    public void setValues(List<String> values) {
+        this.values = values;
+    }
+}

+ 272 - 0
src/main/java/cn/cslg/pas/factorys/EsCountAnalyseBuilderFactory/PrioritiesCountAnalysisBuilder.java

@@ -0,0 +1,272 @@
+package cn.cslg.pas.factorys.EsCountAnalyseBuilderFactory;
+
+import co.elastic.clients.elasticsearch._types.aggregations.*;
+import co.elastic.clients.elasticsearch._types.query_dsl.Query;
+import co.elastic.clients.elasticsearch._types.query_dsl.QueryBuilders;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Component;
+import org.springframework.util.CollectionUtils;
+
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+@Component
+public class PrioritiesCountAnalysisBuilder implements IEsCountAnalysisBuilder{
+    public String field = "";
+    public String valueOne = "";
+    public String valueTwo = "";
+    public Integer topN = 10;
+    public String path = "";
+    public Boolean ifHaveChild = false;
+    public String fieldType = null;
+    public String fieldId = null;
+    private String format;
+    public List<String> values = new ArrayList<>();
+    public static final int YEAR = 4;
+    public static final int MONTH = 7;
+    public static final int DAY = 10;
+
+    @Override
+    public Aggregation createCountAnalyseAgg() throws Exception {
+        Aggregation aggregation = null;
+        if (StringUtils.isNotEmpty(valueOne) && StringUtils.isNotEmpty(valueTwo)) {
+            String end = String.valueOf(Integer.parseInt(valueTwo) + 1);
+            Query query = QueryBuilders.range(j -> j.field(field).from(valueOne).to(end).format("yyyy"));
+            Aggregation filter = AggregationBuilders.filter(n -> n.bool(k -> k.must(query)));
+            aggregation = new Aggregation.Builder().dateHistogram(new DateHistogramAggregation.Builder()
+                    .field(field).format("yyyy")
+                    .calendarInterval(CalendarInterval.Year).build())
+                    .aggregations(new HashMap() {{
+                        put("filter_agg", filter);
+                    }}).build();
+        } else if (!CollectionUtils.isEmpty(values)) {
+            List<DateRangeExpression> rangeExpressions = new ArrayList<>();
+            Calendar calendar = Calendar.getInstance();
+            for (String value : values) {
+                if (value.length() == YEAR) {
+                    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
+                    String startYear = value + "-01";
+                    Date year = format.parse(startYear);
+                    calendar.setTime(year);
+                    calendar.add(Calendar.YEAR, 1);
+                    Date yearDate = calendar.getTime();
+                    String nextYear = format.format(yearDate);
+                    FieldDateMath st = FieldDateMath.of(i -> i.expr(startYear));
+                    FieldDateMath ed = FieldDateMath.of(i -> i.expr(nextYear));
+                    DateRangeExpression expression = DateRangeExpression.of(i -> i.from(st).to(ed).key(value));
+                    rangeExpressions.add(expression);
+                } else if (value.length() == MONTH && !value.contains("Q")
+                        && !value.contains("H")) {
+                    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
+                    Date month = format.parse(value);
+                    calendar.setTime(month);
+                    calendar.add(Calendar.MONTH, 1);
+                    Date monthDate = calendar.getTime();
+                    String nextMonth = format.format(monthDate);
+                    FieldDateMath st = FieldDateMath.of(i -> i.expr(value));
+                    FieldDateMath ed = FieldDateMath.of(i -> i.expr(nextMonth));
+                    DateRangeExpression expression = DateRangeExpression.of(i -> i.from(st).to(ed).key(value));
+                    rangeExpressions.add(expression);
+                } else if (value.length() == MONTH && value.contains("Q")) {
+                    if (value.contains("Q1")) {
+                        String firstQuarter = value.substring(0, value.indexOf("-"));
+                        String firstQuarterDate = firstQuarter + "-01";
+                        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
+                        Date quarter = format.parse(firstQuarterDate);
+                        calendar.setTime(quarter);
+                        calendar.add(Calendar.MONTH, 3);
+                        Date quarterDate = calendar.getTime();
+                        String nextQuarterDate = format.format(quarterDate);
+                        FieldDateMath st = FieldDateMath.of(i -> i.expr(firstQuarterDate));
+                        FieldDateMath ed = FieldDateMath.of(i -> i.expr(nextQuarterDate));
+                        DateRangeExpression expression = DateRangeExpression.of(i -> i.from(st).to(ed).key(value));
+                        rangeExpressions.add(expression);
+                    } else if (value.contains("Q2")) {
+                        String secondQuarter = value.substring(0, value.indexOf("-"));
+                        String secondQuarterDate = secondQuarter + "-04";
+                        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
+                        Date quarter = format.parse(secondQuarterDate);
+                        calendar.setTime(quarter);
+                        calendar.add(Calendar.MONTH, 3);
+                        Date quarterDate = calendar.getTime();
+                        String nextQuarterDate = format.format(quarterDate);
+                        FieldDateMath st = FieldDateMath.of(i -> i.expr(secondQuarterDate));
+                        FieldDateMath ed = FieldDateMath.of(i -> i.expr(nextQuarterDate));
+                        DateRangeExpression expression = DateRangeExpression.of(i -> i.from(st).to(ed).key(value));
+                        rangeExpressions.add(expression);
+                    } else if (value.contains("Q3")) {
+                        String thirdQuarter = value.substring(0, value.indexOf("-"));
+                        String thirdQuarterDate = thirdQuarter + "-07";
+                        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
+                        Date quarter = format.parse(thirdQuarterDate);
+                        calendar.setTime(quarter);
+                        calendar.add(Calendar.MONTH, 3);
+                        Date quarterDate = calendar.getTime();
+                        String nextQuarterDate = format.format(quarterDate);
+                        FieldDateMath st = FieldDateMath.of(i -> i.expr(thirdQuarterDate));
+                        FieldDateMath ed = FieldDateMath.of(i -> i.expr(nextQuarterDate));
+                        DateRangeExpression expression = DateRangeExpression.of(i -> i.from(st).to(ed).key(value));
+                        rangeExpressions.add(expression);
+                    } else if (value.contains("Q4")) {
+                        String fourthQuarter = value.substring(0, value.indexOf("-"));
+                        String fourthQuarterDate = fourthQuarter + "-10";
+                        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
+                        Date quarter = format.parse(fourthQuarterDate);
+                        calendar.setTime(quarter);
+                        calendar.add(Calendar.MONTH, 3);
+                        Date quarterDate = calendar.getTime();
+                        String nextQuarterDate = format.format(quarterDate);
+                        FieldDateMath st = FieldDateMath.of(i -> i.expr(fourthQuarterDate));
+                        FieldDateMath ed = FieldDateMath.of(i -> i.expr(nextQuarterDate));
+                        DateRangeExpression expression = DateRangeExpression.of(i -> i.from(st).to(ed).key(value));
+                        rangeExpressions.add(expression);
+                    }
+                } else if (value.length() == MONTH && value.contains("H")) {
+                    if (value.contains("H1")) {
+                        String firstHalfYear = value.substring(0, value.indexOf("-"));
+                        String firstHalfYearDate = firstHalfYear + "-01";
+                        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
+                        Date halfYear = format.parse(firstHalfYearDate);
+                        calendar.setTime(halfYear);
+                        calendar.add(Calendar.MONTH, 6);
+                        Date halfYearDate = calendar.getTime();
+                        String nextHalfYearDate = format.format(halfYearDate);
+                        FieldDateMath st = FieldDateMath.of(i -> i.expr(firstHalfYearDate));
+                        FieldDateMath ed = FieldDateMath.of(i -> i.expr(nextHalfYearDate));
+                        DateRangeExpression expression = DateRangeExpression.of(i -> i.from(st).to(ed).key(value));
+                        rangeExpressions.add(expression);
+                    } else if (value.contains("H2")) {
+                        String secondHalfYear = value.substring(0, value.indexOf("-"));
+                        String secondHalfYearDate = secondHalfYear + "-07";
+                        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
+                        Date halfYear = format.parse(secondHalfYearDate);
+                        calendar.setTime(halfYear);
+                        calendar.add(Calendar.MONTH, 6);
+                        Date halfYearDate = calendar.getTime();
+                        String nextHalfYearDate = format.format(halfYearDate);
+                        FieldDateMath st = FieldDateMath.of(i -> i.expr(secondHalfYearDate));
+                        FieldDateMath ed = FieldDateMath.of(i -> i.expr(nextHalfYearDate));
+                        DateRangeExpression expression = DateRangeExpression.of(i -> i.from(st).to(ed).key(value));
+                        rangeExpressions.add(expression);
+                    }
+                } else {
+                    String start = value.substring(0, value.indexOf("-")) + "-01";
+                    String end = value.substring(value.indexOf("-") + 1);
+                    String nextYear = String.valueOf(Integer.parseInt(end) + 1) + "-01";
+                    FieldDateMath st = FieldDateMath.of(i -> i.expr(start));
+                    FieldDateMath ed = FieldDateMath.of(i -> i.expr(nextYear));
+                    DateRangeExpression expression = DateRangeExpression.of(i -> i.from(st).to(ed).key(value));
+                    rangeExpressions.add(expression);
+                }
+            }
+            aggregation = AggregationBuilders.dateRange(i -> i.field(field).format("yyyy-MM").ranges(rangeExpressions));
+        } else if (StringUtils.isNotEmpty(format) && CollectionUtils.isEmpty(values)) {
+            if (format.equals("年")) {
+                aggregation = AggregationBuilders.dateHistogram(i -> i.field(field).format("yyyy").calendarInterval(CalendarInterval.Year));
+            } else if (format.equals("半年")) {
+                Aggregation halfYearAgg = AggregationBuilders.dateHistogram(i -> i.field(field).format("yyyy-MM").calendarInterval(CalendarInterval.Month));
+                aggregation = new Aggregation.Builder().dateHistogram(new DateHistogramAggregation.Builder()
+                        .field(field).format("yyyy")
+                        .calendarInterval(CalendarInterval.Year).build())
+                        .aggregations(new HashMap() {{
+                            put("halfYearAgg", halfYearAgg);
+                        }}).build();
+            } else if (format.equals("季")) {
+                aggregation = AggregationBuilders.dateHistogram(i -> i.field(field).format("yyyy-MM").calendarInterval(CalendarInterval.Quarter));
+            } else if (format.equals("月")) {
+                aggregation = AggregationBuilders.dateHistogram(i -> i.field(field).format("yyyy-MM").calendarInterval(CalendarInterval.Month));
+            }
+        } else {
+            aggregation = AggregationBuilders.dateHistogram(i -> i.field(field).format("yyyy").calendarInterval(CalendarInterval.Year));
+
+        }
+
+        Aggregation finalAggregation = aggregation;
+        Aggregation Agg = new Aggregation.Builder().nested(new NestedAggregation.Builder().
+                path(path).build())
+                .aggregations(new HashMap() {{
+                    put("terms_agg", finalAggregation);
+                }}).build();
+        return Agg;
+    }
+
+    public String getField() {
+        return field;
+    }
+
+    public void setField(String field) {
+        this.field = field;
+    }
+
+    public String getValueOne() {
+        return valueOne;
+    }
+
+    public void setValueOne(String valueOne) {
+        this.valueOne = valueOne;
+    }
+
+    public String getValueTwo() {
+        return valueTwo;
+    }
+
+    public void setValueTwo(String valueTwo) {
+        this.valueTwo = valueTwo;
+    }
+
+    public Integer getTopN() {
+        return topN;
+    }
+
+    public void setTopN(Integer topN) {
+        this.topN = topN;
+    }
+
+    public String getPath() {
+        return path;
+    }
+
+    public void setPath(String path) {
+        this.path = path;
+    }
+
+    public Boolean getIfHaveChild() {
+        return ifHaveChild;
+    }
+
+    public void setIfHaveChild(Boolean ifHaveChild) {
+        this.ifHaveChild = ifHaveChild;
+    }
+
+    public String getFieldType() {
+        return fieldType;
+    }
+
+    public void setFieldType(String fieldType) {
+        this.fieldType = fieldType;
+    }
+
+    public String getFieldId() {
+        return fieldId;
+    }
+
+    public void setFieldId(String fieldId) {
+        this.fieldId = fieldId;
+    }
+
+    public String getFormat() {
+        return format;
+    }
+
+    public void setFormat(String format) {
+        this.format = format;
+    }
+
+    public List<String> getValues() {
+        return values;
+    }
+
+    public void setValues(List<String> values) {
+        this.values = values;
+    }
+}

+ 39 - 20
src/main/java/cn/cslg/pas/service/ReportExportService.java

@@ -33,6 +33,8 @@ import org.springframework.stereotype.Service;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.time.format.DateTimeFormatter;
 import java.util.*;
 
 @Slf4j
@@ -103,9 +105,9 @@ public class ReportExportService {
         } else if (report.getReportType() == 3) {
             template = this.FTOTemplate(projectId, templateFilePath, templeId);
         } else if (report.getReportType() == 4) {
-         template = this.Torttemplate(projectId, templateFilePath);
+            template = this.Torttemplate(projectId, templateFilePath);
         } else if (report.getReportType() == 5) {
-         template = this.avoidDesignTemplate(projectId, templateFilePath);
+            template = this.avoidDesignTemplate(projectId, templateFilePath);
         } else if (report.getReportType() == 1) {
 //          template = this.getThirdTemplate(report, filePath);
         }
@@ -142,9 +144,9 @@ public class ReportExportService {
 
     private XWPFTemplate Torttemplate(Integer reportId, String filePath) throws IOException {
         //根据报告Id查询标的专利号
-        LambdaQueryWrapper<ReportProject> projectLambdaQueryWrapper =new LambdaQueryWrapper<>();
-        projectLambdaQueryWrapper.eq(ReportProject::getProjectId,reportId);
-        ReportProject report = reportProjectService.getOne(projectLambdaQueryWrapper,false);
+        LambdaQueryWrapper<ReportProject> projectLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        projectLambdaQueryWrapper.eq(ReportProject::getProjectId, reportId);
+        ReportProject report = reportProjectService.getOne(projectLambdaQueryWrapper, false);
         String patentNo = report.getSignPatentNo();
 //        PatentVO patentVO = new PatentVO();
 //        patentVO.setPatentNos(Arrays.asList(patentNo));
@@ -219,7 +221,7 @@ public class ReportExportService {
         return template;
     }
 
-    private XWPFTemplate avoidDesignTemplate(Integer projectId,String path) throws IOException {
+    private XWPFTemplate avoidDesignTemplate(Integer projectId, String path) throws IOException {
         String filePath = fileUtils.getPath(path);
 
         log.info("开始处理导出规避设计报告,参数为:{}, {}", projectId, filePath);
@@ -268,13 +270,12 @@ public class ReportExportService {
         PictureRenderData pictureRenderData = null;
         byte[] bytes = null;
 
-        if (bytes != null) {
-            try {
-                bytes = fileManagerService.downloadSystemFileFromFMS(guid);
-            } catch (Exception e) {
+        try {
+            bytes = fileManagerService.downloadSystemFileFromFMS(guid);
+        } catch (Exception e) {
 
-            }
         }
+
         FileInputStream fileInputStream = FileUtils.byteToFile(bytes);
         pictureRenderData = Pictures.ofStream(fileInputStream, PictureType.PNG)
                 .create();
@@ -335,6 +336,8 @@ public class ReportExportService {
                 StringRequest stringRequest = new StringRequest();
                 stringRequest.setCustomFields(esCustomFieldDTOS);
                 stringRequest.setProjectId(projectId);
+                stringRequest.setCurrent(1L);
+                stringRequest.setSize(999L);
                 List<PatentColumnDTO> patentColumnDTOS = new ArrayList<>();
                 try {
                     PatentDTO patentDTO = esService.esSearch(stringRequest);
@@ -350,14 +353,17 @@ public class ReportExportService {
                 List<Map<String, Object>> lapsePatents = new ArrayList<>();
                 for (PatentColumnDTO patent : patentColumnDTOS) {
                     String applicants = "";
-                    StringBuilder rightPerson = new StringBuilder();
+                    String rightPerson = "";
                     if (patent.getApplicant() != null && patent.getApplicant().size() != 0) {
-                        applicants = StringUtils.join(patent.getApplicant(), "\r");
+                        applicants = StringUtils.join(patent.getApplicant(), "\n");
+                    }
+                    if (patent.getRightHolder() != null && patent.getRightHolder().size() != 0) {
+                        rightPerson = StringUtils.join(patent.getRightHolder(), "\n");
                     }
                     List<String> affairs = esLegalEventService.getStrLegalEvent(patent.getAppNo());
                     String affairStrs = "";
                     if (affairs != null && affairs.size() != 0) {
-                        affairStrs = StringUtils.join(affairs, "\r");
+                        affairStrs = StringUtils.join(affairs, "\n");
                     }
 
                     //装载单个专利的信息
@@ -372,20 +378,21 @@ public class ReportExportService {
                             if (familyMap.get("nos") != null) {
                                 List<String> nos = (List<String>) familyMap.get("nos");
                                 if (nos != null && nos.size() > 0) {
-                                    String nosStr = StringUtils.join(nos, "\r");
+                                    String nosStr = StringUtils.join(nos, "\n");
                                     patentMap.put("simpleFamilys", nosStr);
                                 }
                             }
                         }
                     } catch (Exception e) {
                     }
+
                     //引用专利
                     try {
                         Map<String, Object> map = esQuotePatentService.getEsQutePatentByNos(patent.getPatentNo());
                         if (map.get("nos") != null) {
                             List<String> nos = (List<String>) map.get("nos");
                             if (nos != null && nos.size() > 0) {
-                                String nosStr = StringUtils.join(nos, "\r");
+                                String nosStr = StringUtils.join(nos, "\n");
                                 patentMap.put("quotePatents", nosStr);
                             }
                         }
@@ -393,10 +400,15 @@ public class ReportExportService {
                     } catch (Exception e) {
 
                     }
+                    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
                     //申请日
-                    patentMap.put("applicationDate", patent.getAppDate());
+                    if(patent.getAppDate()!=null) {
+                        patentMap.put("appDate",  dateFormat.format(patent.getAppDate()));
+                    }
                     //公开日
-                    patentMap.put("publicDate", patent.getPublicDate());
+                    if(patent.getPublicDate()!=null) {
+                        patentMap.put("publicDate", dateFormat.format(patent.getPublicDate()));
+                    }
                     //专利号
                     patentMap.put("publicNo", patent.getPatentNo());
                     patentMap.put("firstPublicDate", patent.getPublicDate());
@@ -404,6 +416,11 @@ public class ReportExportService {
                     patentMap.put("rightPerson", rightPerson);
                     patentMap.put("affair", affairStrs);
 
+                    if (patent.getTitle() != null && patent.getTitle().size() > 0) {
+                        patentMap.put("nameOut", patent.getTitle().get(0).getTextContent());
+                    }
+
+
                     //优先权日
                     if (patent.getPriorities() != null && patent.getPriorities().size() != 0) {
                         patentMap.put("priorityDate", patent.getPriorities().get(0).getPriorityDate());
@@ -415,13 +432,15 @@ public class ReportExportService {
                     if (pictureData != null) {
                         patentMap.put("abstractPath", pictureData);
                     }
+
                     //获得专利对比记录的信息
                     Map<String, Object> temMap = ftoCompareRecordService.LoadCompareMessageForExport(projectId, patent.getPatentNo());
                     List<CompareMessageVO> compareMessageVOS = (List<CompareMessageVO>) temMap.get("compareMessageVOs");
                     //装载对比记录的信息
                     patentMap.put("cM", compareMessageVOS);
-                    patentMap.put("rightNum", temMap.get("right"));
-                    patentMap.put("mainRightNum", temMap.get("mainRight"));
+                    patentMap.put("rightNum", temMap.get("rightNum"));
+
+                    patentMap.put("mainNum", temMap.get("mainRightNum"));
                     Integer status = Integer.parseInt(patent.getSimpleStatus());
                     if (status == 1 || status == 5 || status == 6) {
                         announcePatents.add(patentMap);

+ 3 - 1
src/main/java/cn/cslg/pas/service/business/AssoProjectPersonService.java

@@ -55,7 +55,8 @@ public class AssoProjectPersonService extends ServiceImpl<AssoProjectPersonMappe
         //根据ids查询是否存在
         LambdaQueryWrapper<AssoProjectPerson> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.select(AssoProjectPerson::getPersonId);
-        queryWrapper.in(AssoProjectPerson::getPersonId, personIds);
+        queryWrapper.in(AssoProjectPerson::getPersonId, personIds)
+                .eq(AssoProjectPerson::getProjectId,projectId);
         List<AssoProjectPerson> assoProjectPersonList = this.list(queryWrapper);
         List<String> ids = assoProjectPersonList.stream().map(AssoProjectPerson::getPersonId).collect(Collectors.toList());
         if (ids != null) {
@@ -67,6 +68,7 @@ public class AssoProjectPersonService extends ServiceImpl<AssoProjectPersonMappe
                 assoProjectPerson.setProjectId(projectId);
                 assoProjectPerson.setPersonId(personId);
                 assoProjectPerson.setCreateId(personnelVO.getId());
+                assoProjectPerson.setRole(3);
                 assoProjectPerson.insert();
                 reIds.add(assoProjectPerson.getId());
             }

+ 85 - 52
src/main/java/cn/cslg/pas/service/business/CustomFieldService.java

@@ -247,22 +247,26 @@ public class CustomFieldService extends ServiceImpl<CustomFieldMapper, CustomFie
 
 
     public List<AllCustomFieldVO> getAllProjectCustomField(Integer projectId) {
-        Integer order = 0;
+
         List<AllCustomFieldVO> allCustomFieldVOS = cacheUtils.getPatentCustomField(projectId);
         if (CollectionUtils.isEmpty(allCustomFieldVOS)) {
             allCustomFieldVOS = new ArrayList<>();
-            //根据 project获得栏位值
-            List<CustomField> customFields = new ArrayList<>();
-            LambdaQueryWrapper<CustomField> queryWrapper = new LambdaQueryWrapper<>();
-            queryWrapper.eq(CustomField::getProjectId, projectId);
-            customFields = this.list(queryWrapper);
-            //
-            LambdaQueryWrapper<AssoProjectTreeNode> assoQueryWrapper = new LambdaQueryWrapper<>();
-            assoQueryWrapper.eq(AssoProjectTreeNode::getProjectId, projectId);
-            List<AssoProjectTreeNode> projectTreeNodes = assoProjectTreeNodeService.list(assoQueryWrapper);
-
-            for (CustomField item : customFields) {
-                AllCustomFieldVO allCustomFieldVO = new AllCustomFieldVO();
+        }
+        Integer order = allCustomFieldVOS.size();
+        //根据 project获得栏位值
+        List<CustomField> customFields = new ArrayList<>();
+        LambdaQueryWrapper<CustomField> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(CustomField::getProjectId, projectId);
+        customFields = this.list(queryWrapper);
+        //
+        LambdaQueryWrapper<AssoProjectTreeNode> assoQueryWrapper = new LambdaQueryWrapper<>();
+        assoQueryWrapper.eq(AssoProjectTreeNode::getProjectId, projectId);
+        List<AssoProjectTreeNode> projectTreeNodes = assoProjectTreeNodeService.list(assoQueryWrapper);
+
+        for (CustomField item : customFields) {
+            AllCustomFieldVO allCustomFieldVO = allCustomFieldVOS.stream().filter(i -> i.getId().equals(item.getId()) && i.getType().equals(item.getType())).findFirst().orElse(null);
+            if (allCustomFieldVO == null) {
+                allCustomFieldVO = new AllCustomFieldVO();
                 allCustomFieldVO.setId(item.getId());
                 allCustomFieldVO.setName(item.getName());
                 allCustomFieldVO.setType(item.getType());
@@ -270,31 +274,32 @@ public class CustomFieldService extends ServiceImpl<CustomFieldMapper, CustomFie
                 allCustomFieldVOS.add(allCustomFieldVO);
                 order += 1;
             }
+        }
 
-            for (AssoProjectTreeNode item : projectTreeNodes) {
-                //根据类型和id
-                AllCustomFieldVO allCustomFieldVO = new AllCustomFieldVO();
+        for (AssoProjectTreeNode item : projectTreeNodes) {
+            //根据类型和id
+            AllCustomFieldVO allCustomFieldVO = allCustomFieldVOS.stream().filter(i -> i.getId().equals(item.getId()) && i.getType().equals(item.getTreeType())).findFirst().orElse(null);
+            if (allCustomFieldVO == null) {
+                allCustomFieldVO = new AllCustomFieldVO();
                 allCustomFieldVO.setId(item.getId());
                 allCustomFieldVO.setType(item.getTreeType());
                 allCustomFieldVO.setSysOrder(order);
                 switch (item.getTreeType()) {
-                    case 7:
-                        Product product = productService.getById(item.getId());
+                    case 2:
+                        Product product = productService.getById(item.getFieldId());
                         allCustomFieldVO.setName(product.getName());
                         break;
-                    case 8:
-                        ProductCategory productCategory = productCategoryService.getById(item.getId());
+                    case 3:
+                        ProductCategory productCategory = productCategoryService.getById(item.getFieldId());
                         allCustomFieldVO.setName(productCategory.getName());
                         break;
-                    case 9:
+                    case 1:
                         //TODO 技术类别
                         break;
                 }
                 allCustomFieldVOS.add(allCustomFieldVO);
                 order += 1;
             }
-
-            cacheUtils.addPatentCustomField(projectId, allCustomFieldVOS);
         }
 
         return allCustomFieldVOS;
@@ -459,15 +464,15 @@ public class CustomFieldService extends ServiceImpl<CustomFieldMapper, CustomFie
                             fieldValueVO.setPath(item.getPath());
 
                             List<String> idStrs = new ArrayList<>();
-                            List<String> pathNames =new ArrayList<>();
+                            List<String> pathNames = new ArrayList<>();
                             if (item.getPath() != null && !item.getPath().equals("")) {
                                 idStrs = Arrays.asList(item.getPath().split("/"));
-                            pathNames=  treeNodeService.getBaseMapper().getTreeFieldPath(idStrs);
+                                pathNames = treeNodeService.getBaseMapper().getTreeFieldPath(idStrs);
 
                             }
                             pathNames.add(item.getName());
-                         String pathValue=   StringUtils.join(pathNames,"/");
-                         fieldValueVO.setPathValue(pathValue);
+                            String pathValue = StringUtils.join(pathNames, "/");
+                            fieldValueVO.setPathValue(pathValue);
                             fieldValueVO.setValue(pathValue);
                             fieldValueVOS.add(fieldValueVO);
                         });
@@ -506,7 +511,7 @@ public class CustomFieldService extends ServiceImpl<CustomFieldMapper, CustomFie
         List<EsCustomFieldValueDTO> esCustomFieldDTOS = new ArrayList<>();
         //根据名称获得标引栏位以及标引值
         LambdaQueryWrapper<CustomField> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.in(CustomField::getType, Arrays.asList(4, 5, 6))
+        queryWrapper.in(CustomField::getType, Arrays.asList(4, 5))
                 .eq(CustomField::getProjectId, projectId);
         List<CustomField> customFields = this.list(queryWrapper);
         List<Integer> ids = customFields.stream().map(CustomField::getId).collect(Collectors.toList());
@@ -518,12 +523,6 @@ public class CustomFieldService extends ServiceImpl<CustomFieldMapper, CustomFie
         optionWrapper.eq(CustomOption::getName, name)
                 .in(CustomOption::getCustomFieldId, ids);
         List<CustomOption> options = customOptionService.list(optionWrapper);
-        // 从 treeNode 查询名称相同的节点
-        LambdaQueryWrapper<TreeNode> treeNodeWrapper = new LambdaQueryWrapper<>();
-        treeNodeWrapper.eq(TreeNode::getName, name)
-                .eq(TreeNode::getType, 4)
-                .in(TreeNode::getTypeId, ids);
-        List<TreeNode> treeNodes = treeNodeService.list(treeNodeWrapper);
 
         if (options != null && options.size() != 0) {
             options.forEach(item -> {
@@ -532,32 +531,18 @@ public class CustomFieldService extends ServiceImpl<CustomFieldMapper, CustomFie
                                 .equals(item.getCustomFieldId()))
                         .findFirst().orElse(null);
                 if (esCustomFieldDTO == null) {
+                    esCustomFieldDTO = new EsCustomFieldValueDTO();
                     esCustomFieldDTO.setFieldId(item.getCustomFieldId().toString());
                     List<String> values = new ArrayList<>();
                     values.add(item.getId().toString());
                     esCustomFieldDTO.setFieldValue(values);
+                    esCustomFieldDTOS.add(esCustomFieldDTO);
                 } else {
                     esCustomFieldDTO.getFieldValue().add(item.getId().toString());
                 }
             });
         }
 
-        if (treeNodes != null && treeNodes.size() != 0) {
-            treeNodes.forEach(item -> {
-                EsCustomFieldValueDTO esCustomFieldDTO = esCustomFieldDTOS.stream()
-                        .filter(i -> i.getFieldId()
-                                .equals(item.getTypeId()))
-                        .findFirst().orElse(null);
-                if (esCustomFieldDTO == null) {
-                    esCustomFieldDTO.setFieldId(item.getTypeId().toString());
-                    List<String> values = new ArrayList<>();
-                    values.add(item.getId().toString());
-                    esCustomFieldDTO.setFieldValue(values);
-                } else {
-                    esCustomFieldDTO.getFieldValue().add(item.getId().toString());
-                }
-            });
-        }
         return esCustomFieldDTOS;
     }
 
@@ -631,12 +616,10 @@ public class CustomFieldService extends ServiceImpl<CustomFieldMapper, CustomFie
         if (customField != null) {
             return customField.getId();
         }
-        PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
         CustomField customField1 = new CustomField();
         customField1.setName(name);
         customField1.setProjectId(projectId);
         customField1.setType(type);
-        customField1.setCreateId(personnelVO.getId());
         customField1.insert();
         return customField1.getId();
     }
@@ -835,4 +818,54 @@ public class CustomFieldService extends ServiceImpl<CustomFieldMapper, CustomFie
 //
 //    }
 
+
+    /**
+     * @param customerFieldList
+     */
+    public  List<EsCustomFieldDTO> getFieldDTOByStrings(List<UploadParamsVO.Field> customerFieldList, Integer projectId) {
+      List<EsCustomFieldDTO>  esCustomFieldDTOs =new ArrayList<>();
+        if (customerFieldList != null && customerFieldList.size() != 0) {
+
+            for (UploadParamsVO.Field field : customerFieldList) {
+                EsCustomFieldDTO esCustomFieldDTO =new EsCustomFieldDTO();
+                String key = field.getKey();
+                List<String> fieldList = field.getFieldList();
+                String[] keys = key.split(":");
+                if (keys.length < 2) {
+                    continue;
+                }
+                String type = keys[1].trim();
+                String fieldName = keys[0].trim();
+                Integer typeInt = Integer.parseInt(type);
+                Integer fieldId = this.GetIdByName(fieldName, projectId, typeInt);
+                esCustomFieldDTO.setFieldId(fieldId.toString());
+                List<String> values =new ArrayList<>();
+                switch (type) {
+                    case "0":
+                    case "1":
+                    case "2":
+                        esCustomFieldDTO.setFieldType(Integer.parseInt(type));
+                        values =fieldList;
+                        break;
+                    case "4":
+                    case "5":
+                        esCustomFieldDTO.setFieldType(Integer.parseInt(type));
+                        values = customOptionService.getIdsByNames(fieldList,fieldId);
+                        break;
+                    case "6":
+                        esCustomFieldDTO.setFieldType(Integer.parseInt(type));
+                       values =treeNodeService.getIdByNames(fieldList,fieldId);
+                        break;
+                }
+                esCustomFieldDTO.setFieldValue(values);
+
+                esCustomFieldDTO.setProjectId(projectId);
+                esCustomFieldDTOs.add(esCustomFieldDTO);
+            }
+
+        }
+     return esCustomFieldDTOs;
+    }
+
+
 }

+ 57 - 16
src/main/java/cn/cslg/pas/service/business/FTOCompareRecordService.java

@@ -29,6 +29,7 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.util.*;
 import java.util.function.Function;
@@ -237,6 +238,7 @@ public class FTOCompareRecordService extends ServiceImpl<FTOCompareRecordMapper,
      * @param tortCompareRecordDTO
      * @return
      */
+    @Transactional(rollbackFor = Exception.class)
     public List<Integer> addFTOCompareRecord(TortCompareRecordDTO tortCompareRecordDTO) {
         Integer taskId = tortCompareRecordDTO.getTaskId();
         if (taskId == null) {
@@ -254,7 +256,8 @@ public class FTOCompareRecordService extends ServiceImpl<FTOCompareRecordMapper,
         //查询出原来的特征id集合
         LambdaQueryWrapper<Feature> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.select(Feature::getId)
-                .eq(Feature::getProjectTaskId, taskId);
+                .eq(Feature::getProjectTaskId, taskId)
+                .eq(Feature::getPatentNo, patentNo);
         Function<Object, Integer> f = (o -> Integer.parseInt(o.toString()));
         List<Integer> featureIds = featureService.listObjs(queryWrapper, f);
         // 删除特征
@@ -282,6 +285,14 @@ public class FTOCompareRecordService extends ServiceImpl<FTOCompareRecordMapper,
      * @param tortDTOS
      */
     public List<Integer> updateFeatures(String patentNo, Integer taskId, List<Integer> featureIds, List<TortDTO> tortDTOS) {
+        //根据专利号和任务id获得拆分信息
+        LambdaQueryWrapper<PatentSplitMessage> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(PatentSplitMessage::getTaskId, taskId)
+                .eq(PatentSplitMessage::getPatentNo, patentNo);
+        PatentSplitMessage patentSplitMessage = patentSplitMessageService.getOne(queryWrapper);
+        if (patentSplitMessage == null) {
+            throw new XiaoShiException("未获取到拆分信息");
+        }
         // 获取登录人信息
         PersonnelVO personnelVO = new PersonnelVO();
         try {
@@ -322,6 +333,7 @@ public class FTOCompareRecordService extends ServiceImpl<FTOCompareRecordMapper,
                 feature.setCreateId(personnelVO.getId());
                 feature.setRightType(item.getRightType());
                 feature.setSysOrder(order);
+                feature.setSplitMessageId(patentSplitMessage.getId());
                 feature.insert();
                 item.setFeatureId(feature.getId());
                 // 新增对比结果
@@ -810,6 +822,7 @@ public class FTOCompareRecordService extends ServiceImpl<FTOCompareRecordMapper,
             patentRightVos.forEach(item -> {
                 TortRightVO tortRightVO = new TortRightVO();
                 BeanUtils.copyProperties(item, tortRightVO);
+                tortRightVO.setCompareMessageVOS(item.getCompareMessageVOS());
                 //新建特征与侵权分析对比结果VOS
                 List<Feature> features = item.getFeatures();
                 List<TortVO> tortVOS = this.loadLastVO(features, lastFTORecords);
@@ -903,18 +916,42 @@ public class FTOCompareRecordService extends ServiceImpl<FTOCompareRecordMapper,
         Integer rightNum = 0;
         Integer mainRightNum = 0;
         TortCompareRecordVO tortCompareRecordVO = this.getLastRecord(projectId, patentNo);
-        List<CompareMessageVO> compareMessageVOS = new ArrayList<>();
+        List<TortVO> compareMessageVOS = new ArrayList<>();
         if (tortCompareRecordVO != null) {
             List<TortRightVO> tortRightVOS = tortCompareRecordVO.getTortRightVOS();
-
-            for (TortRightVO item : tortRightVOS) {
-                compareMessageVOS.addAll((item.getCompareMessageVOS()));
-                if (item.getType().equals(0)) {
-                    mainRightNum++;
+            if (tortRightVOS != null) {
+                for (TortRightVO item : tortRightVOS) {
+                    if (item.getTortVOS() != null && item.getTortVOS().size() > 0) {
+                        compareMessageVOS.addAll((item.getTortVOS()));
+                    }
+                    if (item.getType().equals(0)) {
+                        mainRightNum++;
+                    }
+                    rightNum++;
                 }
-                rightNum++;
             }
         }
+        compareMessageVOS.forEach(item -> {
+            if (item.getOriginalRecordVO() != null) {
+                item.setTargetDescription(item.getOriginalRecordVO().getTargetDescription());
+                if (item.getOriginalRecordVO().getCompareResult() != null) {
+                    switch (item.getOriginalRecordVO().getCompareResult()) {
+                        case 0:
+                            item.setResultStr("字面相同");
+                            break;
+                        case 1:
+                            item.setResultStr("等同");
+                            break;
+                        case 2:
+                            item.setResultStr("不等同");
+                            break;
+                        case 3:
+                            item.setResultStr("待确定");
+                            break;
+                    }
+                }
+            }
+        });
         map.put("compareMessageVOs", compareMessageVOS);
         map.put("rightNum", rightNum);
         map.put("mainRightNum", mainRightNum);
@@ -923,12 +960,13 @@ public class FTOCompareRecordService extends ServiceImpl<FTOCompareRecordMapper,
 
     /**
      * 从FTO中获得对比结果,并复制保存
+     *
      * @param projectId
-     * @param taskId 有可能是协同任务id
+     * @param taskId    有可能是协同任务id
      * @param createId
      * @param patentNos
      */
-    public void copyFTOCompareRecords(Integer projectId, Integer taskId, String createId, List<String> patentNos){
+    public void copyFTOCompareRecords(Integer projectId, Integer taskId, String createId, List<String> patentNos) {
         //判断参数不为空
         if (projectId != null && taskId != null) {
             patentNos.forEach(patentNo -> {
@@ -967,11 +1005,12 @@ public class FTOCompareRecordService extends ServiceImpl<FTOCompareRecordMapper,
 
     /**
      * 根据projectId和patentNo从对比结果表中查询最终结果,肯定不为空!
+     *
      * @param projectId
      * @param patentNo
      * @return
      */
-    public Integer getLastTaskIdFromRecords(Integer projectId, String patentNo){
+    public Integer getLastTaskIdFromRecords(Integer projectId, String patentNo) {
         //根据报告id和专利号查询最新的对比结果的任务id
         LambdaQueryWrapper<FTOCompareRecord> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper
@@ -990,12 +1029,13 @@ public class FTOCompareRecordService extends ServiceImpl<FTOCompareRecordMapper,
 
     /**
      * 查询最新对比结果
+     *
      * @param projectId
      * @param patentNo
      * @param taskId
      * @return
      */
-    public List<FTOCompareRecord> getLastFTORecord(Integer projectId, String patentNo, Integer taskId){
+    public List<FTOCompareRecord> getLastFTORecord(Integer projectId, String patentNo, Integer taskId) {
         LambdaQueryWrapper<FTOCompareRecord> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper
                 .eq(FTOCompareRecord::getProjectId, projectId)
@@ -1009,11 +1049,12 @@ public class FTOCompareRecordService extends ServiceImpl<FTOCompareRecordMapper,
 
     /**
      * 根据两个参数查询splitId
+     *
      * @param projectId
      * @param patentNo
      * @return
      */
-    public Integer getSplitId(Integer projectId, String patentNo, Integer taskId){
+    public Integer getSplitId(Integer projectId, String patentNo, Integer taskId) {
         //根据报告id和专利号查询最新的对比结果的任务id
         LambdaQueryWrapper<PatentSplitMessage> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper
@@ -1031,13 +1072,13 @@ public class FTOCompareRecordService extends ServiceImpl<FTOCompareRecordMapper,
         return splitId;
     }
 
-    public Integer getAssoTaskId(String patentNo, Integer assitTaskId){
+    public Integer getAssoTaskId(String patentNo, Integer assitTaskId) {
         LambdaQueryWrapper<FTOCompareRecord> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(FTOCompareRecord::getCompareFileNumber, patentNo)
                 .eq(FTOCompareRecord::getProjectTaskId, assitTaskId)
                 .eq(FTOCompareRecord::getIfOriginal, true);
-        FTOCompareRecord ftoCompareRecord = this.getOne(queryWrapper ,false);
+        FTOCompareRecord ftoCompareRecord = this.getOne(queryWrapper, false);
         Integer assoTaskId = ftoCompareRecord.getAssoTaskId();
-        return  assoTaskId;
+        return assoTaskId;
     }
 }

+ 5 - 1
src/main/java/cn/cslg/pas/service/business/FeatureService.java

@@ -81,7 +81,9 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Feature> {
 
         //查询拆分下的权要
         List<RePatentClaim> patentRights = this.getRightListByNo(patentNo);
-
+        if(patentRights.size()==0){
+            return new ArrayList<>();
+        }
         LambdaQueryWrapper<PatentSplitMessage> splitWrapper = new LambdaQueryWrapper<>();
         splitWrapper.eq(PatentSplitMessage::getPatentNo, patentNo);
         splitWrapper.eq(PatentSplitMessage::getProjectId, projectId);
@@ -116,6 +118,8 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Feature> {
                 }
                 patentSplitMessage.insert();
                 allFeatures = this.splitFeature(splitBy, splitType, patentNo, projectId, taskId, patentRights, patentSplitMessage.getId());
+
+
             }
         }
         //当重拆时新建

+ 9 - 7
src/main/java/cn/cslg/pas/service/business/ImportTaskService.java

@@ -168,8 +168,12 @@ public class ImportTaskService extends ServiceImpl<ImportTaskMapper, ImportTask>
             String jsons = JSONObject.toJSON(importTaskDTO.getPatentNos()).toString();
             importTaskCondition.setPatentNos(jsons);
         }
-        String fieldJson = JsonUtils.objectToJson(importTaskCondition);
-        importTaskCondition.setCustomFields(fieldJson);
+
+        //保存标引信息
+        if (importTaskDTO.getFieldDTOS() != null && importTaskDTO.getFieldDTOS().size() > 0) {
+            String fieldJson = JsonUtils.objectToJson(importTaskDTO.getFieldDTOS());
+            importTaskCondition.setCustomFields(fieldJson);
+        }
         importTaskCondition.insert();
 
         //装载任务
@@ -316,16 +320,14 @@ public class ImportTaskService extends ServiceImpl<ImportTaskMapper, ImportTask>
                 importTaskVO.setStateStr(systemDict2.getLabel());
             }
 
-
-            long percentage = (long) Math.floor((importTaskVO.getDoneNum() + 0D) / importTaskVO.getAllNum() * 100D);
-            importTaskVO.setPercentage(percentage);
-
-
             //装载正在进行中任务的完成条数
             ImportTaskAMVO importTaskAMVO = importTaskAMVOS.stream().filter(item -> item.getId().equals(importTaskVO.getId())).findFirst().orElse(null);
             if (importTaskAMVO != null) {
                 importTaskVO.setDoneNum(importTaskAMVO.getDoneNum());
+                importTaskAMVO.setAllNum(importTaskAMVO.getAllNum());
             }
+            long percentage = (long) Math.floor((importTaskVO.getDoneNum() + 0D) / importTaskVO.getAllNum() * 100D);
+            importTaskVO.setPercentage(percentage);
         }
 
     }

+ 9 - 4
src/main/java/cn/cslg/pas/service/business/MergePersonService.java

@@ -109,7 +109,7 @@ public class MergePersonService extends ServiceImpl<MergePersonMapper, MergePers
                 .eq(MergePerson::getProjectId, vo.getProjectId())
                 .eq(MergePerson::getName, vo.getName());
         List<MergePerson> list = mergePersonMapper.selectList(wrapper);
-        if (list.size() > 1) {
+        if (list.size() > 0) {
             throw new XiaoShiException("合并名称不可重复");
         }
 
@@ -460,7 +460,11 @@ public class MergePersonService extends ServiceImpl<MergePersonMapper, MergePers
         personVO.setAddress(vo.getAddress());
         personVO.setRemark(vo.getRemark());
         personVO.setMergedName(nameList);
-        return this.mergePerson(personVO);
+        Integer id = this.mergePerson(personVO);
+        if (id < 0) {
+            throw new XiaoShiException("再合并失败");
+        }
+        return id;
     }
 
     /**
@@ -482,9 +486,10 @@ public class MergePersonService extends ServiceImpl<MergePersonMapper, MergePers
         //判断是否名称重复
         LambdaQueryWrapper<MergePerson> wrapper = new LambdaQueryWrapper<MergePerson>()
                 .eq(MergePerson::getProjectId, vo.getProjectId())
-                .eq(MergePerson::getName, vo.getName());
+                .eq(MergePerson::getName, vo.getName())
+                .ne(BaseEntity::getId, vo.getId());
         List<MergePerson> list = mergePersonMapper.selectList(wrapper);
-        if (list.size() > 1) {
+        if (list.size() > 0) {
             throw new XiaoShiException("合并名称不可重复");
         }
         //获取老专利

+ 1 - 1
src/main/java/cn/cslg/pas/service/business/ProjectTaskService.java

@@ -968,7 +968,7 @@ public class ProjectTaskService extends ServiceImpl<ProjectTaskMapper, ProjectTa
         });
 
 
-        Integer current = 0;
+        Integer current = 1;
         for (PersonAssignedDTO item : personAssignedDTOList) {
             List<String> addPatentNos = new ArrayList<>();
             //创建任务

+ 55 - 3
src/main/java/cn/cslg/pas/service/business/TreeNodeService.java

@@ -254,11 +254,11 @@ public class TreeNodeService extends ServiceImpl<TreeNodeMapper, TreeNode> imple
             if (parentPath != null) {
                 //父id若为顶层id,则父id没有路径
                 if (parentPath.equals("")) {
-                    treeNode.setPath(parentId+"");
+                    treeNode.setPath(parentId + "");
                     treeNode.setLevel(1);
                 } else {
                     //父id不是顶层id,父id有路径
-                    treeNode.setPath(parentPath + "/" + parentId );
+                    treeNode.setPath(parentPath + "/" + parentId);
                     treeNode.setLevel(parentNode.getLevel() + 1);
                 }
             } else {
@@ -484,7 +484,6 @@ public class TreeNodeService extends ServiceImpl<TreeNodeMapper, TreeNode> imple
         }
 
 
-
         List<Personnel> personnels = new ArrayList<>();
         List<String> guids = new ArrayList<>();
         List<SystemFile> systemFiles = new ArrayList<>();
@@ -771,4 +770,57 @@ public class TreeNodeService extends ServiceImpl<TreeNodeMapper, TreeNode> imple
         });
         return ids;
     }
+
+    //
+    public List<String> getIdByNames(List<String> values, Integer fieldId) {
+
+        List<String> valuesIds = new ArrayList<>();
+        for (String value : values) {
+            String[] valueQs = value.split("\\\\");
+            TreeNode parentTreeNode = null;
+            for (int i = 0; i < valueQs.length; i++) {
+                String valueQ = valueQs[i];
+                TreeNode treeNode = this.getTreeNodeByName(valueQ, i, fieldId, parentTreeNode);
+                if (i == valueQs.length - 1) {
+                    if (!valuesIds.contains(treeNode.getId())) {
+                        valuesIds.add(treeNode.getId().toString());
+                    }
+                }
+            }
+        }
+        return valuesIds;
+    }
+
+
+    public TreeNode getTreeNodeByName(String value, Integer level, Integer fieldId, TreeNode parentTreeNode) {
+        Integer parentId = 0;
+        if (parentTreeNode != null) {
+            parentId = parentTreeNode.getParentId();
+        }
+
+        //根据名称查询
+        LambdaQueryWrapper<TreeNode> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(TreeNode::getName, value)
+                .eq(TreeNode::getLevel, level)
+                .eq(TreeNode::getParentId, parentId)
+                .eq(TreeNode::getType, 4)
+                .eq(TreeNode::getTypeId, fieldId);
+        TreeNode treeNode = this.getOne(queryWrapper, false);
+        if (treeNode == null) {
+             treeNode =new TreeNode();
+            treeNode.setName(value);
+            treeNode.setType(4);
+            treeNode.setParentId(parentId);
+            treeNode.setLevel(level);
+            treeNode.setTypeId(fieldId);
+            if(parentTreeNode!=null) {
+                treeNode.setPath(parentTreeNode.getPath()+"/"+parentTreeNode.getId());
+            }
+            else {
+                treeNode.setPath("");
+            }
+            treeNode.insert();
+        }
+        return  treeNode;
+    }
 }

+ 51 - 6
src/main/java/cn/cslg/pas/service/business/es/EsCountService.java

@@ -38,9 +38,11 @@ import java.util.stream.Collectors;
 @RequiredArgsConstructor(onConstructor_ = {@Lazy})
 public class EsCountService {
     private final List<String> childList = Arrays.asList("field");
-    private final List<String> nestedList = Arrays.asList("PA", "IN", "PE", "SAT", "MAT", "SRH", "MRH", "MIN");
+    private final List<String> nestedList = Arrays.asList("PA", "IN", "PE", "SAT", "SRH","PRCO");
     private final List<String> dateList = Arrays.asList("PD", "AD", "GD");
     private final List<String> numberList = Arrays.asList("QPN", "QDPN", "SFN", "IFN", "PFN");
+    private final List<String> nestDateList = Arrays.asList("PRD");
+    private final List<String> nestChildList = Arrays.asList("MAT","MRH","MIN");
 
 
     private final ElasticsearchClient client;
@@ -153,7 +155,6 @@ public class EsCountService {
             }
         }
 
-
         if (!CollectionUtils.isEmpty(customFields)) {
             searchCondition = esService.parseCustomField(customFields);
         }
@@ -226,6 +227,33 @@ public class EsCountService {
                                 esCountDTO.setAllNumber(filtersAgg.nested().docCount());
                             }
                         });
+                    } else if (nestDateList.contains(field)) {
+                        if (CollectionUtils.isEmpty(values)) {
+                            filtersBuckets.forEach(filtersBucket -> {
+                                Aggregate filtersAgg = filtersBucket.aggregations().get("filters_agg");
+                                Aggregate termsAgg = filtersAgg.nested().aggregations().get("terms_agg");
+                                try {
+                                    this.getDateCountDTOS(termsAgg, field, topN, format, detailDTOS, esCountDTO);
+                                } catch (ParseException e) {
+                                    e.printStackTrace();
+                                }
+                            });
+                        } else {
+                            filtersBuckets.forEach(filtersBucket -> {
+                                Aggregate filtersAgg = filtersBucket.aggregations().get("filters_agg");
+                                Aggregate termsAgg = filtersAgg.nested().aggregations().get("terms_agg");
+                                this.getDateAnalysisDTOS(termsAgg, field, topN, detailDTOS, esCountDTO, firstName, map, values);
+                            });
+                        }
+                    } else if (nestChildList.contains(field)) {
+                        filtersBuckets.forEach(filtersBucket -> {
+                            Aggregate filtersAgg = filtersBucket.aggregations().get("filters_agg");
+                            Aggregate childAgg = filtersAgg.children().aggregations().get("childAgg");
+                            this.getNestedCountDTOS(childAgg, field, topN, detailDTOS, esCountDTO, firstName, map, values);
+                            if (!CollectionUtils.isEmpty(values)) {
+                                esCountDTO.setAllNumber(childAgg.nested().docCount());
+                            }
+                        });
                     } else if (childList.contains(field)) {
                         if (CollectionUtils.isEmpty(values)) {
                             Integer finalFieldType = fieldType;
@@ -271,6 +299,15 @@ public class EsCountService {
                     if (!CollectionUtils.isEmpty(values)) {
                         esCountDTO.setAllNumber(agg.nested().docCount());
                     }
+                } else if (nestDateList.contains(field)) {
+                    Aggregate termsAgg = agg.nested().aggregations().get("terms_agg");
+                    this.getDateCountDTOS(termsAgg, field, topN, format, detailDTOS, esCountDTO);
+                } else if (nestChildList.contains(field)) {
+                    Aggregate childAgg = agg.children().aggregations().get("childAgg");
+                    this.getNestedCountDTOS(childAgg, field, topN, detailDTOS, esCountDTO, firstName, map, values);
+                    if (!CollectionUtils.isEmpty(values)) {
+                        esCountDTO.setAllNumber(childAgg.nested().docCount());
+                    }
                 } else if (childList.contains(field)) {
                     if (CollectionUtils.isEmpty(values)) {
                         this.getChildCountDTOS(agg, field, fieldType, topN, detailDTOS, esCountDTO);
@@ -478,9 +515,13 @@ public class EsCountService {
         EsCountDetailDTO countDTO = new EsCountDetailDTO();
         countDTO.setField(field);
         countDTO.setName("其他");
-        countDTO.setNumber(agg.sterms().sumOtherDocCount());
         countDTO.setTopN(topN);
-        detailDTOS.add(countDTO);
+        Long count = agg.sterms().sumOtherDocCount();
+        if (count > 0) {
+            countDTO.setNumber(count);
+            detailDTOS.add(countDTO);
+        }
+
         List<StringTermsBucket> list = agg.sterms().buckets().array();
         list.forEach(bucket -> {
             EsCountDetailDTO dto = new EsCountDetailDTO();
@@ -933,9 +974,13 @@ public class EsCountService {
         EsCountDetailDTO countDTO = new EsCountDetailDTO();
         countDTO.setField(field);
         countDTO.setName("其他");
-        countDTO.setNumber(termsAgg.sterms().sumOtherDocCount());
         countDTO.setTopN(topN);
-        countDetailDTOS.add(countDTO);
+        Long count = termsAgg.sterms().sumOtherDocCount();
+        if (count > 0) {
+            countDTO.setNumber(count);
+            countDetailDTOS.add(countDTO);
+        }
+
         List<StringTermsBucket> list = termsAgg.sterms().buckets().array();
         list.forEach(bucket -> {
             EsCountDetailDTO dto = new EsCountDetailDTO();

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

@@ -21,6 +21,7 @@ import cn.cslg.pas.service.business.CustomOptionService;
 import cn.cslg.pas.service.business.TreeNodeService;
 import cn.cslg.pas.service.query.FormatQueryService;
 import co.elastic.clients.elasticsearch.ElasticsearchClient;
+import co.elastic.clients.elasticsearch._types.SortOptions;
 import co.elastic.clients.elasticsearch._types.SortOrder;
 import co.elastic.clients.elasticsearch._types.aggregations.Aggregation;
 import co.elastic.clients.elasticsearch._types.aggregations.AggregationBuilders;
@@ -359,6 +360,8 @@ public class EsCustomFieldService {
         Query q = formatQueryService.EsQueryToQuery((operateNode) tree, "patent");
         builder.query(q);
 
+        //排序
+        List<SortOptions> optionsList = new ArrayList<>();
         List<OrderDTO> dtoList = vo.getOrderDTOList();
         if (!CollectionUtils.isEmpty(dtoList)) {
             String json = CommonService.readJsonFile("patent.json");
@@ -367,21 +370,19 @@ public class EsCustomFieldService {
                 EsConfigVO configVO = esConfigVOS.stream().filter(item -> item.getField().equals(orderDTO.getOrderBy())).findFirst().orElse(null);
                 if (configVO != null) {
                     if (orderDTO.getOrderType().equals(IfConstant.NO)) {
-                        builder.sort(sortOptionsBuilder -> sortOptionsBuilder
-                                .field(fieldSortBuilder -> fieldSortBuilder
-                                        .field(configVO.getEsField()).order(SortOrder.Asc)));
+                        SortOptions sortOptions = SortOptions.of(i -> i.field(j -> j.field(configVO.getEsField()).order(SortOrder.Asc).missing(-1)));
+                        optionsList.add(sortOptions);
                     } else {
-                        builder.sort(sortOptionsBuilder -> sortOptionsBuilder
-                                .field(fieldSortBuilder -> fieldSortBuilder
-                                        .field(configVO.getEsField()).order(SortOrder.Desc)));
+                        SortOptions sortOptions = SortOptions.of(i -> i.field(j -> j.field(configVO.getEsField()).order(SortOrder.Desc).missing(-1)));
+                        optionsList.add(sortOptions);
                     }
                 }
             }
         } else {
-            builder.sort(sortOptionsBuilder -> sortOptionsBuilder
-                    .field(fieldSortBuilder -> fieldSortBuilder
-                            .field("patent_no.keyword").order(SortOrder.Desc)));
+            SortOptions sortOptions = SortOptions.of(i -> i.field(j -> j.field("patent_no.keyword").order(SortOrder.Desc).missing(-1)));
+            optionsList.add(sortOptions);
         }
+        builder.sort(optionsList);
 
         int number = endNum - startNum;
         if (startNum > 0 && endNum > startNum) {

+ 24 - 11
src/main/java/cn/cslg/pas/service/business/es/EsPatentService.java

@@ -350,14 +350,15 @@ public class EsPatentService {
         //设置查询索引
         builder.index("patent_family");
         //申请号
-        Query q1 = QueryBuilders.term(t -> t.field("app_no.keyword").value(no));
+        Query q1 = QueryBuilders.term(t -> t.field("patent.app_no").value(no));
         //公开号
-        Query q2 = QueryBuilders.term(t -> t.field("public_no.keyword").value(no));
+        Query q2 = QueryBuilders.term(t -> t.field("patent.public_no").value(no));
         //授权号
-        Query q3 = QueryBuilders.term(t -> t.field("grant_no.keyword").value(no));
+        Query q3 = QueryBuilders.term(t -> t.field("patent.grant_no").value(no));
         //同族类型
         Query q4 = QueryBuilders.term(t -> t.field("family_type").value(type));
-        Query bool = QueryBuilders.bool(i -> i.must(q4).should(q1, q2, q3));
+        Query q =QueryBuilders.bool(i->i.should(q1,q2,q3));
+        Query bool = QueryBuilders.bool(i -> i.must(q4,q));
         builder.query(bool);
         //分页
         if (pageNum > 0 && pageSize > 0) {
@@ -377,14 +378,22 @@ public class EsPatentService {
                     kinDetailVO.setAppNo(familyPatent.getAppNo());
                     kinDetailVO.setPublicNo(familyPatent.getPublicNo());
                     kinDetailVO.setGrantNo(familyPatent.getGrantNo());
-                    PatentKinDTO kinDTO = this.selectPatentKindDetail(kinDetailVO, patentNo)
-                            .stream().findFirst().orElse(null);
-                    if (kinDTO != null) {
-                        kinDTOS.add(kinDTO);
+                    if (StringUtils.isNotEmpty(patentNo)) {
+                        PatentKinDTO kinDTO = this.selectPatentKindDetail(kinDetailVO, patentNo)
+                                .stream().findFirst().orElse(null);
+                        if (kinDTO != null) {
+                            kinDTOS.add(kinDTO);
+                        }
+                        break;
+                    } else {
+                        PatentKinDTO kinDTO = this.selectPatentKindDetail(kinDetailVO, patentNo)
+                                .stream().findFirst().orElse(null);
+                        if (kinDTO != null) {
+                            kinDTOS.add(kinDTO);
+                        }
                     }
                 }
             }
-
         }
         return kinDTOS;
     }
@@ -406,7 +415,7 @@ public class EsPatentService {
         if (StringUtils.isNotEmpty(patentNo)) {
             String str = "*";
             String s = str.concat(patentNo).concat("*");
-            Query query = QueryBuilders.wildcard(i -> i.field(patentNo).value(s));
+            Query query = QueryBuilders.wildcard(i -> i.field("patent_no.keyword").value(s));
             bool = QueryBuilders.bool(i -> i.should(q1, q2).must(query));
         } else {
             bool = QueryBuilders.bool(i -> i.should(q1, q2));
@@ -611,6 +620,8 @@ public class EsPatentService {
     public List<Patent> getPatentsWithNotNo(QueryRequest queryRequest, List<String> patentNos) throws Exception {
         List<Patent> patentList = new ArrayList<>();
         SearchRequest.Builder builder = new SearchRequest.Builder();
+        Long current =queryRequest.getCurrent();
+        Long size =queryRequest.getSize();
         //设置查询索引
         builder.index("patent");
         Query q = this.getQuery(queryRequest);
@@ -624,7 +635,9 @@ public class EsPatentService {
         }
         //4. 返回数据
         builder.query(reQuery);
-
+        if (current > 0 && size > 0) {
+            builder.from(current.intValue() - 1).size(size.intValue());
+        }
         List<String> reSources = this.rePatentSource();
         builder.source(sourceOptionsBuilder -> sourceOptionsBuilder
                 .filter(fieldSourceBuilder -> fieldSourceBuilder

+ 46 - 15
src/main/java/cn/cslg/pas/service/business/es/EsService.java

@@ -34,6 +34,7 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson2.JSONObject;
 import lombok.RequiredArgsConstructor;
+import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.elasticsearch.client.RequestOptions;
 import org.springframework.beans.BeanUtils;
@@ -232,6 +233,7 @@ public class EsService {
         }
 
         //排序
+        List<SortOptions> optionsList = new ArrayList<>();
         List<OrderDTO> dtoList = queryRequest.getOrderDTOList();
         if (!CollectionUtils.isEmpty(dtoList)) {
             String json = CommonService.readJsonFile("patent.json");
@@ -240,23 +242,19 @@ public class EsService {
                 EsConfigVO configVO = esConfigVOS.stream().filter(item -> item.getField().equals(orderDTO.getOrderBy())).findFirst().orElse(null);
                 if (configVO != null) {
                     if (orderDTO.getOrderType().equals(IfConstant.NO)) {
-                        builder.sort(sortOptionsBuilder -> sortOptionsBuilder
-                                .field(fieldSortBuilder -> fieldSortBuilder
-                                        .missing("_missing_").order(SortOrder.Desc)
-                                        .field(configVO.getEsField()).order(SortOrder.Asc)));
+                        SortOptions sortOptions = SortOptions.of(i -> i.field(j -> j.field(configVO.getEsField()).order(SortOrder.Asc).missing(-1)));
+                        optionsList.add(sortOptions);
                     } else {
-                        builder.sort(sortOptionsBuilder -> sortOptionsBuilder
-                                .field(fieldSortBuilder -> fieldSortBuilder
-                                        .missing("_missing_").order(SortOrder.Desc)
-                                        .field(configVO.getEsField()).order(SortOrder.Desc)));
+                        SortOptions sortOptions = SortOptions.of(i -> i.field(j -> j.field(configVO.getEsField()).order(SortOrder.Desc).missing(-1)));
+                        optionsList.add(sortOptions);
                     }
                 }
             }
         } else {
-            builder.sort(sortOptionsBuilder -> sortOptionsBuilder
-                    .field(fieldSortBuilder -> fieldSortBuilder
-                            .field("patent_no.keyword").order(SortOrder.Desc).missing(-1)));
+            SortOptions sortOptions = SortOptions.of(i -> i.field(j -> j.field("patent_no.keyword").order(SortOrder.Desc).missing(-1)));
+            optionsList.add(sortOptions);
         }
+        builder.sort(optionsList);
 
         //分页
         if (current != null && size != null && current > 0 && size > 0) {
@@ -299,6 +297,22 @@ public class EsService {
                                 columnDTO.setMergeInventor(new ArrayList<>());
                             }
                         }
+                        if (ObjectUtils.isNotEmpty(patent1.getApplicantAddr())) {
+                            PersonAddress applicantAddr = patent1.getApplicantAddr();
+                            columnDTO.setAppAddress(applicantAddr.getAddress());
+                            columnDTO.setApplicantCountry(applicantAddr.getCountry());
+                            columnDTO.setAppProvince(applicantAddr.getProvince());
+                            columnDTO.setAppCity(applicantAddr.getCity());
+                            columnDTO.setAppDistrict(applicantAddr.getDistrict());
+                        }
+                        if (ObjectUtils.isNotEmpty(patent1.getRightHolderAddr())) {
+                            PersonAddress rightAddr = patent1.getRightHolderAddr();
+                            columnDTO.setRightAddress(rightAddr.getAddress());
+                            columnDTO.setRightCountry(rightAddr.getCountry());
+                            columnDTO.setRightProvince(rightAddr.getProvince());
+                            columnDTO.setRightCity(rightAddr.getCity());
+                            columnDTO.setRightDistrict(rightAddr.getDistrict());
+                        }
                         columnDTO.setApplicant(esPatentService.loadName(patent1.getApplicant()));
                         columnDTO.setRightHolder(esPatentService.loadName(patent1.getRightHolder()));
                         columnDTO.setInventor(esPatentService.loadName(patent1.getInventor()));
@@ -332,6 +346,22 @@ public class EsService {
                         columnDTO.setMergeInventor(new ArrayList<>());
                     }
                 }
+                if (ObjectUtils.isNotEmpty(esMess.getApplicantAddr())) {
+                    PersonAddress applicantAddr = esMess.getApplicantAddr();
+                    columnDTO.setAppAddress(applicantAddr.getAddress());
+                    columnDTO.setApplicantCountry(applicantAddr.getCountry());
+                    columnDTO.setAppProvince(applicantAddr.getProvince());
+                    columnDTO.setAppCity(applicantAddr.getCity());
+                    columnDTO.setAppDistrict(applicantAddr.getDistrict());
+                }
+                if (ObjectUtils.isNotEmpty(esMess.getRightHolderAddr())) {
+                    PersonAddress rightAddr = esMess.getRightHolderAddr();
+                    columnDTO.setRightAddress(rightAddr.getAddress());
+                    columnDTO.setRightCountry(rightAddr.getCountry());
+                    columnDTO.setRightProvince(rightAddr.getProvince());
+                    columnDTO.setRightCity(rightAddr.getCity());
+                    columnDTO.setRightDistrict(rightAddr.getDistrict());
+                }
                 columnDTO.setApplicant(esPatentService.loadName(esMess.getApplicant()));
                 columnDTO.setRightHolder(esPatentService.loadName(esMess.getRightHolder()));
                 columnDTO.setInventor(esPatentService.loadName(esMess.getInventor()));
@@ -683,14 +713,15 @@ public class EsService {
             //设置查询索引
             builder.index("patent_family");
             //申请号
-            Query q1 = QueryBuilders.term(t -> t.field("app_no").value(no));
+            Query q1 = QueryBuilders.term(t -> t.field("patent.app_no").value(no));
             //公开号
-            Query q2 = QueryBuilders.term(t -> t.field("public_no").value(no));
+            Query q2 = QueryBuilders.term(t -> t.field("patent.public_no").value(no));
             //授权号
-            Query q3 = QueryBuilders.term(t -> t.field("grant_no").value(no));
+            Query q3 = QueryBuilders.term(t -> t.field("patent.grant_no").value(no));
             //类型
             Query q4 = QueryBuilders.term(t -> t.field("family_type").value(type));
-            Query bool = QueryBuilders.bool(i -> i.must(q4).should(q1, q2, q3));
+            Query p  =QueryBuilders.bool(i -> i.should(q1, q2, q3));
+            Query bool = QueryBuilders.bool(i -> i.must(q4,p));
             builder.query(bool);
             SearchResponse<PatentFamilyMessage> response = client.search(builder.build(), PatentFamilyMessage.class);
             long total = response.hits().total().value();

+ 2 - 1
src/main/java/cn/cslg/pas/service/business/invalidReport/EvidenceReasonService.java

@@ -208,6 +208,7 @@ public class EvidenceReasonService extends ServiceImpl<EvidenceReasonMapper, Evi
             assoGroupFeatures.forEach(assoGroupFeature -> {
                 //查询特征
                 Integer featureId = assoGroupFeature.getFeatureId();
+                Integer featureGen =assoGroupFeature.getFeatureGen();
                 //根据特征id查询特征
                 Feature feature = featureService.getById(featureId);
                 Integer featureGroupId = assoGroupFeature.getId();
@@ -256,7 +257,7 @@ public class EvidenceReasonService extends ServiceImpl<EvidenceReasonMapper, Evi
                         queryEvidenceReasonVO.setGroupId(groupId);
                         queryEvidenceReasonVO.setFeatureGroupId(featureGroupId);
                         queryEvidenceReasonVO.setFeatureHistories(queryFeatureHistories);
-
+                        queryEvidenceReasonVO.setFeatureGen(featureGen);
                         //装载特征陈述信息
                         queryEvidenceReasonVO.setFeCommon(item.getCommon());
                         queryEvidenceReasonVO.setFeIfPresentOpinions1(item.getIfPresentOpinions1());

+ 2 - 1
src/main/java/cn/cslg/pas/service/business/invalidReport/PatentClaimService.java

@@ -110,7 +110,8 @@ public class PatentClaimService extends ServiceImpl<PatentClaimMapper, PatentCla
     public List<PatentClaimVO> ifHaveSplit(Integer projectId) {
         //根据报告id 查询是否有拆分权要
         LambdaQueryWrapper<PatentClaim> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(PatentClaim::getProjectId, projectId).orderByAsc(PatentClaim::getSysOrder);
+        queryWrapper.eq(PatentClaim::getProjectId, projectId).
+               eq(PatentClaim::getContentType, 0).orderByAsc(PatentClaim::getSysOrder);
         List<PatentClaim> patentClaims = this.list(queryWrapper);
         List<PatentClaimVO> patentClaimVOS = new ArrayList<>();
         patentClaims.forEach(item -> {

+ 4 - 3
src/main/java/cn/cslg/pas/service/importPatent/GetCataloguingFromWebThread.java

@@ -98,12 +98,12 @@ public class GetCataloguingFromWebThread extends Thread {
 
                 EsService esService = applicationContext.getBean(EsService.class);
 
-//                添加同族专利
+            // 添加同族专利
                 String familyPatentNoStr = patentStarApiService.getFamilyByPubNoApi(uploadPatentWebDTO.getPatent().getPublicNo());
                 List<String> familyPatentNos = new ArrayList<>();
-                if (!familyPatentNoStr.equals("no data")) {
+                if (!familyPatentNoStr.equals("no data")&&!familyPatentNoStr.trim().equals("")) {
                     FamilyPatentNo familyPatentNo = JSON.parseObject(familyPatentNoStr, FamilyPatentNo.class);
-                    if (familyPatentNo != null && familyPatentNo.getFamilyinfo() != null) {
+                    if (familyPatentNo != null &&!familyPatentNo.getFamilyinfo().trim().equals("")&& familyPatentNo.getFamilyinfo() != null) {
                         familyPatentNos = Arrays.asList(familyPatentNo.getFamilyinfo().split(";"));
                     }
                 }
@@ -124,6 +124,7 @@ public class GetCataloguingFromWebThread extends Thread {
                     List<String> quotedNos = this.reQuotedNos(nos);
                     esService.addEsQuotePatent(uploadPatentWebDTO.getPatent().getPublicNo(), quotedNos);
                 }
+
                 //加入es保存队列
                 importFromWebToEsService.loadPatentMessageDone(uploadPatentWebDTO);
             } catch (Exception e) {

+ 10 - 5
src/main/java/cn/cslg/pas/service/importPatent/GetPatentFromExcelThread.java

@@ -3,6 +3,7 @@ package cn.cslg.pas.service.importPatent;
 import cn.cslg.pas.common.core.base.FamilyType;
 import cn.cslg.pas.common.dto.UploadPatentWebDTO;
 import cn.cslg.pas.common.dto.business.EsPatentFamilyDTO;
+import cn.cslg.pas.common.dto.es.EsCustomFieldDTO;
 import cn.cslg.pas.common.model.cronModel.SystemFile;
 import cn.cslg.pas.common.utils.ReadExcelUtils;
 import cn.cslg.pas.common.vo.ImportTaskAMVO;
@@ -11,6 +12,7 @@ import cn.cslg.pas.common.vo.UploadParamsVO;
 import cn.cslg.pas.common.vo.UploadSettingVO;
 import cn.cslg.pas.domain.es.Patent;
 import cn.cslg.pas.domain.es.Text;
+import cn.cslg.pas.service.business.CustomFieldService;
 import cn.cslg.pas.service.business.es.EsService;
 import cn.cslg.pas.service.common.ExcuteDataToVOService;
 import cn.cslg.pas.service.common.ExcuteUploadSettingService;
@@ -53,7 +55,9 @@ public class GetPatentFromExcelThread extends Thread {
                 IOUtils.copy(inputStream, outputStream); // 将输入流复制到临时文件
             }
             Integer total = importTaskAMVO.getAllNum();
+
             Integer lastIndex = importTaskAMVO.getDoneNum();
+
             Integer sourceId = importTaskAMVO.getSourceId();
             //解析数据源类,通过数据来源id(如1:智慧芽)解析数据源配置文件,获得数据源配置文件对象jsonData
             ExcuteDataToVOService excuteDataToVOService = applicationContext.getBean(ExcuteDataToVOService.class);
@@ -68,19 +72,21 @@ public class GetPatentFromExcelThread extends Thread {
                     break;
                 }
                 PatentData patentData = ReadExcelUtils.readExcelOneRow(tempFile, sheet, i + 1);
-
                 //调用装载数据类(根据数据源配置文件对象和专利源数据生成专利数据)
                 UploadParamsVO uploadParamsVO = excuteDataToVOService.fileToPatentVO(patentData, jsonData);
                 this.loadPatent(uploadParamsVO);
-
                 UploadPatentWebDTO uploadPatentWebDTO = new UploadPatentWebDTO();
                 uploadPatentWebDTO.setHaveSaveCounter(0);
                 uploadPatentWebDTO.setTotalCounter(importTaskAMVO.getThreadCounter());
                 uploadPatentWebDTO.setPictureData(uploadParamsVO.getPictureData());
                 uploadPatentWebDTO.setPatent(uploadParamsVO.getPatent());
+                if(uploadParamsVO.getCustomerFieldList()!=null&&uploadParamsVO.getCustomerFieldList().size()!=0){
+                    CustomFieldService customFieldService =applicationContext.getBean(CustomFieldService.class);
+                    List<EsCustomFieldDTO> esCustomFieldDTOList =customFieldService.getFieldDTOByStrings(uploadParamsVO.getCustomerFieldList(),importTaskAMVO.getProjectId());
+                    uploadPatentWebDTO.setEsCustomFieldDTOList(esCustomFieldDTOList);
+                }
                 //专利丢入消费者队列,并唤醒消费者线程
-
-                savePatentToEsThread.awakeTask(uploadPatentWebDTO.getPatent());
+                savePatentToEsThread.awakeTask(uploadPatentWebDTO);
                 getPatentPictureFromExcelThread.awakeTask(uploadPatentWebDTO);
             }
             //专利取完通知消费者线程
@@ -98,7 +104,6 @@ public class GetPatentFromExcelThread extends Thread {
         this.savePatentToEsThread = savePatentToEsThread;
         this.applicationContext = taskThread.getApplicationContext();
         this.getPatentPictureFromExcelThread = getPatentPictureFromExcelThread;
-
     }
 
 

+ 3 - 7
src/main/java/cn/cslg/pas/service/importPatent/ImportFromWebToEsService.java

@@ -283,18 +283,14 @@ public class ImportFromWebToEsService implements PatentImportImp {
                     Patent orgPatent = uploadPatentWebDTO.getPatent();
                     Patent patent = dtos.get(0).getPatent();
                     BeanUtils.copyProperties(patent, orgPatent, FormatUtil.getNullPropertyNames(patent));
-                    Patent patent1 = new Patent();
-                    BeanUtils.copyProperties(orgPatent, patent1);
+                    uploadPatentWebDTO.setPatent(orgPatent);
                     uploadPatentWebDTOS.removeIf(i -> i.getIndex().equals(uploadPatentWebDTO.getIndex()));
-                    savePatentToEsThread.awakeTask(patent1);
+                    savePatentToEsThread.awakeTask(uploadPatentWebDTO);
                 } else {
                     uploadPatentWebDTOS.add(uploadPatentWebDTO);
                 }
             } else {
-                Patent patent = uploadPatentWebDTO.getPatent();
-                Patent patent1 = new Patent();
-                BeanUtils.copyProperties(patent, patent1);
-                savePatentToEsThread.awakeTask(patent1);
+                savePatentToEsThread.awakeTask(uploadPatentWebDTO);
             }
         }
     }

+ 101 - 16
src/main/java/cn/cslg/pas/service/importPatent/ImportSinglePatentService.java

@@ -4,22 +4,23 @@ import cn.cslg.pas.common.core.IgnoreDTDEntityResolver;
 import cn.cslg.pas.common.dto.PatentStarListDTO;
 import cn.cslg.pas.common.dto.UploadPatentWebDTO;
 import cn.cslg.pas.common.dto.es.RefreshPatentDTO;
-import cn.cslg.pas.common.utils.DateUtils;
-import cn.cslg.pas.common.utils.FileUtils;
-import cn.cslg.pas.common.utils.FormatUtil;
+import cn.cslg.pas.common.model.cronModel.PersonnelVO;
+import cn.cslg.pas.common.utils.*;
 import cn.cslg.pas.common.utils.esDataForm.AddressSplitter;
 import cn.cslg.pas.common.utils.esDataForm.PatentClassifySplitter;
-import cn.cslg.pas.common.vo.ChinaPatentZhuLu;
-import cn.cslg.pas.common.vo.PatentWithIdVO;
-import cn.cslg.pas.common.vo.StarPatentVO;
-import cn.cslg.pas.common.vo.WorldPatentZhuLu;
+import cn.cslg.pas.common.vo.*;
+import cn.cslg.pas.domain.business.PatentClaim;
+import cn.cslg.pas.domain.business.ReportProject;
 import cn.cslg.pas.domain.es.*;
 import cn.cslg.pas.exception.XiaoShiException;
+import cn.cslg.pas.service.business.ReportProjectService;
 import cn.cslg.pas.service.business.es.EsService;
+import cn.cslg.pas.service.business.invalidReport.PatentClaimService;
 import cn.cslg.pas.service.common.FileManagerService;
 import cn.cslg.pas.service.common.PatentStarApiService;
 import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import lombok.RequiredArgsConstructor;
 import lombok.experimental.Accessors;
 import org.dom4j.Document;
@@ -34,6 +35,7 @@ import java.io.File;
 import java.io.Reader;
 import java.io.StringReader;
 import java.util.*;
+import java.util.stream.Collectors;
 
 @Service
 @RequiredArgsConstructor
@@ -46,6 +48,16 @@ public class ImportSinglePatentService {
     @Autowired
     private FileManagerService fileManagerService;
 
+    @Autowired
+    private ReportProjectService reportProjectService;
+
+    @Autowired
+    private PatentClaimService patentClaimService;
+
+    @Autowired
+    private CacheUtils cacheUtils;
+    @Autowired
+    private LoginUtils loginUtils;
     public StarPatentVO getPatentFromWeb(String patentNo) {
         StarPatentVO starPatentVO = null;
         String dbType = "";
@@ -518,6 +530,7 @@ public class ImportSinglePatentService {
         String cnFullXmlStr = patentStarApiService.getCnFullXmlApi(starPatentVO.getRowApplicationNo());
         if (contents.contains(3)) {
             this.loadClaim(patent, cnFullXmlStr);
+
         }
         if (contents.contains(2)) {
             this.loadFullText(patent, cnFullXmlStr);
@@ -626,7 +639,7 @@ public class ImportSinglePatentService {
 
         String pdfUrl = "", pdfUrl1 = "", pdfUrl2 = "";
         //先根据公开号判断国家,若没有公开号再根据申请号判断,调用"获得中国专利pdf"接口,获得1个或2个pdf的url地址
-        if ((starPatentVO.getPublicNo() != null && starPatentVO.getPublicNo().contains("CN")) || (starPatentVO.getPublicNo() == null && starPatentVO.getPatentNo().contains("CN"))||(starPatentVO.getPublicAccreditNo() != null &&starPatentVO.getPublicAccreditNo().contains("CN")) ) {
+        if ((starPatentVO.getPublicNo() != null && starPatentVO.getPublicNo().contains("CN")) || (starPatentVO.getPublicNo() == null && starPatentVO.getPatentNo().contains("CN")) || (starPatentVO.getPublicAccreditNo() != null && starPatentVO.getPublicAccreditNo().contains("CN"))) {
 
             String pdfUrlStr = patentStarApiService.getCnPdfApi(starPatentVO.getRowApplicationNo());
 
@@ -658,10 +671,9 @@ public class ImportSinglePatentService {
                         fileManagerService.uploadFileWithGuid(file2, guid2);
                     }
                 } else {  //若只有一个
-                    if(pdfUrlStr.contains("?")) {
+                    if (pdfUrlStr.contains("?")) {
                         pdfUrl1 = pdfUrlStr.substring(pdfUrlStr.indexOf("http"), pdfUrlStr.indexOf("?"));
-                    }
-                    else {
+                    } else {
                         pdfUrl1 = pdfUrlStr.substring(pdfUrlStr.indexOf("http"));
                     }
                     if (pdfUrl1.contains("0A_CN_0.pdf")) {
@@ -710,6 +722,7 @@ public class ImportSinglePatentService {
     public Boolean refreshPatent(RefreshPatentDTO refreshPatentDTO) throws Exception {
         String patentNo = refreshPatentDTO.getPatentNo();
         List<Integer> contents = refreshPatentDTO.getRefreshContent();
+        Integer projectId = refreshPatentDTO.getProjectId();
         if (patentNo == null) {
             throw new XiaoShiException("请输入专利号");
         }
@@ -731,10 +744,8 @@ public class ImportSinglePatentService {
         if (contents.contains(1)) {
             patent = this.getPatentCataloguingFromWeb(starPatentVO);
         }
-        //装载权利要求
-        if (contents.contains(2) || contents.contains(3)) {
-            this.getFullXmlStr(patent, starPatentVO, contents);
-        }
+
+
         //装载图片
         if (contents.contains(4)) {
             this.getPictureFromWeb(starPatentVO);
@@ -744,15 +755,89 @@ public class ImportSinglePatentService {
             this.getPDFFromWeb(starPatentVO);
         }
         //添加法律事务
-        if(contents.contains(6)){
+        if (contents.contains(6)) {
             esService.addEsLegalEvent(patentNo);
         }
 
+        //装载权利要求
+        if (contents.contains(2) || contents.contains(3)) {
+            this.getFullXmlStr(patent, starPatentVO, contents);
+            if (contents.contains(3) && projectId != null) {
+                this.updateReportRight(patent,projectId,patentNo);
+
+            }
+        }
         if (!ObjectUtils.isEmpty(patent)) {
             esService.updatePatentShouldWait(patent, patentWithIdVO.getId());
 
         }
+
         return true;
     }
 
+    private void updateReportRight(Patent patent, Integer projectId,String patentNo) {
+        PersonnelVO personnelVO =cacheUtils.getLoginUser(loginUtils.getId());
+        //根据projectId 查询报告
+        LambdaQueryWrapper<ReportProject> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(ReportProject::getProjectId, projectId);
+        ReportProject reportProject = reportProjectService.getOne(queryWrapper, false);
+        if (reportProject == null) {
+            return;
+        }
+        if (reportProject.getReportType() == null || !reportProject.getReportType().equals(7)) {
+            return;
+        }
+
+        //根据projectId查询
+        LambdaQueryWrapper<PatentClaim> queryWrapper1 = new LambdaQueryWrapper<>();
+        queryWrapper1.eq(PatentClaim::getProjectId, projectId);
+        List<PatentClaim> patentClaims = patentClaimService.list(queryWrapper1);
+        List<Integer> ids =patentClaims.stream().map(PatentClaim::getId).collect(Collectors.toList());
+
+        List<Text> claims = patent.getClaim();
+        if (claims == null || claims.size() == 0) {
+            return;
+        }
+        Text claim = patent.getClaim().stream().filter(item -> item.getIfOrigin().equals(true)).findFirst().orElse(null);
+        if (claim == null) {
+            return;
+        }
+
+        //拆分权要
+        PatentRightParams params = new PatentRightParams();
+        params.setPatentNo(patentNo);
+        params.setContent(claim.getTextContent());
+        List<RePatentClaim> rePatentClaims = PatentRightUtils.formatPatentRight(params);
+        if (rePatentClaims == null || rePatentClaims.size() == 0) {
+            return;
+        }
+          List<PatentClaim> patentClaims1 = new ArrayList<>();
+        rePatentClaims.forEach(item->{
+            PatentClaim patentClaim =patentClaims.stream().filter(i->i.getSysOrder().equals(item.getSort())).findFirst().orElse(null);
+            if(patentClaim==null){
+                PatentClaim patentClaim1 =new PatentClaim();
+                patentClaim1.setProjectId(projectId);
+                patentClaim1.setContentType(0);
+                patentClaim1.setClaimType(item.getType());
+                patentClaim1.setContent(item.getContent());
+                patentClaim1.setParentOrder(item.getParentSort());
+                patentClaim1.setSysOrder(item.getSort());
+                patentClaim1.setCreateId(personnelVO.getId());
+                patentClaims1.add(patentClaim1);
+            }
+            else {
+                patentClaim.setClaimType(item.getType());
+                patentClaim.setContent(item.getContent());
+                patentClaim.setParentOrder(item.getParentSort());
+                ids.remove(patentClaim.getId());
+                patentClaims1.add(patentClaim);
+            }
+        });
+        patentClaimService.saveOrUpdateBatch(patentClaims1);
+        if(ids!=null&&ids.size()>0){
+            patentClaimService.removeBatchByIds(ids);
+        }
+
+    }
+
 }

+ 38 - 11
src/main/java/cn/cslg/pas/service/importPatent/SavePatentToEsThread.java

@@ -1,6 +1,7 @@
 package cn.cslg.pas.service.importPatent;
 
 import cn.cslg.pas.common.dto.UploadPatentWebDTO;
+import cn.cslg.pas.common.dto.es.EsCustomFieldDTO;
 import cn.cslg.pas.common.utils.FormatUtil;
 import cn.cslg.pas.common.vo.ImportTaskAMVO;
 import cn.cslg.pas.common.vo.PatentWithIdVO;
@@ -10,6 +11,7 @@ import cn.cslg.pas.domain.es.Patent;
 import cn.cslg.pas.domain.es.PatentJoin;
 import cn.cslg.pas.service.business.CompareLiteratureService;
 import cn.cslg.pas.service.business.ImportTaskService;
+import cn.cslg.pas.service.business.es.EsCustomFieldService;
 import cn.cslg.pas.service.business.es.EsMergePersonService;
 import cn.cslg.pas.service.business.es.EsProductPatentService;
 import cn.cslg.pas.service.business.es.EsService;
@@ -30,25 +32,26 @@ import java.util.concurrent.locks.ReentrantLock;
 
 public class SavePatentToEsThread extends Thread {
     private ApplicationContext applicationContext;
-    private List<Patent> patents = new ArrayList<>();
+    private List<UploadPatentWebDTO> uploadPatentWebDTOS = new ArrayList<>();
     private Lock taskLock = new ReentrantLock();
-    private  Condition taskCondition = taskLock.newCondition();
+    private Condition taskCondition = taskLock.newCondition();
     private TaskThread taskThread;
     private ImportTaskAMVO importTaskAMVO;
     private Boolean ifProductAll = false;
 
     @Override
     public void run() {
-        while ((!ifProductAll || patents.size() > 0) && importTaskAMVO.getState().equals(1)) {
+        while ((!ifProductAll || uploadPatentWebDTOS.size() > 0) && importTaskAMVO.getState().equals(1)) {
             try {
                 //判断任务队列是否有任务,若没有则线程等待唤醒
-                if (patents.size() == 0) {
+                if (uploadPatentWebDTOS.size() == 0) {
                     taskLock.lock();
                     taskCondition.await();
                 }
             } catch (Exception e) {
             }
-            Patent patent = patents.remove(0);
+            UploadPatentWebDTO uploadPatentWebDTO = uploadPatentWebDTOS.remove(0);
+            Patent patent = uploadPatentWebDTO.getPatent();
             try {
                 //根据专利号查询专利
                 EsService esService = applicationContext.getBean(EsService.class);
@@ -122,6 +125,30 @@ public class SavePatentToEsThread extends Thread {
                     EsProductPatentService esProductPatentService = applicationContext.getBean(EsProductPatentService.class);
                     esProductPatentService.addProductPatent(patentId, importTaskAMVO.getProductId());
                 }
+
+                //保存和自定义字段关联
+                if (importTaskAMVO.getFieldDTOS() != null && importTaskAMVO.getFieldDTOS().size() > 0) {
+                    for (EsCustomFieldDTO esCustomFieldDTO : importTaskAMVO.getFieldDTOS()
+                    ) {
+                        esCustomFieldDTO.setPatentId(patentId);
+                        esCustomFieldDTO.setOptionType(2);
+                        EsCustomFieldService esCustomFieldService = applicationContext.getBean(EsCustomFieldService.class);
+                        esCustomFieldService.addCustomField(esCustomFieldDTO);
+                    }
+
+                }
+
+                if (uploadPatentWebDTO.getEsCustomFieldDTOList() != null && uploadPatentWebDTO.getEsCustomFieldDTOList().size() != 0) {
+                    for (EsCustomFieldDTO esCustomFieldDTO : uploadPatentWebDTO.getEsCustomFieldDTOList()
+                    ) {
+                        esCustomFieldDTO.setPatentId(patentId);
+                        esCustomFieldDTO.setOptionType(2);
+                        EsCustomFieldService esCustomFieldService = applicationContext.getBean(EsCustomFieldService.class);
+                        esCustomFieldService.addCustomField(esCustomFieldDTO);
+                    }
+
+                }
+
                 //导入完成,通知前台
                 taskThread.updateProcess(false, 1, "");
             } catch (Exception e) {
@@ -138,10 +165,10 @@ public class SavePatentToEsThread extends Thread {
         this.importTaskAMVO = taskThread.getImportTaskAMVO();
     }
 
-    public void awakeTask(Patent patent) {
-        Patent patent1 = new Patent();
-        BeanUtils.copyProperties(patent, patent1);
-        patents.add(patent1);
+    public void awakeTask(UploadPatentWebDTO uploadPatentWebDTO) {
+        UploadPatentWebDTO uploadPatentWebDTO1 = new UploadPatentWebDTO();
+        BeanUtils.copyProperties(uploadPatentWebDTO, uploadPatentWebDTO1);
+        uploadPatentWebDTOS.add(uploadPatentWebDTO1);
         if (taskLock.tryLock()) {
             taskCondition.signalAll();
             taskLock.unlock();
@@ -151,9 +178,9 @@ public class SavePatentToEsThread extends Thread {
     public void setIfProductAll(Boolean ifProductAll) {
 
         this.ifProductAll = ifProductAll;
-        System.out.println("专利导入全部结束"+ this.ifProductAll+importTaskAMVO.getId());
+        System.out.println("专利导入全部结束" + this.ifProductAll + importTaskAMVO.getId());
         if (taskLock.tryLock()) {
-            System.out.println("专利导入到es解锁"+importTaskAMVO.getId());
+            System.out.println("专利导入到es解锁" + importTaskAMVO.getId());
             taskCondition.signalAll();
             taskLock.unlock();
         }

+ 6 - 0
src/main/java/cn/cslg/pas/service/importPatent/SchedulingTaskService.java

@@ -1,6 +1,7 @@
 package cn.cslg.pas.service.importPatent;
 
 import cn.cslg.pas.common.core.base.Constants;
+import cn.cslg.pas.common.dto.es.EsCustomFieldDTO;
 import cn.cslg.pas.common.vo.ImportTaskAMVO;
 import cn.cslg.pas.common.vo.ProgressVO;
 import cn.cslg.pas.domain.business.ImportTask;
@@ -9,6 +10,7 @@ import cn.cslg.pas.domain.business.ReportProject;
 import cn.cslg.pas.service.business.ImportTaskConditionService;
 import cn.cslg.pas.service.business.ImportTaskService;
 import cn.cslg.pas.service.business.ReportProjectService;
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -106,6 +108,10 @@ public class SchedulingTaskService {
                 importTaskAMVO.setOrderByType(importTaskCondition.getOrderByType());
                 importTaskAMVO.setProjectType(importTaskCondition.getProjectType());
                 importTaskAMVO.setPatentNoStr(importTaskCondition.getPatentNos());
+                if(importTaskCondition.getCustomFields()!=null) {
+                    List<EsCustomFieldDTO> dtos = JSONArray.parseArray(importTaskCondition.getCustomFields());
+                    importTaskAMVO.setFieldDTOS(dtos);
+                }
                 LambdaQueryWrapper<ReportProject> rQueryWrapper = new LambdaQueryWrapper<>();
                 rQueryWrapper.eq(ReportProject::getProjectId, importTaskCondition.getProjectId());
                 ReportProject reportProject = reportProjectService.getOne(rQueryWrapper, false);

+ 2 - 2
src/main/java/cn/cslg/pas/service/importPatent/TaskThread.java

@@ -81,7 +81,7 @@ public class TaskThread extends Thread {
         if (ifCataloguing == '1' || ifFullText == '1') {
             threadCount += 1;
             this.patentProcess.setPatentMessageDefaultNum(0);
-            this.patentProcess.setPatentMessageDoneNum(0);
+            this.patentProcess.setPatentMessageDoneNum(importTaskAMVO.getDoneNum());
             if (ifCataloguing == '1') {
                 messageThreadCount += 1;
             }
@@ -91,7 +91,7 @@ public class TaskThread extends Thread {
         }
         if (ifPdf == '1') {
             this.patentProcess.setPdfDefaultNum(0);
-            this.patentProcess.setPdfDoneNum(0);
+            this.patentProcess.setPdfDoneNum(importTaskAMVO.getDoneNum());
             threadCount += 1;
         }
         importTaskAMVO.setMessageThreadCounter(messageThreadCount);

+ 6 - 6
src/main/resources/jsons/esCountAnalysis.json

@@ -197,7 +197,7 @@
     "value": "mergeApplicant",
     "field": "MAT",
     "esField": "merge_applicant.name.raw",
-    "esClass": "nestedCountAnalysisBuilder",
+    "esClass": "childNestedAnalyseBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
     "ifShow": "true",
@@ -233,7 +233,7 @@
     "value": "mergeRightHolder",
     "field": "MRH",
     "esField": "merge_right_holder.name.raw",
-    "esClass": "nestedCountAnalysisBuilder",
+    "esClass": "childNestedAnalyseBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
     "ifShow": "true",
@@ -257,7 +257,7 @@
     "value": "mergeRightHolder",
     "field": "MIN",
     "esField": "merge_inventor.name.raw",
-    "esClass": "nestedCountAnalysisBuilder",
+    "esClass": "childNestedAnalyseBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
     "ifShow": "true",
@@ -413,7 +413,7 @@
     "value": "priorityCountry",
     "field": "PRCO",
     "esField": "priorities.prioritycountry",
-    "esClass": "termsCountAnalysisBuilder",
+    "esClass": "nestedCountAnalysisBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
     "ifShow": "false",
@@ -421,11 +421,11 @@
   },
   {
     "name": "优先权日",
-    "type": "String",
+    "type": "DateTime",
     "value": "priorityDate",
     "field": "PRD",
     "esField": "priorities.prioritydate",
-    "esClass": "termsCountAnalysisBuilder",
+    "esClass": "prioritiesCountAnalysisBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
     "ifShow": "false",

+ 240 - 91
src/main/resources/jsons/patent.json

@@ -12,6 +12,7 @@
     "ifAsCondition": "true",
     "ifStats": "false",
     "groupBy": "number",
+    "ifSort": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -27,6 +28,7 @@
     "ifAsCondition": "true",
     "ifStats": "false",
     "groupBy": "number",
+    "ifSort": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -42,6 +44,7 @@
     "ifAsCondition": "true",
     "ifStats": "false",
     "groupBy": "number",
+    "ifSort": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -57,6 +60,7 @@
     "ifAsCondition": "true",
     "ifStats": "false",
     "groupBy": "number",
+    "ifSort": "true",
     "exportClass": "getCommonValue"
   },
   {
@@ -72,6 +76,7 @@
     "ifAsCondition": "true",
     "ifStats": "true",
     "groupBy": "dateType",
+    "ifSort": "true",
     "exportClass": "getDateValue"
   },
   {
@@ -87,6 +92,7 @@
     "ifAsCondition": "true",
     "ifStats": "true",
     "groupBy": "dateType",
+    "ifSort": "true",
     "exportClass": "getDateValue"
   },
   {
@@ -102,6 +108,7 @@
     "ifAsCondition": "true",
     "ifStats": "true",
     "groupBy": "dateType",
+    "ifSort": "true",
     "exportClass": "getDateValue"
   },
   {
@@ -143,7 +150,8 @@
     "ifAsCondition": "true",
     "defaultHidden": "true",
     "ifStats": "false",
-    "groupBy": "text"
+    "groupBy": "text",
+    "ifSort": "true"
   },
   {
     "name": "标题",
@@ -157,7 +165,8 @@
     "ifShow": "true",
     "ifAsCondition": "true",
     "ifStats": "false",
-    "groupBy": "text"
+    "groupBy": "text",
+    "ifSort": "false"
   },
   {
     "name": "申请人",
@@ -173,6 +182,7 @@
     "ifStats": "true",
     "defaultShowStats": "true",
     "groupBy": "company",
+    "ifSort": "false",
     "exportClass": "getNameValue"
   },
   {
@@ -187,7 +197,8 @@
     "ifShow": "true",
     "ifStats": "true",
     "ifAsCondition": "true",
-    "groupBy": "company"
+    "groupBy": "company",
+    "ifSort": "false"
   },
   {
     "name": "合并申请人",
@@ -201,7 +212,8 @@
     "ifShow": "true",
     "ifStats": "true",
     "ifAsCondition": "true",
-    "groupBy": "company"
+    "groupBy": "company",
+    "ifSort": "false"
   },
   {
     "name": "发明人",
@@ -215,7 +227,8 @@
     "ifShow": "true",
     "ifStats": "true",
     "ifAsCondition": "true",
-    "groupBy": "company"
+    "groupBy": "company",
+    "ifSort": "false"
   },
   {
     "name": "合并发明人",
@@ -229,7 +242,8 @@
     "ifShow": "true",
     "ifStats": "true",
     "ifAsCondition": "true",
-    "groupBy": "company"
+    "groupBy": "company",
+    "ifSort": "false"
   },
   {
     "name": "权利人",
@@ -243,7 +257,8 @@
     "ifShow": "true",
     "ifStats": "true",
     "ifAsCondition": "true",
-    "groupBy": "company"
+    "groupBy": "company",
+    "ifSort": "false"
   },
   {
     "name": "标准权利人",
@@ -257,7 +272,8 @@
     "ifShow": "true",
     "ifStats": "true",
     "ifAsCondition": "true",
-    "groupBy": "company"
+    "groupBy": "company",
+    "ifSort": "false"
   },
   {
     "name": "合并权利人",
@@ -271,7 +287,8 @@
     "ifShow": "true",
     "ifStats": "true",
     "ifAsCondition": "true",
-    "groupBy": "company"
+    "groupBy": "company",
+    "ifSort": "false"
   },
   {
     "name": "公开说明书文本",
@@ -313,7 +330,8 @@
     "ifShow": "true",
     "ifStats": "true",
     "ifAsCondition": "true",
-    "groupBy": "company"
+    "groupBy": "company",
+    "ifSort": "true"
   },
   {
     "name": "代理人名称",
@@ -327,7 +345,8 @@
     "ifShow": "true",
     "ifStats": "true",
     "ifAsCondition": "true",
-    "groupBy": "company"
+    "groupBy": "company",
+    "ifSort": "true"
   },
   {
     "name": "简单同族数量",
@@ -336,11 +355,12 @@
     "field": "SFN",
     "esField": "simple_family_num",
     "esClass": "numberQueryBuilder",
-    "ifSearch": "true",
-    "ifGroup": "true",
+    "ifSearch": "false",
+    "ifGroup": "false",
     "ifShow": "true",
     "ifAsCondition": "true",
-    "groupBy": "amount"
+    "groupBy": "amount",
+    "ifSort": "true"
   },
   {
     "name": "inpadoc同族数量",
@@ -349,11 +369,12 @@
     "field": "IFN",
     "esField": "inpadoc_family_num",
     "esClass": "numberQueryBuilder",
-    "ifSearch": "true",
-    "ifGroup": "true",
+    "ifSearch": "false",
+    "ifGroup": "false",
     "ifShow": "true",
     "ifAsCondition": "true",
-    "groupBy": "amount"
+    "groupBy": "amount",
+    "ifSort": "true"
   },
   {
     "name": "扩展同族数量",
@@ -362,11 +383,12 @@
     "field": "PFN",
     "esField": "patsnap_family_num",
     "esClass": "numberQueryBuilder",
-    "ifSearch": "true",
-    "ifGroup": "true",
+    "ifSearch": "false",
+    "ifGroup": "false",
     "ifShow": "true",
     "ifAsCondition": "true",
-    "groupBy": "amount"
+    "groupBy": "amount",
+    "ifSort": "true"
   },
   {
     "name": "引用专利数量",
@@ -375,11 +397,12 @@
     "field": "QPN",
     "esField": "quote_patent_no_num",
     "esClass": "numberQueryBuilder",
-    "ifSearch": "true",
-    "ifGroup": "true",
+    "ifSearch": "false",
+    "ifGroup": "false",
     "ifShow": "true",
     "ifAsCondition": "true",
-    "groupBy": "amount"
+    "groupBy": "amount",
+    "ifSort": "true"
   },
   {
     "name": "被引用专利数量",
@@ -388,11 +411,12 @@
     "field": "QDPN",
     "esField": "quoted_patent_no_num",
     "esClass": "numberQueryBuilder",
-    "ifSearch": "true",
-    "ifGroup": "true",
+    "ifSearch": "false",
+    "ifGroup": "false",
     "ifShow": "true",
     "ifAsCondition": "true",
-    "groupBy": "amount"
+    "groupBy": "amount",
+    "ifSort": "true"
   },
   {
     "name": "申请人地址",
@@ -400,13 +424,14 @@
     "value": "appAddress",
     "field": "ADD",
     "esField": "applicant_addr.address",
-    "esClass": "matchQueryBuilder",
+    "esClass": "matchPhaseQueryBuilder",
     "ifSearch": "true",
     "ifGroup": "true",
     "ifShow": "true",
     "ifStats": "false",
     "ifAsCondition": "true",
-    "groupBy": "address"
+    "groupBy": "address",
+    "ifSort": "false"
   },
   {
     "name": "申请国家",
@@ -420,7 +445,8 @@
     "ifShow": "true",
     "ifStats": "true",
     "ifAsCondition": "true",
-    "groupBy": "nation"
+    "groupBy": "nation",
+    "ifSort": "true"
   },
   {
     "name": "申请人国家",
@@ -434,7 +460,8 @@
     "ifShow": "true",
     "ifStats": "true",
     "ifAsCondition": "true",
-    "groupBy": "nation"
+    "groupBy": "nation",
+    "ifSort": "false"
   },
   {
     "name": "申请人省份",
@@ -448,7 +475,8 @@
     "ifShow": "true",
     "ifStats": "true",
     "ifAsCondition": "true",
-    "groupBy": "nation"
+    "groupBy": "nation",
+    "ifSort": "false"
   },
   {
     "name": "申请人市区",
@@ -462,7 +490,8 @@
     "ifShow": "true",
     "ifStats": "true",
     "ifAsCondition": "true",
-    "groupBy": "nation"
+    "groupBy": "nation",
+    "ifSort": "false"
   },
   {
     "name": "申请人区县",
@@ -476,7 +505,8 @@
     "ifShow": "true",
     "ifStats": "false",
     "ifAsCondition": "true",
-    "groupBy": "nation"
+    "groupBy": "nation",
+    "ifSort": "false"
   },
   {
     "name": "权利人地址",
@@ -484,13 +514,14 @@
     "value": "rightAddress",
     "field": "RDD",
     "esField": "right_holder_addr.address",
-    "esClass": "matchQueryBuilder",
+    "esClass": "matchPhaseQueryBuilder",
     "ifSearch": "true",
     "ifGroup": "true",
     "ifShow": "true",
     "ifStats": "false",
     "ifAsCondition": "true",
-    "groupBy": "address"
+    "groupBy": "address",
+    "ifSort": "false"
   },
   {
     "name": "权利人国家",
@@ -504,7 +535,8 @@
     "ifShow": "true",
     "ifStats": "true",
     "ifAsCondition": "true",
-    "groupBy": "nation"
+    "groupBy": "nation",
+    "ifSort": "false"
   },
   {
     "name": "权利人省份",
@@ -518,7 +550,8 @@
     "ifShow": "true",
     "ifStats": "true",
     "ifAsCondition": "true",
-    "groupBy": "nation"
+    "groupBy": "nation",
+    "ifSort": "false"
   },
   {
     "name": "权利人市区",
@@ -532,7 +565,8 @@
     "ifShow": "true",
     "ifStats": "false",
     "ifAsCondition": "true",
-    "groupBy": "nation"
+    "groupBy": "nation",
+    "ifSort": "false"
   },
   {
     "name": "权利人区县",
@@ -545,21 +579,55 @@
     "ifGroup": "true",
     "ifShow": "true",
     "ifAsCondition": "true",
-    "groupBy": "nation"
+    "groupBy": "nation",
+    "ifSort": "false"
   },
   {
     "name": "IPC分类号",
-    "type": "String",
-    "value": "MIPC",
+    "type": "Object",
+    "value": "mipc",
     "field": "MIPC",
     "esField": "mipc",
     "esClass": "prefixQueryBuilder",
     "ifSearch": "true",
     "ifGroup": "true",
-    "ifShow": "false",
+    "ifShow": "true",
     "ifStats": "true",
     "ifAsCondition": "true",
-    "groupBy": "classify"
+    "groupBy": "classify",
+    "ifSort": "false",
+    "children": [
+      {
+        "label": "IPC部",
+        "type": "1",
+        "group": "nos",
+        "value": "IC1"
+      },
+      {
+        "label": "IPC大类",
+        "type": "1",
+        "group": "nos",
+        "value": "IC2"
+      },
+      {
+        "label": "IPC小类",
+        "type": "1",
+        "group": "nos",
+        "value": "IC3"
+      },
+      {
+        "label": "IPC大组",
+        "type": "1",
+        "group": "nos",
+        "value": "IC4"
+      },
+      {
+        "label": "IPC",
+        "type": "1",
+        "group": "nos",
+        "value": "IC"
+      }
+    ]
   },
   {
     "name": "IPC部",
@@ -570,7 +638,7 @@
     "esClass": "keyWordQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true"
   },
@@ -583,7 +651,7 @@
     "esClass": "keyWordQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true"
   },
@@ -596,7 +664,7 @@
     "esClass": "keyWordQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true"
   },
@@ -609,7 +677,7 @@
     "esClass": "keyWordQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true"
   },
@@ -622,23 +690,56 @@
     "esClass": "keyWordQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true"
   },
   {
     "name": "CPC分类号",
-    "type": "String",
-    "value": "MCPC",
+    "type": "Object",
+    "value": "mcpc",
     "field": "MCPC",
     "esField": "mcpc",
     "esClass": "prefixQueryBuilder",
     "ifSearch": "true",
     "ifGroup": "true",
-    "ifShow": "false",
+    "ifShow": "true",
     "ifStats": "true",
     "ifAsCondition": "true",
-    "groupBy": "classify"
+    "groupBy": "classify",
+    "ifSort": "false",
+    "children": [
+      {
+        "label": "CPC部",
+        "type": "1",
+        "group": "nos",
+        "value": "CPC1"
+      },
+      {
+        "label": "CPC大类",
+        "type": "1",
+        "group": "nos",
+        "value": "CPC2"
+      },
+      {
+        "label": "CPC小类",
+        "type": "1",
+        "group": "nos",
+        "value": "CPC3"
+      },
+      {
+        "label": "CPC大组",
+        "type": "1",
+        "group": "nos",
+        "value": "CPC4"
+      },
+      {
+        "label": "CPC",
+        "type": "1",
+        "group": "nos",
+        "value": "CPC"
+      }
+    ]
   },
   {
     "name": "CPC部",
@@ -649,7 +750,7 @@
     "esClass": "keyWordQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true"
   },
@@ -662,7 +763,7 @@
     "esClass": "keyWordQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true"
   },
@@ -675,7 +776,7 @@
     "esClass": "keyWordQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true"
   },
@@ -688,7 +789,7 @@
     "esClass": "keyWordQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true"
   },
@@ -701,23 +802,38 @@
     "esClass": "keyWordQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true"
   },
   {
     "name": "UPC分类号",
-    "type": "String",
-    "value": "MUPC",
+    "type": "Object",
+    "value": "mupc",
     "field": "MUPC",
     "esField": "mupc",
     "esClass": "prefixQueryBuilder",
     "ifSearch": "true",
     "ifGroup": "true",
-    "ifShow": "false",
+    "ifShow": "true",
     "ifStats": "true",
     "ifAsCondition": "true",
-    "groupBy": "classify"
+    "groupBy": "classify",
+    "ifSort": "false",
+    "children": [
+      {
+        "label": "UPC大类",
+        "type": "1",
+        "group": "nos",
+        "value": "UPC1"
+      },
+      {
+        "label": "UPC",
+        "type": "1",
+        "group": "nos",
+        "value": "UPC"
+      }
+    ]
   },
   {
     "name": "UPC大类",
@@ -728,7 +844,7 @@
     "esClass": "keyWordQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true"
   },
@@ -741,26 +857,41 @@
     "esClass": "keyWordQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true"
   },
   {
     "name": "LOC分类号",
-    "type": "String",
-    "value": "MLOC",
+    "type": "Object",
+    "value": "mloc",
     "field": "MLOC",
     "esField": "mloc",
     "esClass": "prefixQueryBuilder",
     "ifSearch": "true",
     "ifGroup": "true",
-    "ifShow": "false",
+    "ifShow": "true",
     "ifStats": "true",
     "ifAsCondition": "true",
-    "groupBy": "classify"
-  },
-  {
-    "name": "LOC分类号大类",
+    "groupBy": "classify",
+    "ifSort": "false",
+    "children": [
+      {
+        "label": "LOC大类",
+        "type": "1",
+        "group": "nos",
+        "value": "LOC1"
+      },
+      {
+        "label": "LOC",
+        "type": "1",
+        "group": "nos",
+        "value": "LOC"
+      }
+    ]
+  },
+  {
+    "name": "LOC大类",
     "type": "String",
     "value": "locLevel1",
     "field": "LOC1",
@@ -768,7 +899,7 @@
     "esClass": "keyWordQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true"
   },
@@ -776,12 +907,12 @@
     "name": "LOC",
     "type": "String",
     "value": "locLevel2",
-    "field": "LOC2",
+    "field": "LOC",
     "esField": "mloc.level2",
     "esClass": "keyWordQueryBuilder",
     "ifSearch": "false",
     "ifGroup": "false",
-    "ifShow": "true",
+    "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true"
   },
@@ -796,7 +927,8 @@
     "ifGroup": "true",
     "ifShow": "false",
     "ifAsCondition": "true",
-    "groupBy": "text"
+    "groupBy": "text",
+    "ifSort": "false"
   },
   {
     "name": "法律状态",
@@ -811,7 +943,8 @@
     "ifAsCondition": "true",
     "ifStats": "true",
     "fieldOptionQueryParam": "PATENT_SIMPLE_STATUS",
-    "groupBy": "typeStatus"
+    "groupBy": "typeStatus",
+    "ifSort": "true"
   },
   {
     "name": "专利类型",
@@ -826,7 +959,8 @@
     "ifAsCondition": "true",
     "ifStats": "true",
     "fieldOptionQueryParam": "PATENT_TYPE",
-    "groupBy": "typeStatus"
+    "groupBy": "typeStatus",
+    "ifSort": "true"
   },
   {
     "name": "审查员",
@@ -840,7 +974,8 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
-    "groupBy": "company"
+    "groupBy": "company",
+    "ifSort": "true"
   },
   {
     "name": "助理审查员",
@@ -854,7 +989,8 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
-    "groupBy": "company"
+    "groupBy": "company",
+    "ifSort": "true"
   },
   {
     "name": "优先权国家",
@@ -868,7 +1004,8 @@
     "ifShow": "true",
     "ifStats": "true",
     "ifAsCondition": "true",
-    "groupBy": "nation"
+    "groupBy": "nation",
+    "ifSort": "false"
   },
   {
     "name": "优先权日",
@@ -882,7 +1019,8 @@
     "ifShow": "true",
     "ifStats": "true",
     "ifAsCondition": "true",
-    "groupBy": "dateType"
+    "groupBy": "dateType",
+    "ifSort": "false"
   },
   {
     "name": "优先权号",
@@ -896,7 +1034,8 @@
     "ifShow": "true",
     "ifStats": "false",
     "ifAsCondition": "true",
-    "groupBy": "number"
+    "groupBy": "number",
+    "ifSort": "false"
   },
   {
     "name": "pct申请号",
@@ -910,7 +1049,8 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
-    "groupBy": "number"
+    "groupBy": "number",
+    "ifSort": "true"
   },
   {
     "name": "pct申请日",
@@ -924,7 +1064,8 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
-    "groupBy": "dateType"
+    "groupBy": "dateType",
+    "ifSort": "true"
   },
   {
     "name": "pct进入日期",
@@ -938,7 +1079,8 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
-    "groupBy": "dateType"
+    "groupBy": "dateType",
+    "ifSort": "true"
   },
   {
     "name": "pct公开号",
@@ -952,7 +1094,8 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
-    "groupBy": "number"
+    "groupBy": "number",
+    "ifSort": "true"
   },
   {
     "name": "pct公开日",
@@ -966,7 +1109,8 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
-    "groupBy": "dateType"
+    "groupBy": "dateType",
+    "ifSort": "true"
   },
   {
     "name": "实审日",
@@ -980,7 +1124,8 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
-    "groupBy": "dateType"
+    "groupBy": "dateType",
+    "ifSort": "true"
   },
   {
     "name": "wo指定国",
@@ -994,7 +1139,8 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
-    "groupBy": "nation"
+    "groupBy": "nation",
+    "ifSort": "true"
   },
   {
     "name": "ep申请号",
@@ -1008,7 +1154,8 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
-    "groupBy": "number"
+    "groupBy": "number",
+    "ifSort": "true"
   },
   {
     "name": "EP指定国",
@@ -1022,7 +1169,8 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
-    "groupBy": "nation"
+    "groupBy": "nation",
+    "ifSort": "true"
   },
   {
     "name": "ep申请日",
@@ -1036,7 +1184,8 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
-    "groupBy": "dateType"
+    "groupBy": "dateType",
+    "ifSort": "true"
   },
   {
     "name": "自定义栏位id",

+ 3 - 5
src/test/java/cn/cslg/pas/service/CommonServiceTests.java

@@ -145,10 +145,8 @@ public class CommonServiceTests {
 //李仁杰<2232723707@qq.com>"
     @Test
     public void testEmail() throws Exception{
-
-        PatentImportImp patentImportImp = patentImportFactory.getClass("importFromWebToEsService");
-        PatentImportImp patentImportImp2 = patentImportFactory.getClass("importFromWebToEsService");
-          System.out.println(patentImportImp);
-        System.out.println(patentImportImp2);
+          String  a ="多功能应用\\烟熏模块";
+         String[] ab =a.split("\\\\");
+          System.out.println(ab);
     }
     }