瀏覽代碼

Merge remote-tracking branch 'origin/master'

lwhhszx 1 年之前
父節點
當前提交
a2f21bd626

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

@@ -14,6 +14,8 @@ public class ReportVO {
      */
     private Integer projectId;
 
+    private String reportName;
+
     /**
      *标的专利号
      */

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

@@ -4,6 +4,7 @@ import co.elastic.clients.elasticsearch._types.SortOrder;
 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 co.elastic.clients.json.JsonData;
 import co.elastic.clients.util.NamedValue;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Component;
@@ -35,8 +36,13 @@ public class DateCountAnalyssBuilder implements IEsCountAnalysisBuilder {
         Aggregation aggregation = null;
 //        NamedValue<SortOrder> orderNamedValue = NamedValue.of(field, SortOrder.Desc);
         if (StringUtils.isNotEmpty(valueOne) && StringUtils.isNotEmpty(valueTwo)) {
+            SimpleDateFormat format = new SimpleDateFormat("yyyy");
+            Date beginDate = format.parse(valueOne);
+            long beginTime = beginDate.getTime();
             String end = String.valueOf(Integer.parseInt(valueTwo) + 1);
-            Query query = QueryBuilders.range(j -> j.field(field).from(valueOne).to(end).format("yyyy"));
+            Date endDate = format.parse(end);
+            long endTime = endDate.getTime();
+            Query query = QueryBuilders.range(j -> j.field(field).gte(JsonData.of(beginTime)).lt(JsonData.of(endTime)));
             Aggregation filter = AggregationBuilders.filter(n -> n.bool(k -> k.must(query)));
             aggregation = new Aggregation.Builder().dateHistogram(new DateHistogramAggregation.Builder()
                     .field(field).format("yyyy")

+ 6 - 0
src/main/java/cn/cslg/pas/service/business/InvalidRecordService.java

@@ -241,6 +241,9 @@ public class InvalidRecordService extends ServiceImpl<InvalidRecordMapper, Inval
                     //带出报告信息
                     ReportVO reportVO = new ReportVO();
                     BeanUtils.copyProperties(item, reportVO);
+                    Integer projectId = item.getProjectId();
+                    Project reportProject = projectService.getById(projectId);
+                    reportVO.setReportName(reportProject.getName());
                     invalidRecordVO.setReportVO(reportVO);
                     finalVOS.add(invalidRecordVO);
                 } else if (type.equals(7)) {
@@ -262,6 +265,9 @@ public class InvalidRecordService extends ServiceImpl<InvalidRecordMapper, Inval
                     //带出报告信息
                     ReportVO reportVO = new ReportVO();
                     BeanUtils.copyProperties(item, reportVO);
+                    Integer projectId = item.getProjectId();
+                    Project reportProject = projectService.getById(projectId);
+                    reportVO.setReportName(reportProject.getName());
                     invalidRecordVO.setReportVO(reportVO);
                     finalVOS.add(invalidRecordVO);
                 }

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