|
@@ -123,9 +123,6 @@ public class EsCountService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// if (!CollectionUtils.isEmpty(customFields)) {
|
|
|
-// searchCondition = esService.parseCustomField(customFields,projectId,taskId);
|
|
|
-// }
|
|
|
if (!CollectionUtils.isEmpty(customFields)) {
|
|
|
String customFieldCondition = esService.parseCustomField(customFields, projectId, taskId);
|
|
|
if (StringUtils.isNotEmpty(searchCondition)) {
|
|
@@ -151,6 +148,7 @@ public class EsCountService {
|
|
|
|
|
|
for (EsCountVO countVO : countVOS) {
|
|
|
String field = countVO.getField();
|
|
|
+ String fieldId = countVO.getFieldId();
|
|
|
Integer topN = countVO.getTopN();
|
|
|
String valueOne = countVO.getValueOne();
|
|
|
String valueTwo = countVO.getValueTwo();
|
|
@@ -196,7 +194,7 @@ public class EsCountService {
|
|
|
}
|
|
|
} else if (childList.contains(field)) {
|
|
|
if (CollectionUtils.isEmpty(values)) {
|
|
|
- this.getChildCountDTOS(agg, field, fieldType, topN, detailDTOS, esCountDTO,projectId,taskId,query);
|
|
|
+ this.getChildCountDTOS(agg, field, fieldType, topN, detailDTOS, esCountDTO,projectId,fieldId,query);
|
|
|
} else {
|
|
|
this.getChildAnalysisDTOS(agg, field, fieldType, topN,
|
|
|
detailDTOS, esCountDTO, firstName, map, values);
|
|
@@ -524,7 +522,7 @@ public class EsCountService {
|
|
|
* @param detailDTOS
|
|
|
*/
|
|
|
public void getChildCountDTOS(Aggregate agg, String field, Integer fieldType, Integer topN,
|
|
|
- List<EsCountDetailDTO> detailDTOS, EsCountDTO esCountDTO,Integer projectId, Integer taskId,Query query) throws Exception {
|
|
|
+ List<EsCountDetailDTO> detailDTOS, EsCountDTO esCountDTO,Integer projectId, String fieldId,Query query) throws Exception {
|
|
|
esCountDTO.setAllNumber(agg.children().docCount());
|
|
|
Aggregate childAgg = agg.children().aggregations().get("childAgg");
|
|
|
List<StringTermsBucket> list = childAgg.sterms().buckets().array();
|
|
@@ -546,28 +544,19 @@ public class EsCountService {
|
|
|
});
|
|
|
});
|
|
|
if (fieldType == null || fieldType != 6) {
|
|
|
- if (CollectionUtils.isEmpty(detailDTOS)) {
|
|
|
- EsCountDetailDTO detail = new EsCountDetailDTO();
|
|
|
- detail.setField(field);
|
|
|
- detail.setName("未选择");
|
|
|
- detail.setNumber(0l);
|
|
|
- detail.setTopN(topN);
|
|
|
- if (!detailDTOS.contains(detail)) {
|
|
|
- detailDTOS.add(detail);
|
|
|
- }
|
|
|
- } else {
|
|
|
- String fieldId = detailDTOS.get(0).getFieldId();
|
|
|
- GetUnselectedDTO unselectedDTO = this.getUnselectedCustomNum1(projectId, fieldId, query);
|
|
|
- EsCountDetailDTO detail = new EsCountDetailDTO();
|
|
|
- detail.setField(field);
|
|
|
- detail.setName("未选择");
|
|
|
+ GetUnselectedDTO unselectedDTO = this.getUnselectedCustomNum1(projectId, fieldId, query);
|
|
|
+ EsCountDetailDTO detail = new EsCountDetailDTO();
|
|
|
+ detail.setField(field);
|
|
|
+ detail.setName("未选择");
|
|
|
+ if (unselectedDTO.getNumber() != null) {
|
|
|
detail.setNumber(unselectedDTO.getNumber().longValue());
|
|
|
- detail.setTopN(topN);
|
|
|
- if (!detailDTOS.contains(detail)) {
|
|
|
- detailDTOS.add(detail);
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ detail.setNumber(0L);
|
|
|
+ }
|
|
|
+ detail.setTopN(topN);
|
|
|
+ if (!detailDTOS.contains(detail)) {
|
|
|
+ detailDTOS.add(detail);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|