Commit 2dce083d authored by 刘凡's avatar 刘凡

*)统计其他

parent 86e3f5ae
......@@ -465,7 +465,7 @@ public class ZLDPStatisticsServiceImpl {
String orgCode = getAndSetOrgCode(screenDto.getCityCode());
searchSourceBuilder.query(QueryBuilders.boolQuery()
.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*")));
searchSourceBuilder.aggregation(AggregationBuilders.terms("count_by_use_site_code").field("USE_SITE_CODE").size(20));
searchSourceBuilder.aggregation(AggregationBuilders.terms("count_by_use_site_code").field("USE_SITE_CODE").size(500));
searchRequest.source(searchSourceBuilder);
Map<String, Integer> dataMap = new HashMap<>();
List<Map<String, Object>> returnList = new ArrayList<>();
......@@ -486,11 +486,12 @@ public class ZLDPStatisticsServiceImpl {
Map<String, Object> map = new HashMap<>();
map.put("name", x.getName());
map.put("value", dataMap.getOrDefault(x.getCode(), 0));
dataMap.remove(x.getCode());
returnList.add(map);
});
Map<String, Object> otherMap = new HashMap<>();
otherMap.put("name", "其他");
otherMap.put("value", dataMap.getOrDefault("其他", 0) + dataMap.getOrDefault("", 0));
otherMap.put("value", dataMap.values().stream().mapToLong(e -> e).sum());
returnList.add(otherMap);
} catch (IOException e) {
e.printStackTrace();
......
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