|
@@ -587,10 +587,13 @@ public class EsPatentService {
|
|
|
Long current = queryRequest.getCurrent();
|
|
|
Long size = queryRequest.getSize();
|
|
|
EsPatentCommonVO esPatentCommonVO = esService.tranPatentRequestToComVO(queryRequest);
|
|
|
-
|
|
|
+ esPatentCommonVO.setStartNum(current);
|
|
|
+ esPatentCommonVO.setEndNum(current+size);
|
|
|
+ esPatentCommonVO.setCurrent(null);
|
|
|
+ esPatentCommonVO.setSize(null);
|
|
|
+ SearchRequest.Builder builder = esService.getCommonPatent(esPatentCommonVO);
|
|
|
Records records = new Records();
|
|
|
if (esPatentCommonVO.getEsField() == null || esPatentCommonVO.getEsField().equals("")) {
|
|
|
- SearchRequest.Builder builder = esService.getCommonPatent(esPatentCommonVO);
|
|
|
SearchResponse<Patent> response = client.search(builder.build(), Patent.class);
|
|
|
List<Hit<Patent>> hits = response.hits().hits();
|
|
|
for (Hit<Patent> hit : hits) {
|
|
@@ -600,7 +603,6 @@ public class EsPatentService {
|
|
|
}
|
|
|
records.setTotal(response.hits().total().value());
|
|
|
} else {
|
|
|
- SearchRequest.Builder builder = esService.getCommonPatent(esPatentCommonVO);
|
|
|
SearchResponse<Patent> response = client.search(builder.build(), Patent.class);
|
|
|
Aggregate statsAgg = response.aggregations().get("statsBucket");
|
|
|
Long total = statsAgg.statsBucket().count();
|
|
@@ -749,8 +751,6 @@ public class EsPatentService {
|
|
|
Integer taskId = commonVO.getTaskId();
|
|
|
String searchCondition = commonVO.getSearchCondition();
|
|
|
String productFrom = commonVO.getProductFrom();
|
|
|
- List<String> isAdd = commonVO.getIsAdd();
|
|
|
- List<String> isDelete = commonVO.getIsDelete();
|
|
|
List<EsCustomFieldValueDTO> customFields = commonVO.getCustomFields();
|
|
|
if (!CollectionUtils.isEmpty(customFields)) {
|
|
|
String customFieldCondition = esService.parseCustomField(customFields, projectId, taskId);
|
|
@@ -765,14 +765,7 @@ public class EsPatentService {
|
|
|
treeNode tree = expressManager.getInstance().Parse(condition, false);
|
|
|
//3. 从es中检索数据
|
|
|
Query q = formatQueryService.EsQueryToQuery((operateNode) tree, "patent", projectId);
|
|
|
- Query reQuery = null;
|
|
|
- if (isDelete != null && isDelete.size() > 0) {
|
|
|
- List<Query> notInQuery = this.getNoNotInQuery(isDelete);
|
|
|
- reQuery = QueryBuilders.bool(i -> i.must(q).mustNot(notInQuery));
|
|
|
- } else {
|
|
|
- reQuery = QueryBuilders.bool(i -> i.must(q));
|
|
|
- }
|
|
|
- return reQuery;
|
|
|
+ return q;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -808,25 +801,23 @@ public class EsPatentService {
|
|
|
|
|
|
EsPatentCommonVO esPatentCommonVO = esService.tranPatentRequestToComVO(queryRequest);
|
|
|
esPatentCommonVO.setIsDelete(patentNos);
|
|
|
-
|
|
|
+ esPatentCommonVO.setStartNum(startNum);
|
|
|
+ esPatentCommonVO.setEndNum(endNum);
|
|
|
+ SearchRequest.Builder builder = esService.getCommonPatent(esPatentCommonVO);
|
|
|
if (esPatentCommonVO.getEsField() == null || esPatentCommonVO.getEsField().equals("")) {
|
|
|
- SearchRequest.Builder builder = esService.getCommonPatent(esPatentCommonVO);
|
|
|
- if (startNum > 0 && endNum > 0) {
|
|
|
- builder.from(startNum.intValue() - 1).size((endNum.intValue() - startNum.intValue()) + 1);
|
|
|
- }
|
|
|
+
|
|
|
SearchResponse<Patent> response = client.search(builder.build(), Patent.class);
|
|
|
List<Hit<Patent>> hits = response.hits().hits();
|
|
|
for (Hit<Patent> hit : hits) {
|
|
|
- PatentNoWithIdVO patentWithIdVO = new PatentNoWithIdVO();
|
|
|
- patentWithIdVO.setId(hit.id());
|
|
|
- patentWithIdVO.setPatentNo(hit.source().getPatentNo());
|
|
|
- patentWithIdVOS.add(patentWithIdVO);
|
|
|
+ if ((patentNos == null || patentNos.size() == 0) || (!patentNos.contains(hit.source().getPatentNo()))) {
|
|
|
+
|
|
|
+ PatentNoWithIdVO patentWithIdVO = new PatentNoWithIdVO();
|
|
|
+ patentWithIdVO.setId(hit.id());
|
|
|
+ patentWithIdVO.setPatentNo(hit.source().getPatentNo());
|
|
|
+ patentWithIdVOS.add(patentWithIdVO);
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
- SearchRequest.Builder builder = esService.getCommonPatent(esPatentCommonVO);
|
|
|
- if (startNum > 0 && endNum > 0) {
|
|
|
- builder.from(startNum.intValue() - 1).size((endNum.intValue() - startNum.intValue()) + 1);
|
|
|
- }
|
|
|
SearchResponse<Patent> response = client.search(builder.build(), Patent.class);
|
|
|
Aggregate agg = response.aggregations().get("Agg");
|
|
|
List<StringTermsBucket> termsBuckets = agg.sterms().buckets().array();
|
|
@@ -834,10 +825,12 @@ public class EsPatentService {
|
|
|
for (StringTermsBucket termsBucket : termsBuckets) {
|
|
|
String key = termsBucket.key().stringValue();
|
|
|
PatentWithIdVO patentWithIdVO = esService.getPatentColumnDTOByGroup2(key, esPatentCommonVO.getProjectId(), esPatentCommonVO.getEsField());
|
|
|
- PatentNoWithIdVO patentNoWithIdVO = new PatentNoWithIdVO();
|
|
|
- patentNoWithIdVO.setId(patentWithIdVO.getId());
|
|
|
- patentNoWithIdVO.setPatentNo(patentWithIdVO.getPatent().getPatentNo());
|
|
|
- patentWithIdVOS.add(patentNoWithIdVO);
|
|
|
+ if ((patentNos == null || patentNos.size() == 0) || (!patentNos.contains(patentWithIdVO.getPatent().getPatentNo()))) {
|
|
|
+ PatentNoWithIdVO patentNoWithIdVO = new PatentNoWithIdVO();
|
|
|
+ patentNoWithIdVO.setId(patentWithIdVO.getId());
|
|
|
+ patentNoWithIdVO.setPatentNo(patentWithIdVO.getPatent().getPatentNo());
|
|
|
+ patentWithIdVOS.add(patentNoWithIdVO);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return patentWithIdVOS;
|