|
@@ -1,6 +1,7 @@
|
|
|
package cn.cslg.pas.service;
|
|
|
|
|
|
import cn.cslg.pas.common.model.params.PatentRightParams;
|
|
|
+import cn.cslg.pas.common.utils.PatentRightUtils;
|
|
|
import cn.cslg.pas.common.utils.PatentUtils;
|
|
|
import cn.cslg.pas.common.utils.Response;
|
|
|
import cn.cslg.pas.common.utils.StringUtils;
|
|
@@ -30,8 +31,8 @@ import java.util.stream.Collectors;
|
|
|
@Service
|
|
|
@RequiredArgsConstructor(onConstructor_ = {@Lazy})
|
|
|
public class PatentRightService extends ServiceImpl<PatentRightMapper, PatentRight> {
|
|
|
-
|
|
|
private final PatentService patentService;
|
|
|
+ private final PatentRightUtils patentRightUtils;
|
|
|
|
|
|
public List<PatentRight> getPatentRightByPatentNo(String patentNo) {
|
|
|
Patent patent = patentService.getByPatentNo(patentNo);
|
|
@@ -430,290 +431,300 @@ public class PatentRightService extends ServiceImpl<PatentRightMapper, PatentRig
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 格式化权要、拆分并理清父子级,insert/update DB
|
|
|
+ *
|
|
|
+ * @param params 权利要求
|
|
|
+ */
|
|
|
public void updatePatentRight(PatentRightParams params) {
|
|
|
-// 获取国家 公开号前两位
|
|
|
- String country = PatentUtils.getPatentCountry(params.getPatentNo());
|
|
|
- //权利要求原文
|
|
|
- String content = params.getContent();
|
|
|
- //权利要求译文
|
|
|
- String contentOut = params.getContentOut();
|
|
|
- if (StringUtils.isNotEmpty(content)) {
|
|
|
- //先删除库表中原有该权要
|
|
|
- this.deleteByPatentId(params.getPatentId());
|
|
|
-// String[] contentArray = null;
|
|
|
-// String[] contentOutArray = null;
|
|
|
-// String[] selfContentArray = null;
|
|
|
-// switch (country) {
|
|
|
-// case "JP":
|
|
|
-// case "CN":
|
|
|
-// code = "。";
|
|
|
-// if (StringUtils.isNotEmpty(contentOut)) {
|
|
|
-// contentOut = contentOut.replaceAll("\n", "");
|
|
|
-// contentOutArray = StringUtils.split(contentOut, code);
|
|
|
-// }
|
|
|
-// if (StringUtils.isNotEmpty(selfContent)) {
|
|
|
-// selfContent = selfContent.replaceAll("\n", "");
|
|
|
-// selfContentArray = StringUtils.split(selfContent, code);
|
|
|
+ //调用拆分权要工具类格式化并拆分权要理清父子级
|
|
|
+ List<PatentRight> patentRights = patentRightUtils.formatPatentRight(params);
|
|
|
+ //删除库表中原有该权要
|
|
|
+ this.deleteByPatentId(params.getPatentId());
|
|
|
+ this.saveOrUpdateBatch(patentRights);
|
|
|
+
|
|
|
+//// 获取国家 公开号前两位
|
|
|
+// String country = PatentUtils.getPatentCountry(params.getPatentNo());
|
|
|
+// //权利要求原文
|
|
|
+// String content = params.getContent();
|
|
|
+// //权利要求译文
|
|
|
+// String contentOut = params.getContentOut();
|
|
|
+// if (StringUtils.isNotEmpty(content)) {
|
|
|
+// //先删除库表中原有该权要
|
|
|
+// this.deleteByPatentId(params.getPatentId());
|
|
|
+//// String[] contentArray = null;
|
|
|
+//// String[] contentOutArray = null;
|
|
|
+//// String[] selfContentArray = null;
|
|
|
+//// switch (country) {
|
|
|
+//// case "JP":
|
|
|
+//// case "CN":
|
|
|
+//// code = "。";
|
|
|
+//// if (StringUtils.isNotEmpty(contentOut)) {
|
|
|
+//// contentOut = contentOut.replaceAll("\n", "");
|
|
|
+//// contentOutArray = StringUtils.split(contentOut, code);
|
|
|
+//// }
|
|
|
+//// if (StringUtils.isNotEmpty(selfContent)) {
|
|
|
+//// selfContent = selfContent.replaceAll("\n", "");
|
|
|
+//// selfContentArray = StringUtils.split(selfContent, code);
|
|
|
+//// }
|
|
|
+//// content = content.replaceAll("\n", "");
|
|
|
+//// contentArray = StringUtils.split(content, code);
|
|
|
+//// break;
|
|
|
+//// default:
|
|
|
+//// code = "\n";
|
|
|
+//// if (StringUtils.isNotEmpty(contentOut)) {
|
|
|
+//// contentOutArray = StringUtils.split(contentOut, code);
|
|
|
+//// }
|
|
|
+//// if (StringUtils.isNotEmpty(selfContent)) {
|
|
|
+//// selfContentArray = StringUtils.split(selfContent, code);
|
|
|
+//// }
|
|
|
+//// contentArray = StringUtils.split(content, code);
|
|
|
+//// }
|
|
|
+//// for (int i = 0; i < contentArray.length; i++) {
|
|
|
+//// if (StringUtils.isEmpty(contentArray[i])) {
|
|
|
+//// continue;
|
|
|
+//// }
|
|
|
+//// PatentRight patentRight = new PatentRight();
|
|
|
+//// patentRight.setPatentId(params.getPatentId());
|
|
|
+//// patentRight.setContent(contentArray[i]);
|
|
|
+//// patentRight.setType(0);
|
|
|
+//// patentRight.setSort(i);
|
|
|
+//// if (contentOutArray != null && i < contentOutArray.length) {
|
|
|
+//// patentRight.setContentOut(contentOutArray[i]);
|
|
|
+//// }
|
|
|
+//// if (selfContentArray != null) {
|
|
|
+//// String temp = Arrays.stream(selfContentArray).filter(item -> item.equals(patentRight.getContent())).findFirst().orElse(null);
|
|
|
+//// if (temp != null) {
|
|
|
+//// patentRight.setType(1);
|
|
|
+//// }
|
|
|
+//// }
|
|
|
+// ArrayList<PatentRight> patentRights = new ArrayList<>();
|
|
|
+// //先去掉所有换行符,使所有内容连起来
|
|
|
+// if (content.contains("\r\n")) {
|
|
|
+// content = content.replaceAll("\r\n", "");
|
|
|
+// } else {
|
|
|
+// content = content.replaceAll("\n", "");
|
|
|
+// }
|
|
|
+// if (contentOut == null) {
|
|
|
+// contentOut = "";
|
|
|
+// }
|
|
|
+// if (contentOut.contains("\r\n")) {
|
|
|
+// contentOut = contentOut.replaceAll("\r\n", "");
|
|
|
+// } else {
|
|
|
+// contentOut = contentOut.replaceAll("\n", "");
|
|
|
+// }
|
|
|
+// //去掉译文的所有空格
|
|
|
+// contentOut = contentOut.replaceAll(" +", "");
|
|
|
+//
|
|
|
+// //中文专利的权要拆分 ↓
|
|
|
+// if (country.equals("CN") || country.equals("JP") || country.equals("KR")) {
|
|
|
+// String regex;
|
|
|
+// if (content.contains("。2.")) {
|
|
|
+// regex = "。[0-9]+\\.";
|
|
|
+// } else if (content.contains("。2、")) {
|
|
|
+// regex = "。[0-9]+[、]";
|
|
|
+// } else if (content.contains("[001]")) {
|
|
|
+// regex = "\\[[0-9]+]";
|
|
|
+// } else if (content.contains("請求項")) {
|
|
|
+// regex = "。【請求項[0-9]+】";
|
|
|
+// } else if (content.contains("청구항")) {
|
|
|
+// regex = "\\.청구항 [0-9]+";
|
|
|
+// } else {
|
|
|
+// regex = "";
|
|
|
+// }
|
|
|
+// Matcher matcher = Pattern.compile(regex).matcher(content);
|
|
|
+// Matcher matcherOut = Pattern.compile(regex).matcher(contentOut);
|
|
|
+// while (matcher.find()) {
|
|
|
+// if (matcher.group().contains("청구항")) {
|
|
|
+// String matcherGroup = matcher.group().replace(".", "\\.");
|
|
|
+// content = content.replaceFirst(matcherGroup, ".\n" + matcherGroup.substring(matcherGroup.indexOf(".") + 1));
|
|
|
+// } else if (matcher.group().contains(".")) {
|
|
|
+// String matcherGroup = matcher.group().replace(".", "\\.");
|
|
|
+// content = content.replaceFirst(matcherGroup, "。\n" + matcherGroup.substring(matcherGroup.indexOf("。") + 1, matcherGroup.indexOf("\\")) + ".");
|
|
|
+// } else if (matcher.group().contains("、") || matcher.group().contains("請求項")) {
|
|
|
+// content = content.replaceFirst(matcher.group(), "。\n" + matcher.group().substring(matcher.group().indexOf("。") + 1));
|
|
|
// }
|
|
|
-// content = content.replaceAll("\n", "");
|
|
|
-// contentArray = StringUtils.split(content, code);
|
|
|
-// break;
|
|
|
-// default:
|
|
|
-// code = "\n";
|
|
|
-// if (StringUtils.isNotEmpty(contentOut)) {
|
|
|
-// contentOutArray = StringUtils.split(contentOut, code);
|
|
|
+// }
|
|
|
+// String[] strs = content.split("\n");
|
|
|
+// while (matcherOut.find()) {
|
|
|
+// if (matcherOut.group().contains(".")) {
|
|
|
+// String matcherOutGroup = matcherOut.group().replace(".", "\\.");
|
|
|
+// contentOut = contentOut.replaceFirst(matcherOutGroup, "。\n" + matcherOutGroup.substring(matcherOutGroup.indexOf("。") + 1, matcherOutGroup.indexOf("\\")) + ".");
|
|
|
+// } else if (matcherOut.group().contains("、")) {
|
|
|
+// contentOut = contentOut.replaceFirst(matcherOut.group(), "。\n" + matcherOut.group().substring(matcherOut.group().indexOf("。") + 1));
|
|
|
// }
|
|
|
-// if (StringUtils.isNotEmpty(selfContent)) {
|
|
|
-// selfContentArray = StringUtils.split(selfContent, code);
|
|
|
+// }
|
|
|
+// String[] strsOut = contentOut.split("\n");
|
|
|
+//
|
|
|
+// //定义父权要排序号
|
|
|
+// String regex1 = "权利要求[0-9]+";
|
|
|
+// String regex2 = "权利要求[0-9]+[至或~-]+[0-9]+";
|
|
|
+// for (int i = 0; i < strs.length; i++) {
|
|
|
+// //之前:if (strs[i].contains("权利要求")) {
|
|
|
+// //现在:if(该权要有逗号,并且它第一句话中有"权利要求"4个字 || 该权要没有逗号,并且它有"权利要求"4个字) {
|
|
|
+// if ((strs[i].contains(",") && strs[i].substring(0, strs[i].indexOf(",")).contains("权利要求")) || (!strs[i].contains(",") && strs[i].contains("权利要求"))) {
|
|
|
+// Matcher matcher1 = Pattern.compile(regex1).matcher(strs[i]);
|
|
|
+// Matcher matcher2 = Pattern.compile(regex2).matcher(strs[i]);
|
|
|
+// if (matcher2.find()) {
|
|
|
+// String parentNum = matcher2.group().substring(matcher2.group().indexOf("求") + 1);
|
|
|
+// String[] parentNums;
|
|
|
+// if (parentNum.contains("~")) {
|
|
|
+// parentNums = parentNum.split("~");
|
|
|
+// } else if (parentNum.contains("-")) {
|
|
|
+// parentNums = parentNum.split("-");
|
|
|
+// } else if (parentNum.contains("至")) {
|
|
|
+// parentNums = parentNum.split("至");
|
|
|
+// } else if (parentNum.contains("或")) {
|
|
|
+// parentNums = parentNum.split("或");
|
|
|
+// } else {
|
|
|
+// parentNums = new String[0];
|
|
|
+// }
|
|
|
+// StringBuilder builder = new StringBuilder();
|
|
|
+// for (int j = Integer.parseInt(parentNums[0]) - 1; j < Integer.parseInt(parentNums[parentNums.length - 1]); j++) {
|
|
|
+// if ((builder + "").equals("")) {
|
|
|
+// builder.append(j);
|
|
|
+// } else {
|
|
|
+// builder.append(",").append(j);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// PatentRight patentRight = new PatentRight()
|
|
|
+// .setPatentId(params.getPatentId())
|
|
|
+// .setType(0)
|
|
|
+// .setContent(strs[i])
|
|
|
+// .setSort(i)
|
|
|
+// .setParentSort(builder + "");
|
|
|
+// if (strsOut.length - 1 >= i) {
|
|
|
+// patentRight.setContentOut(strsOut[i]);
|
|
|
+// }
|
|
|
+// patentRights.add(patentRight);
|
|
|
+// } else if (matcher1.find()) {
|
|
|
+// String parentNum = matcher1.group().substring(matcher1.group().indexOf("求") + 1);
|
|
|
+// PatentRight patentRight = new PatentRight()
|
|
|
+// .setPatentId(params.getPatentId())
|
|
|
+// .setType(0)
|
|
|
+// .setContent(strs[i])
|
|
|
+// .setSort(i)
|
|
|
+// .setParentSort((Integer.parseInt(parentNum) - 1) + "");
|
|
|
+// if (strsOut.length - 1 >= i) {
|
|
|
+// patentRight.setContentOut(strsOut[i]);
|
|
|
+// }
|
|
|
+// patentRights.add(patentRight);
|
|
|
+// }
|
|
|
+//
|
|
|
+// } else {
|
|
|
+// PatentRight patentRight = new PatentRight()
|
|
|
+// .setPatentId(params.getPatentId())
|
|
|
+// .setType(1)
|
|
|
+// .setContent(strs[i])
|
|
|
+// .setSort(i)
|
|
|
+// .setParentSort("-1");
|
|
|
+// if (strsOut.length - 1 >= i) {
|
|
|
+// patentRight.setContentOut(strsOut[i]);
|
|
|
+// }
|
|
|
+// patentRights.add(patentRight);
|
|
|
// }
|
|
|
-// contentArray = StringUtils.split(content, code);
|
|
|
-// }
|
|
|
-// for (int i = 0; i < contentArray.length; i++) {
|
|
|
-// if (StringUtils.isEmpty(contentArray[i])) {
|
|
|
-// continue;
|
|
|
// }
|
|
|
-// PatentRight patentRight = new PatentRight();
|
|
|
-// patentRight.setPatentId(params.getPatentId());
|
|
|
-// patentRight.setContent(contentArray[i]);
|
|
|
-// patentRight.setType(0);
|
|
|
-// patentRight.setSort(i);
|
|
|
-// if (contentOutArray != null && i < contentOutArray.length) {
|
|
|
-// patentRight.setContentOut(contentOutArray[i]);
|
|
|
+//
|
|
|
+// //英文专利的权要拆分 ↓
|
|
|
+// } else {
|
|
|
+// content = content.substring(content.indexOf("1."));
|
|
|
+// if (contentOut.contains("1.")) {
|
|
|
+// contentOut = contentOut.substring(contentOut.indexOf("1."));
|
|
|
+// } else {
|
|
|
+// contentOut = contentOut.substring(contentOut.indexOf("1、"));
|
|
|
+// }
|
|
|
+// String regex;
|
|
|
+// if (content.contains("1.")) {
|
|
|
+// regex = "\\.[0-9]+\\. ";
|
|
|
+// } else if (content.contains("1、")) {
|
|
|
+// regex = "\\.[0-9]+\\. ";
|
|
|
+// } else if (content.contains("[001]")) {
|
|
|
+// regex = "\\[[0-9]+]";
|
|
|
+// } else {
|
|
|
+// regex = "";
|
|
|
+// }
|
|
|
+// Matcher matcher = Pattern.compile(regex).matcher(content);
|
|
|
+// Matcher matcherOut = Pattern.compile("。[0-9]+\\.").matcher(contentOut);
|
|
|
+// while (matcher.find()) {
|
|
|
+// String matcherGroup = matcher.group().replace(".", "\\.");
|
|
|
+// content = content.replaceFirst(matcherGroup, ".\n" + matcherGroup.substring(matcherGroup.indexOf(".") + 1, matcherGroup.lastIndexOf("\\")) + ". ");
|
|
|
// }
|
|
|
-// if (selfContentArray != null) {
|
|
|
-// String temp = Arrays.stream(selfContentArray).filter(item -> item.equals(patentRight.getContent())).findFirst().orElse(null);
|
|
|
-// if (temp != null) {
|
|
|
-// patentRight.setType(1);
|
|
|
+// String[] strs = content.split("\n");
|
|
|
+// while (matcherOut.find()) {
|
|
|
+// String matcherOutGroup = matcherOut.group().replace(".", "\\.");
|
|
|
+// contentOut = contentOut.replaceFirst(matcherOutGroup, "。\n" + matcherOutGroup.substring(matcherOutGroup.indexOf("。") + 1, matcherOutGroup.indexOf("\\")) + ".");
|
|
|
+// }
|
|
|
+// String[] strsOut = contentOut.split("\n");
|
|
|
+// //定义父权要排序号
|
|
|
+// String regex1 = "claim [0-9]+";
|
|
|
+// String regex2 = "claims [0-9]+ or [0-9]+";
|
|
|
+// for (int i = 0; i < strs.length; i++) {
|
|
|
+// if (strs[i].contains("claim")) {
|
|
|
+// Matcher matcher1 = Pattern.compile(regex1).matcher(strs[i]);
|
|
|
+// Matcher matcher2 = Pattern.compile(regex2).matcher(strs[i]);
|
|
|
+// if (matcher2.find()) {
|
|
|
+// String parentNum = matcher2.group().substring(matcher2.group().indexOf("s") + 2);
|
|
|
+// String[] parentNums;
|
|
|
+// if (parentNum.contains(" or ")) {
|
|
|
+// parentNums = parentNum.split(" or ");
|
|
|
+// } else if (parentNum.contains(" - ")) {
|
|
|
+// parentNums = parentNum.split(" - ");
|
|
|
+// } else if (parentNum.contains(" to ")) {
|
|
|
+// parentNums = parentNum.split(" to ");
|
|
|
+// } else if (parentNum.contains("或")) {
|
|
|
+// parentNums = parentNum.split("或");
|
|
|
+// } else {
|
|
|
+// parentNums = new String[0];
|
|
|
+// }
|
|
|
+// StringBuilder builder = new StringBuilder();
|
|
|
+// for (int j = Integer.parseInt(parentNums[0]) - 1; j < Integer.parseInt(parentNums[parentNums.length - 1]); j++) {
|
|
|
+// if ((builder + "").equals("")) {
|
|
|
+// builder.append(j);
|
|
|
+// } else {
|
|
|
+// builder.append(",").append(j);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// PatentRight patentRight = new PatentRight()
|
|
|
+// .setPatentId(params.getPatentId())
|
|
|
+// .setType(0)
|
|
|
+// .setContent(strs[i])
|
|
|
+// .setSort(i)
|
|
|
+// .setParentSort(builder + "");
|
|
|
+// if (strsOut.length - 1 >= i) {
|
|
|
+// patentRight.setContentOut(strsOut[i]);
|
|
|
+// }
|
|
|
+// patentRights.add(patentRight);
|
|
|
+// } else if (matcher1.find()) {
|
|
|
+// String parentNum = matcher1.group().substring(matcher1.group().indexOf("m") + 2);
|
|
|
+// PatentRight patentRight = new PatentRight()
|
|
|
+// .setPatentId(params.getPatentId())
|
|
|
+// .setType(0)
|
|
|
+// .setContent(strs[i])
|
|
|
+// .setSort(i)
|
|
|
+// .setParentSort((Integer.parseInt(parentNum) - 1) + "");
|
|
|
+// if (strsOut.length - 1 >= i) {
|
|
|
+// patentRight.setContentOut(strsOut[i]);
|
|
|
+// }
|
|
|
+// patentRights.add(patentRight);
|
|
|
+// }
|
|
|
+//
|
|
|
+// } else {
|
|
|
+// PatentRight patentRight = new PatentRight()
|
|
|
+// .setPatentId(params.getPatentId())
|
|
|
+// .setType(1)
|
|
|
+// .setContent(strs[i])
|
|
|
+// .setSort(i)
|
|
|
+// .setParentSort("-1");
|
|
|
+// if (strsOut.length - 1 >= i) {
|
|
|
+// patentRight.setContentOut(strsOut[i]);
|
|
|
+// }
|
|
|
+// patentRights.add(patentRight);
|
|
|
// }
|
|
|
// }
|
|
|
- ArrayList<PatentRight> patentRights = new ArrayList<>();
|
|
|
- //先去掉所有换行符,使所有内容连起来
|
|
|
- if (content.contains("\r\n")) {
|
|
|
- content = content.replaceAll("\r\n", "");
|
|
|
- } else {
|
|
|
- content = content.replaceAll("\n", "");
|
|
|
- }
|
|
|
- if (contentOut == null) {
|
|
|
- contentOut = "";
|
|
|
- }
|
|
|
- if (contentOut.contains("\r\n")) {
|
|
|
- contentOut = contentOut.replaceAll("\r\n", "");
|
|
|
- } else {
|
|
|
- contentOut = contentOut.replaceAll("\n", "");
|
|
|
- }
|
|
|
- //去掉译文的所有空格
|
|
|
- contentOut = contentOut.replaceAll(" +", "");
|
|
|
-
|
|
|
- //中文专利的权要拆分 ↓
|
|
|
- if (country.equals("CN") || country.equals("JP") || country.equals("KR")) {
|
|
|
- String regex;
|
|
|
- if (content.contains("。2.")) {
|
|
|
- regex = "。[0-9]+\\.";
|
|
|
- } else if (content.contains("。2、")) {
|
|
|
- regex = "。[0-9]+[、]";
|
|
|
- } else if (content.contains("[001]")) {
|
|
|
- regex = "\\[[0-9]+]";
|
|
|
- } else if (content.contains("請求項")) {
|
|
|
- regex = "。【請求項[0-9]+】";
|
|
|
- } else if (content.contains("청구항")) {
|
|
|
- regex = "\\.청구항 [0-9]+";
|
|
|
- } else {
|
|
|
- regex = "";
|
|
|
- }
|
|
|
- Matcher matcher = Pattern.compile(regex).matcher(content);
|
|
|
- Matcher matcherOut = Pattern.compile(regex).matcher(contentOut);
|
|
|
- while (matcher.find()) {
|
|
|
- if (matcher.group().contains("청구항")) {
|
|
|
- String matcherGroup = matcher.group().replace(".", "\\.");
|
|
|
- content = content.replaceFirst(matcherGroup, ".\n" + matcherGroup.substring(matcherGroup.indexOf(".") + 1));
|
|
|
- } else if (matcher.group().contains(".")) {
|
|
|
- String matcherGroup = matcher.group().replace(".", "\\.");
|
|
|
- content = content.replaceFirst(matcherGroup, "。\n" + matcherGroup.substring(matcherGroup.indexOf("。") + 1, matcherGroup.indexOf("\\")) + ".");
|
|
|
- } else if (matcher.group().contains("、") || matcher.group().contains("請求項")) {
|
|
|
- content = content.replaceFirst(matcher.group(), "。\n" + matcher.group().substring(matcher.group().indexOf("。") + 1));
|
|
|
- }
|
|
|
- }
|
|
|
- String[] strs = content.split("\n");
|
|
|
- while (matcherOut.find()) {
|
|
|
- if (matcherOut.group().contains(".")) {
|
|
|
- String matcherOutGroup = matcherOut.group().replace(".", "\\.");
|
|
|
- contentOut = contentOut.replaceFirst(matcherOutGroup, "。\n" + matcherOutGroup.substring(matcherOutGroup.indexOf("。") + 1, matcherOutGroup.indexOf("\\")) + ".");
|
|
|
- } else if (matcherOut.group().contains("、")) {
|
|
|
- contentOut = contentOut.replaceFirst(matcherOut.group(), "。\n" + matcherOut.group().substring(matcherOut.group().indexOf("。") + 1));
|
|
|
- }
|
|
|
- }
|
|
|
- String[] strsOut = contentOut.split("\n");
|
|
|
- //定义父权要排序号
|
|
|
- String regex1 = "权利要求[0-9]+";
|
|
|
- String regex2 = "权利要求[0-9]+[至或~-]+[0-9]+";
|
|
|
- for (int i = 0; i < strs.length; i++) {
|
|
|
- if (strs[i].contains("权利要求")) {
|
|
|
- Matcher matcher1 = Pattern.compile(regex1).matcher(strs[i]);
|
|
|
- Matcher matcher2 = Pattern.compile(regex2).matcher(strs[i]);
|
|
|
- if (matcher2.find()) {
|
|
|
- String parentNum = matcher2.group().substring(matcher2.group().indexOf("求") + 1);
|
|
|
- String[] parentNums;
|
|
|
- if (parentNum.contains("~")) {
|
|
|
- parentNums = parentNum.split("~");
|
|
|
- } else if (parentNum.contains("-")) {
|
|
|
- parentNums = parentNum.split("-");
|
|
|
- } else if (parentNum.contains("至")) {
|
|
|
- parentNums = parentNum.split("至");
|
|
|
- } else if (parentNum.contains("或")) {
|
|
|
- parentNums = parentNum.split("或");
|
|
|
- } else {
|
|
|
- parentNums = new String[0];
|
|
|
- }
|
|
|
- StringBuilder builder = new StringBuilder();
|
|
|
- for (int j = Integer.parseInt(parentNums[0]) - 1; j < Integer.parseInt(parentNums[parentNums.length - 1]); j++) {
|
|
|
- if ((builder + "").equals("")) {
|
|
|
- builder.append(j);
|
|
|
- } else {
|
|
|
- builder.append(",").append(j);
|
|
|
- }
|
|
|
- }
|
|
|
- PatentRight patentRight = new PatentRight()
|
|
|
- .setPatentId(params.getPatentId())
|
|
|
- .setType(0)
|
|
|
- .setContent(strs[i])
|
|
|
- .setSort(i)
|
|
|
- .setParentSort(builder + "");
|
|
|
- if (strsOut.length - 1 >= i) {
|
|
|
- patentRight.setContentOut(strsOut[i]);
|
|
|
- }
|
|
|
- patentRights.add(patentRight);
|
|
|
- } else if (matcher1.find()) {
|
|
|
- String parentNum = matcher1.group().substring(matcher1.group().indexOf("求") + 1);
|
|
|
- PatentRight patentRight = new PatentRight()
|
|
|
- .setPatentId(params.getPatentId())
|
|
|
- .setType(0)
|
|
|
- .setContent(strs[i])
|
|
|
- .setSort(i)
|
|
|
- .setParentSort((Integer.parseInt(parentNum) - 1) + "");
|
|
|
- if (strsOut.length - 1 >= i) {
|
|
|
- patentRight.setContentOut(strsOut[i]);
|
|
|
- }
|
|
|
- patentRights.add(patentRight);
|
|
|
- }
|
|
|
-
|
|
|
- } else {
|
|
|
- PatentRight patentRight = new PatentRight()
|
|
|
- .setPatentId(params.getPatentId())
|
|
|
- .setType(1)
|
|
|
- .setContent(strs[i])
|
|
|
- .setSort(i)
|
|
|
- .setParentSort("-1");
|
|
|
- if (strsOut.length - 1 >= i) {
|
|
|
- patentRight.setContentOut(strsOut[i]);
|
|
|
- }
|
|
|
- patentRights.add(patentRight);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //英文专利的权要拆分 ↓
|
|
|
- } else {
|
|
|
- content = content.substring(content.indexOf("1."));
|
|
|
- if(contentOut.indexOf("1.")>-1){
|
|
|
- contentOut = contentOut.substring(contentOut.indexOf("1."));
|
|
|
- }
|
|
|
- else{
|
|
|
- contentOut = contentOut.substring(contentOut.indexOf("1、"));
|
|
|
- }
|
|
|
- String regex;
|
|
|
- if (content.contains("1.")) {
|
|
|
- regex = "\\.[0-9]+\\. ";
|
|
|
- }
|
|
|
- else if (content.contains("1、")) {
|
|
|
- regex = "\\.[0-9]+\\. ";
|
|
|
- }
|
|
|
- else if (content.contains("[001]")) {
|
|
|
- regex = "\\[[0-9]+]";
|
|
|
- }
|
|
|
- else {
|
|
|
- regex = "";
|
|
|
- }
|
|
|
- Matcher matcher = Pattern.compile(regex).matcher(content);
|
|
|
- Matcher matcherOut = Pattern.compile("。[0-9]+\\.").matcher(contentOut);
|
|
|
- while (matcher.find()) {
|
|
|
- String matcherGroup = matcher.group().replace(".", "\\.");
|
|
|
- content = content.replaceFirst(matcherGroup, ".\n" + matcherGroup.substring(matcherGroup.indexOf(".") + 1, matcherGroup.lastIndexOf("\\")) + ". ");
|
|
|
- }
|
|
|
- String[] strs = content.split("\n");
|
|
|
- while (matcherOut.find()) {
|
|
|
- String matcherOutGroup = matcherOut.group().replace(".", "\\.");
|
|
|
- contentOut = contentOut.replaceFirst(matcherOutGroup, "。\n" + matcherOutGroup.substring(matcherOutGroup.indexOf("。") + 1, matcherOutGroup.indexOf("\\")) + ".");
|
|
|
- }
|
|
|
- String[] strsOut = contentOut.split("\n");
|
|
|
- //定义父权要排序号
|
|
|
- String regex1 = "claim [0-9]+";
|
|
|
- String regex2 = "claims [0-9]+ or [0-9]+";
|
|
|
- for (int i = 0; i < strs.length; i++) {
|
|
|
- if (strs[i].contains("claim")) {
|
|
|
- Matcher matcher1 = Pattern.compile(regex1).matcher(strs[i]);
|
|
|
- Matcher matcher2 = Pattern.compile(regex2).matcher(strs[i]);
|
|
|
- if (matcher2.find()) {
|
|
|
- String parentNum = matcher2.group().substring(matcher2.group().indexOf("s") + 2);
|
|
|
- String[] parentNums;
|
|
|
- if (parentNum.contains(" or ")) {
|
|
|
- parentNums = parentNum.split(" or ");
|
|
|
- } else if (parentNum.contains(" - ")) {
|
|
|
- parentNums = parentNum.split(" - ");
|
|
|
- } else if (parentNum.contains(" to ")) {
|
|
|
- parentNums = parentNum.split(" to ");
|
|
|
- } else if (parentNum.contains("或")) {
|
|
|
- parentNums = parentNum.split("或");
|
|
|
- } else {
|
|
|
- parentNums = new String[0];
|
|
|
- }
|
|
|
- StringBuilder builder = new StringBuilder();
|
|
|
- for (int j = Integer.parseInt(parentNums[0]) - 1; j < Integer.parseInt(parentNums[parentNums.length - 1]); j++) {
|
|
|
- if ((builder + "").equals("")) {
|
|
|
- builder.append(j);
|
|
|
- } else {
|
|
|
- builder.append(",").append(j);
|
|
|
- }
|
|
|
- }
|
|
|
- PatentRight patentRight = new PatentRight()
|
|
|
- .setPatentId(params.getPatentId())
|
|
|
- .setType(0)
|
|
|
- .setContent(strs[i])
|
|
|
- .setSort(i)
|
|
|
- .setParentSort(builder + "");
|
|
|
- if (strsOut.length - 1 >= i) {
|
|
|
- patentRight.setContentOut(strsOut[i]);
|
|
|
- }
|
|
|
- patentRights.add(patentRight);
|
|
|
- } else if (matcher1.find()) {
|
|
|
- String parentNum = matcher1.group().substring(matcher1.group().indexOf("m") + 2);
|
|
|
- PatentRight patentRight = new PatentRight()
|
|
|
- .setPatentId(params.getPatentId())
|
|
|
- .setType(0)
|
|
|
- .setContent(strs[i])
|
|
|
- .setSort(i)
|
|
|
- .setParentSort((Integer.parseInt(parentNum) - 1) + "");
|
|
|
- if (strsOut.length - 1 >= i) {
|
|
|
- patentRight.setContentOut(strsOut[i]);
|
|
|
- }
|
|
|
- patentRights.add(patentRight);
|
|
|
- }
|
|
|
-
|
|
|
- } else {
|
|
|
- PatentRight patentRight = new PatentRight()
|
|
|
- .setPatentId(params.getPatentId())
|
|
|
- .setType(1)
|
|
|
- .setContent(strs[i])
|
|
|
- .setSort(i)
|
|
|
- .setParentSort("-1");
|
|
|
- if (strsOut.length - 1 >= i) {
|
|
|
- patentRight.setContentOut(strsOut[i]);
|
|
|
- }
|
|
|
- patentRights.add(patentRight);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- this.saveOrUpdateBatch(patentRights);
|
|
|
- }
|
|
|
+// }
|
|
|
+//
|
|
|
+// this.saveOrUpdateBatch(patentRights);
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
|