Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/master'

lwhhszx 1 gadu atpakaļ
vecāks
revīzija
8965db2c8a

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

+ 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 = "*";

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

@@ -0,0 +1,58 @@
+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.util.CollectionUtils;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+public class ChildNestedAnalyseBuilder {
+    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 = new Aggregation.Builder().children(new ChildrenAggregation.Builder()
+                .type(path).build())
+                .aggregations(new HashMap() {{
+                    put("childAgg", aggregation);
+                }}).build();
+
+        return agg;
+    }
+
+}

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

+ 8 - 11
src/main/java/cn/cslg/pas/service/business/es/EsService.java

@@ -233,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");
@@ -241,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) {

+ 103 - 46
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": "简单同族数量",
@@ -340,7 +359,8 @@
     "ifGroup": "false",
     "ifShow": "true",
     "ifAsCondition": "true",
-    "groupBy": "amount"
+    "groupBy": "amount",
+    "ifSort": "true"
   },
   {
     "name": "inpadoc同族数量",
@@ -353,7 +373,8 @@
     "ifGroup": "false",
     "ifShow": "true",
     "ifAsCondition": "true",
-    "groupBy": "amount"
+    "groupBy": "amount",
+    "ifSort": "true"
   },
   {
     "name": "扩展同族数量",
@@ -366,7 +387,8 @@
     "ifGroup": "false",
     "ifShow": "true",
     "ifAsCondition": "true",
-    "groupBy": "amount"
+    "groupBy": "amount",
+    "ifSort": "true"
   },
   {
     "name": "引用专利数量",
@@ -379,7 +401,8 @@
     "ifGroup": "false",
     "ifShow": "true",
     "ifAsCondition": "true",
-    "groupBy": "amount"
+    "groupBy": "amount",
+    "ifSort": "true"
   },
   {
     "name": "被引用专利数量",
@@ -392,7 +415,8 @@
     "ifGroup": "false",
     "ifShow": "true",
     "ifAsCondition": "true",
-    "groupBy": "amount"
+    "groupBy": "amount",
+    "ifSort": "true"
   },
   {
     "name": "申请人地址",
@@ -406,7 +430,8 @@
     "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": "权利人地址",
@@ -490,7 +520,8 @@
     "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,7 +579,8 @@
     "ifGroup": "true",
     "ifShow": "true",
     "ifAsCondition": "true",
-    "groupBy": "nation"
+    "groupBy": "nation",
+    "ifSort": "false"
   },
   {
     "name": "IPC分类号",
@@ -560,6 +595,7 @@
     "ifStats": "true",
     "ifAsCondition": "true",
     "groupBy": "classify",
+    "ifSort": "false",
     "children": [
       {
         "label": "IPC部",
@@ -671,12 +707,13 @@
     "ifStats": "true",
     "ifAsCondition": "true",
     "groupBy": "classify",
+    "ifSort": "false",
     "children": [
       {
         "label": "CPC部",
         "type": "1",
         "group": "nos",
-        "field": "CPC1"
+        "value": "CPC1"
       },
       {
         "label": "CPC大类",
@@ -782,6 +819,7 @@
     "ifStats": "true",
     "ifAsCondition": "true",
     "groupBy": "classify",
+    "ifSort": "false",
     "children": [
       {
         "label": "UPC大类",
@@ -836,6 +874,7 @@
     "ifStats": "true",
     "ifAsCondition": "true",
     "groupBy": "classify",
+    "ifSort": "false",
     "children": [
       {
         "label": "LOC大类",
@@ -888,7 +927,8 @@
     "ifGroup": "true",
     "ifShow": "false",
     "ifAsCondition": "true",
-    "groupBy": "text"
+    "groupBy": "text",
+    "ifSort": "false"
   },
   {
     "name": "法律状态",
@@ -903,7 +943,8 @@
     "ifAsCondition": "true",
     "ifStats": "true",
     "fieldOptionQueryParam": "PATENT_SIMPLE_STATUS",
-    "groupBy": "typeStatus"
+    "groupBy": "typeStatus",
+    "ifSort": "true"
   },
   {
     "name": "专利类型",
@@ -918,7 +959,8 @@
     "ifAsCondition": "true",
     "ifStats": "true",
     "fieldOptionQueryParam": "PATENT_TYPE",
-    "groupBy": "typeStatus"
+    "groupBy": "typeStatus",
+    "ifSort": "true"
   },
   {
     "name": "审查员",
@@ -932,7 +974,8 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
-    "groupBy": "company"
+    "groupBy": "company",
+    "ifSort": "true"
   },
   {
     "name": "助理审查员",
@@ -946,7 +989,8 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
-    "groupBy": "company"
+    "groupBy": "company",
+    "ifSort": "true"
   },
   {
     "name": "优先权国家",
@@ -960,7 +1004,8 @@
     "ifShow": "true",
     "ifStats": "true",
     "ifAsCondition": "true",
-    "groupBy": "nation"
+    "groupBy": "nation",
+    "ifSort": "false"
   },
   {
     "name": "优先权日",
@@ -974,7 +1019,8 @@
     "ifShow": "true",
     "ifStats": "true",
     "ifAsCondition": "true",
-    "groupBy": "dateType"
+    "groupBy": "dateType",
+    "ifSort": "false"
   },
   {
     "name": "优先权号",
@@ -988,7 +1034,8 @@
     "ifShow": "true",
     "ifStats": "false",
     "ifAsCondition": "true",
-    "groupBy": "number"
+    "groupBy": "number",
+    "ifSort": "false"
   },
   {
     "name": "pct申请号",
@@ -1002,7 +1049,8 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
-    "groupBy": "number"
+    "groupBy": "number",
+    "ifSort": "true"
   },
   {
     "name": "pct申请日",
@@ -1016,7 +1064,8 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
-    "groupBy": "dateType"
+    "groupBy": "dateType",
+    "ifSort": "true"
   },
   {
     "name": "pct进入日期",
@@ -1030,7 +1079,8 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
-    "groupBy": "dateType"
+    "groupBy": "dateType",
+    "ifSort": "true"
   },
   {
     "name": "pct公开号",
@@ -1044,7 +1094,8 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
-    "groupBy": "number"
+    "groupBy": "number",
+    "ifSort": "true"
   },
   {
     "name": "pct公开日",
@@ -1058,7 +1109,8 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
-    "groupBy": "dateType"
+    "groupBy": "dateType",
+    "ifSort": "true"
   },
   {
     "name": "实审日",
@@ -1072,7 +1124,8 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
-    "groupBy": "dateType"
+    "groupBy": "dateType",
+    "ifSort": "true"
   },
   {
     "name": "wo指定国",
@@ -1086,7 +1139,8 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
-    "groupBy": "nation"
+    "groupBy": "nation",
+    "ifSort": "true"
   },
   {
     "name": "ep申请号",
@@ -1100,7 +1154,8 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
-    "groupBy": "number"
+    "groupBy": "number",
+    "ifSort": "true"
   },
   {
     "name": "EP指定国",
@@ -1114,7 +1169,8 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
-    "groupBy": "nation"
+    "groupBy": "nation",
+    "ifSort": "true"
   },
   {
     "name": "ep申请日",
@@ -1128,7 +1184,8 @@
     "ifShow": "false",
     "ifStats": "false",
     "ifAsCondition": "true",
-    "groupBy": "dateType"
+    "groupBy": "dateType",
+    "ifSort": "true"
   },
   {
     "name": "自定义栏位id",