|
@@ -7,10 +7,7 @@ import cn.cslg.pas.common.vo.ContentVO;
|
|
|
import cn.cslg.pas.common.vo.business.PatentKinDetailVO;
|
|
|
import cn.cslg.pas.common.vo.business.PatentKinVO;
|
|
|
import cn.cslg.pas.common.vo.business.PatentNoVO;
|
|
|
-import cn.cslg.pas.domain.es.FamilyPatent;
|
|
|
-import cn.cslg.pas.domain.es.Patent;
|
|
|
-import cn.cslg.pas.domain.es.PatentFamilyMessage;
|
|
|
-import cn.cslg.pas.domain.es.Text;
|
|
|
+import cn.cslg.pas.domain.es.*;
|
|
|
import co.elastic.clients.elasticsearch.ElasticsearchClient;
|
|
|
import co.elastic.clients.elasticsearch._types.query_dsl.Query;
|
|
|
import co.elastic.clients.elasticsearch._types.query_dsl.QueryBuilders;
|
|
@@ -29,6 +26,7 @@ import org.springframework.util.CollectionUtils;
|
|
|
import java.io.IOException;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
|
@RequiredArgsConstructor(onConstructor_ = {@Lazy})
|
|
@@ -54,20 +52,46 @@ public class EsPatentService {
|
|
|
for (Hit<Patent> hit : hits) {
|
|
|
Patent esMess = hit.source();
|
|
|
BeanUtils.copyProperties(esMess, dto);
|
|
|
- ContentVO titleVO = new ContentVO();
|
|
|
- String title = StringUtils.strip(JSON.toJSONString(esMess.getTitle()), "[]");
|
|
|
- ContentDetailDTO titleContent = JSONObject.parseObject(title, ContentDetailDTO.class);
|
|
|
- titleVO.setContent(titleContent.getTextContent());
|
|
|
- dto.setTitle(titleVO);
|
|
|
- ContentVO abstractVO = new ContentVO();
|
|
|
- String abstractStr = StringUtils.strip(JSON.toJSONString(esMess.getAbstractStr()), "[]");
|
|
|
- ContentDetailDTO abstractContent = JSONObject.parseObject(abstractStr, ContentDetailDTO.class);
|
|
|
- abstractVO.setContent(abstractContent.getTextContent());
|
|
|
- dto.setAbstractStr(abstractVO);
|
|
|
+ dto.setMC(esMess.getMipc());
|
|
|
+ dto.setLG(esMess.getLegalStatus());
|
|
|
+ dto.setSS(esMess.getSimpleStatus());
|
|
|
+ dto.setPT(esMess.getPatentType());
|
|
|
+ if (!CollectionUtils.isEmpty(esMess.getTitle())) {
|
|
|
+ dto.setTitle(this.loadContent(esMess.getTitle()));
|
|
|
+ }
|
|
|
+ if (!CollectionUtils.isEmpty(esMess.getAbstractStr())) {
|
|
|
+ dto.setAbstractStr(this.loadContent(esMess.getAbstractStr()));
|
|
|
+ }
|
|
|
+ if (!CollectionUtils.isEmpty(esMess.getClaim())) {
|
|
|
+ dto.setClaim(this.loadContent(esMess.getClaim()));
|
|
|
+ }
|
|
|
+ if (!CollectionUtils.isEmpty(esMess.getApplicant())) {
|
|
|
+ dto.setApplicant(this.loadName(esMess.getApplicant()));
|
|
|
+ }
|
|
|
+ if (!CollectionUtils.isEmpty(esMess.getRightHolder())) {
|
|
|
+ dto.setRightHolder(this.loadName(esMess.getRightHolder()));
|
|
|
+ }
|
|
|
+ if (!CollectionUtils.isEmpty(esMess.getInventor())) {
|
|
|
+ dto.setInventor(this.loadName(esMess.getInventor()));
|
|
|
+ }
|
|
|
}
|
|
|
return dto;
|
|
|
}
|
|
|
|
|
|
+ //通用返回摘要、标题、权利要求具体内容
|
|
|
+ public ContentVO loadContent(List<Text> list) {
|
|
|
+ ContentVO contentVO = new ContentVO();
|
|
|
+ String content = StringUtils.strip(JSON.toJSONString(list), "[]");
|
|
|
+ ContentDetailDTO contentDetailDTO = JSONObject.parseObject(content, ContentDetailDTO.class);
|
|
|
+ contentVO.setContent(contentDetailDTO.getTextContent());
|
|
|
+ return contentVO;
|
|
|
+ }
|
|
|
+
|
|
|
+ //通用返回申请人、权利人、发明人
|
|
|
+ public List<String> loadName(List<PatentPerson> list) {
|
|
|
+ return list.stream().map(PatentPerson::getName).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 根据专利号查询出同族专利列表
|
|
|
* @param vo
|
|
@@ -147,10 +171,10 @@ public class EsPatentService {
|
|
|
kinDTO.setAppNo(patent.getAppNo());
|
|
|
kinDTO.setPublicNo(patent.getPublicNo());
|
|
|
kinDTO.setGrantNo(patent.getGrantNo());
|
|
|
- kinDTO.setTitle(patent.getTitle());
|
|
|
- kinDTO.setAbstractStr(patent.getAbstractStr());
|
|
|
- kinDTO.setApplicant(patent.getApplicant());
|
|
|
- kinDTO.setRightHolder(patent.getRightHolder());
|
|
|
+ kinDTO.setTitle(this.loadContent(patent.getTitle()));
|
|
|
+ kinDTO.setAbstractStr(this.loadContent(patent.getAbstractStr()));
|
|
|
+ kinDTO.setApplicant(this.loadName(patent.getApplicant()));
|
|
|
+ kinDTO.setRightHolder(this.loadName(patent.getRightHolder()));
|
|
|
list.add(kinDTO);
|
|
|
}
|
|
|
}
|