|
@@ -571,6 +571,7 @@ public class EsCountService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //统计未选择数量
|
|
public GetUnselectedDTO getUnselectedCustomNum1(Integer projectId, String fieldId, Query query) throws Exception {
|
|
public GetUnselectedDTO getUnselectedCustomNum1(Integer projectId, String fieldId, Query query) throws Exception {
|
|
GetUnselectedDTO dto = new GetUnselectedDTO();
|
|
GetUnselectedDTO dto = new GetUnselectedDTO();
|
|
SearchRequest.Builder builder = new SearchRequest.Builder();
|
|
SearchRequest.Builder builder = new SearchRequest.Builder();
|
|
@@ -586,42 +587,12 @@ public class EsCountService {
|
|
list.add(id);
|
|
list.add(id);
|
|
}
|
|
}
|
|
if (!CollectionUtils.isEmpty(list)) {
|
|
if (!CollectionUtils.isEmpty(list)) {
|
|
- dto = this.ifExistChild1(list, projectId,fieldId);
|
|
|
|
|
|
+ dto = this.ifExistChild(list, projectId,fieldId);
|
|
}
|
|
}
|
|
return dto;
|
|
return dto;
|
|
}
|
|
}
|
|
|
|
|
|
- public GetUnselectedDTO ifExistChild1(List<String> list, Integer projectId,String fieldId) throws IOException {
|
|
|
|
- GetUnselectedDTO dto = new GetUnselectedDTO();
|
|
|
|
- List<String> existChildIds = new ArrayList<>();
|
|
|
|
- List<String> beinglessChildIds = new ArrayList<>();
|
|
|
|
- int count = 0;
|
|
|
|
- for (String id : list) {
|
|
|
|
- SearchRequest.Builder builder = new SearchRequest.Builder();
|
|
|
|
- //设置查询索引
|
|
|
|
- builder.index("patent");
|
|
|
|
- Query q1 = QueryBuilders.parentId(i -> i.type("project_customfield").id(id));
|
|
|
|
- Query q2 = QueryBuilders.exists(i -> i.field("custom_field"));
|
|
|
|
- Query q3 = QueryBuilders.term(i -> i.field("custom_field.if_new").value(1));
|
|
|
|
- Query q4 = QueryBuilders.term(i -> i.field("custom_field.project_id").value(projectId));
|
|
|
|
- Query q5 = QueryBuilders.term(i -> i.field("custom_field.field").value(fieldId));
|
|
|
|
- Query bool = QueryBuilders.bool(i -> i.must(q1, q2, q3,q4,q5));
|
|
|
|
- builder.query(bool);
|
|
|
|
- SearchResponse<Patent> response = client.search(builder.build(), Patent.class);
|
|
|
|
- Long total = response.hits().total().value();
|
|
|
|
- if (total > 0) {
|
|
|
|
- existChildIds.add(id);
|
|
|
|
- } else {
|
|
|
|
- beinglessChildIds.add(id);
|
|
|
|
- count++;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- dto.setNumber(count);
|
|
|
|
- dto.setExistChildIds(existChildIds);
|
|
|
|
- dto.setBeinglessChildIds(beinglessChildIds);
|
|
|
|
- return dto;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ //根据未选择查询专利
|
|
public GetUnselectedDTO getUnselectedCustomNum(Integer projectId,String fieldId) throws Exception {
|
|
public GetUnselectedDTO getUnselectedCustomNum(Integer projectId,String fieldId) throws Exception {
|
|
GetUnselectedDTO dto = new GetUnselectedDTO();
|
|
GetUnselectedDTO dto = new GetUnselectedDTO();
|
|
SearchRequest.Builder builder = new SearchRequest.Builder();
|
|
SearchRequest.Builder builder = new SearchRequest.Builder();
|
|
@@ -645,6 +616,7 @@ public class EsCountService {
|
|
return dto;
|
|
return dto;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //查询到对应的ids
|
|
public GetUnselectedDTO ifExistChild(List<String> list, Integer projectId,String fieldId) throws IOException {
|
|
public GetUnselectedDTO ifExistChild(List<String> list, Integer projectId,String fieldId) throws IOException {
|
|
GetUnselectedDTO dto = new GetUnselectedDTO();
|
|
GetUnselectedDTO dto = new GetUnselectedDTO();
|
|
List<String> existChildIds = new ArrayList<>();
|
|
List<String> existChildIds = new ArrayList<>();
|