|
@@ -441,8 +441,7 @@ public class EsService {
|
|
|
if (s.equals("未选择")) {
|
|
|
GetUnselectedDTO unselectedDTO = esCountService.getUnselectedCustomNum(projectId, taskId);
|
|
|
List<String> childIds = unselectedDTO.getBeinglessChildIds();
|
|
|
- List<String> nos = this.getPatentNos(childIds);
|
|
|
- String noCondition = this.appendPatentNo(nos);
|
|
|
+ String noCondition = this.appendIds(childIds);
|
|
|
builder.append(s).append(")").append(" ").append("or")
|
|
|
.append(" ").append("(").append(noCondition).append(")").append(")");
|
|
|
} else {
|
|
@@ -455,8 +454,7 @@ public class EsService {
|
|
|
if (value.equals("未选择")) {
|
|
|
GetUnselectedDTO unselectedDTO = esCountService.getUnselectedCustomNum(projectId, taskId);
|
|
|
List<String> childIds = unselectedDTO.getBeinglessChildIds();
|
|
|
- List<String> nos = this.getPatentNos(childIds);
|
|
|
- String noCondition = this.appendPatentNo(nos);
|
|
|
+ String noCondition = this.appendIds(childIds);
|
|
|
builder.append(value).append(" ").append("or").append(" ").append(noCondition).append(")");
|
|
|
} else {
|
|
|
builder.append(value).append(")");
|
|
@@ -468,9 +466,9 @@ public class EsService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //拼接专利号
|
|
|
- public String appendPatentNo(List<String> nos) {
|
|
|
- String str = "NO = ";
|
|
|
+ //拼接ids
|
|
|
+ public String appendIds(List<String> nos) {
|
|
|
+ String str = "ids = ";
|
|
|
if (nos.size() > 1) {
|
|
|
str = str + "(";
|
|
|
for (int i = 0; i < nos.size(); i++) {
|
|
@@ -1381,6 +1379,7 @@ public class EsService {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ //根据父id获取相应专利的专利号
|
|
|
public List<String> getPatentNos(List<String> ids) throws IOException {
|
|
|
SearchRequest.Builder builder = new SearchRequest.Builder();
|
|
|
//设置查询索引
|
|
@@ -1411,8 +1410,6 @@ public class EsService {
|
|
|
Integer number = this.getPatent(patentNo, projectId);
|
|
|
if (number < 1) {
|
|
|
throw new XiaoShiException("删除失败");
|
|
|
- } else {
|
|
|
- return false;
|
|
|
}
|
|
|
}
|
|
|
} else if (startNum >= 1 && endNum > 0) {
|
|
@@ -1421,8 +1418,6 @@ public class EsService {
|
|
|
Integer number = this.getPatent(patentNo, projectId);
|
|
|
if (number < 1) {
|
|
|
throw new XiaoShiException("删除失败");
|
|
|
- } else {
|
|
|
- return false;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1452,7 +1447,7 @@ public class EsService {
|
|
|
|
|
|
public Integer deleteByIds(List<String> ids) {
|
|
|
Query query = QueryBuilders.ids(n -> n.values(ids));
|
|
|
- DeleteByQueryRequest request = DeleteByQueryRequest.of(i -> i.index("patent").query(query));
|
|
|
+ DeleteByQueryRequest request = DeleteByQueryRequest.of(i -> i.index("patent").query(query).refresh(true));
|
|
|
try {
|
|
|
client.deleteByQuery(request);
|
|
|
return 1;
|