|
@@ -105,7 +105,11 @@ public class EsPatentService {
|
|
|
|
|
|
//通用返回申请人、权利人、发明人
|
|
//通用返回申请人、权利人、发明人
|
|
public List<String> loadName(List<PatentPerson> list) {
|
|
public List<String> loadName(List<PatentPerson> list) {
|
|
- return list.stream().map(PatentPerson::getName).collect(Collectors.toList());
|
|
|
|
|
|
+ List<String> collect = new ArrayList<>();
|
|
|
|
+ if (!CollectionUtils.isEmpty(list)) {
|
|
|
|
+ collect = list.stream().map(PatentPerson::getName).collect(Collectors.toList());
|
|
|
|
+ }
|
|
|
|
+ return collect;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -117,10 +121,11 @@ public class EsPatentService {
|
|
*/
|
|
*/
|
|
public List<PatentKinDTO> selectKinByPatentNo(PatentKinVO vo) throws IOException {
|
|
public List<PatentKinDTO> selectKinByPatentNo(PatentKinVO vo) throws IOException {
|
|
//1.根据专利号查询出同族
|
|
//1.根据专利号查询出同族
|
|
- String no = vo.getPatentNo();
|
|
|
|
|
|
+ String no = vo.getNo();
|
|
Integer pageNum = vo.getPageNum();
|
|
Integer pageNum = vo.getPageNum();
|
|
Integer pageSize = vo.getPageSize();
|
|
Integer pageSize = vo.getPageSize();
|
|
String type = vo.getType();
|
|
String type = vo.getType();
|
|
|
|
+ String patentNo = vo.getPatentNo();
|
|
SearchRequest.Builder builder = new SearchRequest.Builder();
|
|
SearchRequest.Builder builder = new SearchRequest.Builder();
|
|
//设置查询索引
|
|
//设置查询索引
|
|
builder.index("patent_family");
|
|
builder.index("patent_family");
|
|
@@ -150,7 +155,7 @@ public class EsPatentService {
|
|
kinDetailVO.setAppNo(familyPatent.getAppNo());
|
|
kinDetailVO.setAppNo(familyPatent.getAppNo());
|
|
kinDetailVO.setPublicNo(familyPatent.getPublicNo());
|
|
kinDetailVO.setPublicNo(familyPatent.getPublicNo());
|
|
kinDetailVO.setGrantNo(familyPatent.getGrantNo());
|
|
kinDetailVO.setGrantNo(familyPatent.getGrantNo());
|
|
- PatentKinDTO kinDTO = this.selectPatentKindDetail(kinDetailVO)
|
|
|
|
|
|
+ PatentKinDTO kinDTO = this.selectPatentKindDetail(kinDetailVO,patentNo)
|
|
.stream().findFirst().orElse(null);
|
|
.stream().findFirst().orElse(null);
|
|
if (kinDTO != null) {
|
|
if (kinDTO != null) {
|
|
kinDTOS.add(kinDTO);
|
|
kinDTOS.add(kinDTO);
|
|
@@ -162,7 +167,7 @@ public class EsPatentService {
|
|
return kinDTOS;
|
|
return kinDTOS;
|
|
}
|
|
}
|
|
|
|
|
|
- public List<PatentKinDTO> selectPatentKindDetail(PatentKinDetailVO vo) throws IOException {
|
|
|
|
|
|
+ public List<PatentKinDTO> selectPatentKindDetail(PatentKinDetailVO vo, String patentNo) throws IOException {
|
|
List<PatentKinDTO> list = new ArrayList<>();
|
|
List<PatentKinDTO> list = new ArrayList<>();
|
|
SearchRequest.Builder builder = new SearchRequest.Builder();
|
|
SearchRequest.Builder builder = new SearchRequest.Builder();
|
|
//设置查询索引
|
|
//设置查询索引
|
|
@@ -173,7 +178,15 @@ public class EsPatentService {
|
|
Query q2 = QueryBuilders.term(t -> t.field("patent_no.keyword").value(vo.getPublicNo()));
|
|
Query q2 = QueryBuilders.term(t -> t.field("patent_no.keyword").value(vo.getPublicNo()));
|
|
//授权号
|
|
//授权号
|
|
// Query q3 = QueryBuilders.term(t -> t.field("patent_no.keyword").value(vo.getGrantNo()));
|
|
// Query q3 = QueryBuilders.term(t -> t.field("patent_no.keyword").value(vo.getGrantNo()));
|
|
- Query bool = QueryBuilders.bool(i -> i.should(q1, q2));
|
|
|
|
|
|
+ Query bool = null;
|
|
|
|
+ if (StringUtils.isNotEmpty(patentNo)) {
|
|
|
|
+ String str = "*";
|
|
|
|
+ String s = str.concat(patentNo).concat("*");
|
|
|
|
+ Query query = QueryBuilders.wildcard(i -> i.field(patentNo).value(s));
|
|
|
|
+ bool = QueryBuilders.bool(i -> i.should(q1, q2).must(query));
|
|
|
|
+ } else {
|
|
|
|
+ bool = QueryBuilders.bool(i -> i.should(q1, q2));
|
|
|
|
+ }
|
|
builder.query(bool);
|
|
builder.query(bool);
|
|
SearchResponse<Patent> response = client.search(builder.build(), Patent.class);
|
|
SearchResponse<Patent> response = client.search(builder.build(), Patent.class);
|
|
List<Hit<Patent>> hits = response.hits().hits();
|
|
List<Hit<Patent>> hits = response.hits().hits();
|
|
@@ -189,6 +202,7 @@ public class EsPatentService {
|
|
kinDTO.setAbstractStr(patent.getAbstractStr());
|
|
kinDTO.setAbstractStr(patent.getAbstractStr());
|
|
kinDTO.setApplicant(this.loadName(patent.getApplicant()));
|
|
kinDTO.setApplicant(this.loadName(patent.getApplicant()));
|
|
kinDTO.setRightHolder(this.loadName(patent.getRightHolder()));
|
|
kinDTO.setRightHolder(this.loadName(patent.getRightHolder()));
|
|
|
|
+ kinDTO.setPictureGuid(FormatUtil.getPictureFormat(kinDTO.getAppNo()));
|
|
list.add(kinDTO);
|
|
list.add(kinDTO);
|
|
}
|
|
}
|
|
}
|
|
}
|