Pārlūkot izejas kodu

fixed 检索统计

zero 1 gadu atpakaļ
vecāks
revīzija
a825ceaa8f

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

@@ -40,7 +40,7 @@ public class DateCountAnalyssBuilder implements IEsCountAnalysisBuilder {
             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).timeZone("+08:00").build())
+                    .calendarInterval(CalendarInterval.Year).timeZone("+01:00").build())
                     .aggregations(new HashMap() {{
                         put("filter_agg", filter);
                     }}).build();

+ 8 - 3
src/main/java/cn/cslg/pas/service/business/MergePersonService.java

@@ -1038,13 +1038,18 @@ public class MergePersonService extends ServiceImpl<MergePersonMapper, MergePers
                         Map<String, List<PatentMergePerson>> appMap = this.getChildMergePerson(id, projectId, "merge_applicant");
                         if (!CollectionUtils.isEmpty(appMap)) {
                             for (String appId : appMap.keySet()) {
-                                if (CollectionUtils.isEmpty(nameDatas)) {
-                                    this.delSingleMerge(appId, type, name);
-                                }
+//                                if (CollectionUtils.isEmpty(nameDatas)) {
+//                                    this.delSingleMerge(appId, type, name);
+//                                }
 
                                 List<PatentMergePerson> appMergeList = new ArrayList<>(mergePersonList);
                                 List<PatentMergePerson> appList = appMap.get(appId);
                                 appMergeList.addAll(appList);
+                                if (CollectionUtils.isEmpty(nameDatas)) {
+                                    if (!CollectionUtils.isEmpty(appMergeList)) {
+                                        appMergeList.removeIf(app -> app.getName().equals(name));
+                                    }
+                                }
                                 //添加子文档
                                 Patent newPatent = new Patent();
                                 PatentJoin patentJoin = new PatentJoin();

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

@@ -182,6 +182,8 @@ public class EsCountService {
         for (EsCountVO countVO : countVOS) {
             String field = countVO.getField();
             Integer topN = countVO.getTopN();
+            String valueOne = countVO.getValueOne();
+            String valueTwo = countVO.getValueTwo();
             Integer fieldType = null;
             String type = countVO.getFieldType();
             if (StringUtils.isNotEmpty(type) && type.equals("tree")) {
@@ -213,7 +215,7 @@ public class EsCountService {
                             filtersBuckets.forEach(filtersBucket -> {
                                 Aggregate filtersAgg = filtersBucket.aggregations().get("filters_agg");
                                 try {
-                                    this.getDateCountDTOS(filtersAgg, field, topN, format, detailDTOS, esCountDTO);
+                                    this.getDateCountDTOS(filtersAgg, field, topN, format, detailDTOS, esCountDTO,valueOne,valueTwo);
                                 } catch (ParseException e) {
                                     e.printStackTrace();
                                 }
@@ -238,7 +240,7 @@ public class EsCountService {
                                 Aggregate filtersAgg = filtersBucket.aggregations().get("filters_agg");
                                 Aggregate termsAgg = filtersAgg.nested().aggregations().get("terms_agg");
                                 try {
-                                    this.getDateCountDTOS(termsAgg, field, topN, format, detailDTOS, esCountDTO);
+                                    this.getDateCountDTOS(termsAgg, field, topN, format, detailDTOS, esCountDTO,valueOne,valueTwo);
                                 } catch (ParseException e) {
                                     e.printStackTrace();
                                 }
@@ -299,7 +301,7 @@ public class EsCountService {
             } else {
                 if (dateList.contains(field)) {
                     if (CollectionUtils.isEmpty(values)) {
-                        this.getDateCountDTOS(agg, field, topN, format, detailDTOS, esCountDTO);
+                        this.getDateCountDTOS(agg, field, topN, format, detailDTOS, esCountDTO,valueOne,valueTwo);
                     } else {
                         this.getDateAnalysisDTOS(agg, field, topN, detailDTOS, esCountDTO, firstName, map, values);
                     }
@@ -310,7 +312,7 @@ public class EsCountService {
                     }
                 } else if (nestDateList.contains(field)) {
                     Aggregate termsAgg = agg.nested().aggregations().get("terms_agg");
-                    this.getDateCountDTOS(termsAgg, field, topN, format, detailDTOS, esCountDTO);
+                    this.getDateCountDTOS(termsAgg, field, topN, format, detailDTOS, esCountDTO,valueOne,valueTwo);
                 } else if (nestChildList.contains(field)) {
                     Aggregate childAgg = agg.children().aggregations().get("childAgg");
                     this.getNestedCountDTOS(childAgg, field, topN, detailDTOS, esCountDTO, firstName, map, values);
@@ -830,7 +832,8 @@ public class EsCountService {
      * @param field
      * @param detailDTOS
      */
-    public void getDateCountDTOS(Aggregate agg, String field, Integer topN, String format, List<EsCountDetailDTO> detailDTOS, EsCountDTO esCountDTO) throws ParseException {
+    public void getDateCountDTOS(Aggregate agg, String field, Integer topN, String format, List<EsCountDetailDTO> detailDTOS,
+                                 EsCountDTO esCountDTO, String valueOne, String valueTwo) throws ParseException {
         List<DateHistogramBucket> list = agg.dateHistogram().buckets().array();
         esCountDTO.setAllNumber(Long.valueOf(String.valueOf(list.size())));
         List<EsCountDetailDTO> esCountDetailDTOS = new ArrayList<>();
@@ -924,7 +927,13 @@ public class EsCountService {
                 if (aggregate != null) {
                     dto.setNumber(aggregate.filter().docCount());
                 }
-                esCountDetailDTOS.add(dto);
+                if (StringUtils.isNotEmpty(valueOne) || StringUtils.isNotEmpty(valueTwo)) {
+                    if (dto.getNumber() > 0) {
+                        esCountDetailDTOS.add(dto);
+                    }
+                } else {
+                    esCountDetailDTOS.add(dto);
+                }
             });
         }