|
@@ -0,0 +1,771 @@
|
|
|
+package cn.cslg.pas.service.importPatent;
|
|
|
+
|
|
|
+import cn.cslg.pas.common.core.IgnoreDTDEntityResolver;
|
|
|
+import cn.cslg.pas.common.dto.UploadPatentWebDTO;
|
|
|
+import cn.cslg.pas.common.utils.DateUtils;
|
|
|
+import cn.cslg.pas.common.utils.esDataForm.AddressSplitter;
|
|
|
+import cn.cslg.pas.common.utils.esDataForm.PatentClassifySplitter;
|
|
|
+import cn.cslg.pas.common.vo.StarPatentVO;
|
|
|
+import cn.cslg.pas.domain.es.*;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import org.dom4j.Document;
|
|
|
+import org.dom4j.Element;
|
|
|
+import org.dom4j.XPath;
|
|
|
+import org.dom4j.io.SAXReader;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.io.Reader;
|
|
|
+import java.io.StringReader;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+import java.util.regex.Matcher;
|
|
|
+import java.util.regex.Pattern;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+@Service
|
|
|
+public class WebVOTransformService {
|
|
|
+ private static List<String> SCHOOL = new ArrayList<String>() {{
|
|
|
+ add("大学");
|
|
|
+ add("学院");
|
|
|
+ add("小学");
|
|
|
+ add("中学");
|
|
|
+ add("学校");
|
|
|
+ add("幼儿园");
|
|
|
+ }};
|
|
|
+ private static List<String> INSTITUTES = new ArrayList<String>() {{
|
|
|
+ add("研究院");
|
|
|
+ add("研究所");
|
|
|
+ }};
|
|
|
+
|
|
|
+ private static List<String> COMPANY = new ArrayList<String>() {{
|
|
|
+ add("公司");
|
|
|
+ add("集团");
|
|
|
+ add("事务所");
|
|
|
+ }};
|
|
|
+
|
|
|
+ //装载中国专利
|
|
|
+ public void loadCNPatent(String chinaPatentZhuLuStr, Patent patent, StarPatentVO starPatentVO) {
|
|
|
+ patent.setPatentNo(patent.getAppNo());
|
|
|
+ if (chinaPatentZhuLuStr != null && !chinaPatentZhuLuStr.trim().equals("") && !chinaPatentZhuLuStr.equals("{}") && !chinaPatentZhuLuStr.contains("请求不合法")) {
|
|
|
+ List<StarPatentVO> chinaPatentZhuLus = JSON.parseArray(chinaPatentZhuLuStr, StarPatentVO.class);
|
|
|
+ StarPatentVO chinaPatentZhuLu = chinaPatentZhuLus.get(0);
|
|
|
+
|
|
|
+ //装载 申请人地址
|
|
|
+ this.loadApplicantAddr(patent, chinaPatentZhuLu.getDZ(), starPatentVO.getCO());
|
|
|
+
|
|
|
+ //装载代理人
|
|
|
+ this.loadAgent(patent, chinaPatentZhuLu.getAT());
|
|
|
+
|
|
|
+ //装载发明人
|
|
|
+ this.loadInventor(patent, chinaPatentZhuLu.getIV());
|
|
|
+
|
|
|
+ //装载优先权号、优先权国家、优先权日
|
|
|
+ this.loadPriorities(patent, chinaPatentZhuLu.getPR());
|
|
|
+
|
|
|
+ this.loadCountry(patent, true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //装载专利信息
|
|
|
+ public void loadPatent(UploadPatentWebDTO uploadPatentWebDTO) {
|
|
|
+ String country = "";
|
|
|
+ Patent patent = uploadPatentWebDTO.getPatent();
|
|
|
+ StarPatentVO starPatentVO = uploadPatentWebDTO.getStarPatentVO();
|
|
|
+ //装载专利类型
|
|
|
+ Integer patentType = starPatentVO.getPT();
|
|
|
+ this.loadPatentType(patent, patentType);
|
|
|
+ //装载申请号
|
|
|
+ this.loadApplicationNo(patent, starPatentVO.getAN());
|
|
|
+ //装载公告号
|
|
|
+ this.loadGrantNo(patent, starPatentVO.getPN(), starPatentVO.getGN());
|
|
|
+ //装载公开号
|
|
|
+ this.loadPublicNo(patent, starPatentVO.getPN(), starPatentVO.getGN());
|
|
|
+
|
|
|
+
|
|
|
+ this.loadCountry(patent, true);
|
|
|
+
|
|
|
+
|
|
|
+ //装载申请人地址
|
|
|
+ this.loadApplicantAddr(patent, starPatentVO.getDZ(), starPatentVO.getCO());
|
|
|
+
|
|
|
+ //装载IPC分类号
|
|
|
+ this.loadPatentIPC(patent, starPatentVO.getMC(), starPatentVO.getIC());
|
|
|
+
|
|
|
+
|
|
|
+ //装载摘要
|
|
|
+ this.loadAbstractStr(patent, starPatentVO.getAB());
|
|
|
+
|
|
|
+ //装载申请日
|
|
|
+ if (starPatentVO.getAD() != null && !starPatentVO.getAD().equals("")) {
|
|
|
+ Date date = DateUtils.strToDate(starPatentVO.getAD());
|
|
|
+ patent.setAppDate(date);
|
|
|
+ }
|
|
|
+
|
|
|
+ //装载发明人
|
|
|
+ this.loadInventor(patent, starPatentVO.getIV());
|
|
|
+
|
|
|
+ //装载申请人
|
|
|
+ this.loadApplicant(patent, starPatentVO.getPA());
|
|
|
+
|
|
|
+ //装载代理人
|
|
|
+ this.loadAgent(patent, starPatentVO.getAT());
|
|
|
+
|
|
|
+ //装载代理机构
|
|
|
+ this.loadAgency(patent, starPatentVO.getAGN());
|
|
|
+
|
|
|
+
|
|
|
+ //装载公告日
|
|
|
+ this.loadGrantDate(patent, starPatentVO.getPD(), starPatentVO.getGD());
|
|
|
+ //装载公开日
|
|
|
+ this.loadPublicDate(patent, starPatentVO.getPD(), starPatentVO.getGD());
|
|
|
+
|
|
|
+ //装载标题
|
|
|
+ this.loadTitle(patent, starPatentVO.getTI());
|
|
|
+
|
|
|
+ //装载权利人
|
|
|
+ this.loadRightHolder(patent, starPatentVO.getPE());
|
|
|
+
|
|
|
+ //装载法律状态(os_patent表status字段值)
|
|
|
+ this.loadPatentStatus(patent, starPatentVO.getLG());
|
|
|
+ patent.setAppCountry(country);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // 装载世界专利
|
|
|
+ public void loadWorldPatent(String worldPatentZhuLuStr, Patent patent) {
|
|
|
+ List<StarPatentVO> worldPatentZhuLus = JSON.parseArray(worldPatentZhuLuStr, StarPatentVO.class);
|
|
|
+ StarPatentVO worldPatentZhuLu = worldPatentZhuLus.get(0);
|
|
|
+ //装载申请号
|
|
|
+ this.loadApplicationNo(patent, worldPatentZhuLu.getEpoAppNo());
|
|
|
+
|
|
|
+ //装载公开号
|
|
|
+ this.loadPublicNo(patent, worldPatentZhuLu.getDocdbPubNo(), null);
|
|
|
+
|
|
|
+ this.loadCountry(patent, false);
|
|
|
+ //装载申请日
|
|
|
+ this.loadAppDate(patent, worldPatentZhuLu.getAppDate());
|
|
|
+
|
|
|
+ //装载公开日
|
|
|
+ this.loadPublicDate(patent, worldPatentZhuLu.getPubDate(), null);
|
|
|
+
|
|
|
+ //装载IPC分类号
|
|
|
+ if (patent.getPatentType().equals(3)) {
|
|
|
+ this.loadPatentLoc(patent, worldPatentZhuLu.getMC(), worldPatentZhuLu.getIpc());
|
|
|
+ } else {
|
|
|
+ this.loadPatentIPC(patent, worldPatentZhuLu.getMC(), worldPatentZhuLu.getIpc());
|
|
|
+ }
|
|
|
+ //装载CPC分类号
|
|
|
+ this.loadPatentCPC(patent, worldPatentZhuLu.getCpc());
|
|
|
+
|
|
|
+ //装载申请人
|
|
|
+ this.loadApplicant(patent, worldPatentZhuLu.getPA());
|
|
|
+
|
|
|
+ //装载发明人
|
|
|
+ this.loadInventor(patent, worldPatentZhuLu.getIV());
|
|
|
+
|
|
|
+ //装载优先权号、优先权国家、优先权日
|
|
|
+ this.loadPriorities(patent, worldPatentZhuLu.getPR());
|
|
|
+
|
|
|
+ //装载标题
|
|
|
+ this.loadTitle(patent, worldPatentZhuLu.getTitle());
|
|
|
+
|
|
|
+ //装载摘要
|
|
|
+ this.loadAbstractStr(patent, worldPatentZhuLu.getAbstract());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载申请人地址
|
|
|
+ *
|
|
|
+ * @param patent
|
|
|
+ * @param address
|
|
|
+ * @param proviceStr
|
|
|
+ */
|
|
|
+ public void loadApplicantAddr(Patent patent, String address, String proviceStr) {
|
|
|
+ //装载申请人地址
|
|
|
+ if (patent.getApplicantAddr() == null) {
|
|
|
+ if (address != null && !address.equals("")) {
|
|
|
+ PersonAddress personAddress = AddressSplitter.splitAddress(address, proviceStr);
|
|
|
+ patent.setApplicantAddr(personAddress);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载代理人
|
|
|
+ *
|
|
|
+ * @param patent
|
|
|
+ * @param agentStr
|
|
|
+ */
|
|
|
+ public void loadAgent(Patent patent, String agentStr) {
|
|
|
+ if (patent.getAgent() == null || patent.getAgent().size() == 0) {
|
|
|
+ if (agentStr != null && !agentStr.equals("")) {
|
|
|
+ List<String> patentAgents = Arrays.asList(agentStr.split(";"));
|
|
|
+ if (patentAgents != null && patentAgents.size() != 0) {
|
|
|
+ patent.setAgent(patentAgents);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载专利类型
|
|
|
+ *
|
|
|
+ * @param patent
|
|
|
+ * @param patentType
|
|
|
+ */
|
|
|
+ public void loadPatentType(Patent patent, Integer patentType) {
|
|
|
+ //装载专利类型
|
|
|
+ if (patentType != null) {
|
|
|
+ patent.setPatentType(patentType.toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载简单法律状态
|
|
|
+ *
|
|
|
+ * @param patent
|
|
|
+ * @param status
|
|
|
+ */
|
|
|
+ public void loadPatentStatus(Patent patent, Integer status) {
|
|
|
+ if (status != null) {
|
|
|
+ //1有效(有权)2失效(无权)3审中(审中)
|
|
|
+ patent.setSimpleStatus(status.toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载优先权
|
|
|
+ *
|
|
|
+ * @param patent
|
|
|
+ * @param pr
|
|
|
+ */
|
|
|
+ public void loadPriorities(Patent patent, String pr) {
|
|
|
+ //装载优先权号、优先权国家、优先权日
|
|
|
+ if (pr != null && pr != "") {
|
|
|
+ String[] prStrs = pr.split(" ");
|
|
|
+ String priorityNo = prStrs[0];
|
|
|
+ String prDate = "";
|
|
|
+ if (prStrs.length > 1) {
|
|
|
+ prDate = prStrs[1];
|
|
|
+ }
|
|
|
+ Priorities priorities = new Priorities();
|
|
|
+ priorities.setPriorityNo(priorityNo);
|
|
|
+ String pCountry = priorityNo.substring(0, 2);
|
|
|
+ priorities.setPriorityCountry(pCountry);
|
|
|
+ //装载优先权日
|
|
|
+ if (prDate != null) {
|
|
|
+ String a = DateUtils.strToStr(prDate, "yyyy-MM-dd");
|
|
|
+ priorities.setPriorityDate(a);
|
|
|
+ }
|
|
|
+ patent.setPriorities(Arrays.asList(priorities));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载发明人
|
|
|
+ *
|
|
|
+ * @param patent
|
|
|
+ * @param inventors
|
|
|
+ */
|
|
|
+ public void loadInventor(Patent patent, String inventors) {
|
|
|
+ if (patent.getInventor() == null || patent.getInventor().size() == 0) {
|
|
|
+
|
|
|
+ if (inventors != null && !inventors.equals("")) {
|
|
|
+ List<String> patentInventorNames = Arrays.asList(inventors.split(";"));
|
|
|
+ List<PatentPerson> patentPeople = new ArrayList<>();
|
|
|
+ for (int i = 0; i < patentInventorNames.size(); i++) {
|
|
|
+ PatentPerson patentPerson = new PatentPerson();
|
|
|
+ patentPerson.setOrder(0);
|
|
|
+ patentPerson.setType("1");
|
|
|
+ patentPerson.setName(patentInventorNames.get(i));
|
|
|
+ patentPeople.add(patentPerson);
|
|
|
+ }
|
|
|
+ patent.setInventor(patentPeople);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载ipc分类号
|
|
|
+ *
|
|
|
+ * @param patent
|
|
|
+ * @param mainIpc
|
|
|
+ * @param ipcs
|
|
|
+ */
|
|
|
+ public void loadPatentIPC(Patent patent, String mainIpc, String ipcs) {
|
|
|
+ //装载IPC分类号
|
|
|
+ if (ipcs != null && !ipcs.equals("")) {
|
|
|
+ List<PatentClassify> patentClassifies = new ArrayList<>();
|
|
|
+ List<String> ipcArr = Arrays.asList(ipcs.split(";"));
|
|
|
+ for (int i = 0; i < ipcArr.size(); i++) {
|
|
|
+ PatentClassify patentClassify = PatentClassifySplitter.split(ipcArr.get(i));
|
|
|
+ patentClassifies.add(patentClassify);
|
|
|
+ }
|
|
|
+ patent.setIpc(patentClassifies);
|
|
|
+ if (mainIpc == null || mainIpc.equals("")) {
|
|
|
+ if (patentClassifies.size() > 0) {
|
|
|
+ patent.setMipc(patentClassifies.get(0));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ PatentClassify patentClassify = PatentClassifySplitter.split(mainIpc);
|
|
|
+ patent.setMipc(patentClassify);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (mainIpc != null || !mainIpc.equals("")) {
|
|
|
+ PatentClassify patentClassify = PatentClassifySplitter.split(mainIpc);
|
|
|
+ patent.setMipc(patentClassify);
|
|
|
+ patent.setIpc(Arrays.asList(patentClassify));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载loc分类号
|
|
|
+ *
|
|
|
+ * @param patent
|
|
|
+ * @param mainIpc
|
|
|
+ * @param ipcs
|
|
|
+ */
|
|
|
+ public void loadPatentLoc(Patent patent, String mainIpc, String ipcs) {
|
|
|
+ //装载Loc分类号
|
|
|
+ if (ipcs != null && !ipcs.equals("")) {
|
|
|
+ List<PatentClassify> patentClassifies = new ArrayList<>();
|
|
|
+ List<String> ipcArr = Arrays.asList(ipcs.split(";"));
|
|
|
+ for (int i = 0; i < ipcArr.size(); i++) {
|
|
|
+ PatentClassify patentClassify = PatentClassifySplitter.split(ipcArr.get(i));
|
|
|
+ patentClassifies.add(patentClassify);
|
|
|
+ }
|
|
|
+ patent.setLoc(patentClassifies);
|
|
|
+
|
|
|
+ if (mainIpc == null || mainIpc.equals("")) {
|
|
|
+ if (patentClassifies.size() > 0) {
|
|
|
+ patent.setMloc(patentClassifies.get(0));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ PatentClassify patentClassify = PatentClassifySplitter.split(mainIpc);
|
|
|
+ patent.setMloc(patentClassify);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (mainIpc != null || !mainIpc.equals("")) {
|
|
|
+ PatentClassify patentClassify = PatentClassifySplitter.split(mainIpc);
|
|
|
+ patent.setMloc(patentClassify);
|
|
|
+ patent.setLoc(Arrays.asList(patentClassify));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载cpc分类号
|
|
|
+ *
|
|
|
+ * @param patent
|
|
|
+ * @param cpcs
|
|
|
+ */
|
|
|
+ public void loadPatentCPC(Patent patent, String cpcs) {
|
|
|
+ //装载IPC分类号
|
|
|
+ if (cpcs != null && !cpcs.equals("")) {
|
|
|
+ List<PatentClassify> patentClassifies = new ArrayList<>();
|
|
|
+ List<String> cpcArr = Arrays.asList(cpcs.split(";"));
|
|
|
+ for (int i = 0; i < cpcArr.size(); i++) {
|
|
|
+ PatentClassify patentClassify = PatentClassifySplitter.split(cpcArr.get(i));
|
|
|
+ patentClassifies.add(patentClassify);
|
|
|
+ }
|
|
|
+ patent.setIpc(patentClassifies);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载摘要
|
|
|
+ *
|
|
|
+ * @param patent
|
|
|
+ * @param abstractStr
|
|
|
+ */
|
|
|
+ public void loadAbstractStr(Patent patent, String abstractStr) {
|
|
|
+ //装载摘要
|
|
|
+ if (abstractStr != null && !abstractStr.equals("")) {
|
|
|
+ Text text = new Text();
|
|
|
+ text.setLanguage(patent.getAppCountry());
|
|
|
+ text.setIfOrigin(true);
|
|
|
+ text.setTextContent(abstractStr);
|
|
|
+ patent.setAbstractStr(Arrays.asList(text));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载标题
|
|
|
+ *
|
|
|
+ * @param patent
|
|
|
+ * @param title
|
|
|
+ */
|
|
|
+ public void loadTitle(Patent patent, String title) {
|
|
|
+ if (title != null && !title.equals("")) {
|
|
|
+ Text text = new Text();
|
|
|
+ text.setLanguage(patent.getAppCountry());
|
|
|
+ text.setIfOrigin(true);
|
|
|
+ text.setTextContent(title);
|
|
|
+ patent.setTitle(Arrays.asList(text));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载公开日
|
|
|
+ *
|
|
|
+ * @param patent
|
|
|
+ * @param publicDate
|
|
|
+ */
|
|
|
+ public void loadPublicDate(Patent patent, String publicDate, String grantDate) {
|
|
|
+ //装载公开日
|
|
|
+ if (publicDate != null && !publicDate.equals("")) {
|
|
|
+ Date date = DateUtils.strToDate(publicDate);
|
|
|
+ patent.setPublicDate(date);
|
|
|
+ } else if (!patent.getPatentType().equals("1") && !patent.getPatentType().equals("8")) {
|
|
|
+ if (grantDate != null && !grantDate.trim().equals("")) {
|
|
|
+ Date date = DateUtils.strToDate(grantDate);
|
|
|
+ patent.setPublicDate(date);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载公开日
|
|
|
+ *
|
|
|
+ * @param patent
|
|
|
+ * @param
|
|
|
+ */
|
|
|
+ public void loadGrantDate(Patent patent, String publicDate, String grantDate) {
|
|
|
+ if (grantDate != null && !grantDate.equals("")) {
|
|
|
+ Date date = DateUtils.strToDate(grantDate);
|
|
|
+ patent.setGrantDate(date);
|
|
|
+ } else if (!patent.getPatentType().equals("1") && !patent.getPatentType().equals("8")) {
|
|
|
+ if (publicDate != null && !publicDate.trim().equals("")) {
|
|
|
+ Date date = DateUtils.strToDate(publicDate);
|
|
|
+ patent.setGrantDate(date);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载公开号
|
|
|
+ *
|
|
|
+ * @param patent
|
|
|
+ * @param publicNo
|
|
|
+ */
|
|
|
+ public void loadPublicNo(Patent patent, String publicNo, String grantNo) {
|
|
|
+ publicNo = publicNo.trim();
|
|
|
+ if (publicNo != null && !publicNo.equals("")) {
|
|
|
+ patent.setPublicNo(publicNo);
|
|
|
+ } else if (!patent.getPatentType().equals("1") && !patent.getPatentType().equals("8")) {
|
|
|
+ if (grantNo != null && !grantNo.equals("")) {
|
|
|
+ patent.setPublicNo(grantNo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载公告号
|
|
|
+ *
|
|
|
+ * @param patent
|
|
|
+ * @param grantNo
|
|
|
+ */
|
|
|
+ public void loadGrantNo(Patent patent, String publicNo, String grantNo) {
|
|
|
+ if (grantNo != null && !grantNo.equals("")) {
|
|
|
+ patent.setGrantNo(grantNo);
|
|
|
+ } else if (!patent.getPatentType().equals("1") && !patent.getPatentType().equals("8")) {
|
|
|
+ if (publicNo != null && !publicNo.equals("")) {
|
|
|
+ patent.setGrantNo(publicNo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载申请号
|
|
|
+ *
|
|
|
+ * @param patent
|
|
|
+ * @param appNo
|
|
|
+ */
|
|
|
+ public void loadApplicationNo(Patent patent, String appNo) {
|
|
|
+ if (appNo != null && !appNo.equals("")) {
|
|
|
+ patent.setAppNo(appNo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载权利人
|
|
|
+ *
|
|
|
+ * @param patent
|
|
|
+ * @param rightHolder
|
|
|
+ */
|
|
|
+ public void loadRightHolder(Patent patent, String rightHolder) {
|
|
|
+ //装载权利人
|
|
|
+ if (rightHolder != null && !rightHolder.equals("")) {
|
|
|
+ List<String> names = Arrays.asList(rightHolder.split(";"));
|
|
|
+ List<PatentPerson> patentPeople = new ArrayList<>();
|
|
|
+ for (int i = 0; i < names.size(); i++) {
|
|
|
+ String name = names.get(i);
|
|
|
+ String type = this.getPersonType(name, patent.getInventor());
|
|
|
+ PatentPerson patentPerson = new PatentPerson();
|
|
|
+ patentPerson.setOrder(0);
|
|
|
+ patentPerson.setType(type);
|
|
|
+ patentPerson.setName(names.get(i));
|
|
|
+ patentPeople.add(patentPerson);
|
|
|
+ }
|
|
|
+ patent.setRightHolder(patentPeople);
|
|
|
+ } else if (patent.getApplicant() != null) {
|
|
|
+ patent.setRightHolder(patent.getApplicant());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载代理机构
|
|
|
+ * @param patent
|
|
|
+ * @param agency
|
|
|
+ */
|
|
|
+ public void loadAgency(Patent patent, String agency) {
|
|
|
+ if (agency != null && !agency.equals("")) {
|
|
|
+ patent.setAgency(agency);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载申请人
|
|
|
+ *
|
|
|
+ * @param patent
|
|
|
+ * @param applicant
|
|
|
+ */
|
|
|
+ public void loadApplicant(Patent patent, String applicant) {
|
|
|
+ if (applicant != null && !applicant.equals("")) {
|
|
|
+ List<String> names = Arrays.asList(applicant.split(";"));
|
|
|
+ List<PatentPerson> patentPeople = new ArrayList<>();
|
|
|
+ for (int i = 0; i < names.size(); i++) {
|
|
|
+ String name = names.get(i);
|
|
|
+ String type = this.getPersonType(name, patent.getInventor());
|
|
|
+ PatentPerson patentPerson = new PatentPerson();
|
|
|
+ patentPerson.setOrder(i + 1);
|
|
|
+ patentPerson.setType(type);
|
|
|
+ patentPerson.setName(names.get(i));
|
|
|
+ patentPeople.add(patentPerson);
|
|
|
+ }
|
|
|
+ patent.setApplicant(patentPeople);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载申请日
|
|
|
+ *
|
|
|
+ * @param patent
|
|
|
+ * @param appDate
|
|
|
+ */
|
|
|
+ public void loadAppDate(Patent patent, String appDate) {
|
|
|
+ if (appDate != null && !appDate.equals("")) {
|
|
|
+ Date date = DateUtils.strToDate(appDate);
|
|
|
+ patent.setAppDate(date);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载申请国家
|
|
|
+ *
|
|
|
+ * @param patent
|
|
|
+ * @param ifCN
|
|
|
+ */
|
|
|
+ public void loadCountry(Patent patent, boolean ifCN) {
|
|
|
+ if (ifCN) {
|
|
|
+ patent.setAppCountry("CN");
|
|
|
+ } else {
|
|
|
+ String appNo = patent.getAppNo();
|
|
|
+ String publicNo = patent.getPublicNo();
|
|
|
+ String grantNo = patent.getGrantNo();
|
|
|
+ String useNo = null;
|
|
|
+ if (grantNo != null) {
|
|
|
+ useNo = grantNo;
|
|
|
+ } else if (publicNo != null) {
|
|
|
+ useNo = publicNo;
|
|
|
+ } else if (appNo != null) {
|
|
|
+ useNo = appNo;
|
|
|
+ }
|
|
|
+ if (useNo != null) {
|
|
|
+ // 定义正则表达式,^[A-Za-z]+ 表示从字符串开头匹配一个或多个英文字母
|
|
|
+ Pattern pattern = Pattern.compile("^[A-Za-z]+");
|
|
|
+ Matcher matcher = pattern.matcher(useNo);
|
|
|
+ if (matcher.find()) {
|
|
|
+ // 如果找到匹配项,则获取匹配的内容
|
|
|
+ String prefix = matcher.group();
|
|
|
+ patent.setAppCountry(prefix);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载中国专利号
|
|
|
+ *
|
|
|
+ * @param patent
|
|
|
+ */
|
|
|
+ public void loadCNPatentNo(Patent patent) {
|
|
|
+ patent.setPatentNo(patent.getAppNo());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载世界专利号
|
|
|
+ */
|
|
|
+ public void loadWorldPatentNo(Patent patent) {
|
|
|
+ String publicNo = patent.getPublicNo();
|
|
|
+ String grantNo = patent.getGrantNo();
|
|
|
+ if (grantNo != null) {
|
|
|
+ patent.setPatentNo(grantNo);
|
|
|
+ } else if (publicNo != null) {
|
|
|
+ patent.setPatentNo(publicNo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载说明书
|
|
|
+ *
|
|
|
+ * @param patent
|
|
|
+ * @param cnFullXmlStr
|
|
|
+ */
|
|
|
+ private void loadFullText(Patent patent, String cnFullXmlStr) {
|
|
|
+ try {
|
|
|
+ //若没有取到全文文本,即取不到说明书文本,则将当前申请号或专利号和备注信息记录到问题记录表
|
|
|
+ if (cnFullXmlStr.equals("")) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ SAXReader reader = new SAXReader();
|
|
|
+ reader.setEntityResolver(new IgnoreDTDEntityResolver());
|
|
|
+ Reader stringReader = new StringReader(cnFullXmlStr);
|
|
|
+ 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> fullTexts = new ArrayList<>();
|
|
|
+ Integer count = 1;
|
|
|
+ List<String> ts = this.getTitleStrs();
|
|
|
+ for (Element item : elements) {
|
|
|
+ String fullText = item.getText().replaceAll("<br/>", "");
|
|
|
+ if (!ts.contains(fullText.trim())) {
|
|
|
+ String formattedNum = String.format("%04d", count);
|
|
|
+ fullText = "[" + formattedNum + "]" + fullText;
|
|
|
+ count++;
|
|
|
+ }
|
|
|
+ fullText = fullText.replaceAll("\r\n|\r|\n| ", "");
|
|
|
+ if (!fullText.trim().equals("")) {
|
|
|
+ fullTexts.add(fullText);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String fullText = "";
|
|
|
+ if (fullTexts.size() != 0) {
|
|
|
+ fullText = cn.cslg.pas.common.utils.StringUtils.join(fullTexts, "\r\n");
|
|
|
+ }
|
|
|
+ Text text = new Text();
|
|
|
+ text.setIfOrigin(true);
|
|
|
+ text.setTextContent(fullText);
|
|
|
+ text.setLanguage(patent.getAppCountry());
|
|
|
+ patent.setPublicFullText(Arrays.asList(text));
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<String> getTitleStrs() {
|
|
|
+ String t1 = "技术领域";
|
|
|
+ String t2 = "发明内容";
|
|
|
+ String t3 = "附图说明";
|
|
|
+ String t4 = "具体实施方式";
|
|
|
+ String t5 = "背景技术";
|
|
|
+ String t6 = "实用新型内容";
|
|
|
+ String t7 = "【技术领域】";
|
|
|
+ String t8 = "【背景技术】";
|
|
|
+ String t9 = "【发明内容】";
|
|
|
+ String t10 = "【附图说明】";
|
|
|
+ String t11 = "【具体实施方式】";
|
|
|
+ List<String> ts = Arrays.asList(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11);
|
|
|
+ return ts;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载权利要求
|
|
|
+ *
|
|
|
+ * @param patent
|
|
|
+ * @param cnFullXmlStr
|
|
|
+ */
|
|
|
+ public void loadClaim(Patent patent, String cnFullXmlStr) {
|
|
|
+ try {
|
|
|
+ if (cnFullXmlStr != null && cnFullXmlStr != "") {
|
|
|
+ SAXReader reader = new SAXReader();
|
|
|
+ reader.setEntityResolver(new IgnoreDTDEntityResolver());
|
|
|
+ Reader stringReader = new StringReader(cnFullXmlStr);
|
|
|
+ Document document = reader.read(stringReader);
|
|
|
+ XPath xpath = document.createXPath("//claim-text");
|
|
|
+ List<Element> element = (List<Element>) xpath.selectNodes(document);
|
|
|
+ if (element.size() == 0) {
|
|
|
+ xpath = document.createXPath("//business:ClaimText");
|
|
|
+ element = (List<Element>) xpath.selectNodes(document);
|
|
|
+ }
|
|
|
+ List<String> reClaims = new ArrayList<>();
|
|
|
+ element.forEach(item -> {
|
|
|
+ String claim = item.getText();
|
|
|
+ claim = claim.replaceAll("\r\n|\r|\n|\t| ", "");
|
|
|
+ reClaims.add(claim);
|
|
|
+ });
|
|
|
+ String reClaim = "";
|
|
|
+ if (reClaims.size() != 0) {
|
|
|
+ reClaim = cn.cslg.pas.common.utils.StringUtils.join(reClaims, "@##");
|
|
|
+ }
|
|
|
+ //装载权利要求原文
|
|
|
+ Text text = new Text();
|
|
|
+ text.setLanguage("CN");
|
|
|
+ text.setTextContent(reClaim);
|
|
|
+ text.setIfOrigin(true);
|
|
|
+ patent.setClaim(Arrays.asList(text));
|
|
|
+
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getPersonType(String name, List<PatentPerson> personList) {
|
|
|
+ List<String> names = new ArrayList<>();
|
|
|
+ if (personList != null) {
|
|
|
+ names = personList.stream().map(PatentPerson::getName).collect(Collectors.toList());
|
|
|
+ if (names.contains(name)) {
|
|
|
+ return "1";
|
|
|
+ } else {
|
|
|
+ return this.getPersonTypeByName(name);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return this.getPersonTypeByName(name);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getPersonTypeByName(String name) {
|
|
|
+ if (SCHOOL.contains(name)) {
|
|
|
+ return "3";
|
|
|
+ } else if (INSTITUTES.contains(name)) {
|
|
|
+ return "4";
|
|
|
+ } else if (COMPANY.contains(name)) {
|
|
|
+ return "2";
|
|
|
+ } else {
|
|
|
+ return "1";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public void addLegalEvent(Patent patent){
|
|
|
+
|
|
|
+ }
|
|
|
+}
|