|
@@ -70,6 +70,7 @@ public class EsCountService {
|
|
if (countVOS.size() > 1) {
|
|
if (countVOS.size() > 1) {
|
|
EsCountVO countVO = countVOS.get(0);
|
|
EsCountVO countVO = countVOS.get(0);
|
|
List<String> values = countVO.getValues();
|
|
List<String> values = countVO.getValues();
|
|
|
|
+ values.removeIf(i -> i.equals("其他"));
|
|
List<EsCountVO> esCountVOS = new ArrayList<>();
|
|
List<EsCountVO> esCountVOS = new ArrayList<>();
|
|
esCountVOS.add(countVOS.get(1));
|
|
esCountVOS.add(countVOS.get(1));
|
|
if (StringUtils.isNotEmpty(countVO.getFieldId())) {
|
|
if (StringUtils.isNotEmpty(countVO.getFieldId())) {
|
|
@@ -79,30 +80,38 @@ public class EsCountService {
|
|
valueDTO.setFieldId(countVO.getFieldId());
|
|
valueDTO.setFieldId(countVO.getFieldId());
|
|
valueDTO.setFieldValue(Arrays.asList(value));
|
|
valueDTO.setFieldValue(Arrays.asList(value));
|
|
customFields.add(valueDTO);
|
|
customFields.add(valueDTO);
|
|
- this.getReturnData(searchCondition, customFields, taskId, projectId, esCountVOS, detailDTOS, esCountDTO, value, map);
|
|
|
|
|
|
+ this.getReturnData(searchCondition, "",customFields, taskId, projectId,
|
|
|
|
+ esCountVOS, detailDTOS, esCountDTO, value, map);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
for (String value : values) {
|
|
for (String value : values) {
|
|
String condition = countVO.getField() + " = " + value;
|
|
String condition = countVO.getField() + " = " + value;
|
|
- if (searchCondition != null && !"".equals(searchCondition.trim())) {
|
|
|
|
- searchCondition = condition + " AND " + searchCondition;
|
|
|
|
- } else {
|
|
|
|
- searchCondition = condition;
|
|
|
|
- }
|
|
|
|
- this.getReturnData(searchCondition, customFields, taskId, projectId, esCountVOS, detailDTOS, esCountDTO, value, map);
|
|
|
|
|
|
+ this.getReturnData(searchCondition, condition, customFields, taskId, projectId,
|
|
|
|
+ esCountVOS, detailDTOS, esCountDTO, value, map);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- this.getReturnData(searchCondition, customFields, taskId, projectId, countVOS, detailDTOS, esCountDTO, "", map);
|
|
|
|
|
|
+ this.getReturnData(searchCondition, "", customFields, taskId, projectId, countVOS,
|
|
|
|
+ detailDTOS, esCountDTO, "", map);
|
|
}
|
|
}
|
|
esCountDTO.setDetailDTOS(detailDTOS);
|
|
esCountDTO.setDetailDTOS(detailDTOS);
|
|
return esCountDTO;
|
|
return esCountDTO;
|
|
}
|
|
}
|
|
|
|
|
|
- public void getReturnData(String searchCondition, List<EsCustomFieldValueDTO> customFields, Integer taskId,
|
|
|
|
|
|
+ public void getReturnData(String searchCondition,String condition, List<EsCustomFieldValueDTO> customFields, Integer taskId,
|
|
Integer projectId, List<EsCountVO> countVOS, List<EsCountDetailDTO> detailDTOS,
|
|
Integer projectId, List<EsCountVO> countVOS, List<EsCountDetailDTO> detailDTOS,
|
|
EsCountDTO esCountDTO, String firstName, Map<String, List<EsCountDetailDTO>> map) throws Exception {
|
|
EsCountDTO esCountDTO, String firstName, Map<String, List<EsCountDetailDTO>> map) throws Exception {
|
|
|
|
+
|
|
|
|
+ if (StringUtils.isNotEmpty(condition)) {
|
|
|
|
+ if (searchCondition != null && !"".equals(searchCondition.trim())) {
|
|
|
|
+ searchCondition = condition + " AND " + searchCondition;
|
|
|
|
+ } else {
|
|
|
|
+ searchCondition = condition;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
if (!CollectionUtils.isEmpty(customFields)) {
|
|
if (!CollectionUtils.isEmpty(customFields)) {
|
|
searchCondition = esService.parseCustomField(customFields);
|
|
searchCondition = esService.parseCustomField(customFields);
|
|
}
|
|
}
|
|
@@ -164,7 +173,7 @@ public class EsCountService {
|
|
} else {
|
|
} else {
|
|
filtersBuckets.forEach(filtersBucket -> {
|
|
filtersBuckets.forEach(filtersBucket -> {
|
|
Aggregate filtersAgg = filtersBucket.aggregations().get("filters_agg");
|
|
Aggregate filtersAgg = filtersBucket.aggregations().get("filters_agg");
|
|
- this.getDateAnalysisDTOS(filtersAgg, field, topN, detailDTOS, esCountDTO, firstName, map,values);
|
|
|
|
|
|
+ this.getDateAnalysisDTOS(filtersAgg, field, topN, detailDTOS, esCountDTO, firstName, map, values);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
} else if (nestedList.contains(field)) {
|
|
} else if (nestedList.contains(field)) {
|
|
@@ -187,7 +196,7 @@ public class EsCountService {
|
|
filtersBuckets.forEach(filtersBucket -> {
|
|
filtersBuckets.forEach(filtersBucket -> {
|
|
Aggregate filtersAgg = filtersBucket.aggregations().get("filters_agg");
|
|
Aggregate filtersAgg = filtersBucket.aggregations().get("filters_agg");
|
|
this.getChildAnalysisDTOS(filtersAgg, field, finalFieldType1, topN,
|
|
this.getChildAnalysisDTOS(filtersAgg, field, finalFieldType1, topN,
|
|
- detailDTOS, esCountDTO, firstName, map,values);
|
|
|
|
|
|
+ detailDTOS, esCountDTO, firstName, map, values);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
} else if (numberList.contains(field)) {
|
|
} else if (numberList.contains(field)) {
|
|
@@ -196,13 +205,13 @@ public class EsCountService {
|
|
} else {
|
|
} else {
|
|
filtersBuckets.forEach(filtersBucket -> {
|
|
filtersBuckets.forEach(filtersBucket -> {
|
|
Aggregate filtersAgg = filtersBucket.aggregations().get("filters_agg");
|
|
Aggregate filtersAgg = filtersBucket.aggregations().get("filters_agg");
|
|
- this.getNumberAnalysisDTOS(filtersAgg, field, topN, detailDTOS, esCountDTO, firstName, map,values);
|
|
|
|
|
|
+ this.getNumberAnalysisDTOS(filtersAgg, field, topN, detailDTOS, esCountDTO, firstName, map, values);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
filtersBuckets.forEach(filtersBucket -> {
|
|
filtersBuckets.forEach(filtersBucket -> {
|
|
Aggregate filtersAgg = filtersBucket.aggregations().get("filters_agg");
|
|
Aggregate filtersAgg = filtersBucket.aggregations().get("filters_agg");
|
|
- this.getTermCountDTOS(filtersAgg, field, topN, detailDTOS, esCountDTO, firstName, map,values);
|
|
|
|
|
|
+ this.getTermCountDTOS(filtersAgg, field, topN, detailDTOS, esCountDTO, firstName, map, values);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -213,7 +222,7 @@ public class EsCountService {
|
|
if (CollectionUtils.isEmpty(values)) {
|
|
if (CollectionUtils.isEmpty(values)) {
|
|
this.getDateCountDTOS(agg, field, topN, format, detailDTOS, esCountDTO);
|
|
this.getDateCountDTOS(agg, field, topN, format, detailDTOS, esCountDTO);
|
|
} else {
|
|
} else {
|
|
- this.getDateAnalysisDTOS(agg, field, topN, detailDTOS, esCountDTO, firstName, map,values);
|
|
|
|
|
|
+ this.getDateAnalysisDTOS(agg, field, topN, detailDTOS, esCountDTO, firstName, map, values);
|
|
}
|
|
}
|
|
} else if (nestedList.contains(field)) {
|
|
} else if (nestedList.contains(field)) {
|
|
this.getNestedCountDTOS(agg, field, topN, detailDTOS, esCountDTO, firstName, map, values);
|
|
this.getNestedCountDTOS(agg, field, topN, detailDTOS, esCountDTO, firstName, map, values);
|
|
@@ -225,12 +234,12 @@ public class EsCountService {
|
|
this.getChildCountDTOS(agg, field, fieldType, topN, detailDTOS, esCountDTO);
|
|
this.getChildCountDTOS(agg, field, fieldType, topN, detailDTOS, esCountDTO);
|
|
} else {
|
|
} else {
|
|
this.getChildAnalysisDTOS(agg, field, fieldType, topN,
|
|
this.getChildAnalysisDTOS(agg, field, fieldType, topN,
|
|
- detailDTOS, esCountDTO, firstName, map,values);
|
|
|
|
|
|
+ detailDTOS, esCountDTO, firstName, map, values);
|
|
}
|
|
}
|
|
} else if (numberList.contains(field)) {
|
|
} else if (numberList.contains(field)) {
|
|
- this.getNumberAnalysisDTOS(agg, field, topN, detailDTOS, esCountDTO, firstName, map,values);
|
|
|
|
|
|
+ this.getNumberAnalysisDTOS(agg, field, topN, detailDTOS, esCountDTO, firstName, map, values);
|
|
} else {
|
|
} else {
|
|
- this.getTermCountDTOS(agg, field, topN, detailDTOS, esCountDTO, firstName, map,values);
|
|
|
|
|
|
+ this.getTermCountDTOS(agg, field, topN, detailDTOS, esCountDTO, firstName, map, values);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
esCountDTO.setCondition(searchCondition);
|
|
esCountDTO.setCondition(searchCondition);
|