zero 1 vuosi sitten
vanhempi
commit
48d713849e

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

@@ -136,6 +136,9 @@ public class PatentColumnDTO {
      * 优先权
      */
     private List<Priorities> priorities;
+    private String priorityCountry;
+    private String priorityDate;
+    private String priorityNo;
 
     /**
      * 申请国家

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

@@ -32,4 +32,5 @@ public class GetAllPatentCountVO {
     private String field;
     private String groupBy;
     private Object children;
+    private Object optionValue;
 }

+ 0 - 6
src/main/java/cn/cslg/pas/factorys/EsCountAnalyseBuilderFactory/TermsCountAnalysisBuilder.java

@@ -35,12 +35,6 @@ public class TermsCountAnalysisBuilder implements IEsCountAnalysisBuilder {
             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)));
-//            aggregation = new Aggregation.Builder().terms(new TermsAggregation.Builder()
-//                    .field(field).size(topN).build())
-//                    .aggregations(new HashMap() {{
-//                        put("filter_agg", filter);
-//                    }}).build();
             Aggregation term = AggregationBuilders.terms(j -> j.field(field).size(topN));
             aggregation = new Aggregation.Builder().filter(i -> i.bool(j -> j.must(query))).aggregations(new HashMap() {{
                 put("filter_agg", term);

+ 8 - 5
src/main/java/cn/cslg/pas/service/business/ProductMarketDataService.java

@@ -30,6 +30,7 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.IOException;
@@ -282,11 +283,13 @@ public class ProductMarketDataService extends ServiceImpl<ProductMarketDataMappe
                 allCompanyAndAreaVO.setCompanyNames(companyNames);
                 //根据查出来的产品ids查询地区名
                 List<Integer> productIds = products.stream().map(Product::getId).collect(Collectors.toList());
-                LambdaQueryWrapper<ProductMarketData> areaWrapper = new LambdaQueryWrapper<>();
-                areaWrapper.in(ProductMarketData::getProductId, productIds);
-                List<ProductMarketData> productMarketDatas = this.list(areaWrapper);
-                List<String> areas = productMarketDatas.stream().map(ProductMarketData::getSaleArea).distinct().collect(Collectors.toList());
-                allCompanyAndAreaVO.setSaleAreas(areas);
+                if (!CollectionUtils.isEmpty(productIds)) {
+                    LambdaQueryWrapper<ProductMarketData> areaWrapper = new LambdaQueryWrapper<>();
+                    areaWrapper.in(ProductMarketData::getProductId, productIds);
+                    List<ProductMarketData> productMarketDatas = this.list(areaWrapper);
+                    List<String> areas = productMarketDatas.stream().map(ProductMarketData::getSaleArea).distinct().collect(Collectors.toList());
+                    allCompanyAndAreaVO.setSaleAreas(areas);
+                }
                 return allCompanyAndAreaVO;
             } else {
                 throw new XiaoShiException("必须传一个参数");

+ 14 - 25
src/main/java/cn/cslg/pas/service/business/es/EsCountService.java

@@ -123,9 +123,6 @@ public class EsCountService {
             }
         }
 
-//        if (!CollectionUtils.isEmpty(customFields)) {
-//            searchCondition = esService.parseCustomField(customFields,projectId,taskId);
-//        }
         if (!CollectionUtils.isEmpty(customFields)) {
             String customFieldCondition = esService.parseCustomField(customFields, projectId, taskId);
             if (StringUtils.isNotEmpty(searchCondition)) {
@@ -151,6 +148,7 @@ public class EsCountService {
 
         for (EsCountVO countVO : countVOS) {
             String field = countVO.getField();
+            String fieldId = countVO.getFieldId();
             Integer topN = countVO.getTopN();
             String valueOne = countVO.getValueOne();
             String valueTwo = countVO.getValueTwo();
@@ -196,7 +194,7 @@ public class EsCountService {
                     }
                 } else if (childList.contains(field)) {
                     if (CollectionUtils.isEmpty(values)) {
-                        this.getChildCountDTOS(agg, field, fieldType, topN, detailDTOS, esCountDTO,projectId,taskId,query);
+                        this.getChildCountDTOS(agg, field, fieldType, topN, detailDTOS, esCountDTO,projectId,fieldId,query);
                     } else {
                         this.getChildAnalysisDTOS(agg, field, fieldType, topN,
                                 detailDTOS, esCountDTO, firstName, map, values);
@@ -524,7 +522,7 @@ public class EsCountService {
      * @param detailDTOS
      */
     public void getChildCountDTOS(Aggregate agg, String field, Integer fieldType, Integer topN,
-                                  List<EsCountDetailDTO> detailDTOS, EsCountDTO esCountDTO,Integer projectId, Integer taskId,Query query) throws Exception {
+                                  List<EsCountDetailDTO> detailDTOS, EsCountDTO esCountDTO,Integer projectId, String fieldId,Query query) throws Exception {
         esCountDTO.setAllNumber(agg.children().docCount());
         Aggregate childAgg = agg.children().aggregations().get("childAgg");
         List<StringTermsBucket> list = childAgg.sterms().buckets().array();
@@ -546,28 +544,19 @@ public class EsCountService {
             });
         });
         if (fieldType == null || fieldType != 6) {
-            if (CollectionUtils.isEmpty(detailDTOS)) {
-                EsCountDetailDTO detail = new EsCountDetailDTO();
-                detail.setField(field);
-                detail.setName("未选择");
-                detail.setNumber(0l);
-                detail.setTopN(topN);
-                if (!detailDTOS.contains(detail)) {
-                    detailDTOS.add(detail);
-                }
-            } else {
-                String fieldId = detailDTOS.get(0).getFieldId();
-                GetUnselectedDTO unselectedDTO = this.getUnselectedCustomNum1(projectId, fieldId, query);
-                EsCountDetailDTO detail = new EsCountDetailDTO();
-                detail.setField(field);
-                detail.setName("未选择");
+            GetUnselectedDTO unselectedDTO = this.getUnselectedCustomNum1(projectId, fieldId, query);
+            EsCountDetailDTO detail = new EsCountDetailDTO();
+            detail.setField(field);
+            detail.setName("未选择");
+            if (unselectedDTO.getNumber() != null) {
                 detail.setNumber(unselectedDTO.getNumber().longValue());
-                detail.setTopN(topN);
-                if (!detailDTOS.contains(detail)) {
-                    detailDTOS.add(detail);
-                }
+            } else {
+                detail.setNumber(0L);
+            }
+            detail.setTopN(topN);
+            if (!detailDTOS.contains(detail)) {
+                detailDTOS.add(detail);
             }
-
         }
     }
 

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

@@ -386,7 +386,7 @@ public class EsCustomFieldService {
         }
         builder.sort(optionsList);
 
-        int number = endNum - startNum;
+        int number = endNum - startNum + 1;
         if (startNum > 0 && endNum > startNum) {
             builder.from(startNum - 1).size(number);
         }

+ 12 - 0
src/main/java/cn/cslg/pas/service/business/es/EsService.java

@@ -337,6 +337,18 @@ public class EsService {
             columnDTO.setRightCity(rightAddr.getCity());
             columnDTO.setRightDistrict(rightAddr.getDistrict());
         }
+        if (!CollectionUtils.isEmpty(patent.getPriorities())) {
+            List<Priorities> priorities = patent.getPriorities();
+            List<String> priorityCountrys = priorities.stream().map(Priorities::getPriorityCountry).distinct().collect(Collectors.toList());
+            String priorityCountry = String.join("<br>", priorityCountrys);
+            columnDTO.setPriorityCountry(priorityCountry);
+            List<String> priorityNos = priorities.stream().map(Priorities::getPriorityNo).distinct().collect(Collectors.toList());
+            String priorityNo = String.join("<br>", priorityNos);
+            columnDTO.setPriorityNo(priorityNo);
+            List<String> priorityDates = priorities.stream().map(Priorities::getPriorityDate).distinct().collect(Collectors.toList());
+            String priorityDate = String.join("<br>", priorityDates);
+            columnDTO.setPriorityDate(priorityDate);
+        }
         columnDTO.setApplicant(esPatentService.loadName(patent.getApplicant()));
         columnDTO.setRightHolder(esPatentService.loadName(patent.getRightHolder()));
         columnDTO.setInventor(esPatentService.loadName(patent.getInventor()));