|
@@ -181,7 +181,7 @@ public class EsService {
|
|
//1. 解析检索条件
|
|
//1. 解析检索条件
|
|
treeNode tree = expressManager.getInstance().Parse(condition, false);
|
|
treeNode tree = expressManager.getInstance().Parse(condition, false);
|
|
//3. 从es中检索数据
|
|
//3. 从es中检索数据
|
|
- Query q = formatQueryService.EsQueryToQuery((operateNode) tree, "patent",projectId);
|
|
|
|
|
|
+ Query q = formatQueryService.EsQueryToQuery((operateNode) tree, "patent", projectId);
|
|
builder.query(q);
|
|
builder.query(q);
|
|
//判断同族分组
|
|
//判断同族分组
|
|
String str = "";
|
|
String str = "";
|
|
@@ -261,7 +261,7 @@ public class EsService {
|
|
List<StringTermsBucket> termsBuckets = agg.sterms().buckets().array();
|
|
List<StringTermsBucket> termsBuckets = agg.sterms().buckets().array();
|
|
for (StringTermsBucket termsBucket : termsBuckets) {
|
|
for (StringTermsBucket termsBucket : termsBuckets) {
|
|
String key = termsBucket.key().stringValue();
|
|
String key = termsBucket.key().stringValue();
|
|
- PatentColumnDTO columnDTO = this.getPatentColumnDTO(key, projectId,esField);
|
|
|
|
|
|
+ PatentColumnDTO columnDTO = this.getPatentColumnDTO(key, projectId, esField);
|
|
list.add(columnDTO);
|
|
list.add(columnDTO);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -344,7 +344,7 @@ public class EsService {
|
|
}
|
|
}
|
|
|
|
|
|
//拼接专题库id或其他id条件
|
|
//拼接专题库id或其他id条件
|
|
- public String appendIdsCondition(String searchCondition,Integer taskId,String productFrom,Integer projectId,Integer productId) {
|
|
|
|
|
|
+ public String appendIdsCondition(String searchCondition, Integer taskId, String productFrom, Integer projectId, Integer productId) {
|
|
String condition = "";
|
|
String condition = "";
|
|
if (taskId != null) {
|
|
if (taskId != null) {
|
|
if (searchCondition != null && !"".equals(searchCondition.trim())) {
|
|
if (searchCondition != null && !"".equals(searchCondition.trim())) {
|
|
@@ -546,10 +546,8 @@ public class EsService {
|
|
Query q1 = QueryBuilders.hasParent(i -> i.parentType("patent").query(j -> j.ids(IdsQuery.of(k -> k.values(parentId)))));
|
|
Query q1 = QueryBuilders.hasParent(i -> i.parentType("patent").query(j -> j.ids(IdsQuery.of(k -> k.values(parentId)))));
|
|
Query q2 = QueryBuilders.exists(i -> i.field("custom_field"));
|
|
Query q2 = QueryBuilders.exists(i -> i.field("custom_field"));
|
|
Query q3 = QueryBuilders.term(i -> i.field("custom_field.project_id").value(projectId));
|
|
Query q3 = QueryBuilders.term(i -> i.field("custom_field.project_id").value(projectId));
|
|
-
|
|
|
|
Query q4 = QueryBuilders.term(i -> i.field("custom_field.field").value(fieldId));
|
|
Query q4 = QueryBuilders.term(i -> i.field("custom_field.field").value(fieldId));
|
|
- Query finalQ = q3;
|
|
|
|
- Query bool = QueryBuilders.bool(i -> i.must(q1, q2, finalQ, q4));
|
|
|
|
|
|
+ Query bool = QueryBuilders.bool(i -> i.must(q1, q2, q3, q4));
|
|
builder.query(bool);
|
|
builder.query(bool);
|
|
|
|
|
|
List<SortOptions> optionsList = new ArrayList<>();
|
|
List<SortOptions> optionsList = new ArrayList<>();
|
|
@@ -639,7 +637,7 @@ public class EsService {
|
|
String dateStr = "\'" + s + "\'";
|
|
String dateStr = "\'" + s + "\'";
|
|
String projectId = "ctx._source.custom_field.project_id = " + customField.getProjectId() + ";";
|
|
String projectId = "ctx._source.custom_field.project_id = " + customField.getProjectId() + ";";
|
|
String taskId = "ctx._source.custom_field.task_id = " + customField.getTaskId() + ";";
|
|
String taskId = "ctx._source.custom_field.task_id = " + customField.getTaskId() + ";";
|
|
- String ifNew = "ctx._source.custom_field.if_new = " + 1+ ";";
|
|
|
|
|
|
+ String ifNew = "ctx._source.custom_field.if_new = " + 1 + ";";
|
|
String field = "ctx._source.custom_field.field=" + customField.getField() + ";";
|
|
String field = "ctx._source.custom_field.field=" + customField.getField() + ";";
|
|
String fieldType = "ctx._source.custom_field.field_type = " + customField.getFieldType() + ";";
|
|
String fieldType = "ctx._source.custom_field.field_type = " + customField.getFieldType() + ";";
|
|
String personId = "ctx._source.custom_field.person_id = " + customField.getPersonId() + ";";
|
|
String personId = "ctx._source.custom_field.person_id = " + customField.getPersonId() + ";";
|
|
@@ -647,11 +645,10 @@ public class EsService {
|
|
String fieldValue = "ctx._source.custom_field.field_value = " + valueField + ";";
|
|
String fieldValue = "ctx._source.custom_field.field_value = " + valueField + ";";
|
|
String statsValue = "ctx._source.custom_field.stats_value = " + valueStats;
|
|
String statsValue = "ctx._source.custom_field.stats_value = " + valueStats;
|
|
|
|
|
|
- String source = projectId + taskId + field + fieldType + personId + createTime + fieldValue + statsValue;
|
|
|
|
|
|
+ String source = projectId + taskId + ifNew + field + fieldType + personId + createTime + fieldValue + statsValue;
|
|
InlineScript inlineScript = InlineScript.of(i -> i.lang("painless").source(source));
|
|
InlineScript inlineScript = InlineScript.of(i -> i.lang("painless").source(source));
|
|
Script script = Script.of(i -> i.inline(inlineScript));
|
|
Script script = Script.of(i -> i.inline(inlineScript));
|
|
Query query = QueryBuilders.term(i -> i.field("_id").value(id));
|
|
Query query = QueryBuilders.term(i -> i.field("_id").value(id));
|
|
- //.waitForActiveShards(WaitForActiveShards.of(t -> t.count(1)))
|
|
|
|
UpdateByQueryRequest request = UpdateByQueryRequest.of(i -> i.index("patent").script(script).refresh(true).query(query));
|
|
UpdateByQueryRequest request = UpdateByQueryRequest.of(i -> i.index("patent").script(script).refresh(true).query(query));
|
|
try {
|
|
try {
|
|
client.updateByQuery(request);
|
|
client.updateByQuery(request);
|
|
@@ -1166,28 +1163,28 @@ public class EsService {
|
|
legalEvents.add(item.source());
|
|
legalEvents.add(item.source());
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- if(!cnLegalApiStr.contains("408")) {
|
|
|
|
- List<ChinaLeagalStatus> chinaLeagalStatuses = JSON.parseArray(cnLegalApiStr, ChinaLeagalStatus.class);
|
|
|
|
- chinaLeagalStatuses.forEach(item -> {
|
|
|
|
- LegalEvent tem = legalEvents.stream().filter(em -> em.getEventDate() != null && em.getEventDate().compareTo(item.getLegalDate()) == 0).findFirst().orElse(null);
|
|
|
|
- if (tem == null) {
|
|
|
|
- LegalEvent legalEvent1 = new LegalEvent();
|
|
|
|
- legalEvent1.setEventDate(item.getLegalDate());
|
|
|
|
- legalEvent1.setCode(item.getLegalCode());
|
|
|
|
- legalEvent1.setAppNo(starPatentVO.getApplicationNo());
|
|
|
|
- legalEvent1.setGrantNo(starPatentVO.getPublicAccreditNo());
|
|
|
|
- legalEvent1.setPublicNo(starPatentVO.getPublicNo());
|
|
|
|
- legalEvent1.setDescription(item.getLegalStatusInfo());
|
|
|
|
- legalEvent1.setName(item.getLegalStatus());
|
|
|
|
- try {
|
|
|
|
- String reId = this.addLegalEvent(legalEvent1);
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- throw new XiaoShiException(e.getMessage());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ if (!cnLegalApiStr.contains("408")) {
|
|
|
|
+ List<ChinaLeagalStatus> chinaLeagalStatuses = JSON.parseArray(cnLegalApiStr, ChinaLeagalStatus.class);
|
|
|
|
+ chinaLeagalStatuses.forEach(item -> {
|
|
|
|
+ LegalEvent tem = legalEvents.stream().filter(em -> em.getEventDate() != null && em.getEventDate().compareTo(item.getLegalDate()) == 0).findFirst().orElse(null);
|
|
|
|
+ if (tem == null) {
|
|
|
|
+ LegalEvent legalEvent1 = new LegalEvent();
|
|
|
|
+ legalEvent1.setEventDate(item.getLegalDate());
|
|
|
|
+ legalEvent1.setCode(item.getLegalCode());
|
|
|
|
+ legalEvent1.setAppNo(starPatentVO.getApplicationNo());
|
|
|
|
+ legalEvent1.setGrantNo(starPatentVO.getPublicAccreditNo());
|
|
|
|
+ legalEvent1.setPublicNo(starPatentVO.getPublicNo());
|
|
|
|
+ legalEvent1.setDescription(item.getLegalStatusInfo());
|
|
|
|
+ legalEvent1.setName(item.getLegalStatus());
|
|
|
|
+ try {
|
|
|
|
+ String reId = this.addLegalEvent(legalEvent1);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ throw new XiaoShiException(e.getMessage());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|
|
return "";
|
|
return "";
|
|
@@ -1222,7 +1219,7 @@ public class EsService {
|
|
Patent esMess = hit.source();
|
|
Patent esMess = hit.source();
|
|
if (esMess != null) {
|
|
if (esMess != null) {
|
|
dto.setClaimContent(esMess.getClaim());
|
|
dto.setClaimContent(esMess.getClaim());
|
|
- dto.setClaim(esMess.getClaim().get(0).getTextContent());
|
|
|
|
|
|
+ dto.setClaim(esMess.getClaim().get(0).getTextContent());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return dto;
|
|
return dto;
|