Forráskód Böngészése

Merge remote-tracking branch 'origin/master'

xiexiang 1 éve
szülő
commit
41c334a7df

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

@@ -48,6 +48,7 @@ import org.springframework.util.CollectionUtils;
 import java.io.IOException;
 import java.text.SimpleDateFormat;
 import java.util.*;
+import java.util.stream.Collectors;
 
 
 @Service
@@ -173,6 +174,7 @@ public class EsService {
         treeNode tree = expressManager.getInstance().Parse(condition, false);
         //3. 从es中检索数据
         Query q = formatQueryService.EsQueryToQuery((operateNode) tree, "patent",projectId);
+        builder.query(q);
         //判断同族分组
         String str = "";
         if (StringUtils.isNotEmpty(groupField)) {
@@ -195,18 +197,15 @@ public class EsService {
             options.add(appDate);
             Aggregation hits = AggregationBuilders.topHits(i -> i.size(1).sort(options));
             Aggregation aggregation = new Aggregation.Builder().terms(new TermsAggregation.Builder()
-                    .field(esField).build())
+                    .field(esField).size(10).build())
                     .aggregations(new HashMap() {{
                         put("hitAgg", hits);
                     }}).build();
-            Aggregation filterAgg = new Aggregation.Builder().filter(i -> i.bool(j -> j.must(q)))
-                    .aggregations(new HashMap() {{
-                        put("filterAgg", aggregation);
-                    }}).build();
-            builder.aggregations("Agg", filterAgg);
-        } else {
-            //4. 返回数据
-            builder.query(q);
+//            Aggregation filterAgg = new Aggregation.Builder().filter(i -> i.bool(j -> j.must(q)))
+//                    .aggregations(new HashMap() {{
+//                        put("filterAgg", aggregation);
+//                    }}).build();
+            builder.aggregations("Agg", aggregation);
         }
 
         //排序
@@ -247,11 +246,10 @@ public class EsService {
         long total = 0L;
         if (StringUtils.isNotEmpty(esField)) {
             Aggregate agg = response.aggregations().get("Agg");
-            Aggregate filtersAgg = agg.filter().aggregations().get("filterAgg");
-            List<StringTermsBucket> termsBuckets = filtersAgg.sterms().buckets().array();
+            List<StringTermsBucket> termsBuckets = agg.sterms().buckets().array();
+            total = Long.valueOf(String.valueOf(termsBuckets.size()));
             for (StringTermsBucket termsBucket : termsBuckets) {
                 Aggregate hitAgg = termsBucket.aggregations().get("hitAgg");
-                total = hitAgg.topHits().hits().total().value();
                 List<Hit<JsonData>> hits = hitAgg.topHits().hits().hits();
                 hits.forEach(hit -> {
                     String id = hit.id();

+ 0 - 4
src/main/java/cn/cslg/pas/service/business/invalidReport/AssoGroupFeatureService.java

@@ -207,13 +207,9 @@ public class AssoGroupFeatureService extends ServiceImpl<AssoGroupFeatureMapper,
             List<AssoGroupFeature> list = this.list(new LambdaQueryWrapper<AssoGroupFeature>()
                     .eq(AssoGroupFeature::getFeatureId, featureId1)
                     .eq(AssoGroupFeature::getGroupId, groupId1)
-                    .eq(AssoGroupFeature::getFeatureGen,0)
                     .orderByDesc(BaseEntity::getId));
             if (!CollectionUtils.isEmpty(list)) {
                 assoGroupFeature = list.get(0);
-            } else {
-                //根据特征id查询证据组合和特征关联
-                assoGroupFeature = this.getById(featureGroupId);
             }
         } else {
             //根据特征id查询证据组合和特征关联