|
@@ -1,5 +1,6 @@
|
|
package cn.cslg.pas.service.upLoadPatent;
|
|
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.dto.UploadFileDTO;
|
|
import cn.cslg.pas.common.model.outApi.PatentStarListDto;
|
|
import cn.cslg.pas.common.model.outApi.PatentStarListDto;
|
|
import cn.cslg.pas.common.model.vo.KeyValueVO;
|
|
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.TaskService;
|
|
import cn.cslg.pas.service.UploadPatentBatchService;
|
|
import cn.cslg.pas.service.UploadPatentBatchService;
|
|
import cn.cslg.pas.service.asso.TaskConditionService;
|
|
import cn.cslg.pas.service.asso.TaskConditionService;
|
|
|
|
+import cn.cslg.pas.service.getPatentStarPart.GetPatentStarPartService;
|
|
import cn.cslg.pas.service.outApi.PatentStarApiService;
|
|
import cn.cslg.pas.service.outApi.PatentStarApiService;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.fileupload.FileItem;
|
|
import org.apache.commons.fileupload.FileItem;
|
|
@@ -51,6 +54,7 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
private final UploadPatentBatchService uploadPatentBatchService;
|
|
private final UploadPatentBatchService uploadPatentBatchService;
|
|
private final TaskService taskService;
|
|
private final TaskService taskService;
|
|
private final TaskConditionService taskConditionService;
|
|
private final TaskConditionService taskConditionService;
|
|
|
|
+ private final QuestionRecordService questionRecordService;
|
|
private Integer pTaskId = 0;
|
|
private Integer pTaskId = 0;
|
|
private Integer pTaskStatus = 0;
|
|
private Integer pTaskStatus = 0;
|
|
|
|
|
|
@@ -470,10 +474,6 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
uploadParamsVO.setPatentSimpleStatus(starPatent.getSimpleStatus());
|
|
uploadParamsVO.setPatentSimpleStatus(starPatent.getSimpleStatus());
|
|
uploadParamsVO.setSimpleStatus(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("")) {
|
|
if (starPatent.getPriorityNo() != null && !starPatent.getPriorityNo().equals("")) {
|
|
uploadParamsVO.getPatent().setPriorityNo(starPatent.getPriorityNo());
|
|
uploadParamsVO.getPatent().setPriorityNo(starPatent.getPriorityNo());
|
|
@@ -483,6 +483,10 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
int timeStamp = stringDateToTimeStamp(starPatent.getPriorityDate());
|
|
int timeStamp = stringDateToTimeStamp(starPatent.getPriorityDate());
|
|
uploadParamsVO.getPatent().setPriorityDate(timeStamp);
|
|
uploadParamsVO.getPatent().setPriorityDate(timeStamp);
|
|
}
|
|
}
|
|
|
|
+ //装载受理局
|
|
|
|
+ if (starPatent.getBureau() != null && !starPatent.getBureau().equals("")) {
|
|
|
|
+ uploadParamsVO.getPatent().setBureau(starPatent.getBureau());
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
String appNo;
|
|
String appNo;
|
|
@@ -588,8 +592,12 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
uploadParamsVO.setIpcList(Arrays.asList(ipcArr));
|
|
uploadParamsVO.setIpcList(Arrays.asList(ipcArr));
|
|
}
|
|
}
|
|
//装载CPC分类号
|
|
//装载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) {
|
|
if (uploadParamsVO.getPatentApplicantOriginalName() == null || uploadParamsVO.getPatentApplicantOriginalName().size() == 0) {
|
|
uploadParamsVO.setPatentApplicantOriginalName(Arrays.asList(worldPatentZhuLu.getPa().split(";")));
|
|
uploadParamsVO.setPatentApplicantOriginalName(Arrays.asList(worldPatentZhuLu.getPa().split(";")));
|
|
@@ -624,7 +632,7 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
}
|
|
}
|
|
|
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
-
|
|
|
|
|
|
+ e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
|
|
//以下 ↓装载的是调用"获得同族专利"接口返回的专利相关数据
|
|
//以下 ↓装载的是调用"获得同族专利"接口返回的专利相关数据
|
|
@@ -633,41 +641,12 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
String familyPatentNoStr = patentStarApiService.getFamilyByPubNoApi(starPatent.getPatentNo());
|
|
String familyPatentNoStr = patentStarApiService.getFamilyByPubNoApi(starPatent.getPatentNo());
|
|
if (!familyPatentNoStr.equals("no data")) {
|
|
if (!familyPatentNoStr.equals("no data")) {
|
|
FamilyPatentNo familyPatentNo = JSON.parseObject(familyPatentNoStr, FamilyPatentNo.class);
|
|
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) {
|
|
} catch (Exception e) {
|
|
-
|
|
|
|
|
|
+ e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
|
|
//以下 ↓装载的是调用"获得中国专利法律状态"接口返回的专利相关数据
|
|
//以下 ↓装载的是调用"获得中国专利法律状态"接口返回的专利相关数据
|
|
@@ -711,7 +690,7 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
}
|
|
}
|
|
|
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
-
|
|
|
|
|
|
+ e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
@@ -723,39 +702,48 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
* @param uploadParamsVO 专利实体类对象
|
|
* @param uploadParamsVO 专利实体类对象
|
|
*/
|
|
*/
|
|
public void setPatentClaim(StarPatentVO starPatent, UploadParamsVO uploadParamsVO) throws IOException {
|
|
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");
|
|
|
|
- }
|
|
|
|
|
|
+ try {
|
|
|
|
+ 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);
|
|
|
|
|
|
-// <!-- SIPO <DP n="1"> -->
|
|
|
|
|
|
+ //若没有取到全文文本,即取不到权要,则将当前申请号或专利号和备注信息记录到问题记录表
|
|
|
|
+ if (cnFullXmlStr.equals("")) {
|
|
|
|
+ recordQuestionPatent(applicationNo, 2);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
|
|
- String patentRightText = builder + "";
|
|
|
|
|
|
+ //使用正则表达式拼接出权要原文
|
|
|
|
+ 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");
|
|
|
|
+ }
|
|
|
|
|
|
- //使用工具类去除字符串文本中的所有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();
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -766,68 +754,42 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
* @param uploadParamsVO 专利实体类对象
|
|
* @param uploadParamsVO 专利实体类对象
|
|
*/
|
|
*/
|
|
public void setPatentInstructionText(StarPatentVO starPatent, UploadParamsVO uploadParamsVO) throws IOException {
|
|
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", "");
|
|
|
|
|
|
+ try {
|
|
|
|
+ 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("")) {
|
|
|
|
+ recordQuestionPatent(applicationNo, 3);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //使用正则表达式拼接出说明书文本全文
|
|
|
|
+ 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();
|
|
}
|
|
}
|
|
-// 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);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -838,53 +800,66 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
* @param uploadParamsVO 专利实体类对象
|
|
* @param uploadParamsVO 专利实体类对象
|
|
*/
|
|
*/
|
|
public void setPatentInstructionPDF(StarPatentVO starPatent, UploadParamsVO uploadParamsVO) throws IOException {
|
|
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);
|
|
|
|
|
|
+ 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.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.getPatentNo(), 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(starPatent.getPatentNo());
|
|
|
|
+
|
|
|
|
+ //若没有取到说明书pdf,则将当前申请号和备注信息存入问题记录表,并返回空对象
|
|
|
|
+ if (pdfUrl.equals("") || pdfUrl.equals("{}")) {
|
|
|
|
+ recordQuestionPatent(starPatent.getPatentNo(), 4);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ UploadFileDTO fileDTO = downLoadPdf(pdfUrl);
|
|
|
|
+ uploadParamsVO.setPdf1FileDTO(fileDTO);
|
|
}
|
|
}
|
|
- UploadFileDTO fileDTO = downLoadPdf(pdfUrl);
|
|
|
|
- uploadParamsVO.setPdf1FileDTO(fileDTO);
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -894,37 +869,47 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
* @param uploadParamsVO 专利实体类对象
|
|
* @param uploadParamsVO 专利实体类对象
|
|
*/
|
|
*/
|
|
public void setPatentPicture(StarPatentVO starPatent, UploadParamsVO uploadParamsVO) throws IOException {
|
|
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 (appNo.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);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1089,6 +1074,24 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
return calculate;
|
|
return calculate;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 记录没有数据的专利信息
|
|
|
|
+ *
|
|
|
|
+ * @param applicationNoOrPatentNo 公开号/申请号
|
|
|
|
+ * @param cell 失败字段(1著录 2权要 3说明书文本 4说明书pdf 5摘要附图)
|
|
|
|
+ */
|
|
|
|
+ public void recordQuestionPatent(String applicationNoOrPatentNo, int cell) {
|
|
|
|
+ QuestionRecord questionRecord = new QuestionRecord()
|
|
|
|
+ .setPatentNo(applicationNoOrPatentNo)
|
|
|
|
+ .setCell(cell)
|
|
|
|
+ .setTaskId(-1)
|
|
|
|
+ .setRemark("该公开号或申请号的该字段接口检索返回原始数据为空");
|
|
|
|
+ List<QuestionRecord> questionRecords = questionRecordService.list(new LambdaQueryWrapper<QuestionRecord>().eq(QuestionRecord::getPatentNo, applicationNoOrPatentNo).eq(QuestionRecord::getCell, cell).eq(QuestionRecord::getTaskId, -1));
|
|
|
|
+ if (questionRecords == null || questionRecords.size() == 0) {
|
|
|
|
+ questionRecordService.save(questionRecord);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
public void setTaskStatus(Integer taskId, Integer taskStatus) {
|
|
public void setTaskStatus(Integer taskId, Integer taskStatus) {
|
|
this.pTaskId = taskId;
|
|
this.pTaskId = taskId;
|
|
this.pTaskStatus = taskStatus;
|
|
this.pTaskStatus = taskStatus;
|