Commit bb7934ec authored by tianyiming's avatar tianyiming

bug修改

parent 190a9f00
...@@ -1186,8 +1186,8 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -1186,8 +1186,8 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
JSONArray rightGroup = filterParams.getJSONArray("group2"); JSONArray rightGroup = filterParams.getJSONArray("group2");
Boolean isOrGroup = or.equals(filterParams.getString("groupAndOr")) ? Boolean.TRUE : Boolean.FALSE; Boolean isOrGroup = or.equals(filterParams.getString("groupAndOr")) ? Boolean.TRUE : Boolean.FALSE;
handleAdvancedFilter(boolMust, leftGroup, rightGroup, isOrGroup, StatisticalAnalysisEnum.equip.getCode()); handleAdvancedFilter(boolMust, leftGroup, rightGroup, isOrGroup, StatisticalAnalysisEnum.equip.getCode());
equListCodes.add("8000"); equListCodes.add("all");
equCategoryCodes.add("2300"); equCategoryCodes.add("all");
} }
filterParams.put("equList", String.join(",", equListCodes)); filterParams.put("equList", String.join(",", equListCodes));
filterParams.put("equCategory", String.join(",", equCategoryCodes)); filterParams.put("equCategory", String.join(",", equCategoryCodes));
...@@ -3246,9 +3246,12 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -3246,9 +3246,12 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
// 一级统计 // 一级统计
if (!is2LeveFlag) { if (!is2LeveFlag) {
companyBoolMust(boolMust, "company"); BoolQueryBuilder countBoolMust = QueryBuilderUtils.copyBoolQuery(boolMust);
Map<String, Object> dats = getTotalAggMapsByUnitType(request, builder, boolMust, tabTotalMap, StatisticalAnalysisEnum.person); companyBoolMust(countBoolMust, "company");
result = getUseAndProductAndFillingStatistics(dats); long total = this.queryDpStatisticsTotalByIndex(countBoolMust, StatisticalAnalysisEnum.person.getKey());
// 汇总总数
tabTotalMap.put(StatisticalAnalysisEnum.person.getCode(), total);
result = getUseAndProductAndFillingStatistics(boolMust, StatisticalAnalysisEnum.person.getKey());
} else if (!is3LeveFlag) { } else if (!is3LeveFlag) {
if (unitCategory.equals(UnitCategoryEnum.use.getCode())) { if (unitCategory.equals(UnitCategoryEnum.use.getCode())) {
companyBoolMust(boolMust, UnitCategoryEnum.use.getCode()); companyBoolMust(boolMust, UnitCategoryEnum.use.getCode());
...@@ -3405,16 +3408,12 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -3405,16 +3408,12 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
.orElse(false); .orElse(false);
// 一级统计 // 一级统计
if (!is2LeveFlag) { if (!is2LeveFlag) {
// 计算总数 BoolQueryBuilder countBoolMust = QueryBuilderUtils.copyBoolQuery(boolMust);
boolMust.should(QueryBuilders.matchQuery("unitType", UnitTypeEnum.sydw.getName())) companyBoolMust(countBoolMust, "company");
.should(QueryBuilders.matchQuery("unitType", UnitTypeEnum.grzt.getName())) long total = this.queryDpStatisticsTotalByIndex(countBoolMust, StatisticalAnalysisEnum.company.getKey());
.should(QueryBuilders.matchQuery("unitType", UnitTypeEnum.zzdw.getName())) // 汇总总数
.should(QueryBuilders.matchQuery("unitType", UnitTypeEnum.sjdw.getName())) tabTotalMap.put(StatisticalAnalysisEnum.company.getCode(), total);
.should(QueryBuilders.matchQuery("unitType", UnitTypeEnum.azgzwxdw.getName())) return Collections.singletonList(getUseAndProductAndFillingStatistics(boolMust, StatisticalAnalysisEnum.company.getKey()));
.should(QueryBuilders.matchQuery("unitType", UnitTypeEnum.czdw.getName()))
.minimumShouldMatch(1);
Map<String, Object> datas = getTotalAggMapsByUnitType(request, builder, boolMust, tabTotalMap, StatisticalAnalysisEnum.company);
return Collections.singletonList(getUseAndProductAndFillingStatistics(datas));
} else if (!is3LeveFlag) { } else if (!is3LeveFlag) {
Long companyCount = getStatisticCount(boolMust, StatisticalAnalysisEnum.company.getKey()); Long companyCount = getStatisticCount(boolMust, StatisticalAnalysisEnum.company.getKey());
JSONObject industrySupervisor = this.getItemGroupStatisticsByItemName(boolMust, JSONObject industrySupervisor = this.getItemGroupStatisticsByItemName(boolMust,
...@@ -3540,29 +3539,20 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -3540,29 +3539,20 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
return Collections.singletonList(result); return Collections.singletonList(result);
} }
private Map<String, Object> getUseAndProductAndFillingStatistics(Map<String, Object> datas) { private Map<String, Object> getUseAndProductAndFillingStatistics(BoolQueryBuilder boolMust, String index) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
Long filling = 0L; BoolQueryBuilder useBoolMust = QueryBuilderUtils.copyBoolQuery(boolMust);
Long use = 0L; companyBoolMust(useBoolMust, UnitCategoryEnum.use.getCode());
Long produce = 0L; BoolQueryBuilder produceBoolMust = QueryBuilderUtils.copyBoolQuery(boolMust);
for (String key : datas.keySet()) { companyBoolMust(produceBoolMust, UnitCategoryEnum.produce.getCode());
if (key.equals("sydw")) { BoolQueryBuilder fillingBoolMust = QueryBuilderUtils.copyBoolQuery(boolMust);
use += Long.valueOf(datas.get("sydw").toString()); companyBoolMust(fillingBoolMust, UnitCategoryEnum.filling.getCode());
} else if (key.equals("grzt")) { Long useCount = getStatisticCount(useBoolMust, index);
use += Long.valueOf(datas.get("grzt").toString()); Long produceCount = getStatisticCount(produceBoolMust, index);
} else if (key.equals("sjdw")) { Long fillingCount = getStatisticCount(fillingBoolMust, index);
produce += Long.valueOf(datas.get("sjdw").toString()); result.put("use", useCount);
} else if (key.equals("zzdw")) { result.put("produce", produceCount);
produce += Long.valueOf(datas.get("zzdw").toString()); result.put("filling", fillingCount);
} else if (key.equals("azgzwxdw")) {
produce += Long.valueOf(datas.get("azgzwxdw").toString());
} else if (key.equals("czdw")) {
filling = Long.valueOf(datas.get("czdw").toString());
}
}
result.put("use", use);
result.put("produce", produce);
result.put("filling", filling);
return result; return result;
} }
......
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