|
@@ -33,6 +33,7 @@ import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 专利之星类型任务解析获取专利类
|
|
@@ -80,7 +81,12 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
}
|
|
|
|
|
|
//获得返回的的多个检索式 patentStarListDtos
|
|
|
- List<PatentStarListDto> patentStarListDtos = patentStarApiService.getSplitedConditions(new PatentStarListDto().setCurrentQuery(task.getConditions()), patentNum);
|
|
|
+
|
|
|
+ List<PatentStarListDto> patentStarListDtos = patentStarApiService.getSplitedConditions(new PatentStarListDto()
|
|
|
+ .setCurrentQuery(task.getConditions())
|
|
|
+ .setOrderBy(orderBy)
|
|
|
+ .setOrderByType(orderByType)
|
|
|
+ .setDBType(dbType), patentNum);
|
|
|
|
|
|
int produceSuccessNum = 0;
|
|
|
int countForStart = 0; //定义变量countForStart,记录检索式的专利总数量(目的是找出下载开始位置专利所属的那个检索式)
|
|
@@ -108,14 +114,11 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
//第2层:遍历检索页数
|
|
|
for (Integer i = startPage; i <= endPage; i++) {
|
|
|
//调用一般检索接口,返回一批专利著录相关数据
|
|
|
- Map<String, Object> resultMap = patentStarApiService.patentStarSearchApi(new PatentStarListDto()
|
|
|
- .setCurrentQuery(patentStarListDto.getCurrentQuery())
|
|
|
- .setOrderBy(orderBy)
|
|
|
- .setOrderByType(orderByType)
|
|
|
+ patentStarListDto
|
|
|
.setPageNum(i)
|
|
|
.setRowCount(50)
|
|
|
- .setDBType(dbType)
|
|
|
- .setFormed(true));
|
|
|
+ .setFormed(true);
|
|
|
+ Map<String, Object> resultMap = patentStarApiService.patentStarSearchApi(patentStarListDto);
|
|
|
if (resultMap == null || (Integer) resultMap.get("total") == 0) {
|
|
|
ThrowException.throwXiaoShiException("未检索到相关专利");
|
|
|
}
|
|
@@ -343,45 +346,108 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
* @param starPatent 专利之星著录对象
|
|
|
* @param uploadParamsVO 专利实体类对象
|
|
|
*/
|
|
|
- public void setPatentZhuLu(StarPatentVO starPatent, UploadParamsVO uploadParamsVO) {
|
|
|
+ public void setPatentZhuLu(StarPatentVO starPatent, UploadParamsVO uploadParamsVO) throws IOException {
|
|
|
//以下 ↓装载的是调用"一般检索"接口返回的专利相关数据
|
|
|
- //Patent patent = new Patent();
|
|
|
- //装载专利号
|
|
|
- uploadParamsVO.getPatent().setPatentNo(starPatent.getPatentNo());
|
|
|
+ //装载专利类型
|
|
|
+ Integer patentType = starPatent.getPatentType();
|
|
|
+ if (patentType != null) {
|
|
|
+ if (patentType.equals(2) || patentType.equals(9)) {
|
|
|
+ uploadParamsVO.getPatent().setType(1); //实用新型
|
|
|
+ } else if (patentType.equals(1) || patentType.equals(8)) {
|
|
|
+ uploadParamsVO.getPatent().setType(2); //发明
|
|
|
+ } else if (patentType.equals(3)) {
|
|
|
+ uploadParamsVO.getPatent().setType(3); //外观设计
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //装载申请人地址
|
|
|
+ if (starPatent.getApplicationAddress() != null && !starPatent.getApplicationAddress().equals("")) {
|
|
|
+ ArrayList<String> patentApplicantOriginalAddresss = new ArrayList<>();
|
|
|
+ patentApplicantOriginalAddresss.add(starPatent.getApplicationAddress());
|
|
|
+ uploadParamsVO.setPatentApplicantOriginalAddress(patentApplicantOriginalAddresss);
|
|
|
+ }
|
|
|
+ //装载IPC分类号
|
|
|
+ if (starPatent.getIpcListStr() != null && !starPatent.getIpcListStr().equals("")) {
|
|
|
+ String[] ipcArr = starPatent.getIpcListStr().split(";");
|
|
|
+ //装载主分类号
|
|
|
+ //uploadParamsVO.setMainIpc(ipcArr[0]);
|
|
|
+ uploadParamsVO.setMainIpc(starPatent.getMainIpc());
|
|
|
+ uploadParamsVO.setIpcList(Arrays.asList(ipcArr));
|
|
|
+ }
|
|
|
+ //装载公告日(公开授权日)
|
|
|
+ if (starPatent.getPublicAccreditDate() != null && !starPatent.getPublicAccreditDate().equals("")) {
|
|
|
+ int timeStamp = stringDateToTimeStamp(starPatent.getPublicAccreditDate());
|
|
|
+ uploadParamsVO.getPatent().setPublicAccreditDate(timeStamp);
|
|
|
+ }
|
|
|
//装载摘要
|
|
|
- uploadParamsVO.getPatent().setAbstractStr(starPatent.getAbstractStr());
|
|
|
- //装载标题
|
|
|
- uploadParamsVO.getPatent().setName(starPatent.getName());
|
|
|
- //装载申请号
|
|
|
- uploadParamsVO.getPatent().setApplicationNo(starPatent.getApplicationNo());
|
|
|
+ if (starPatent.getAbstractStr() != null && !starPatent.getAbstractStr().equals("")) {
|
|
|
+ uploadParamsVO.getPatent().setAbstractStr(starPatent.getAbstractStr());
|
|
|
+ }
|
|
|
//装载申请日
|
|
|
if (starPatent.getApplicationDate() != null && !starPatent.getApplicationDate().equals("")) {
|
|
|
int timeStamp = stringDateToTimeStamp(starPatent.getApplicationDate());
|
|
|
uploadParamsVO.getPatent().setApplicationDate(timeStamp);
|
|
|
}
|
|
|
- //装载公开号
|
|
|
- uploadParamsVO.getPatent().setPublicNo(starPatent.getPublicNo());
|
|
|
+ //装载发明人
|
|
|
+ if (starPatent.getInventorStr() != null && !starPatent.getInventorStr().equals("")) {
|
|
|
+ List<String> patentInventorNames = Arrays.asList(starPatent.getInventorStr().split(";"));
|
|
|
+ ArrayList<PatentInventor> patentInventors = new ArrayList<>();
|
|
|
+ for (String patentInventorName : patentInventorNames) {
|
|
|
+ PatentInventor patentInventor = new PatentInventor();
|
|
|
+ patentInventor.setName(patentInventorName);
|
|
|
+ patentInventors.add(patentInventor);
|
|
|
+ }
|
|
|
+ uploadParamsVO.setPatentInventorList(patentInventors);
|
|
|
+ }
|
|
|
+ //装载专利号
|
|
|
+ if (starPatent.getPatentNo() != null && !starPatent.getPatentNo().equals("")) {
|
|
|
+ uploadParamsVO.getPatent().setPatentNo(starPatent.getPatentNo());
|
|
|
+ }
|
|
|
+ //装载授权号(公开授权日)
|
|
|
+ if (starPatent.getPublicAccreditNo() != null && !starPatent.getPublicAccreditNo().equals("")) {
|
|
|
+ uploadParamsVO.getPatent().setPublicAccreditNo(starPatent.getPublicAccreditNo());
|
|
|
+ }
|
|
|
+ //装载代理机构地址
|
|
|
+ if (starPatent.getAgencyStr() != null && !starPatent.getAgencyStr().equals("")) {
|
|
|
+ String agencyAddress;
|
|
|
+ if (starPatent.getAgencyStr().contains(" ")) {
|
|
|
+ agencyAddress = starPatent.getAgencyStr().substring(0, starPatent.getAgencyStr().lastIndexOf(" "));
|
|
|
+ } else {
|
|
|
+ agencyAddress = starPatent.getAgencyStr();
|
|
|
+ }
|
|
|
+ uploadParamsVO.getPatent().setAgencyId(agencyAddress);
|
|
|
+ }
|
|
|
+ //装载申请号
|
|
|
+ if (starPatent.getApplicationNo() != null && !starPatent.getApplicationNo().equals("")) {
|
|
|
+ uploadParamsVO.getPatent().setApplicationNo(starPatent.getApplicationNo());
|
|
|
+ }
|
|
|
+ //装载申请人
|
|
|
+ if (starPatent.getApplicantStr() != null && !starPatent.getApplicantStr().equals("")) {
|
|
|
+ uploadParamsVO.setPatentApplicantOriginalName(Arrays.asList(starPatent.getApplicantStr().split(";")));
|
|
|
+ }
|
|
|
+ //装载代理人
|
|
|
+ if (starPatent.getAgentStr() != null && !starPatent.getAgentStr().equals("")) {
|
|
|
+ List<String> patentAgents = Arrays.asList(starPatent.getAgentStr().split(";"));
|
|
|
+ ArrayList<PatentAgent> patentAgentList = new ArrayList<>();
|
|
|
+ for (String n : patentAgents) {
|
|
|
+ PatentAgent patentAgent = new PatentAgent();
|
|
|
+ patentAgent.setName(n);
|
|
|
+ patentAgentList.add(patentAgent);
|
|
|
+ }
|
|
|
+ uploadParamsVO.setPatentAgentList(patentAgentList);
|
|
|
+ }
|
|
|
//装载公开日
|
|
|
if (starPatent.getPublicDate() != null && !starPatent.getPublicDate().equals("")) {
|
|
|
int timeStamp = stringDateToTimeStamp(starPatent.getPublicDate());
|
|
|
uploadParamsVO.getPatent().setPublicDate(timeStamp);
|
|
|
}
|
|
|
- //装载申请人
|
|
|
- if (starPatent.getApplicantStr() != null && !starPatent.getApplicantStr().equals("")) {
|
|
|
- uploadParamsVO.setPatentApplicantOriginalName(Arrays.asList(starPatent.getApplicantStr().split(";")));
|
|
|
+ //装载标题
|
|
|
+ if (starPatent.getName() != null && !starPatent.getName().equals("")) {
|
|
|
+ uploadParamsVO.getPatent().setName(starPatent.getName());
|
|
|
}
|
|
|
//装载权利人
|
|
|
if (starPatent.getCurrentApplicantStr() != null && !starPatent.getCurrentApplicantStr().equals("")) {
|
|
|
uploadParamsVO.setPatentApplicantCurrentName(Arrays.asList(starPatent.getCurrentApplicantStr().split(";")));
|
|
|
}
|
|
|
- //装载IPC分类号
|
|
|
- if (starPatent.getIpcListStr() != null && !starPatent.getIpcListStr().equals("")) {
|
|
|
- String[] ipcArr = starPatent.getIpcListStr().split(";");
|
|
|
- //装载主分类号
|
|
|
- //uploadParamsVO.setMainIpc(ipcArr[0]);
|
|
|
- uploadParamsVO.setMainIpc(starPatent.getMainIpc());
|
|
|
- uploadParamsVO.setIpcList(Arrays.asList(ipcArr));
|
|
|
- }
|
|
|
//装载法律状态(os_patent表status字段值)
|
|
|
Integer status = starPatent.getLG();
|
|
|
if (status != null) {
|
|
@@ -396,130 +462,254 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
uploadParamsVO.getPatent().setSimpleStatus(1);
|
|
|
}
|
|
|
}
|
|
|
- uploadParamsVO.setPatentSimpleStatus(starPatent.getSimpleStatus());
|
|
|
- uploadParamsVO.setSimpleStatus(starPatent.getSimpleStatus());
|
|
|
- //装载专利类型
|
|
|
- Integer patentType = starPatent.getPatentType();
|
|
|
- if (patentType != null) {
|
|
|
- if (patentType.equals(2) || patentType.equals(9)) {
|
|
|
- uploadParamsVO.getPatent().setType(1); //实用新型
|
|
|
- } else if (patentType.equals(1) || patentType.equals(8)) {
|
|
|
- uploadParamsVO.getPatent().setType(2); //发明
|
|
|
- } else if (patentType.equals(3)) {
|
|
|
- uploadParamsVO.getPatent().setType(3); //外观设计
|
|
|
- }
|
|
|
+ //装载公开号
|
|
|
+ if (starPatent.getPublicNo() != null && !starPatent.getPublicNo().equals("")) {
|
|
|
+ uploadParamsVO.getPatent().setPublicNo(starPatent.getPublicNo());
|
|
|
+ }
|
|
|
+ if (starPatent.getSimpleStatus() != null && !starPatent.getSimpleStatus().equals("")) {
|
|
|
+ uploadParamsVO.setPatentSimpleStatus(starPatent.getSimpleStatus());
|
|
|
+ uploadParamsVO.setSimpleStatus(starPatent.getSimpleStatus());
|
|
|
+ }
|
|
|
+ //装载受理局
|
|
|
+ if (starPatent.getBureau() != null && !starPatent.getBureau().equals("")) {
|
|
|
+ uploadParamsVO.getPatent().setBureau(starPatent.getBureau());
|
|
|
+ }
|
|
|
+ //装载优先权
|
|
|
+ if (starPatent.getPriorityNo() != null && !starPatent.getPriorityNo().equals("")) {
|
|
|
+ uploadParamsVO.getPatent().setPriorityNo(starPatent.getPriorityNo());
|
|
|
+ }
|
|
|
+ //装载优先权日
|
|
|
+ if (starPatent.getPriorityDate() != null && !starPatent.getPriorityDate().equals("")) {
|
|
|
+ int timeStamp = stringDateToTimeStamp(starPatent.getPriorityDate());
|
|
|
+ uploadParamsVO.getPatent().setPriorityDate(timeStamp);
|
|
|
}
|
|
|
|
|
|
|
|
|
- //以下 ↓装载的是调用"获得中国专利著录"接口返回的专利相关数据
|
|
|
String appNo;
|
|
|
if (starPatent.getApplicationNo().contains(".")) {
|
|
|
appNo = starPatent.getApplicationNo().substring(0, starPatent.getApplicationNo().lastIndexOf("."));
|
|
|
} else {
|
|
|
appNo = starPatent.getApplicationNo();
|
|
|
}
|
|
|
- //调用中国专利著录接口返回的专利相关数据最外层是一个集合"[]",但是集合中只有一个对象"{}",以下方式处理
|
|
|
- String chinaPatentZhuLuStr = patentStarApiService.getCnBibApi(appNo);
|
|
|
- if (chinaPatentZhuLuStr != null && !chinaPatentZhuLuStr.trim().equals("") && !chinaPatentZhuLuStr.equals("{}")) {
|
|
|
- List<ChinaPatentZhuLu> chinaPatentZhuLus = JSON.parseArray(chinaPatentZhuLuStr, ChinaPatentZhuLu.class);
|
|
|
- ChinaPatentZhuLu chinaPatentZhuLu = chinaPatentZhuLus.get(0);
|
|
|
-
|
|
|
- //装载申请人地址
|
|
|
- if (chinaPatentZhuLu.getDZ() != null && !chinaPatentZhuLu.getDZ().equals("")) {
|
|
|
- ArrayList<String> patentApplicantOriginalAddresss = new ArrayList<>();
|
|
|
- if (chinaPatentZhuLu.getDZ().contains(" ")) {
|
|
|
- patentApplicantOriginalAddresss.add(chinaPatentZhuLu.getDZ().substring(chinaPatentZhuLu.getDZ().indexOf(" ") + 1));
|
|
|
- } else {
|
|
|
- patentApplicantOriginalAddresss.add(chinaPatentZhuLu.getDZ());
|
|
|
+
|
|
|
+ try {
|
|
|
+ //以下 ↓装载的是调用"获得中国专利著录"接口返回的专利相关数据
|
|
|
+ if (starPatent.getPatentNo().contains("CN")) {
|
|
|
+ String chinaPatentZhuLuStr = patentStarApiService.getCnBibApi(appNo);
|
|
|
+ if (chinaPatentZhuLuStr != null && !chinaPatentZhuLuStr.trim().equals("") && !chinaPatentZhuLuStr.equals("{}")) {
|
|
|
+ List<ChinaPatentZhuLu> chinaPatentZhuLus = JSON.parseArray(chinaPatentZhuLuStr, ChinaPatentZhuLu.class);
|
|
|
+ ChinaPatentZhuLu chinaPatentZhuLu = chinaPatentZhuLus.get(0);
|
|
|
+ //装载申请人地址
|
|
|
+ if (uploadParamsVO.getPatentApplicantOriginalAddress() == null || uploadParamsVO.getPatentApplicantOriginalAddress().size() == 0) {
|
|
|
+ if (chinaPatentZhuLu.getDZ() != null && !chinaPatentZhuLu.getDZ().equals("")) {
|
|
|
+ List<String> patentApplicantOriginalAddresss = new ArrayList<>();
|
|
|
+ if (chinaPatentZhuLu.getDZ().contains(" ")) {
|
|
|
+ patentApplicantOriginalAddresss.add(chinaPatentZhuLu.getDZ().substring(chinaPatentZhuLu.getDZ().indexOf(" ") + 1));
|
|
|
+ } else {
|
|
|
+ patentApplicantOriginalAddresss.add(chinaPatentZhuLu.getDZ());
|
|
|
+ }
|
|
|
+ uploadParamsVO.setPatentApplicantOriginalAddress(patentApplicantOriginalAddresss);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //装载代理人
|
|
|
+ if (uploadParamsVO.getPatentAgentList() == null || uploadParamsVO.getPatentAgentList().size() == 0) {
|
|
|
+ if (chinaPatentZhuLu.getAT() != null && !chinaPatentZhuLu.getAT().equals("")) {
|
|
|
+ List<String> patentAgents = Arrays.asList(chinaPatentZhuLu.getAT().split(";"));
|
|
|
+ ArrayList<PatentAgent> patentAgentList = new ArrayList<>();
|
|
|
+ for (String n : patentAgents) {
|
|
|
+ PatentAgent patentAgent = new PatentAgent();
|
|
|
+ patentAgent.setName(n);
|
|
|
+ patentAgentList.add(patentAgent);
|
|
|
+ }
|
|
|
+ uploadParamsVO.setPatentAgentList(patentAgentList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //装载代理机构地址
|
|
|
+ if (uploadParamsVO.getPatent().getAgencyId() == null || uploadParamsVO.getPatent().getAgencyId().equals("")) {
|
|
|
+ if (chinaPatentZhuLu.getAGN() != null && !chinaPatentZhuLu.getAGN().equals("")) {
|
|
|
+ String agencyAddress;
|
|
|
+ if (chinaPatentZhuLu.getAGN().contains(" ")) {
|
|
|
+ agencyAddress = chinaPatentZhuLu.getAGN().substring(0, chinaPatentZhuLu.getAGN().lastIndexOf(" "));
|
|
|
+ } else {
|
|
|
+ agencyAddress = chinaPatentZhuLu.getAGN();
|
|
|
+ }
|
|
|
+ uploadParamsVO.getPatent().setAgencyId(agencyAddress);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //装载发明人
|
|
|
+ if (uploadParamsVO.getPatentInventorList() == null || uploadParamsVO.getPatentInventorList().size() == 0) {
|
|
|
+ if (chinaPatentZhuLu.getIV() != null && !chinaPatentZhuLu.getIV().equals("")) {
|
|
|
+ List<String> patentInventorNames = Arrays.asList(chinaPatentZhuLu.getIV().split(";"));
|
|
|
+ ArrayList<PatentInventor> patentInventors = new ArrayList<>();
|
|
|
+ for (String patentInventorName : patentInventorNames) {
|
|
|
+ PatentInventor patentInventor = new PatentInventor();
|
|
|
+ patentInventor.setName(patentInventorName);
|
|
|
+ patentInventors.add(patentInventor);
|
|
|
+ }
|
|
|
+ uploadParamsVO.setPatentInventorList(patentInventors);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //装载优先权号、优先权国家、优先权日
|
|
|
+ if (uploadParamsVO.getPatent().getPriorityNo() == null || uploadParamsVO.getPatent().getPriorityNo().equals("")) {
|
|
|
+ uploadParamsVO.getPatent().setPriorityNo(chinaPatentZhuLu.getPR());
|
|
|
+ }
|
|
|
}
|
|
|
- uploadParamsVO.setPatentApplicantOriginalAddress(patentApplicantOriginalAddresss);
|
|
|
- }
|
|
|
- //装载代理人
|
|
|
- if (chinaPatentZhuLu.getAT() != null && !chinaPatentZhuLu.getAT().equals("")) {
|
|
|
- List<String> patentAgents = Arrays.asList(chinaPatentZhuLu.getAT().split(";"));
|
|
|
- ArrayList<PatentAgent> patentAgentList = new ArrayList<>();
|
|
|
- for (String n : patentAgents) {
|
|
|
- PatentAgent patentAgent = new PatentAgent();
|
|
|
- patentAgent.setName(n);
|
|
|
- patentAgentList.add(patentAgent);
|
|
|
+ } else { //以下 ↓装载的是调用"获得世界专利著录"接口返回的专利相关数据
|
|
|
+ String worldPatentZhuLuStr = patentStarApiService.getENBibApi(starPatent.getPatentNo());
|
|
|
+ List<WorldPatentZhuLu> worldPatentZhuLus = JSON.parseArray(worldPatentZhuLuStr, WorldPatentZhuLu.class);
|
|
|
+ WorldPatentZhuLu worldPatentZhuLu = worldPatentZhuLus.get(0);
|
|
|
+
|
|
|
+ //装载公开号
|
|
|
+ if (uploadParamsVO.getPatent().getPublicNo() == null || uploadParamsVO.getPatent().getPublicNo().equals("")) {
|
|
|
+ uploadParamsVO.getPatent().setPatentNo(worldPatentZhuLu.getDocdbPubNo());
|
|
|
}
|
|
|
- uploadParamsVO.setPatentAgentList(patentAgentList);
|
|
|
- }
|
|
|
- //装载代理机构地址
|
|
|
- if (chinaPatentZhuLu.getAGN() != null && !chinaPatentZhuLu.getAGN().equals("")) {
|
|
|
- String agencyAddress;
|
|
|
- if (chinaPatentZhuLu.getAGN().contains(" ")) {
|
|
|
- agencyAddress = chinaPatentZhuLu.getAGN().substring(0, chinaPatentZhuLu.getAGN().lastIndexOf(" "));
|
|
|
- } else {
|
|
|
- agencyAddress = chinaPatentZhuLu.getAGN();
|
|
|
+ //装载申请号
|
|
|
+ if (uploadParamsVO.getPatent().getApplicationNo() == null || uploadParamsVO.getPatent().getApplicationNo().equals("")) {
|
|
|
+ uploadParamsVO.getPatent().setApplicationNo(worldPatentZhuLu.getEpoAppNo());
|
|
|
}
|
|
|
- uploadParamsVO.getPatent().setAgencyId(agencyAddress);
|
|
|
- }
|
|
|
- //装载发明人
|
|
|
- if (chinaPatentZhuLu.getIV() != null && !chinaPatentZhuLu.getIV().equals("")) {
|
|
|
- List<String> patentInventorNames = Arrays.asList(chinaPatentZhuLu.getIV().split(";"));
|
|
|
- ArrayList<PatentInventor> patentInventors = new ArrayList<>();
|
|
|
- for (String patentInventorName : patentInventorNames) {
|
|
|
- PatentInventor patentInventor = new PatentInventor();
|
|
|
- patentInventor.setName(patentInventorName);
|
|
|
- patentInventors.add(patentInventor);
|
|
|
+ //装载申请日
|
|
|
+ if (uploadParamsVO.getPatent().getApplicationDate() == null) {
|
|
|
+ int timeStamp = stringDateToTimeStamp(worldPatentZhuLu.getAppDate());
|
|
|
+ uploadParamsVO.getPatent().setApplicationDate(timeStamp);
|
|
|
+ }
|
|
|
+ //装载公开日
|
|
|
+ if (uploadParamsVO.getPatent().getPublicDate() == null) {
|
|
|
+ int timeStamp = stringDateToTimeStamp(worldPatentZhuLu.getPubDate());
|
|
|
+ uploadParamsVO.getPatent().setPublicDate(timeStamp);
|
|
|
+ }
|
|
|
+ //装载IPC分类号
|
|
|
+ if (uploadParamsVO.getIpcList() == null || uploadParamsVO.getIpcList().size() == 0) {
|
|
|
+ String[] ipcArr = worldPatentZhuLu.getIpc().split(";");
|
|
|
+ //装载主分类号
|
|
|
+ if (uploadParamsVO.getMainIpc() == null || uploadParamsVO.getMainIpc().equals("")) {
|
|
|
+ uploadParamsVO.setMainIpc(ipcArr[0]);
|
|
|
+ }
|
|
|
+ //装载IPC分类号
|
|
|
+ uploadParamsVO.setIpcList(Arrays.asList(ipcArr));
|
|
|
+ }
|
|
|
+ //装载CPC分类号
|
|
|
+ String[] cpcArr = worldPatentZhuLu.getCpc().split(";");
|
|
|
+ uploadParamsVO.setCpcList(Arrays.asList(cpcArr));
|
|
|
+ //装载申请人
|
|
|
+ if (uploadParamsVO.getPatentApplicantOriginalName() == null || uploadParamsVO.getPatentApplicantOriginalName().size() == 0) {
|
|
|
+ uploadParamsVO.setPatentApplicantOriginalName(Arrays.asList(worldPatentZhuLu.getPa().split(";")));
|
|
|
+ }
|
|
|
+ //装载发明人
|
|
|
+ if (uploadParamsVO.getPatentInventorList() == null || uploadParamsVO.getPatentInventorList().size() == 0) {
|
|
|
+ if (worldPatentZhuLu.getIv() != null && !worldPatentZhuLu.getIv().equals("")) {
|
|
|
+ List<String> patentInventorNames = Arrays.asList(worldPatentZhuLu.getIv().split(";"));
|
|
|
+ ArrayList<PatentInventor> patentInventors = new ArrayList<>();
|
|
|
+ for (String patentInventorName : patentInventorNames) {
|
|
|
+ PatentInventor patentInventor = new PatentInventor();
|
|
|
+ patentInventor.setName(patentInventorName);
|
|
|
+ patentInventors.add(patentInventor);
|
|
|
+ }
|
|
|
+ uploadParamsVO.setPatentInventorList(patentInventors);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //装载优先权
|
|
|
+ if (uploadParamsVO.getPatent().getPriorityNo() == null || uploadParamsVO.getPatent().getPriorityNo().equals("")) {
|
|
|
+ uploadParamsVO.getPatent().setPriorityNo(worldPatentZhuLu.getPr());
|
|
|
}
|
|
|
- uploadParamsVO.setPatentInventorList(patentInventors);
|
|
|
+ //装载标题
|
|
|
+ if (uploadParamsVO.getPatent().getName() == null && uploadParamsVO.getPatent().getName().equals("")) {
|
|
|
+ uploadParamsVO.getPatent().setName(worldPatentZhuLu.getTitle());
|
|
|
+ }
|
|
|
+ //装载摘要
|
|
|
+ if (uploadParamsVO.getPatent().getAbstractStr() == null && uploadParamsVO.getPatent().getAbstractStr().equals("")) {
|
|
|
+ uploadParamsVO.getPatent().setAbstractStr(worldPatentZhuLu.getAbstract());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
- //装载优先权号、优先权国家、优先权日
|
|
|
- uploadParamsVO.getPatent().setPriorityNo(chinaPatentZhuLu.getPR());
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ //e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
//以下 ↓装载的是调用"获得同族专利"接口返回的专利相关数据
|
|
|
- if (starPatent.getPatentNo() != null && !starPatent.getPatentNo().equals("")) {
|
|
|
- String familyPatentNoStr = patentStarApiService.getFamilyByPubNoApi(starPatent.getPatentNo());
|
|
|
- if (!familyPatentNoStr.equals("no data")) {
|
|
|
- FamilyPatentNo familyPatentNo = JSON.parseObject(familyPatentNoStr, FamilyPatentNo.class);
|
|
|
- //装载同族号
|
|
|
- if (familyPatentNo.getFamilyinfo() != null && !familyPatentNo.getFamilyinfo().equals("")) {
|
|
|
- List<String> simpleFamily = Arrays.asList(familyPatentNo.getFamilyinfo().split(";"));
|
|
|
- uploadParamsVO.setSimpleFamily(simpleFamily);
|
|
|
+ try {
|
|
|
+ if (starPatent.getPatentNo() != null && !starPatent.getPatentNo().equals("")) {
|
|
|
+ String familyPatentNoStr = patentStarApiService.getFamilyByPubNoApi(starPatent.getPatentNo());
|
|
|
+ if (!familyPatentNoStr.equals("no data")) {
|
|
|
+ FamilyPatentNo familyPatentNo = JSON.parseObject(familyPatentNoStr, FamilyPatentNo.class);
|
|
|
+ //装载同族号
|
|
|
+ if (familyPatentNo.getFamilyinfo() != null && !familyPatentNo.getFamilyinfo().equals("")) {
|
|
|
+ List<String> familyPatentNos = Arrays.asList(familyPatentNo.getFamilyinfo().split(";"));
|
|
|
+ //集合转成字符串
|
|
|
+ String conditions = "PN=(" + StringUtils.join(familyPatentNos, " OR ") + ")";
|
|
|
+
|
|
|
+ //调用一般接口返回这些同族号专利的著录相关数据(标题、申请人、权利人、摘要附图)
|
|
|
+ PatentStarListDto patentStarListDto = new PatentStarListDto()
|
|
|
+ .setCurrentQuery(conditions)
|
|
|
+ .setOrderBy("ID")
|
|
|
+ .setOrderByType("DESC")
|
|
|
+ .setPageNum(1)
|
|
|
+ .setRowCount(50)
|
|
|
+ .setDBType("CN");
|
|
|
+ Map<String, Object> resultMap = patentStarApiService.patentStarSearchApi(patentStarListDto);
|
|
|
+ List<StarPatentVO> patents = new ArrayList<>();
|
|
|
+ if (resultMap == null || (Integer) resultMap.get("total") == 0) {
|
|
|
+ patentStarListDto.setDBType("WD");
|
|
|
+ resultMap = patentStarApiService.patentStarSearchApi(patentStarListDto);
|
|
|
+ if (resultMap != null && (Integer) resultMap.get("total") != 0) {
|
|
|
+ patents = (List<StarPatentVO>) resultMap.get("records");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ patents = (List<StarPatentVO>) resultMap.get("records");
|
|
|
+ }
|
|
|
+ if (patents != null && patents.size() > 0) {
|
|
|
+ List<String> simpleFamilys = patents.stream().map(StarPatentVO::getPatentNo).collect(Collectors.toList());
|
|
|
+ uploadParamsVO.setSimpleFamily(simpleFamilys);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
//以下 ↓装载的是调用"获得中国专利法律状态"接口返回的专利相关数据
|
|
|
- PatentAffair patentAffair = new PatentAffair();
|
|
|
- String cnLegalApiStr = patentStarApiService.getCnLegalApi(appNo);
|
|
|
- if (!cnLegalApiStr.equals("")) {
|
|
|
- List<ChinaLeagalStatus> chinaLeagalStatuses = JSON.parseArray(cnLegalApiStr, ChinaLeagalStatus.class);
|
|
|
- if (chinaLeagalStatuses != null && chinaLeagalStatuses.size() > 0) {
|
|
|
- ArrayList<KeyValueVO> lst = new ArrayList<>();
|
|
|
- HashMap<Integer, String> nameMap = new HashMap<>();
|
|
|
- HashMap<Integer, String> contentMap = new HashMap<>();
|
|
|
- nameMap.put(0, "发生日期");
|
|
|
- nameMap.put(1, "法律状态");
|
|
|
- nameMap.put(2, "详细法律状态");
|
|
|
- nameMap.put(3, "详细信息");
|
|
|
- for (int i = 0; i < chinaLeagalStatuses.size(); i++) {
|
|
|
- if (i == 0) {
|
|
|
- patentAffair.setStatus(chinaLeagalStatuses.get(i).getLegalStatus());
|
|
|
- }
|
|
|
- contentMap.put(0, chinaLeagalStatuses.get(i).getLegalDate());
|
|
|
- contentMap.put(1, chinaLeagalStatuses.get(i).getLegalStatus());
|
|
|
- contentMap.put(2, chinaLeagalStatuses.get(i).getLegalStatusInfo());
|
|
|
- contentMap.put(3, chinaLeagalStatuses.get(i).getDETAIL());
|
|
|
- ArrayList<KeyValueVO.InpadocData> inpadocDatas = new ArrayList<>();
|
|
|
- for (int j = 0; j < 4; j++) {
|
|
|
- KeyValueVO.InpadocData inpadocData = new KeyValueVO.InpadocData();
|
|
|
- inpadocData.setName(nameMap.get(j));
|
|
|
- inpadocData.setContent(contentMap.get(j));
|
|
|
- inpadocDatas.add(inpadocData);
|
|
|
+ try {
|
|
|
+ PatentAffair patentAffair = new PatentAffair();
|
|
|
+ String cnLegalApiStr = patentStarApiService.getCnLegalApi(appNo);
|
|
|
+ if (!cnLegalApiStr.equals("")) {
|
|
|
+ List<ChinaLeagalStatus> chinaLeagalStatuses = JSON.parseArray(cnLegalApiStr, ChinaLeagalStatus.class);
|
|
|
+ if (chinaLeagalStatuses != null && chinaLeagalStatuses.size() > 0) {
|
|
|
+ ArrayList<KeyValueVO> lst = new ArrayList<>();
|
|
|
+ HashMap<Integer, String> nameMap = new HashMap<>();
|
|
|
+ HashMap<Integer, String> contentMap = new HashMap<>();
|
|
|
+ nameMap.put(0, "发生日期");
|
|
|
+ nameMap.put(1, "法律状态");
|
|
|
+ nameMap.put(2, "详细法律状态");
|
|
|
+ nameMap.put(3, "详细信息");
|
|
|
+ for (int i = 0; i < chinaLeagalStatuses.size(); i++) {
|
|
|
+ if (i == 0) {
|
|
|
+ patentAffair.setStatus(chinaLeagalStatuses.get(i).getLegalStatus());
|
|
|
+ }
|
|
|
+ contentMap.put(0, chinaLeagalStatuses.get(i).getLegalDate());
|
|
|
+ contentMap.put(1, chinaLeagalStatuses.get(i).getLegalStatus());
|
|
|
+ contentMap.put(2, chinaLeagalStatuses.get(i).getLegalStatusInfo());
|
|
|
+ contentMap.put(3, chinaLeagalStatuses.get(i).getDETAIL());
|
|
|
+ ArrayList<KeyValueVO.InpadocData> inpadocDatas = new ArrayList<>();
|
|
|
+ for (int j = 0; j < 4; j++) {
|
|
|
+ KeyValueVO.InpadocData inpadocData = new KeyValueVO.InpadocData();
|
|
|
+ inpadocData.setName(nameMap.get(j));
|
|
|
+ inpadocData.setContent(contentMap.get(j));
|
|
|
+ inpadocDatas.add(inpadocData);
|
|
|
+ }
|
|
|
+ KeyValueVO keyValueVO = new KeyValueVO();
|
|
|
+ keyValueVO.setInpadocData(inpadocDatas);
|
|
|
+ lst.add(keyValueVO);
|
|
|
}
|
|
|
- KeyValueVO keyValueVO = new KeyValueVO();
|
|
|
- keyValueVO.setInpadocData(inpadocDatas);
|
|
|
- lst.add(keyValueVO);
|
|
|
+ //装载事务表的status(公开|授权|驳回|权力转移。。。)
|
|
|
+ String content = JSONObject.toJSONString(lst);
|
|
|
+ patentAffair.setContent(content);
|
|
|
+ uploadParamsVO.setPatentAffair(patentAffair);
|
|
|
}
|
|
|
- //装载事务表的status(公开|授权|驳回|权力转移。。。)
|
|
|
- String content = JSONObject.toJSONString(lst);
|
|
|
- patentAffair.setContent(content);
|
|
|
- uploadParamsVO.setPatentAffair(patentAffair);
|
|
|
}
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -547,10 +737,13 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
StringBuilder builder = new StringBuilder();
|
|
|
while (matcher.find()) {
|
|
|
String macherGroup = matcher.group();
|
|
|
- String right = macherGroup.replaceAll("<.*?>", "").trim();
|
|
|
+ String right = macherGroup.replaceAll("<!--.*?-->", "").trim();
|
|
|
+ right = right.replaceAll("<.*?>", "").trim();
|
|
|
builder.append(right).append("\r\n");
|
|
|
}
|
|
|
|
|
|
+// <!-- SIPO <DP n="1"> -->
|
|
|
+
|
|
|
String patentRightText = builder + "";
|
|
|
|
|
|
//使用工具类去除字符串文本中的所有HTML格式标签
|
|
@@ -590,7 +783,7 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
String text = "";
|
|
|
while (matcher.find()) {
|
|
|
text = matcher.group();
|
|
|
- text = text.replaceAll("<invention-title(.*?)</invention-title>", "");
|
|
|
+ text = text.replaceAll("<invention-title[^>]*>.*?(\\n{0,}|\\s{0,}?)</invention-title>", "");
|
|
|
text = text.replaceAll("<br/>", "");
|
|
|
text = text.replaceAll("\\s", "");
|
|
|
}
|
|
@@ -643,42 +836,54 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
* @param uploadParamsVO 专利实体类对象
|
|
|
*/
|
|
|
public void setPatentInstructionPDF(StarPatentVO starPatent, UploadParamsVO uploadParamsVO) throws IOException {
|
|
|
- //根据专利号调用"获得世界专利pdf"接口,获得pdf的url地址
|
|
|
- if (starPatent.getPatentNo() != null && !starPatent.getPatentNo().equals("")) {
|
|
|
- String pdfUrl = patentStarApiService.getEnPdfApi(starPatent.getPatentNo());
|
|
|
- URL url = new URL(pdfUrl); //想要读取的url地址
|
|
|
- InputStream in = url.openStream();
|
|
|
-
|
|
|
- File file = File.createTempFile("new_url", ".pdf"); //创建文件
|
|
|
- OutputStream os = new FileOutputStream(file); //创建文件输出流
|
|
|
- int bytesRead;
|
|
|
- byte[] buffer = new byte[8192];
|
|
|
- int len = 8192;
|
|
|
- while ((bytesRead = in.read(buffer, 0, len)) != -1) {
|
|
|
- os.write(buffer, 0, bytesRead);
|
|
|
+ String pdfUrl = "", pdfUrlOA = "", pdfUrlOC = "";
|
|
|
+ if ((starPatent.getPatentNo() != null && !starPatent.getPatentNo().equals("")) || (starPatent.getApplicationNo() != null && !starPatent.getApplicationNo().equals(""))) {
|
|
|
+ //根据申请号调用"获得中国专利pdf"接口,获得1个或2个pdf的url地址
|
|
|
+ if (starPatent.getPatentNo().contains("CN")) {
|
|
|
+ String appNo = starPatent.getApplicationNo();
|
|
|
+ if (appNo.contains(".")) {
|
|
|
+ appNo = appNo.substring(0, appNo.lastIndexOf("."));
|
|
|
+ }
|
|
|
+ String pdfUrlStr = patentStarApiService.getCnPdfApi(appNo);
|
|
|
+ if (pdfUrlStr.equals("")) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (pdfUrlStr.contains("|http")) { //若包含公开和授权两个pdf
|
|
|
+ String[] pdfUrlArr = pdfUrlStr.split("\\|http");
|
|
|
+ pdfUrlOA = pdfUrlArr[0].substring(pdfUrlArr[0].indexOf("http"), pdfUrlArr[0].indexOf("0A_CN_0.pdf") + 11);
|
|
|
+ pdfUrlArr[1] = "|http" + pdfUrlArr[1];
|
|
|
+ pdfUrlOC = pdfUrlArr[1].substring(pdfUrlArr[1].indexOf("http"), pdfUrlArr[1].indexOf("0C_CN_0.pdf") + 11);
|
|
|
+ } else if (pdfUrlStr.contains("0A_CN_0.pdf")) { //若只有一个且是OA
|
|
|
+ pdfUrlOA = pdfUrlStr.substring(pdfUrlStr.indexOf("http"), pdfUrlStr.indexOf("0A_CN_0.pdf") + 11);
|
|
|
+ } else if (pdfUrlStr.contains("0C_CN_0.pdf")) { //若只有一个且是OC
|
|
|
+ pdfUrlOC = pdfUrlStr.substring(pdfUrlStr.indexOf("http"), pdfUrlStr.indexOf("0C_CN_0.pdf") + 11);
|
|
|
+ //外国专利检索世界pdf接口
|
|
|
+ }
|
|
|
+ //根据专利号调用"获得世界专利pdf"接口,获得pdf的url地址
|
|
|
+ } else {
|
|
|
+ pdfUrl = patentStarApiService.getEnPdfApi(starPatent.getPatentNo());
|
|
|
+ if (pdfUrl.equals("")) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
- //关闭释放流
|
|
|
- os.close();
|
|
|
- in.close();
|
|
|
-
|
|
|
- DiskFileItemFactory diskFileItemFactory = new DiskFileItemFactory(16, null);
|
|
|
- FileItem item = diskFileItemFactory.createItem(file.getName(), "text/plain", true, file.getName());
|
|
|
- buffer = new byte[8192];
|
|
|
- FileInputStream fis = new FileInputStream(file);
|
|
|
- OutputStream fos = item.getOutputStream();
|
|
|
- len = 8192;
|
|
|
- while ((bytesRead = fis.read(buffer, 0, len)) != -1) {
|
|
|
- fos.write(buffer, 0, bytesRead);
|
|
|
+
|
|
|
+ if (!pdfUrl.equals("")) {
|
|
|
+ UploadFileDTO fileDTO = downLoadPdf(pdfUrl);
|
|
|
+ uploadParamsVO.setFileDTO(fileDTO);
|
|
|
+ } else if (!pdfUrlOA.equals("") && !pdfUrlOC.equals("")) {
|
|
|
+ UploadFileDTO fileDTO = downLoadPdf(pdfUrlOA);
|
|
|
+ uploadParamsVO.setFileDTO(fileDTO);
|
|
|
+ UploadFileDTO fileDTO2 = downLoadPdf(pdfUrlOC);
|
|
|
+ uploadParamsVO.setFileDTO2(fileDTO2);
|
|
|
+ } else if (!pdfUrlOA.equals("")) {
|
|
|
+ UploadFileDTO fileDTO = downLoadPdf(pdfUrlOA);
|
|
|
+ uploadParamsVO.setFileDTO(fileDTO);
|
|
|
+ } else if (!pdfUrlOC.equals("")) {
|
|
|
+ UploadFileDTO fileDTO2 = downLoadPdf(pdfUrlOC);
|
|
|
+ uploadParamsVO.setFileDTO2(fileDTO2);
|
|
|
}
|
|
|
- //关闭释放流
|
|
|
- fos.close();
|
|
|
- fis.close();
|
|
|
- MultipartFile multipartFile = new CommonsMultipartFile(item);
|
|
|
- UploadFileDTO fileDTO = fileUtils.uploadFile(multipartFile);
|
|
|
- uploadParamsVO.setFileDTO(fileDTO);
|
|
|
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -729,7 +934,7 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
*/
|
|
|
public void downLoadIsAddPatentNos(List<String> isAddPatentNos, Task task, String orderBy, String orderByType, String dbType, List<String> cells, String conditions) throws IOException {
|
|
|
if (conditions == null) {
|
|
|
- conditions = "(AN=(" + StringUtils.join(isAddPatentNos, " OR ") + "))";
|
|
|
+ conditions = "AN=(" + StringUtils.join(isAddPatentNos, " OR ") + ")";
|
|
|
}
|
|
|
|
|
|
int pageNum = 1;
|
|
@@ -794,6 +999,39 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ public UploadFileDTO downLoadPdf(String pdfUrl) throws IOException {
|
|
|
+ URL url = new URL(pdfUrl); //想要读取的url地址
|
|
|
+ InputStream in = url.openStream();
|
|
|
+
|
|
|
+ File file = File.createTempFile("new_url", ".pdf"); //创建文件
|
|
|
+ OutputStream os = new FileOutputStream(file); //创建文件输出流
|
|
|
+ int bytesRead;
|
|
|
+ byte[] buffer = new byte[8192];
|
|
|
+ int len = 8192;
|
|
|
+ while ((bytesRead = in.read(buffer, 0, len)) != -1) {
|
|
|
+ os.write(buffer, 0, bytesRead);
|
|
|
+ }
|
|
|
+ //关闭释放流
|
|
|
+ os.close();
|
|
|
+ in.close();
|
|
|
+
|
|
|
+ DiskFileItemFactory diskFileItemFactory = new DiskFileItemFactory(16, null);
|
|
|
+ FileItem item = diskFileItemFactory.createItem(file.getName(), "text/plain", true, file.getName());
|
|
|
+ buffer = new byte[8192];
|
|
|
+ FileInputStream fis = new FileInputStream(file);
|
|
|
+ OutputStream fos = item.getOutputStream();
|
|
|
+ len = 8192;
|
|
|
+ while ((bytesRead = fis.read(buffer, 0, len)) != -1) {
|
|
|
+ fos.write(buffer, 0, bytesRead);
|
|
|
+ }
|
|
|
+ //关闭释放流
|
|
|
+ fos.close();
|
|
|
+ fis.close();
|
|
|
+ MultipartFile multipartFile = new CommonsMultipartFile(item);
|
|
|
+ UploadFileDTO fileDTO = fileUtils.uploadFile(multipartFile);
|
|
|
+ return fileDTO;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 专利之星返回日期格式为字符串 yyyyMMdd,如 "20230713",本方法将其转成10位数字时间戳
|
|
|
*
|