|
@@ -1,5 +1,6 @@
|
|
|
package cn.cslg.pas.service.upLoadPatent;
|
|
|
|
|
|
+import cn.cslg.pas.common.model.dto.PatentDTO;
|
|
|
import cn.cslg.pas.common.model.dto.UploadFileDTO;
|
|
|
import cn.cslg.pas.common.model.outApi.PatentStarListDto;
|
|
|
import cn.cslg.pas.common.model.vo.KeyValueVO;
|
|
@@ -13,9 +14,11 @@ import cn.cslg.pas.domain.asso.TaskCondition;
|
|
|
import cn.cslg.pas.service.TaskService;
|
|
|
import cn.cslg.pas.service.UploadPatentBatchService;
|
|
|
import cn.cslg.pas.service.asso.TaskConditionService;
|
|
|
+import cn.cslg.pas.service.getPatentStarPart.GetPatentStarPartService;
|
|
|
import cn.cslg.pas.service.outApi.PatentStarApiService;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.fileupload.FileItem;
|
|
@@ -51,6 +54,7 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
private final UploadPatentBatchService uploadPatentBatchService;
|
|
|
private final TaskService taskService;
|
|
|
private final TaskConditionService taskConditionService;
|
|
|
+ private final QuestionRecordService questionRecordService;
|
|
|
private Integer pTaskId = 0;
|
|
|
private Integer pTaskStatus = 0;
|
|
|
|
|
@@ -223,6 +227,9 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
|
|
|
//如果完成数量大于0,则当前下载任务为暂停后的继续下载,则开始位置更新
|
|
|
if (successNum > 0) {
|
|
|
+ if (startNumber == null) { //多个专利号导入任务没有startNumber这些值
|
|
|
+ startNumber = 0;
|
|
|
+ }
|
|
|
startNumber += successNum;
|
|
|
}
|
|
|
|
|
@@ -306,22 +313,13 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //若是暂停后继续的任务,若 successNum > startToEndNum,即已经下载完了起止条数中的专利
|
|
|
- int fromIndex = 0;
|
|
|
- if (successNum > 0 && successNum > startToEndNum) {
|
|
|
- fromIndex = successNum - startToEndNum;
|
|
|
- }
|
|
|
//下载isAdd中的专利 / 下载多个专利号导入接口的专利 ↓
|
|
|
if (isAddPatentNos != null && isAddPatentNos.size() > 0) {
|
|
|
- if (fromIndex > 0 && fromIndex < isAddPatentNos.size() - 1) {
|
|
|
- isAddPatentNos = isAddPatentNos.subList(fromIndex, isAddPatentNos.size());
|
|
|
- } else if (fromIndex == isAddPatentNos.size() - 1) {
|
|
|
- isAddPatentNos = Arrays.asList(isAddPatentNos.get(isAddPatentNos.size() - 1));
|
|
|
- }
|
|
|
-
|
|
|
//判断isAdd中的多个专利号或申请号,即判断是检索页面手动勾选的多个专利下载/还是多个专利号导入的下载任务
|
|
|
if (task.getIsAddType() != null && task.getIsAddType().equals(2)) {
|
|
|
//若是多个专利号导入的下载
|
|
|
+ String patentNoCondition = StringUtils.join(isAddPatentNos, " OR ");
|
|
|
+ conditions = "AN=(" + patentNoCondition + ") OR PN=(" + patentNoCondition + ") OR GN=(" + patentNoCondition + ")";
|
|
|
downLoadIsAddPatentNos(isAddPatentNos, task, orderBy, orderByType, dbType, cells, conditions);
|
|
|
} else {
|
|
|
//若是检索页面手动勾选的多个专利的下载
|
|
@@ -347,6 +345,13 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
* @param uploadParamsVO 专利实体类对象
|
|
|
*/
|
|
|
public void setPatentZhuLu(StarPatentVO starPatent, UploadParamsVO uploadParamsVO) throws IOException {
|
|
|
+ String usedPatentNo;
|
|
|
+ if (starPatent.getPublicNo() != null && !starPatent.getPublicNo().equals("")) {
|
|
|
+ usedPatentNo = starPatent.getPublicNo();
|
|
|
+ } else {
|
|
|
+ usedPatentNo = starPatent.getPatentNo();
|
|
|
+ }
|
|
|
+
|
|
|
//以下 ↓装载的是调用"一般检索"接口返回的专利相关数据
|
|
|
//装载专利类型
|
|
|
Integer patentType = starPatent.getPatentType();
|
|
@@ -470,10 +475,6 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
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());
|
|
@@ -483,6 +484,10 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
int timeStamp = stringDateToTimeStamp(starPatent.getPriorityDate());
|
|
|
uploadParamsVO.getPatent().setPriorityDate(timeStamp);
|
|
|
}
|
|
|
+ //装载受理局
|
|
|
+ if (starPatent.getBureau() != null && !starPatent.getBureau().equals("")) {
|
|
|
+ uploadParamsVO.getPatent().setBureau(starPatent.getBureau());
|
|
|
+ }
|
|
|
|
|
|
|
|
|
String appNo;
|
|
@@ -494,9 +499,9 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
|
|
|
try {
|
|
|
//以下 ↓装载的是调用"获得中国专利著录"接口返回的专利相关数据
|
|
|
- if (starPatent.getPatentNo().contains("CN")) {
|
|
|
+ if ((starPatent.getPublicNo() != null && starPatent.getPublicNo().contains("CN")) || (starPatent.getPublicNo() == null && starPatent.getPatentNo().contains("CN"))) {
|
|
|
String chinaPatentZhuLuStr = patentStarApiService.getCnBibApi(appNo);
|
|
|
- if (chinaPatentZhuLuStr != null && !chinaPatentZhuLuStr.trim().equals("") && !chinaPatentZhuLuStr.equals("{}")) {
|
|
|
+ if (chinaPatentZhuLuStr != null && !chinaPatentZhuLuStr.trim().equals("") && !chinaPatentZhuLuStr.equals("{}") && !chinaPatentZhuLuStr.contains("请求不合法")) {
|
|
|
List<ChinaPatentZhuLu> chinaPatentZhuLus = JSON.parseArray(chinaPatentZhuLuStr, ChinaPatentZhuLu.class);
|
|
|
ChinaPatentZhuLu chinaPatentZhuLu = chinaPatentZhuLus.get(0);
|
|
|
//装载申请人地址
|
|
@@ -555,7 +560,7 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
}
|
|
|
}
|
|
|
} else { //以下 ↓装载的是调用"获得世界专利著录"接口返回的专利相关数据
|
|
|
- String worldPatentZhuLuStr = patentStarApiService.getENBibApi(starPatent.getPatentNo());
|
|
|
+ String worldPatentZhuLuStr = patentStarApiService.getENBibApi(usedPatentNo);
|
|
|
List<WorldPatentZhuLu> worldPatentZhuLus = JSON.parseArray(worldPatentZhuLuStr, WorldPatentZhuLu.class);
|
|
|
WorldPatentZhuLu worldPatentZhuLu = worldPatentZhuLus.get(0);
|
|
|
|
|
@@ -588,8 +593,12 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
uploadParamsVO.setIpcList(Arrays.asList(ipcArr));
|
|
|
}
|
|
|
//装载CPC分类号
|
|
|
- String[] cpcArr = worldPatentZhuLu.getCpc().split(";");
|
|
|
- uploadParamsVO.setCpcList(Arrays.asList(cpcArr));
|
|
|
+ if (uploadParamsVO.getCpcList() == null || uploadParamsVO.getCpcList().size() == 0) {
|
|
|
+ if (worldPatentZhuLu.getCpc() != null && !worldPatentZhuLu.getCpc().equals("")) {
|
|
|
+ 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(";")));
|
|
@@ -612,11 +621,11 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
uploadParamsVO.getPatent().setPriorityNo(worldPatentZhuLu.getPr());
|
|
|
}
|
|
|
//装载标题
|
|
|
- if (uploadParamsVO.getPatent().getName() == null && uploadParamsVO.getPatent().getName().equals("")) {
|
|
|
+ if (uploadParamsVO.getPatent().getName() == null || uploadParamsVO.getPatent().getName().equals("")) {
|
|
|
uploadParamsVO.getPatent().setName(worldPatentZhuLu.getTitle());
|
|
|
}
|
|
|
//装载摘要
|
|
|
- if (uploadParamsVO.getPatent().getAbstractStr() == null && uploadParamsVO.getPatent().getAbstractStr().equals("")) {
|
|
|
+ if (uploadParamsVO.getPatent().getAbstractStr() == null || uploadParamsVO.getPatent().getAbstractStr().equals("")) {
|
|
|
uploadParamsVO.getPatent().setAbstractStr(worldPatentZhuLu.getAbstract());
|
|
|
}
|
|
|
|
|
@@ -624,94 +633,67 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
}
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
-
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
//以下 ↓装载的是调用"获得同族专利"接口返回的专利相关数据
|
|
|
try {
|
|
|
if (starPatent.getPatentNo() != null && !starPatent.getPatentNo().equals("")) {
|
|
|
- String familyPatentNoStr = patentStarApiService.getFamilyByPubNoApi(starPatent.getPatentNo());
|
|
|
- if (!familyPatentNoStr.equals("no data")) {
|
|
|
+ String familyPatentNoStr = patentStarApiService.getFamilyByPubNoApi(usedPatentNo);
|
|
|
+ if (!familyPatentNoStr.equals("no data") && !familyPatentNoStr.equals("{}")) {
|
|
|
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);
|
|
|
- }
|
|
|
- }
|
|
|
+ List<String> familyPatentNos = Arrays.asList(familyPatentNo.getFamilyinfo().split(";"));
|
|
|
+ uploadParamsVO.setSimpleFamily(familyPatentNos);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
} catch (Exception e) {
|
|
|
-
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
//以下 ↓装载的是调用"获得中国专利法律状态"接口返回的专利相关数据
|
|
|
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);
|
|
|
+ if ((starPatent.getPublicNo() != null && starPatent.getPublicNo().contains("CN")) || (starPatent.getPublicNo() == null && starPatent.getPatentNo().contains("CN"))) {
|
|
|
+ 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();
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -722,40 +704,64 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
* @param starPatent 专利之星著录对象
|
|
|
* @param uploadParamsVO 专利实体类对象
|
|
|
*/
|
|
|
- public void setPatentClaim(StarPatentVO starPatent, UploadParamsVO uploadParamsVO) throws IOException {
|
|
|
- String appNo;
|
|
|
- if (starPatent.getApplicationNo().contains(".")) {
|
|
|
- appNo = starPatent.getApplicationNo().substring(0, starPatent.getApplicationNo().lastIndexOf("."));
|
|
|
- } else {
|
|
|
- appNo = starPatent.getApplicationNo();
|
|
|
- }
|
|
|
- //根据申请号调用"获得中国专利全文文本"接口,获得包含各种xml标签的专利全文内容的长字符串 cnFullXmlStr
|
|
|
- String cnFullXmlStr = patentStarApiService.getCnFullXmlApi(appNo);
|
|
|
-
|
|
|
- //使用正则表达式拼接出权要原文
|
|
|
- String regex = "(?<=<claim id=.{1,110}>)[\\w\\W]+?(?=</claim>)";
|
|
|
- Pattern compile = Pattern.compile(regex);
|
|
|
- Matcher matcher = compile.matcher(cnFullXmlStr);
|
|
|
- StringBuilder builder = new StringBuilder();
|
|
|
- while (matcher.find()) {
|
|
|
- String macherGroup = matcher.group();
|
|
|
- String right = macherGroup.replaceAll("<!--.*?-->", "").trim();
|
|
|
- right = right.replaceAll("<.*?>", "").trim();
|
|
|
- builder.append(right).append("\r\n");
|
|
|
- }
|
|
|
+ public Boolean setPatentClaim(StarPatentVO starPatent, UploadParamsVO uploadParamsVO, PQueueData pQueueData) throws IOException {
|
|
|
+ try {
|
|
|
+ if ((starPatent.getPublicNo() != null && starPatent.getPublicNo().contains("CN")) || (starPatent.getPublicNo() == null && starPatent.getPatentNo().contains("CN"))) {
|
|
|
+ String applicationNo = starPatent.getApplicationNo() + "";
|
|
|
+ String appNo;
|
|
|
+ if (starPatent.getApplicationNo().contains(".")) {
|
|
|
+ appNo = starPatent.getApplicationNo().substring(0, starPatent.getApplicationNo().lastIndexOf("."));
|
|
|
+ } else {
|
|
|
+ appNo = starPatent.getApplicationNo();
|
|
|
+ }
|
|
|
|
|
|
-// <!-- SIPO <DP n="1"> -->
|
|
|
+ //根据申请号调用"获得中国专利全文文本"接口,获得包含各种xml标签的专利全文内容的长字符串 cnFullXmlStr
|
|
|
+ String cnFullXmlStr = patentStarApiService.getCnFullXmlApi(appNo);
|
|
|
|
|
|
- String patentRightText = builder + "";
|
|
|
+ //若没有取到全文文本即取不到权要,则将该专利检索专利之星接口次数+1,重新丢入权要生产队列,将当前申请号或专利号和备注信息记录到问题记录表,返回false
|
|
|
+ if (cnFullXmlStr.equals("")) {
|
|
|
+ if (pQueueData != null && pQueueData.getCallNum() < 2) {
|
|
|
+ pQueueData.setCallNum(pQueueData.getCallNum() + 1);
|
|
|
+ pantentQueueService.rightToPQueue(pQueueData);
|
|
|
+ recordQuestionPatent(applicationNo, pQueueData.getTask().getId(), 2);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ recordQuestionPatent(applicationNo, null, 2);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ //使用正则表达式拼接出权要原文
|
|
|
+ String regex = "(?<=<claim id=.{1,110}>)[\\w\\W]+?(?=</claim>)";
|
|
|
+ Pattern compile = Pattern.compile(regex);
|
|
|
+ Matcher matcher = compile.matcher(cnFullXmlStr);
|
|
|
+ StringBuilder builder = new StringBuilder();
|
|
|
+ while (matcher.find()) {
|
|
|
+ String macherGroup = matcher.group();
|
|
|
+ String right = macherGroup.replaceAll("<!--.*?-->", "").trim();
|
|
|
+ right = right.replaceAll("<.*?>", "").trim();
|
|
|
+ right = right.replaceAll(" +", "");
|
|
|
+ right = right.replace("\r\n", "").replace("\n", "");
|
|
|
+ builder.append(right).append("\r\n");
|
|
|
+ }
|
|
|
|
|
|
- //使用工具类去除字符串文本中的所有HTML格式标签
|
|
|
- patentRightText = RemoveHtmlTagsUtils.removeHtmlTags(patentRightText);
|
|
|
- patentRightText = patentRightText.trim();
|
|
|
+ String patentRightText = builder + "";
|
|
|
|
|
|
- //装载权利要求原文
|
|
|
- PatentRight patentRight = new PatentRight();
|
|
|
- patentRight.setContent(patentRightText);
|
|
|
- uploadParamsVO.setPatentRight(patentRight);
|
|
|
+ //使用工具类去除字符串文本中的所有HTML格式标签
|
|
|
+ patentRightText = RemoveHtmlTagsUtils.removeHtmlTags(patentRightText);
|
|
|
+ patentRightText = patentRightText.trim();
|
|
|
+
|
|
|
+ //装载权利要求原文
|
|
|
+ PatentRight patentRight = new PatentRight();
|
|
|
+ patentRight.setContent(patentRightText);
|
|
|
+ uploadParamsVO.setPatentRight(patentRight);
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -765,69 +771,56 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
* @param starPatent 专利之星著录对象
|
|
|
* @param uploadParamsVO 专利实体类对象
|
|
|
*/
|
|
|
- public void setPatentInstructionText(StarPatentVO starPatent, UploadParamsVO uploadParamsVO) throws IOException {
|
|
|
- String appNo;
|
|
|
- if (starPatent.getApplicationNo().contains(".")) {
|
|
|
- appNo = starPatent.getApplicationNo().substring(0, starPatent.getApplicationNo().lastIndexOf("."));
|
|
|
- } else {
|
|
|
- appNo = starPatent.getApplicationNo();
|
|
|
- }
|
|
|
- //根据申请号调用"获得中国专利全文文本"接口,获得包含各种xml标签的专利全文内容的长字符串 cnFullXmlStr
|
|
|
- String cnFullXmlStr = patentStarApiService.getCnFullXmlApi(appNo);
|
|
|
-
|
|
|
- //使用正则表达式拼接出说明书文本全文
|
|
|
- String regex = "(?<=<description>)[\\w\\W]+?(?=</description>)";
|
|
|
- Pattern compile = Pattern.compile(regex);
|
|
|
- Matcher matcher = compile.matcher(cnFullXmlStr);
|
|
|
-// StringBuilder builder = new StringBuilder();
|
|
|
-// String regexTable = "(?<=<tables[^>]{1,50}>)[\\w\\W]+?(?=</tables>)";
|
|
|
-// Pattern compileTable = Pattern.compile(regexTable);
|
|
|
- String text = "";
|
|
|
- while (matcher.find()) {
|
|
|
- text = matcher.group();
|
|
|
- text = text.replaceAll("<invention-title[^>]*>.*?(\\n{0,}|\\s{0,}?)</invention-title>", "");
|
|
|
- text = text.replaceAll("<br/>", "");
|
|
|
- text = text.replaceAll("\\s", "");
|
|
|
+ public Boolean setPatentInstructionText(StarPatentVO starPatent, UploadParamsVO uploadParamsVO, PQueueData pQueueData) throws IOException {
|
|
|
+ try {
|
|
|
+ if ((starPatent.getPublicNo() != null && starPatent.getPublicNo().contains("CN")) || (starPatent.getPublicNo() == null && starPatent.getPatentNo().contains("CN"))) {
|
|
|
+ String applicationNo = starPatent.getApplicationNo() + "";
|
|
|
+ String appNo;
|
|
|
+ if (starPatent.getApplicationNo().contains(".")) {
|
|
|
+ appNo = starPatent.getApplicationNo().substring(0, starPatent.getApplicationNo().lastIndexOf("."));
|
|
|
+ } else {
|
|
|
+ appNo = starPatent.getApplicationNo();
|
|
|
+ }
|
|
|
+
|
|
|
+ //根据申请号调用"获得中国专利全文文本"接口,获得包含各种xml标签的专利全文内容的长字符串 cnFullXmlStr
|
|
|
+ String cnFullXmlStr = patentStarApiService.getCnFullXmlApi(appNo);
|
|
|
+
|
|
|
+ //若没有取到全文文本,即取不到说明书文本,则将当前申请号或专利号和备注信息记录到问题记录表
|
|
|
+ if (cnFullXmlStr.equals("")) {
|
|
|
+ if (pQueueData != null && pQueueData.getCallNum() < 2) {
|
|
|
+ pQueueData.setCallNum(pQueueData.getCallNum() + 1);
|
|
|
+ pantentQueueService.rightToPQueue(pQueueData);
|
|
|
+ recordQuestionPatent(applicationNo, pQueueData.getTask().getId(), 3);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ recordQuestionPatent(applicationNo, null, 3);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ //使用正则表达式拼接出说明书文本全文
|
|
|
+ String regex = "(?<=<description>)[\\w\\W]+?(?=</description>)";
|
|
|
+ Pattern compile = Pattern.compile(regex);
|
|
|
+ Matcher matcher = compile.matcher(cnFullXmlStr);
|
|
|
+ String text = "";
|
|
|
+ while (matcher.find()) {
|
|
|
+ text = matcher.group();
|
|
|
+ text = text.replaceAll("<invention-title[^>]*>.*?(\\n{0,}|\\s{0,}?)</invention-title>", "");
|
|
|
+ text = text.replaceAll("<br/>", "");
|
|
|
+ text = text.replaceAll("\\s", "");
|
|
|
+ }
|
|
|
+
|
|
|
+ //装载说明书文本全文
|
|
|
+ PatentInstructionText patentInstructionText = new PatentInstructionText();
|
|
|
+ patentInstructionText.setManual(text.trim());
|
|
|
+ uploadParamsVO.setPatentInstructionText(patentInstructionText);
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return true;
|
|
|
}
|
|
|
-// String oldRow = matcher.group();
|
|
|
-// oldRow = oldRow.replaceAll("\\s", "");
|
|
|
-// if (oldRow.contains("num=\"n")) {
|
|
|
-// oldRow = oldRow.substring(oldRow.indexOf("num=\"n") + 6);
|
|
|
-// oldRow = "[" + oldRow;
|
|
|
-// oldRow = oldRow.replace("\">", "]");
|
|
|
-// } else if (oldRow.contains("num=")) {
|
|
|
-// oldRow = oldRow.substring(oldRow.indexOf("num=") + 5);
|
|
|
-// oldRow = "[" + oldRow;
|
|
|
-// oldRow = oldRow.replace("\">", "]");
|
|
|
-// } else {
|
|
|
-// oldRow = oldRow.substring(oldRow.indexOf("\">") + 2);
|
|
|
-// }
|
|
|
-// Matcher matcherTable = compileTable.matcher(oldRow);
|
|
|
-// StringBuilder builder1 = new StringBuilder();
|
|
|
-// while (matcherTable.find()) {
|
|
|
-// String tableGroup = matcherTable.group();
|
|
|
-// tableGroup = tableGroup.replaceAll("<tgroup[^>]*>", "").replaceAll("</tgroup >", "").replaceAll("<colspec[^>]*>", "").
|
|
|
-// replaceAll("</colspec>", "").replaceAll("<colspec", "<td").replaceAll("row", "tr").
|
|
|
-// replaceAll("entry", "td");
|
|
|
-// builder1.append(tableGroup);
|
|
|
-// }
|
|
|
-// if ((builder1 + "").length() > 0) {
|
|
|
-// oldRow = builder1 + "";
|
|
|
-// }
|
|
|
-
|
|
|
-// builder.append(oldRow).append("\r\n");
|
|
|
-// }
|
|
|
-
|
|
|
-// String instructionText = builder + "";
|
|
|
-
|
|
|
- //使用工具类去除字符串文本中的所有HTML格式标签
|
|
|
-// instructionText = RemoveHtmlTagsUtils.removeHtmlTags(instructionText);
|
|
|
-// instructionText = instructionText.trim();
|
|
|
-
|
|
|
- //装载说明书文本全文
|
|
|
- PatentInstructionText patentInstructionText = new PatentInstructionText();
|
|
|
- patentInstructionText.setManual(text.trim());
|
|
|
- uploadParamsVO.setPatentInstructionText(patentInstructionText);
|
|
|
+
|
|
|
+ return true;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -837,54 +830,75 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
* @param starPatent 专利之星著录对象
|
|
|
* @param uploadParamsVO 专利实体类对象
|
|
|
*/
|
|
|
- public void setPatentInstructionPDF(StarPatentVO starPatent, UploadParamsVO uploadParamsVO) throws IOException {
|
|
|
- String pdfUrl = "", pdfUrl1 = "", pdfUrl2 = "";
|
|
|
- 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");
|
|
|
- pdfUrl1 = pdfUrlArr[0].substring(pdfUrlArr[0].indexOf("http"), pdfUrlArr[0].indexOf("?"));
|
|
|
- pdfUrlArr[1] = "http" + pdfUrlArr[1];
|
|
|
- pdfUrl2 = pdfUrlArr[1].substring(pdfUrlArr[1].indexOf("http"), pdfUrlArr[1].indexOf("?"));
|
|
|
- UploadFileDTO fileDTO = downLoadPdf(pdfUrl1);
|
|
|
- UploadFileDTO fileDTO2 = downLoadPdf(pdfUrl2);
|
|
|
- if (pdfUrl1.contains("0A_CN_0.pdf")) {
|
|
|
- uploadParamsVO.setPdf1FileDTO(fileDTO);
|
|
|
- uploadParamsVO.setPdf2FileDTO(fileDTO2);
|
|
|
- } else {
|
|
|
- uploadParamsVO.setPdf1FileDTO(fileDTO2);
|
|
|
- uploadParamsVO.setPdf2FileDTO(fileDTO);
|
|
|
+ public void setPatentInstructionPDF(StarPatentVO starPatent, UploadParamsVO uploadParamsVO, Task task) throws IOException {
|
|
|
+ String usedPatentNo;
|
|
|
+ if (starPatent.getPublicNo() != null && !starPatent.getPublicNo().equals("")) {
|
|
|
+ usedPatentNo = starPatent.getPublicNo();
|
|
|
+ } else {
|
|
|
+ usedPatentNo = starPatent.getPatentNo();
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ String pdfUrl = "", pdfUrl1 = "", pdfUrl2 = "";
|
|
|
+ if ((starPatent.getPatentNo() != null && !starPatent.getPatentNo().equals("")) || (starPatent.getApplicationNo() != null && !starPatent.getApplicationNo().equals(""))) {
|
|
|
+ //先根据公开号判断国家,若没有公开号再根据申请号判断,调用"获得中国专利pdf"接口,获得1个或2个pdf的url地址
|
|
|
+ if ((starPatent.getPublicNo() != null && starPatent.getPublicNo().contains("CN")) || (starPatent.getPublicNo() == null && starPatent.getPatentNo().contains("CN"))) {
|
|
|
+ String appNo = starPatent.getApplicationNo();
|
|
|
+ if (appNo.contains(".")) {
|
|
|
+ appNo = appNo.substring(0, appNo.lastIndexOf("."));
|
|
|
}
|
|
|
- } else { //若只有一个
|
|
|
- pdfUrl1 = pdfUrlStr.substring(pdfUrlStr.indexOf("http"), pdfUrlStr.indexOf("?"));
|
|
|
- UploadFileDTO fileDTO = downLoadPdf(pdfUrl1);
|
|
|
- if (pdfUrl1.contains("0A_CN_0.pdf")) {
|
|
|
- uploadParamsVO.setPdf1FileDTO(fileDTO);
|
|
|
- } else {
|
|
|
- uploadParamsVO.setPdf2FileDTO(fileDTO);
|
|
|
+ String pdfUrlStr = patentStarApiService.getCnPdfApi(appNo);
|
|
|
+
|
|
|
+ //若没有取到说明书pdf,则将当前申请号和备注信息存入问题记录表,并返回空对象
|
|
|
+ if (pdfUrlStr.equals("")) {
|
|
|
+ recordQuestionPatent(starPatent.getApplicationNo(), task.getId(), 4);
|
|
|
+ return;
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- //根据专利号调用"获得世界专利pdf"接口,获得pdf的url地址
|
|
|
- } else {
|
|
|
- pdfUrl = patentStarApiService.getEnPdfApi(starPatent.getPatentNo());
|
|
|
- if (pdfUrl.equals("")) {
|
|
|
- return;
|
|
|
+ if (pdfUrlStr.contains("|http")) { //若包含公开和授权两个pdf
|
|
|
+ String[] pdfUrlArr = pdfUrlStr.split("\\|http");
|
|
|
+ pdfUrl1 = pdfUrlArr[0].substring(pdfUrlArr[0].indexOf("http"), pdfUrlArr[0].indexOf("?"));
|
|
|
+ pdfUrlArr[1] = "http" + pdfUrlArr[1];
|
|
|
+ pdfUrl2 = pdfUrlArr[1].substring(pdfUrlArr[1].indexOf("http"), pdfUrlArr[1].indexOf("?"));
|
|
|
+
|
|
|
+ UploadFileDTO fileDTO = downLoadPdf(pdfUrl1);
|
|
|
+ UploadFileDTO fileDTO2 = downLoadPdf(pdfUrl2);
|
|
|
+
|
|
|
+ if (pdfUrl1.contains("0A_CN_0.pdf")) {
|
|
|
+ uploadParamsVO.setPdf1FileDTO(fileDTO);
|
|
|
+ uploadParamsVO.setPdf2FileDTO(fileDTO2);
|
|
|
+ } else {
|
|
|
+ uploadParamsVO.setPdf1FileDTO(fileDTO2);
|
|
|
+ uploadParamsVO.setPdf2FileDTO(fileDTO);
|
|
|
+ }
|
|
|
+ } else { //若只有一个
|
|
|
+ pdfUrl1 = pdfUrlStr.substring(pdfUrlStr.indexOf("http"), pdfUrlStr.indexOf("?"));
|
|
|
+ UploadFileDTO fileDTO = downLoadPdf(pdfUrl1);
|
|
|
+ if (pdfUrl1.contains("0A_CN_0.pdf")) {
|
|
|
+ uploadParamsVO.setPdf1FileDTO(fileDTO);
|
|
|
+ } else {
|
|
|
+ uploadParamsVO.setPdf2FileDTO(fileDTO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //根据专利号调用"获得世界专利pdf"接口,获得pdf的url地址
|
|
|
+ } else {
|
|
|
+ pdfUrl = patentStarApiService.getEnPdfApi(usedPatentNo);
|
|
|
+
|
|
|
+ //若没有取到说明书pdf,则将当前申请号和备注信息存入问题记录表,并返回空对象
|
|
|
+ if (pdfUrl.equals("") || pdfUrl.equals("{}")) {
|
|
|
+ recordQuestionPatent(starPatent.getApplicationNo(), task.getId(), 4);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ UploadFileDTO fileDTO = downLoadPdf(pdfUrl);
|
|
|
+ uploadParamsVO.setPdf1FileDTO(fileDTO);
|
|
|
}
|
|
|
- UploadFileDTO fileDTO = downLoadPdf(pdfUrl);
|
|
|
- uploadParamsVO.setPdf1FileDTO(fileDTO);
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -894,37 +908,47 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
* @param uploadParamsVO 专利实体类对象
|
|
|
*/
|
|
|
public void setPatentPicture(StarPatentVO starPatent, UploadParamsVO uploadParamsVO) throws IOException {
|
|
|
- //取出一般接口返回的摘要附图路径
|
|
|
- String pictureUrl = starPatent.getAbstractPath();
|
|
|
- URL url = new URL(pictureUrl); //想要读取的url地址
|
|
|
- InputStream in = url.openStream();
|
|
|
- File file = File.createTempFile("new_url", ".jpg"); //创建文件
|
|
|
- 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);
|
|
|
+ try {
|
|
|
+ //调用"获取中国专利摘要附图"接口
|
|
|
+ String appNo = starPatent.getApplicationNo();
|
|
|
+ if (appNo.contains(".")) {
|
|
|
+ appNo = appNo.substring(0, appNo.lastIndexOf("."));
|
|
|
+ }
|
|
|
+ if ((starPatent.getPublicNo() != null && starPatent.getPublicNo().contains("CN")) || (starPatent.getPublicNo() == null && starPatent.getPatentNo().contains("CN"))) {
|
|
|
+ String pictureUrl = patentStarApiService.getPictureApi(appNo);
|
|
|
+ URL url = new URL(pictureUrl); //想要读取的url地址
|
|
|
+ InputStream in = url.openStream();
|
|
|
+ File file = File.createTempFile("new_url", ".jpg"); //创建文件
|
|
|
+ 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);
|
|
|
+ uploadParamsVO.setPictureFileDTO(fileDTO);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
- //关闭释放流
|
|
|
- fos.close();
|
|
|
- fis.close();
|
|
|
- MultipartFile multipartFile = new CommonsMultipartFile(item);
|
|
|
- UploadFileDTO fileDTO = fileUtils.uploadFile(multipartFile);
|
|
|
- uploadParamsVO.setPictureFileDTO(fileDTO);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -953,12 +977,14 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
}
|
|
|
|
|
|
List<StarPatentVO> starPatents = (List<StarPatentVO>) resultMap.get("records");
|
|
|
+
|
|
|
//遍历这一页的专利
|
|
|
for (StarPatentVO starPatent : starPatents) {
|
|
|
//判断若任务状态为已暂停,则结束生产
|
|
|
if (pTaskId.equals(task.getId()) && pTaskStatus == 4) {
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
try {
|
|
|
UploadParamsVO uploadParamsVO = new UploadParamsVO();
|
|
|
Patent patent = new Patent();
|
|
@@ -996,6 +1022,7 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -1089,6 +1116,25 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
return calculate;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 记录没有数据的专利信息
|
|
|
+ *
|
|
|
+ * @param applicationNoOrPatentNo 公开号/申请号
|
|
|
+ * @param taskId 任务id
|
|
|
+ * @param cell 失败字段(1著录 2权要 3说明书文本 4说明书pdf 5摘要附图)
|
|
|
+ */
|
|
|
+ public void recordQuestionPatent(String applicationNoOrPatentNo, Integer taskId, int cell) {
|
|
|
+ QuestionRecord questionRecord = new QuestionRecord()
|
|
|
+ .setPatentNo(applicationNoOrPatentNo)
|
|
|
+ .setCell(cell)
|
|
|
+ .setTaskId(taskId)
|
|
|
+ .setRemark("该申请号的该字段(2权要 3说明书文本 4说明书pdf)接口检索返回原始数据为空");
|
|
|
+ List<QuestionRecord> questionRecords = questionRecordService.list(new LambdaQueryWrapper<QuestionRecord>().eq(QuestionRecord::getPatentNo, applicationNoOrPatentNo).eq(QuestionRecord::getCell, cell));
|
|
|
+ if (questionRecords == null || questionRecords.size() == 0) {
|
|
|
+ questionRecordService.save(questionRecord);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public void setTaskStatus(Integer taskId, Integer taskStatus) {
|
|
|
this.pTaskId = taskId;
|
|
|
this.pTaskStatus = taskStatus;
|