Commit bf511c66 authored by tianyiming's avatar tianyiming

修改方法名

parent 60a58076
...@@ -1124,7 +1124,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -1124,7 +1124,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
); );
normalBoolQuery.must(normalNestedQuery); normalBoolQuery.must(normalNestedQuery);
Long normalCount = getStaticCount(normalBoolQuery, index); Long normalCount = getStatisticCount(normalBoolQuery, index);
BoolQueryBuilder nearBoolQuery = QueryBuilderUtils.copyBoolQuery(boolMust); BoolQueryBuilder nearBoolQuery = QueryBuilderUtils.copyBoolQuery(boolMust);
NestedQueryBuilder nearNestedQuery = QueryBuilders.nestedQuery( NestedQueryBuilder nearNestedQuery = QueryBuilders.nestedQuery(
...@@ -1133,7 +1133,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -1133,7 +1133,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
ScoreMode.None ScoreMode.None
); );
nearBoolQuery.must(nearNestedQuery); nearBoolQuery.must(nearNestedQuery);
Long nearCount = getStaticCount(nearBoolQuery, StatisticalAnalysisEnum.company.getKey()); Long nearCount = getStatisticCount(nearBoolQuery, StatisticalAnalysisEnum.company.getKey());
Map<String, Object> normalMap = new HashMap<>(); Map<String, Object> normalMap = new HashMap<>();
normalMap.put("name", index.equals(StatisticalAnalysisEnum.company.getKey()) ? "许可正常" : "资质正常"); normalMap.put("name", index.equals(StatisticalAnalysisEnum.company.getKey()) ? "许可正常" : "资质正常");
...@@ -1147,7 +1147,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -1147,7 +1147,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
} }
private Long getStaticCount(BoolQueryBuilder builder, String index) { private Long getStatisticCount(BoolQueryBuilder builder, String index) {
CountRequest countRequest = new CountRequest(); CountRequest countRequest = new CountRequest();
countRequest.indices(index); countRequest.indices(index);
CountResponse response = null; CountResponse response = null;
...@@ -2645,23 +2645,23 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -2645,23 +2645,23 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
if (businessType.equals(StatisticalAnalysisEnum.equip.getCode())) { if (businessType.equals(StatisticalAnalysisEnum.equip.getCode())) {
// 获取企业总数 // 获取企业总数
Long companyCount = getStaticCount(companyBoolMust, companyIndex); Long companyCount = getStatisticCount(companyBoolMust, companyIndex);
// 获取人员总数 // 获取人员总数
Long personCount = getStaticCount(personBoolMust, personIndex); Long personCount = getStatisticCount(personBoolMust, personIndex);
tabTotalMap.put(StatisticalAnalysisEnum.company.getCode(), companyCount); tabTotalMap.put(StatisticalAnalysisEnum.company.getCode(), companyCount);
tabTotalMap.put(StatisticalAnalysisEnum.person.getCode(), personCount); tabTotalMap.put(StatisticalAnalysisEnum.person.getCode(), personCount);
} else if (businessType.equals(StatisticalAnalysisEnum.company.getCode())) { } else if (businessType.equals(StatisticalAnalysisEnum.company.getCode())) {
// 获取设备总数 // 获取设备总数
Long equipCount = getStaticCount(equipBoolMust, equipIndex); Long equipCount = getStatisticCount(equipBoolMust, equipIndex);
// 获取人员总数 // 获取人员总数
Long personCount = getStaticCount(personBoolMust, personIndex); Long personCount = getStatisticCount(personBoolMust, personIndex);
tabTotalMap.put(StatisticalAnalysisEnum.equip.getCode(), equipCount); tabTotalMap.put(StatisticalAnalysisEnum.equip.getCode(), equipCount);
tabTotalMap.put(StatisticalAnalysisEnum.person.getCode(), personCount); tabTotalMap.put(StatisticalAnalysisEnum.person.getCode(), personCount);
} else { } else {
// 获取设备总数 // 获取设备总数
Long equipCount = getStaticCount(equipBoolMust, equipIndex); Long equipCount = getStatisticCount(equipBoolMust, equipIndex);
// 获取企业总数 // 获取企业总数
Long companyCount = getStaticCount(companyBoolMust, companyIndex); Long companyCount = getStatisticCount(companyBoolMust, companyIndex);
tabTotalMap.put(StatisticalAnalysisEnum.equip.getCode(), equipCount); tabTotalMap.put(StatisticalAnalysisEnum.equip.getCode(), equipCount);
tabTotalMap.put(StatisticalAnalysisEnum.company.getCode(), companyCount); tabTotalMap.put(StatisticalAnalysisEnum.company.getCode(), companyCount);
} }
...@@ -2711,10 +2711,11 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -2711,10 +2711,11 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
List<Map<String, Long>> staticCountByGroup = new ArrayList<>(); List<Map<String, Long>> staticCountByGroup = new ArrayList<>();
getStaticCountByGroup(request, builder, boolMust, groupField, staticCountByGroup); getStatisticCountByGroup(request, builder, boolMust, groupField, staticCountByGroup);
Long otherCount = staticCountByGroup.stream().map(item -> item.values().stream().reduce(0L, Long::sum)).reduce(0L, Long::sum); Long otherCount = staticCountByGroup.stream().map(item -> item.values().stream().reduce(0L, Long::sum)).reduce(0L, Long::sum);
tabTotalMap.put(StatisticalAnalysisEnum.equip.getCode(), otherCount); tabTotalMap.put(StatisticalAnalysisEnum.equip.getCode(), otherCount);
// 组装数据
for (Map<String, Object> map : staticCountByGroupMap) { for (Map<String, Object> map : staticCountByGroupMap) {
...@@ -2724,7 +2725,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -2724,7 +2725,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
return staticCountByGroupMap; return staticCountByGroupMap;
} }
private void getStaticCountByGroup(SearchRequest request, SearchSourceBuilder builder, BoolQueryBuilder boolMust, String groupField, List<Map<String, Long>> staticCountByGroup) { private void getStatisticCountByGroup(SearchRequest request, SearchSourceBuilder builder, BoolQueryBuilder boolMust, String groupField, List<Map<String, Long>> staticCountByGroup) {
builder.query(boolMust); builder.query(boolMust);
builder.aggregation(AggregationBuilders.terms(groupField).field(groupField).missing("null")); builder.aggregation(AggregationBuilders.terms(groupField).field(groupField).missing("null"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment