|
@@ -14,6 +14,7 @@ import cn.cslg.pas.domain.es.PatentJoin;
|
|
import cn.cslg.pas.exception.XiaoShiException;
|
|
import cn.cslg.pas.exception.XiaoShiException;
|
|
import cn.cslg.pas.service.permissions.PermissionService;
|
|
import cn.cslg.pas.service.permissions.PermissionService;
|
|
import co.elastic.clients.elasticsearch.ElasticsearchClient;
|
|
import co.elastic.clients.elasticsearch.ElasticsearchClient;
|
|
|
|
+import co.elastic.clients.elasticsearch._types.aggregations.AggregationBuilders;
|
|
import co.elastic.clients.elasticsearch._types.query_dsl.Query;
|
|
import co.elastic.clients.elasticsearch._types.query_dsl.Query;
|
|
import co.elastic.clients.elasticsearch._types.query_dsl.QueryBuilders;
|
|
import co.elastic.clients.elasticsearch._types.query_dsl.QueryBuilders;
|
|
import co.elastic.clients.elasticsearch.core.*;
|
|
import co.elastic.clients.elasticsearch.core.*;
|
|
@@ -47,19 +48,7 @@ public class EsScratchWordsService {
|
|
if (patentNo == null) {
|
|
if (patentNo == null) {
|
|
throw new XiaoShiException("请输入专利号");
|
|
throw new XiaoShiException("请输入专利号");
|
|
}
|
|
}
|
|
- //根据专利号查询专利
|
|
|
|
- String patentId = null;
|
|
|
|
- try {
|
|
|
|
- PatentWithIdVO patentWithIdVO = esService.getIdByPatentNo(patentNo);
|
|
|
|
- if (patentWithIdVO != null) {
|
|
|
|
- patentId = patentWithIdVO.getId();
|
|
|
|
- }
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- throw new XiaoShiException("未获取到专利");
|
|
|
|
- }
|
|
|
|
- if (patentId == null) {
|
|
|
|
- throw new XiaoShiException("未获取到专利");
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
Marking marking = new Marking();
|
|
Marking marking = new Marking();
|
|
BeanUtils.copyProperties(scratchWords, marking);
|
|
BeanUtils.copyProperties(scratchWords, marking);
|
|
|
|
|
|
@@ -120,11 +109,26 @@ public class EsScratchWordsService {
|
|
//公开并且全部范围
|
|
//公开并且全部范围
|
|
Query bool1 = QueryBuilders.bool(i -> i.must(q1, q5, q4));
|
|
Query bool1 = QueryBuilders.bool(i -> i.must(q1, q5, q4));
|
|
// 公开并且所在地
|
|
// 公开并且所在地
|
|
- Query bool2 = QueryBuilders.bool(i -> i.must(q1, q6, q7, q4));
|
|
|
|
|
|
+ List<Query> bool2Querys=new ArrayList<>();
|
|
|
|
+ bool2Querys.add(q1);
|
|
|
|
+ bool2Querys.add(q6);
|
|
|
|
+ if(projectId!=null){
|
|
|
|
+ bool2Querys.add(q7);
|
|
|
|
+ }
|
|
|
|
+ bool2Querys.add(q4);
|
|
|
|
+ Query bool2 = QueryBuilders.bool(i -> i.must(bool2Querys));
|
|
|
|
+
|
|
//不公开并且全部范围
|
|
//不公开并且全部范围
|
|
Query bool3 = QueryBuilders.bool(i -> i.must(q2, q5, q3));
|
|
Query bool3 = QueryBuilders.bool(i -> i.must(q2, q5, q3));
|
|
//不公开并且所在地
|
|
//不公开并且所在地
|
|
- Query bool4 = QueryBuilders.bool(i -> i.must(q2, q6, q3, q7));
|
|
|
|
|
|
+ List<Query> bool3Querys=new ArrayList<>();
|
|
|
|
+ bool3Querys.add(q2);
|
|
|
|
+ bool3Querys.add(q6);
|
|
|
|
+ if(projectId!=null){
|
|
|
|
+ bool3Querys.add(q7);
|
|
|
|
+ }
|
|
|
|
+ bool3Querys.add(q3);
|
|
|
|
+ Query bool4 = QueryBuilders.bool(i -> i.must(bool3Querys));
|
|
Query riBool = QueryBuilders.bool(i -> i.should(bool1, bool2, bool3, bool4));
|
|
Query riBool = QueryBuilders.bool(i -> i.should(bool1, bool2, bool3, bool4));
|
|
List<Query> queries = new ArrayList<>();
|
|
List<Query> queries = new ArrayList<>();
|
|
queries.add(riBool);
|
|
queries.add(riBool);
|
|
@@ -147,9 +151,11 @@ public class EsScratchWordsService {
|
|
Query searchBool = QueryBuilders.bool(i -> i.must(queries));
|
|
Query searchBool = QueryBuilders.bool(i -> i.must(queries));
|
|
SearchRequest.Builder builder = new SearchRequest.Builder();
|
|
SearchRequest.Builder builder = new SearchRequest.Builder();
|
|
builder.index("patent_marking");
|
|
builder.index("patent_marking");
|
|
- if (current != null && size != null && current > 0 && size > 0) {
|
|
|
|
- builder.from((current.intValue() - 1) * size.intValue()).size(size.intValue());
|
|
|
|
|
|
+ if (current == null || size == null || current <0 || size <0) {
|
|
|
|
+ current =Long.parseLong(1+"");
|
|
|
|
+ size=Long.parseLong(1000+"");
|
|
}
|
|
}
|
|
|
|
+ builder.from((current.intValue() - 1) * size.intValue()).size(size.intValue());
|
|
builder.query(searchBool);
|
|
builder.query(searchBool);
|
|
|
|
|
|
long total = 0;
|
|
long total = 0;
|
|
@@ -258,4 +264,10 @@ public class EsScratchWordsService {
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public void GroupScratchWord(){
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|