Commit ac382516 authored by tianyiming's avatar tianyiming

refactor: 调整综合查询,自定义查询设备表头统计展示

parent 3bd38e84
......@@ -123,7 +123,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
private final String DOWNLOAD_TOPIC = "/topic/download/excel/%s";
private final String BUCKET_NAME = "upload";
private final String UPLOAD_PATH = "/tzs/excelTempFile";
private final List<String> equList = Arrays.asList("1000","2000","3000","4000","5000","6000","8000","9000");
private final List<String> equList = Arrays.asList("1000", "2000", "3000", "4000", "5000", "6000", "8000", "9000");
// 大屏统计图片路径前缀
private final String dpEquipPhotoPrefix = "/upload/tzs/dpscreen/statistic/equip/";
// 大屏统计图片路径后缀
......@@ -965,8 +965,8 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
if (!equList.equals("8000") && !equCategory.equals("2300")) {
BoolQueryBuilder queryBuilder = QueryBuilderUtils.copyBoolQuery(boolMust);
queryBuilder.mustNot(QueryBuilders.termQuery("EQU_LIST_CODE","8000"))
.mustNot(QueryBuilders.termQuery("EQU_CATEGORY_CODE","2300"));
queryBuilder.mustNot(QueryBuilders.termQuery("EQU_LIST_CODE", "8000"))
.mustNot(QueryBuilders.termQuery("EQU_CATEGORY_CODE", "2300"));
Long count = getStatisticCount(queryBuilder, StatisticalAnalysisEnum.equip.getKey());
Map<String, Object> sum = new HashMap<>();
sum.put("name", "设备总数(台套)");
......@@ -1029,8 +1029,8 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
}
private void getEquipmentBoolQueryBuilder(BoolQueryBuilder boolMust, JSONObject filterParams, String filterType) {
List<String> equListCodes = new ArrayList<>();
List<String> equCategoryCodes = new ArrayList<>();
HashSet<String> equListCodes = new HashSet<>();
HashSet<String> equCategoryCodes = new HashSet<>();
//快捷筛选和自定义筛选解析筛选规则不一致
if (filterType.equals("advanced")) {
JSONObject finalFilterParams = filterParams;
......@@ -1184,48 +1184,10 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
} else {
JSONArray leftGroup = filterParams.getJSONArray("group1");
JSONArray rightGroup = filterParams.getJSONArray("group2");
leftGroup.forEach(item -> {
JSONObject left = JSONObject.parseObject(JSONObject.toJSONString(item));
String leftField = left.getString("field");
String leftValue = left.getString("value");
String leftItemCondition = left.getString("itemCondition");
if (!ObjectUtils.isEmpty(leftField) && leftField.equals("EQU_LIST_CODE") && !ObjectUtils.isEmpty(leftValue)) {
if ("in".equals(leftItemCondition) || "eq".equals(leftItemCondition)) {
equListCodes.add(leftValue);
} else {
//todo
}
}
if (!ObjectUtils.isEmpty(leftField) && leftField.equals("EQU_CATEGORY_CODE") && !ObjectUtils.isEmpty(leftValue)) {
if ("in".equals(leftItemCondition) || "eq".equals(leftItemCondition)) {
equCategoryCodes.add(leftValue);
} else {
// todo
}
}
});
rightGroup.forEach(item -> {
JSONObject right = JSONObject.parseObject(JSONObject.toJSONString(item));
String rightField = right.getString("field");
String rightValue = right.getString("value");
String rightItemCondition = right.getString("itemCondition");
if (!ObjectUtils.isEmpty(rightField) && rightField.equals("EQU_LIST_CODE") && !ObjectUtils.isEmpty(rightValue)) {
if ("in".equals(rightItemCondition) || "eq".equals(rightItemCondition)) {
equListCodes.add(rightValue);
} else {
// todo
}
}
if (!ObjectUtils.isEmpty(rightField) && rightField.equals("EQU_CATEGORY_CODE") && !ObjectUtils.isEmpty(rightValue)) {
if ("in".equals(rightItemCondition) || "eq".equals(rightItemCondition)) {
equCategoryCodes.add(rightValue);
} else {
// todo
}
}
});
Boolean isOrGroup = or.equals(filterParams.getString("groupAndOr")) ? Boolean.TRUE : Boolean.FALSE;
handleAdvancedFilter(boolMust, leftGroup, rightGroup, isOrGroup, StatisticalAnalysisEnum.equip.getCode());
equListCodes.add("8000");
equCategoryCodes.add("2300");
}
filterParams.put("equList", String.join(",", equListCodes));
filterParams.put("equCategory", String.join(",", equCategoryCodes));
......@@ -3161,10 +3123,10 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
equipBoolMust.must(QueryBuilders.termsQuery("EQU_LIST_CODE", Arrays.asList("1000", "2000", "3000", "4000", "5000", "6000", "9000")));
BoolQueryBuilder companyUnitTypeBoolMust = QueryBuilders.boolQuery();
companyBoolMust(companyUnitTypeBoolMust,"company");
companyBoolMust(companyUnitTypeBoolMust, "company");
BoolQueryBuilder inspectionUnitTypeBoolMust = QueryBuilders.boolQuery();
companyBoolMust(inspectionUnitTypeBoolMust,"inspection");
companyBoolMust(inspectionUnitTypeBoolMust, "inspection");
BoolQueryBuilder companyBoolMust = QueryBuilders.boolQuery();
companyBoolMust.must(QueryBuilders.prefixQuery("superviseOrgCode.keyword", orgCode));
......
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