|
@@ -2,15 +2,18 @@ package cn.cslg.pas.service.common;
|
|
|
|
|
|
import cn.cslg.pas.common.config.XDns;
|
|
import cn.cslg.pas.common.config.XDns;
|
|
|
|
|
|
|
|
+import cn.cslg.pas.common.core.IgnoreDTDEntityResolver;
|
|
import cn.cslg.pas.common.dto.PatentColumnDTO;
|
|
import cn.cslg.pas.common.dto.PatentColumnDTO;
|
|
import cn.cslg.pas.common.dto.PatentStarDTO;
|
|
import cn.cslg.pas.common.dto.PatentStarDTO;
|
|
import cn.cslg.pas.common.dto.PatentStarListDTO;
|
|
import cn.cslg.pas.common.dto.PatentStarListDTO;
|
|
|
|
+import cn.cslg.pas.common.dto.QueryExternalFamilyDTO;
|
|
import cn.cslg.pas.common.dto.business.SelectClaimDTO;
|
|
import cn.cslg.pas.common.dto.business.SelectClaimDTO;
|
|
import cn.cslg.pas.common.model.cronModel.PersonnelVO;
|
|
import cn.cslg.pas.common.model.cronModel.PersonnelVO;
|
|
import cn.cslg.pas.common.model.cronModel.Records;
|
|
import cn.cslg.pas.common.model.cronModel.Records;
|
|
import cn.cslg.pas.common.model.importTaskModel.PatentApplicant;
|
|
import cn.cslg.pas.common.model.importTaskModel.PatentApplicant;
|
|
import cn.cslg.pas.common.utils.*;
|
|
import cn.cslg.pas.common.utils.*;
|
|
import cn.cslg.pas.common.vo.ContentVO;
|
|
import cn.cslg.pas.common.vo.ContentVO;
|
|
|
|
+import cn.cslg.pas.common.vo.QueryExternalFamilyVO;
|
|
import cn.cslg.pas.common.vo.StarPatentVO;
|
|
import cn.cslg.pas.common.vo.StarPatentVO;
|
|
import cn.cslg.pas.common.vo.business.PatentNoVO;
|
|
import cn.cslg.pas.common.vo.business.PatentNoVO;
|
|
import cn.cslg.pas.domain.WebLoginConfig;
|
|
import cn.cslg.pas.domain.WebLoginConfig;
|
|
@@ -32,6 +35,11 @@ import okhttp3.FormBody;
|
|
import okhttp3.OkHttpClient;
|
|
import okhttp3.OkHttpClient;
|
|
import okhttp3.Request;
|
|
import okhttp3.Request;
|
|
import okhttp3.Response;
|
|
import okhttp3.Response;
|
|
|
|
+import org.dom4j.Document;
|
|
|
|
+import org.dom4j.DocumentException;
|
|
|
|
+import org.dom4j.Element;
|
|
|
|
+import org.dom4j.XPath;
|
|
|
|
+import org.dom4j.io.SAXReader;
|
|
import org.joda.time.DateTime;
|
|
import org.joda.time.DateTime;
|
|
import org.joda.time.format.DateTimeFormat;
|
|
import org.joda.time.format.DateTimeFormat;
|
|
import org.joda.time.format.DateTimeFormatter;
|
|
import org.joda.time.format.DateTimeFormatter;
|
|
@@ -42,6 +50,8 @@ import org.springframework.stereotype.Service;
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
|
+import java.io.Reader;
|
|
|
|
+import java.io.StringReader;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Matcher;
|
|
@@ -492,6 +502,40 @@ public class PatentStarApiService {
|
|
return "{}";
|
|
return "{}";
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //获取说明书文本
|
|
|
|
+ public String getFullText(String str) throws DocumentException {
|
|
|
|
+ SAXReader reader = new SAXReader();
|
|
|
|
+ reader.setEntityResolver(new IgnoreDTDEntityResolver());
|
|
|
|
+ Reader stringReader = new StringReader(str);
|
|
|
|
+ Document document = reader.read(stringReader);
|
|
|
|
+ XPath xpath = document.createXPath("//description//p");
|
|
|
|
+ List<Element> elements = (List<Element>) xpath.selectNodes(document);
|
|
|
|
+ if (elements.size() == 0) {
|
|
|
|
+ xpath = document.createXPath("//business:Description//base:Paragraphs");
|
|
|
|
+ elements = (List<Element>) xpath.selectNodes(document);
|
|
|
|
+ }
|
|
|
|
+ List<String> reStrs = new ArrayList<>();
|
|
|
|
+ Integer count = 1;
|
|
|
|
+ for (Element item : elements) {
|
|
|
|
+ String claim = item.getText().replaceAll("<br/>", "");
|
|
|
|
+ if (!claim.trim().equals("技术领域")
|
|
|
|
+ && !claim.trim().equals("发明内容")
|
|
|
|
+ && !claim.trim().equals("附图说明")
|
|
|
|
+ && !claim.trim().equals("具体实施方式")
|
|
|
|
+ && !claim.trim().equals("背景技术")) {
|
|
|
|
+ String formattedNum = String.format("%04d", count);
|
|
|
|
+ claim = "[" + formattedNum + "]" + claim;
|
|
|
|
+ count++;
|
|
|
|
+ }
|
|
|
|
+ reStrs.add(claim);
|
|
|
|
+ }
|
|
|
|
+ String reStr = "";
|
|
|
|
+ if (reStrs.size() != 0) {
|
|
|
|
+ reStr = StringUtils.join(reStrs, "\r\n");
|
|
|
|
+ }
|
|
|
|
+ return reStr;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* @param patentNo
|
|
* @param patentNo
|
|
* @return
|
|
* @return
|
|
@@ -805,7 +849,6 @@ public class PatentStarApiService {
|
|
patentColumnDTO.setPatentNo(patentColumnDTO.getAppNo());
|
|
patentColumnDTO.setPatentNo(patentColumnDTO.getAppNo());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
//装载申请日
|
|
//装载申请日
|
|
@@ -832,6 +875,30 @@ public class PatentStarApiService {
|
|
//获取摘要附图
|
|
//获取摘要附图
|
|
String pictureApi = this.getPictureApi(item.getRowApplicationNo());
|
|
String pictureApi = this.getPictureApi(item.getRowApplicationNo());
|
|
patentColumnDTO.setPictureGuid(pictureApi);
|
|
patentColumnDTO.setPictureGuid(pictureApi);
|
|
|
|
+ //获取公开说明书
|
|
|
|
+ String cnFullXmlApi = null;
|
|
|
|
+ try {
|
|
|
|
+ cnFullXmlApi = this.getCnFullXmlApi(item.getRowApplicationNo());
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ try {
|
|
|
|
+ String fullText = this.getFullText(cnFullXmlApi);
|
|
|
|
+ List<Text> pubTextList = new ArrayList<>();
|
|
|
|
+ Text pubText = new Text();
|
|
|
|
+ pubText.setTextContent(fullText);
|
|
|
|
+ pubText.setIfOrigin(true);
|
|
|
|
+ pubTextList.add(pubText);
|
|
|
|
+ patentColumnDTO.setPublicFullText(pubTextList);
|
|
|
|
+ } catch (DocumentException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ //获取外部专利原始申请号
|
|
|
|
+ patentColumnDTO.setRowApplicationNo(item.getRowApplicationNo());
|
|
|
|
+ //获取法律状态
|
|
|
|
+ String cnLegalApi = this.getCnLegalApi(item.getRowApplicationNo());
|
|
|
|
+ patentColumnDTO.setLegalStatus(Arrays.asList(cnLegalApi));
|
|
|
|
+ //获取被引用次数
|
|
//装载公开日
|
|
//装载公开日
|
|
if (item.getPublicDate() != null && !item.getPublicDate().trim().equals("")) {
|
|
if (item.getPublicDate() != null && !item.getPublicDate().trim().equals("")) {
|
|
patentColumnDTO.setPublicDate(DateUtils.strToDate(item.getPublicDate()));
|
|
patentColumnDTO.setPublicDate(DateUtils.strToDate(item.getPublicDate()));
|
|
@@ -875,13 +942,13 @@ public class PatentStarApiService {
|
|
|
|
|
|
/**
|
|
/**
|
|
* 根据专利号查询外部权利要求
|
|
* 根据专利号查询外部权利要求
|
|
- * @param patentNo
|
|
|
|
|
|
+ * @param vo
|
|
* @return
|
|
* @return
|
|
* @throws IOException
|
|
* @throws IOException
|
|
*/
|
|
*/
|
|
- public SelectClaimDTO selectClaim(String patentNo) throws IOException {
|
|
|
|
|
|
+ public SelectClaimDTO selectClaim(QueryExternalFamilyVO vo) throws IOException {
|
|
PatentStarListDTO patentStarListDTO = new PatentStarListDTO();
|
|
PatentStarListDTO patentStarListDTO = new PatentStarListDTO();
|
|
- String condition = "AN=" + patentNo;
|
|
|
|
|
|
+ String condition = "AN=" + vo.getPatentNo();
|
|
patentStarListDTO.setCurrentQuery(condition);
|
|
patentStarListDTO.setCurrentQuery(condition);
|
|
patentStarListDTO.setDBType("CN");
|
|
patentStarListDTO.setDBType("CN");
|
|
patentStarListDTO.setOrderBy("AD");
|
|
patentStarListDTO.setOrderBy("AD");
|
|
@@ -907,7 +974,7 @@ public class PatentStarApiService {
|
|
* @return
|
|
* @return
|
|
* @throws IOException
|
|
* @throws IOException
|
|
*/
|
|
*/
|
|
- public PatentColumnDTO queryExternalDetail(PatentNoVO vo) throws IOException {
|
|
|
|
|
|
+ public PatentColumnDTO queryExternalDetail(QueryExternalFamilyVO vo) throws IOException {
|
|
PatentStarListDTO patentStarListDTO = new PatentStarListDTO();
|
|
PatentStarListDTO patentStarListDTO = new PatentStarListDTO();
|
|
String condition = "AN=" + vo.getPatentNo();
|
|
String condition = "AN=" + vo.getPatentNo();
|
|
patentStarListDTO.setCurrentQuery(condition);
|
|
patentStarListDTO.setCurrentQuery(condition);
|
|
@@ -929,4 +996,32 @@ public class PatentStarApiService {
|
|
return dto;
|
|
return dto;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 查询外部专利同族专利
|
|
|
|
+ * @param vo
|
|
|
|
+ * @return
|
|
|
|
+ * @throws IOException
|
|
|
|
+ */
|
|
|
|
+ public Records queryExternalFamily(QueryExternalFamilyVO vo) throws IOException {
|
|
|
|
+ Records records = new Records();
|
|
|
|
+ String family = this.getFamilyByPubNoApi(vo.getPatentNo());
|
|
|
|
+ QueryExternalFamilyDTO familyDTO = JSONObject.parseObject(family, QueryExternalFamilyDTO.class);
|
|
|
|
+ String familyInfos = familyDTO.getFamilyinfo();
|
|
|
|
+ List<String> publicNos = Arrays.asList(familyInfos.split(";"));
|
|
|
|
+ if (!CollectionUtils.isEmpty(publicNos)) {
|
|
|
|
+ for (String publicNo : publicNos) {
|
|
|
|
+ PatentStarListDTO patentStarListDTO = new PatentStarListDTO();
|
|
|
|
+ String condition = "PN=" + publicNo;
|
|
|
|
+ patentStarListDTO.setCurrentQuery(condition);
|
|
|
|
+ patentStarListDTO.setDBType("CN");
|
|
|
|
+ patentStarListDTO.setOrderBy("AD");
|
|
|
|
+ patentStarListDTO.setOrderByType("DESC");
|
|
|
|
+ patentStarListDTO.setPageNum(vo.getPageNum());
|
|
|
|
+ patentStarListDTO.setRowCount(vo.getPageSize());
|
|
|
|
+ records = this.patentStarSearchLocal(patentStarListDTO);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return records;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|