|
@@ -6,6 +6,7 @@ import cn.cslg.pas.common.dto.business.ContentDetailDTO;
|
|
|
import cn.cslg.pas.common.model.cronModel.Personnel;
|
|
|
import cn.cslg.pas.common.model.cronModel.PersonnelVO;
|
|
|
import cn.cslg.pas.common.model.cronModel.Records;
|
|
|
+import cn.cslg.pas.common.model.cronModel.SystemFile;
|
|
|
import cn.cslg.pas.common.model.request.MapRequest;
|
|
|
import cn.cslg.pas.common.model.request.OrderDTO;
|
|
|
import cn.cslg.pas.common.model.request.QueryRequest;
|
|
@@ -106,10 +107,10 @@ public class EsPatentService {
|
|
|
Patent esMess = hit.source();
|
|
|
BeanUtils.copyProperties(esMess, dto);
|
|
|
//格式化权利要求
|
|
|
- List<Text> claims =dto.getClaim();
|
|
|
- if(claims!=null&&claims.size()>0){
|
|
|
- claims.forEach(item->{
|
|
|
- item.setTextContent(PatentRightUtils.getFormatClaim(item.getTextContent(),item.getLanguage()));
|
|
|
+ List<Text> claims = dto.getClaim();
|
|
|
+ if (claims != null && claims.size() > 0) {
|
|
|
+ claims.forEach(item -> {
|
|
|
+ item.setTextContent(PatentRightUtils.getFormatClaim(item.getTextContent(), item.getLanguage()));
|
|
|
});
|
|
|
}
|
|
|
dto.setRightHolderAddr(esMess.getRightHolderAddr());
|
|
@@ -189,26 +190,39 @@ public class EsPatentService {
|
|
|
public List<InnerPatentPdfDTO> getTextPdf(String appNo) throws IOException {
|
|
|
List<InnerPatentPdfDTO> list = new ArrayList<>();
|
|
|
//公开说明书pdf
|
|
|
- String pdfFormat = FormatUtil.getPDFFormat(appNo, 0);
|
|
|
- if (StringUtils.isNotEmpty(pdfFormat)) {
|
|
|
+ String pdfFormat1 = FormatUtil.getPDFFormat(appNo, 0);
|
|
|
+
|
|
|
+ //授权说明书pdf
|
|
|
+ String pdfFormat2 = FormatUtil.getPDFFormat(appNo, 1);
|
|
|
+
|
|
|
+ //查询文件是否存在
|
|
|
+ List<SystemFile> systemFiles = new ArrayList<>();
|
|
|
+ try {
|
|
|
+ String res = fileManagerService.getSystemFileFromFMS(Arrays.asList(pdfFormat1, pdfFormat2));
|
|
|
+ systemFiles = com.alibaba.fastjson.JSONObject.parseArray(res, SystemFile.class);
|
|
|
+ } catch (Exception e) {
|
|
|
+
|
|
|
+ }
|
|
|
+ SystemFile systemFile1 = systemFiles.stream().filter(item->item.getGuid().equals(pdfFormat1)).findFirst().orElse(null);
|
|
|
+ SystemFile systemFile2 = systemFiles.stream().filter(item->item.getGuid().equals(pdfFormat2)).findFirst().orElse(null);
|
|
|
+ if(systemFile1!=null) {
|
|
|
+ InnerPatentPdfDTO dto = new InnerPatentPdfDTO();
|
|
|
+ dto.setPdfGuid(pdfFormat1);
|
|
|
+ dto.setType(0);
|
|
|
+ list.add(dto);
|
|
|
+ }
|
|
|
+ if(systemFile2!=null) {
|
|
|
InnerPatentPdfDTO dto = new InnerPatentPdfDTO();
|
|
|
- dto.setPdfGuid(pdfFormat);
|
|
|
- dto.setType(0);
|
|
|
+ dto.setPdfGuid(pdfFormat2);
|
|
|
+ dto.setType(1);
|
|
|
list.add(dto);
|
|
|
}
|
|
|
- //授权说明书pdf
|
|
|
- String pdfFormat1 = FormatUtil.getPDFFormat(appNo, 1);
|
|
|
- if (StringUtils.isNotEmpty(pdfFormat1)) {
|
|
|
- InnerPatentPdfDTO dto1 = new InnerPatentPdfDTO();
|
|
|
- dto1.setPdfGuid(pdfFormat1);
|
|
|
- dto1.setType(1);
|
|
|
- list.add(dto1);
|
|
|
- }
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取附图
|
|
|
+ *
|
|
|
* @param appNo
|
|
|
* @return
|
|
|
*/
|
|
@@ -267,7 +281,7 @@ public class EsPatentService {
|
|
|
kinDetailVO.setAppNo(familyPatent.getAppNo());
|
|
|
kinDetailVO.setPublicNo(familyPatent.getPublicNo());
|
|
|
kinDetailVO.setGrantNo(familyPatent.getGrantNo());
|
|
|
- PatentKinDTO kinDTO = this.selectPatentKindDetail(kinDetailVO,patentNo)
|
|
|
+ PatentKinDTO kinDTO = this.selectPatentKindDetail(kinDetailVO, patentNo)
|
|
|
.stream().findFirst().orElse(null);
|
|
|
if (kinDTO != null) {
|
|
|
kinDTOS.add(kinDTO);
|
|
@@ -353,7 +367,7 @@ public class EsPatentService {
|
|
|
Query bool = QueryBuilders.bool(i -> i.should(q1, q2, q3));
|
|
|
Query q = QueryBuilders.exists(i -> i.field("product_id"));
|
|
|
Query query = QueryBuilders.hasParent(parent -> parent.parentType("patent").query(bool));
|
|
|
- Query bool1 = QueryBuilders.bool(i -> i.must(q,query));
|
|
|
+ Query bool1 = QueryBuilders.bool(i -> i.must(q, query));
|
|
|
builder.query(bool1);
|
|
|
|
|
|
SearchResponse<Patent> response = client.search(builder.build(), Patent.class);
|
|
@@ -376,7 +390,7 @@ public class EsPatentService {
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
- public List<Patent> getPatentsByNo(List<String> patentNos,Boolean ifGetAll,Long current,Long size) throws Exception {
|
|
|
+ public List<Patent> getPatentsByNo(List<String> patentNos, Boolean ifGetAll, Long current, Long size) throws Exception {
|
|
|
List<Patent> patentList = new ArrayList<>();
|
|
|
SearchRequest.Builder builder = new SearchRequest.Builder();
|
|
|
//设置查询索引
|
|
@@ -393,24 +407,24 @@ public class EsPatentService {
|
|
|
}
|
|
|
Query finalQuery = QueryBuilders.bool((i -> i.should(querys)));
|
|
|
builder.query(finalQuery);
|
|
|
- if(!ifGetAll) {
|
|
|
+ if (!ifGetAll) {
|
|
|
List<String> reSources = this.rePatentSource();
|
|
|
builder.source(sourceOptionsBuilder -> sourceOptionsBuilder
|
|
|
.filter(fieldSourceBuilder -> fieldSourceBuilder
|
|
|
.includes(reSources)));
|
|
|
}
|
|
|
- if (current!=null&&size!=null&¤t > 0 && size > 0) {
|
|
|
+ if (current != null && size != null && current > 0 && size > 0) {
|
|
|
builder.from((current.intValue() - 1) * size.intValue()).size(size.intValue());
|
|
|
- }
|
|
|
- else {
|
|
|
+ } else {
|
|
|
builder.from(0).size(10000);
|
|
|
}
|
|
|
SearchResponse<Patent> response = client.search(builder.build(), Patent.class);
|
|
|
List<Hit<Patent>> hits = response.hits().hits();
|
|
|
if (hits != null && hits.size() > 0) {
|
|
|
- hits.forEach(item->{
|
|
|
- Patent patent=item.source();
|
|
|
- patentList.add(patent);}
|
|
|
+ hits.forEach(item -> {
|
|
|
+ Patent patent = item.source();
|
|
|
+ patentList.add(patent);
|
|
|
+ }
|
|
|
);
|
|
|
}
|
|
|
return patentList;
|
|
@@ -483,7 +497,7 @@ public class EsPatentService {
|
|
|
patentPageMessageVO.setPatentNo(hit.source().getPatentNo());
|
|
|
patentPageMessageVOS.add(patentPageMessageVO);
|
|
|
}
|
|
|
- Records records =new Records();
|
|
|
+ Records records = new Records();
|
|
|
records.setTotal(response.hits().total().value());
|
|
|
records.setSize(size);
|
|
|
records.setCurrent(current);
|
|
@@ -505,12 +519,11 @@ public class EsPatentService {
|
|
|
builder.index("patent");
|
|
|
Query q = this.getQuery(queryRequest);
|
|
|
|
|
|
- Query reQuery =null;
|
|
|
- if(patentNos!=null&&patentNos.size()>0){
|
|
|
+ Query reQuery = null;
|
|
|
+ if (patentNos != null && patentNos.size() > 0) {
|
|
|
List<Query> notInQuery = this.getNoNotInQuery(patentNos);
|
|
|
reQuery = QueryBuilders.bool(i -> i.must(q).mustNot(notInQuery));
|
|
|
- }
|
|
|
- else {
|
|
|
+ } else {
|
|
|
reQuery = QueryBuilders.bool(i -> i.must(q));
|
|
|
}
|
|
|
//4. 返回数据
|
|
@@ -598,12 +611,13 @@ public class EsPatentService {
|
|
|
|
|
|
/**
|
|
|
* 根据id查询
|
|
|
+ *
|
|
|
* @param ids
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
- public List<Hit<Patent>> getById(List<String> ids) throws Exception {
|
|
|
- List<Hit<Patent>> patents =new ArrayList<>();
|
|
|
+ public List<Hit<Patent>> getById(List<String> ids) throws Exception {
|
|
|
+ List<Hit<Patent>> patents = new ArrayList<>();
|
|
|
SearchRequest.Builder builder = new SearchRequest.Builder();
|
|
|
builder.index("patent");
|
|
|
Query q = QueryBuilders.ids(i -> i.values(ids));
|
|
@@ -611,10 +625,10 @@ public class EsPatentService {
|
|
|
SearchResponse<Patent> response = client.search(builder.build(), Patent.class);
|
|
|
long total = response.hits().total().value();
|
|
|
if (total > 0) {
|
|
|
- patents = response.hits().hits();
|
|
|
- }
|
|
|
- return patents;
|
|
|
+ patents = response.hits().hits();
|
|
|
}
|
|
|
+ return patents;
|
|
|
+ }
|
|
|
|
|
|
public void removeById(String id) throws IOException {
|
|
|
DeleteResponse deleteResponse = client.delete(deleteRequest ->
|