|
@@ -432,164 +432,194 @@ public class PatentRightService extends ServiceImpl<PatentRightMapper, PatentRig
|
|
|
|
|
|
|
|
|
|
public void updatePatentRight(PatentRightParams params) {
|
|
public void updatePatentRight(PatentRightParams params) {
|
|
-// List<PatentRight> patentRightList = new ArrayList<>();
|
|
|
|
-// 获取国家 公开号前两位
|
|
|
|
-// String country = PatentUtils.getPatentCountry(params.getPatentNo());
|
|
|
|
-// String code;
|
|
|
|
|
|
+ ArrayList<PatentRight> patentRights = new ArrayList<>();
|
|
|
|
+ //获取国家(公开号的前两位)
|
|
|
|
+ String country = PatentUtils.getPatentCountry(params.getPatentNo());
|
|
|
|
|
|
//权利要求原文
|
|
//权利要求原文
|
|
String content = params.getContent();
|
|
String content = params.getContent();
|
|
//权利要求译文
|
|
//权利要求译文
|
|
String contentOut = params.getContentOut();
|
|
String contentOut = params.getContentOut();
|
|
- //独立权利要求
|
|
|
|
- String selfContent = params.getSelfContent();
|
|
|
|
|
|
+ //先去掉所有换行符,使原文和原文译文都连起来
|
|
|
|
+ content = content.replaceAll("\n", "");
|
|
|
|
+ contentOut = contentOut.replaceAll("\n", "").replaceAll(" +", "");
|
|
if (StringUtils.isNotEmpty(content)) {
|
|
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);
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// patentRightList.add(patentRight);
|
|
|
|
- ArrayList<PatentRight> patentRights = new ArrayList<>();
|
|
|
|
- //先去掉所有换行符,使原文连起来
|
|
|
|
- content = content.replaceAll("\n", "");
|
|
|
|
- contentOut = contentOut.replaceAll("\n", "");
|
|
|
|
-
|
|
|
|
- //根据专利所属国家,定义序号规则
|
|
|
|
- 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 = "";
|
|
|
|
- }
|
|
|
|
|
|
+ //先删除原来的专利权要
|
|
|
|
+ this.deleteByPatentId(params.getPatentId());
|
|
|
|
+ if (country.equals("CN") || country.equals("JP")) {
|
|
|
|
+ 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 = "";
|
|
|
|
+ }
|
|
|
|
|
|
- Pattern compile = Pattern.compile(regex);
|
|
|
|
- Matcher matcher = compile.matcher(content);
|
|
|
|
- Matcher matcherOut = compile.matcher(contentOut);
|
|
|
|
- while (matcher.find()) {
|
|
|
|
- if (!matcher.group().equals("1.") && !matcher.group().equals("1、") && !matcher.group().equals("[001]")) {
|
|
|
|
- content = content.replaceFirst(matcher.group(), "\n" + matcher.group());
|
|
|
|
|
|
+ Pattern compile = Pattern.compile(regex);
|
|
|
|
+ Matcher matcher = compile.matcher(content);
|
|
|
|
+ Matcher matcherOut = compile.matcher(contentOut);
|
|
|
|
+ while (matcher.find()) {
|
|
|
|
+ String matcherGroup = matcher.group();
|
|
|
|
+ matcherGroup = matcherGroup.substring(1).replace(".", "\\.");
|
|
|
|
+ content = content.replaceFirst(matcherGroup, "\n" + matcherGroup);
|
|
}
|
|
}
|
|
- }
|
|
|
|
- String[] strs = content.split("\n");
|
|
|
|
- while (matcherOut.find()) {
|
|
|
|
- if (!matcherOut.group().equals("1.") && !matcherOut.group().equals("1、") && !matcherOut.group().equals("[001]")) {
|
|
|
|
- contentOut = contentOut.replaceFirst(matcher.group(), "\n" + matcher.group());
|
|
|
|
|
|
+ while (matcherOut.find()) {
|
|
|
|
+ String matcherGroup = matcherOut.group();
|
|
|
|
+ matcherGroup = matcherGroup.substring(1).replace(".", "\\.");
|
|
|
|
+ contentOut = contentOut.replaceFirst(matcherGroup, "\n" + matcherGroup);
|
|
}
|
|
}
|
|
- }
|
|
|
|
- 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("权利要求")) {
|
|
|
|
- Pattern compile1 = Pattern.compile(regex1);
|
|
|
|
- Matcher matcher1 = compile1.matcher(strs[i]);
|
|
|
|
- Pattern compile2 = Pattern.compile(regex2);
|
|
|
|
- Matcher matcher2 = compile2.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);
|
|
|
|
|
|
+ String[] strs = content.split("\n");
|
|
|
|
+ String[] strsOut = contentOut.split("\n");
|
|
|
|
+
|
|
|
|
+ //定义父权要排序号
|
|
|
|
+ String regex1 = "权利要求[0-9]+";
|
|
|
|
+ String regex2 = "权利要求[0-9]+[至或~-]+[0-9]+";
|
|
|
|
+ for (int i = 0; i < strs.length; i++) {
|
|
|
|
+ PatentRight patentRight = new PatentRight()
|
|
|
|
+ .setPatentId(params.getPatentId())
|
|
|
|
+ .setContent(strs[i])
|
|
|
|
+ .setContentOut(strsOut[i])
|
|
|
|
+ .setSort(i);
|
|
|
|
+ if (strs[i].contains("权利要求")) {
|
|
|
|
+ patentRight.setType(1);
|
|
|
|
+ Pattern compile1 = Pattern.compile(regex1);
|
|
|
|
+ Matcher matcher1 = compile1.matcher(strs[i]);
|
|
|
|
+ Pattern compile2 = Pattern.compile(regex2);
|
|
|
|
+ Matcher matcher2 = compile2.matcher(strs[i]);
|
|
|
|
+ if (matcher2.find()) {
|
|
|
|
+ String parentNum = matcher2.group().substring(matcher2.group().indexOf("求") + 1);
|
|
|
|
+ String[] parentNums;
|
|
|
|
+ String chr;
|
|
|
|
+ if (parentNum.contains("~")) {
|
|
|
|
+ chr = "~";
|
|
|
|
+ } else if (parentNum.contains("-")) {
|
|
|
|
+ chr = "-";
|
|
|
|
+ } else if (parentNum.contains("至")) {
|
|
|
|
+ chr = "至";
|
|
|
|
+ } else if (parentNum.contains("或")) {
|
|
|
|
+ chr = "或";
|
|
} else {
|
|
} else {
|
|
- builder.append(",").append(j);
|
|
|
|
|
|
+ chr = "";
|
|
}
|
|
}
|
|
|
|
+ parentNums = parentNum.split(chr);
|
|
|
|
+ StringBuilder builder = new StringBuilder();
|
|
|
|
+ if (!chr.equals("或")) {
|
|
|
|
+ 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);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ for (String num : parentNums) {
|
|
|
|
+ if ((builder + "").equals("")) {
|
|
|
|
+ builder.append(Integer.parseInt(num) - 1);
|
|
|
|
+ } else {
|
|
|
|
+ builder.append(",").append(Integer.parseInt(num) - 1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ patentRight.setParentSort(builder + "");
|
|
|
|
+ patentRights.add(patentRight);
|
|
|
|
+ } else if (matcher1.find()) {
|
|
|
|
+ String parentNum = matcher1.group().substring(matcher1.group().indexOf("求") + 1);
|
|
|
|
+ patentRight.setParentSort((Integer.parseInt(parentNum) - 1) + "");
|
|
|
|
+ patentRights.add(patentRight);
|
|
}
|
|
}
|
|
- PatentRight patentRight = new PatentRight()
|
|
|
|
- .setPatentId(params.getPatentId())
|
|
|
|
- .setType(1)
|
|
|
|
- .setContent(strs[i])
|
|
|
|
- .setContentOut(strsOut[i])
|
|
|
|
- .setSort(i)
|
|
|
|
- .setParentSort(builder + "");
|
|
|
|
- patentRights.add(patentRight);
|
|
|
|
- } else if (matcher1.find()) {
|
|
|
|
- String parentNum = matcher1.group().substring(matcher1.group().indexOf("求") + 1);
|
|
|
|
- PatentRight patentRight = new PatentRight()
|
|
|
|
- .setPatentId(params.getPatentId())
|
|
|
|
- .setType(1)
|
|
|
|
- .setContent(strs[i])
|
|
|
|
- .setContentOut(strsOut[i])
|
|
|
|
- .setSort(i)
|
|
|
|
- .setParentSort((Integer.parseInt(parentNum) - 1) + "");
|
|
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ patentRight.setType(0);
|
|
|
|
+ patentRight.setParentSort("-1");
|
|
patentRights.add(patentRight);
|
|
patentRights.add(patentRight);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ String regex = "[0-9]+\\. ";
|
|
|
|
+ String regexOut;
|
|
|
|
+ if (contentOut.contains("1.")) {
|
|
|
|
+ regexOut = "。[0-9]+[.]";
|
|
|
|
+ } else if (contentOut.contains("1、")) {
|
|
|
|
+ regexOut = "。[0-9]+[、]";
|
|
|
|
+ } else if (contentOut.contains("[001]")) {
|
|
|
|
+ regexOut = "\\[[0-9]+]";
|
|
} else {
|
|
} else {
|
|
|
|
+ regexOut = "";
|
|
|
|
+ }
|
|
|
|
+ Pattern compile = Pattern.compile(regex);
|
|
|
|
+ Matcher matcher = compile.matcher(content);
|
|
|
|
+ Pattern compileOut = Pattern.compile(regexOut);
|
|
|
|
+ Matcher matcherOut = compileOut.matcher(contentOut);
|
|
|
|
+ while (matcher.find()) {
|
|
|
|
+ String matcherGroup = matcher.group();
|
|
|
|
+ matcherGroup = matcherGroup.replace(".", "\\.");
|
|
|
|
+ content = content.replaceFirst(matcherGroup, "\n" + matcherGroup);
|
|
|
|
+ }
|
|
|
|
+ while (matcherOut.find()) {
|
|
|
|
+ String matcherOutGroup = matcherOut.group();
|
|
|
|
+ matcherOutGroup = matcherOutGroup.substring(1).replace(".", "\\.");
|
|
|
|
+ contentOut = contentOut.replaceFirst(matcherOutGroup, "\n" + matcherOutGroup);
|
|
|
|
+ }
|
|
|
|
+ content = content.substring(content.indexOf("1. "));
|
|
|
|
+ contentOut = contentOut.substring(contentOut.indexOf("1."));
|
|
|
|
+ String[] strs = content.split("\n");
|
|
|
|
+ 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++) {
|
|
PatentRight patentRight = new PatentRight()
|
|
PatentRight patentRight = new PatentRight()
|
|
.setPatentId(params.getPatentId())
|
|
.setPatentId(params.getPatentId())
|
|
- .setType(0)
|
|
|
|
.setContent(strs[i])
|
|
.setContent(strs[i])
|
|
.setContentOut(strsOut[i])
|
|
.setContentOut(strsOut[i])
|
|
- .setSort(i)
|
|
|
|
- .setParentSort("-1");
|
|
|
|
- patentRights.add(patentRight);
|
|
|
|
|
|
+ .setSort(i);
|
|
|
|
+ if (strs[i].contains("claim")) {
|
|
|
|
+ patentRight.setType(1);
|
|
|
|
+ Pattern compile1 = Pattern.compile(regex1);
|
|
|
|
+ Matcher matcher1 = compile1.matcher(strs[i]);
|
|
|
|
+ Pattern compile2 = Pattern.compile(regex2);
|
|
|
|
+ Matcher matcher2 = compile2.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 {
|
|
|
|
+ parentNums = new String[0];
|
|
|
|
+ }
|
|
|
|
+ StringBuilder builder = new StringBuilder();
|
|
|
|
+ for (String num : parentNums) {
|
|
|
|
+ if ((builder + "").equals("")) {
|
|
|
|
+ builder.append(Integer.parseInt(num) - 1);
|
|
|
|
+ } else {
|
|
|
|
+ builder.append(",").append(Integer.parseInt(num) - 1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ patentRight.setParentSort(builder + "");
|
|
|
|
+ patentRights.add(patentRight);
|
|
|
|
+ } else if (matcher1.find()) {
|
|
|
|
+ String parentNum = matcher1.group().substring(matcher1.group().indexOf("m") + 2);
|
|
|
|
+ patentRight.setParentSort((Integer.parseInt(parentNum) - 1) + "");
|
|
|
|
+ patentRights.add(patentRight);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ patentRight.setType(0);
|
|
|
|
+ patentRight.setParentSort("-1");
|
|
|
|
+ patentRights.add(patentRight);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- this.saveOrUpdateBatch(patentRights);
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
+ this.saveOrUpdateBatch(patentRights);
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|