|
@@ -19,6 +19,8 @@ import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.regex.Matcher;
|
|
|
+import java.util.regex.Pattern;
|
|
|
|
|
|
/**
|
|
|
* 专利之星类型任务解析获取专利类
|
|
@@ -80,23 +82,26 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
Patent patent = new Patent();
|
|
|
//装载专利著录
|
|
|
if (cells.contains("1")) {
|
|
|
- setPatentZhuLu(uploadParamsVO, patent, starPatent);
|
|
|
+ setPatentZhuLu(starPatent, uploadParamsVO, patent);
|
|
|
}
|
|
|
|
|
|
- uploadParamsVOs.add(uploadParamsVO);
|
|
|
-
|
|
|
-
|
|
|
//装载权要
|
|
|
-// if (cells.contains("2")) {
|
|
|
-// setPatentClaim(patentCell, pubNO);
|
|
|
-// }
|
|
|
+ if (cells.contains("2")) {
|
|
|
+ setPatentClaim(starPatent, uploadParamsVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ //装载说明书文本
|
|
|
+ if (cells.contains("3")) {
|
|
|
+ setPatentInstructionText(starPatent, uploadParamsVO);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
+ uploadParamsVOs.add(uploadParamsVO);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- System.out.println("专利总数量:" + uploadParamsVOs.size());
|
|
|
|
|
|
+ System.out.println("专利总数量:" + uploadParamsVOs.size());
|
|
|
|
|
|
}
|
|
|
|
|
@@ -104,9 +109,10 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
* 装载著录方法
|
|
|
*
|
|
|
* @param uploadParamsVO 专利实体类对象
|
|
|
+ * @param patent 专利基础数据实体类对象
|
|
|
* @param starPatent 专利之星著录对象
|
|
|
*/
|
|
|
- private void setPatentZhuLu(UploadParamsVO uploadParamsVO, Patent patent, StarPatentVO starPatent) {
|
|
|
+ private void setPatentZhuLu(StarPatentVO starPatent, UploadParamsVO uploadParamsVO, Patent patent) {
|
|
|
//装载专利号
|
|
|
patent.setPatentNo(starPatent.getPatentNo());
|
|
|
//装载申请号
|
|
@@ -136,9 +142,9 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
uploadParamsVO.setMainIpc(ipcArr[0]);
|
|
|
uploadParamsVO.setIpcList(Arrays.asList(ipcArr));
|
|
|
}
|
|
|
- //以上 ↑装载的是调用一般接口返回的专利相关数据
|
|
|
+ //以上 ↑装载的是调用"一般接口"返回的专利相关数据
|
|
|
|
|
|
- //以下 ↓装载的是调用中国专利著录接口返回的专利相关数据
|
|
|
+ //以下 ↓装载的是调用"中国专利著录接口"返回的专利相关数据
|
|
|
String appNo = starPatent.getApplicationNo().substring(0, starPatent.getApplicationNo().lastIndexOf("."));
|
|
|
//调用中国专利著录接口返回的专利相关数据最外层是一个集合"[]",但是集合中只有一个对象"{}",以下方式处理
|
|
|
String chinaPatentZhuLuStr = patentStarApiService.getCnBibApi(appNo);
|
|
@@ -164,8 +170,10 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
uploadParamsVO.setPatentAgentList(patentAgentList);
|
|
|
|
|
|
//装载代理机构地址
|
|
|
- String agencyAddress = chinaPatentZhuLu.getAGN().substring(0, chinaPatentZhuLu.getAGN().lastIndexOf(" "));
|
|
|
- patent.setAgencyId(agencyAddress);
|
|
|
+ if (chinaPatentZhuLu.getAGN() != null && !chinaPatentZhuLu.getAGN().equals("")) {
|
|
|
+ String agencyAddress = chinaPatentZhuLu.getAGN().substring(0, chinaPatentZhuLu.getAGN().lastIndexOf(" "));
|
|
|
+ patent.setAgencyId(agencyAddress);
|
|
|
+ }
|
|
|
|
|
|
//装载发明人
|
|
|
List<String> patentInventorNames = Arrays.asList(chinaPatentZhuLu.getIV().split(";"));
|
|
@@ -198,4 +206,55 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 装载权要方法
|
|
|
+ *
|
|
|
+ * @param uploadParamsVO 专利实体类对象
|
|
|
+ */
|
|
|
+ private void setPatentClaim(StarPatentVO starPatent, UploadParamsVO uploadParamsVO) throws IOException {
|
|
|
+ String appNo = starPatent.getApplicationNo().substring(0, starPatent.getApplicationNo().lastIndexOf("."));
|
|
|
+ //根据申请号调用"获得中国专利全文文本"接口,获得包含各种xml标签的专利全文内容的长字符串 cnFullXmlStr
|
|
|
+ String cnFullXmlStr = patentStarApiService.getCnFullXmlApi(appNo);
|
|
|
+
|
|
|
+ //使用正则表达式,拼接出权要原文
|
|
|
+ String regex = "(?<=<claim-text>)[\\w\\W]+?(?=</claim-text>)";
|
|
|
+ Pattern compile = Pattern.compile(regex);
|
|
|
+ Matcher matcher = compile.matcher(cnFullXmlStr);
|
|
|
+ StringBuilder builder = new StringBuilder();
|
|
|
+ while (matcher.find()) {
|
|
|
+ builder.append(matcher.group()).append("\r\n");
|
|
|
+ }
|
|
|
+
|
|
|
+ //装载权利要求原文
|
|
|
+ PatentRight patentRight = new PatentRight();
|
|
|
+ patentRight.setContent(builder + "");
|
|
|
+ uploadParamsVO.setPatentRight(patentRight);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 装载说明书文本
|
|
|
+ *
|
|
|
+ * @param uploadParamsVO 专利实体类对象
|
|
|
+ */
|
|
|
+ private void setPatentInstructionText(StarPatentVO starPatent, UploadParamsVO uploadParamsVO) throws IOException {
|
|
|
+ String appNo = starPatent.getApplicationNo().substring(0, starPatent.getApplicationNo().lastIndexOf("."));
|
|
|
+ //根据申请号调用"获得中国专利全文文本"接口,获得包含各种xml标签的专利全文内容的长字符串 cnFullXmlStr
|
|
|
+ String cnFullXmlStr = patentStarApiService.getCnFullXmlApi(appNo);
|
|
|
+
|
|
|
+ //使用正则表达式,拼接出说明书文本全文
|
|
|
+ String regex = "(?<=<claim-text>)[\\w\\W]+?(?=</claim-text>)";
|
|
|
+ Pattern compile = Pattern.compile(regex);
|
|
|
+ Matcher matcher = compile.matcher(cnFullXmlStr);
|
|
|
+ StringBuilder builder = new StringBuilder();
|
|
|
+ while (matcher.find()) {
|
|
|
+ builder.append(matcher.group()).append("\r\n");
|
|
|
+ }
|
|
|
+
|
|
|
+ //装载说明书文本全文
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|