|
@@ -73,9 +73,12 @@ public class PatentUtils {
|
|
|
}
|
|
|
String a = removeStringNotChinese(address);
|
|
|
switch (level) {
|
|
|
- case 1: return StrUtil.sub(a, 0, a.indexOf("省") + 1);
|
|
|
- case 2: return StrUtil.sub(a, a.indexOf("省") + 1, a.indexOf("市") + 1);
|
|
|
- case 3: return StrUtil.sub(a, a.indexOf("市") + 1, a.indexOf("区") + 1);
|
|
|
+ case 1:
|
|
|
+ return StrUtil.sub(a, 0, a.indexOf("省") + 1);
|
|
|
+ case 2:
|
|
|
+ return StrUtil.sub(a, a.indexOf("省") + 1, a.indexOf("市") + 1);
|
|
|
+ case 3:
|
|
|
+ return StrUtil.sub(a, a.indexOf("市") + 1, a.indexOf("区") + 1);
|
|
|
}
|
|
|
return "暂无";
|
|
|
}
|
|
@@ -180,14 +183,29 @@ public class PatentUtils {
|
|
|
String copy = matcher.replaceAll(placeholder);
|
|
|
String[] querys = StringUtils.split(copy, placeholder);
|
|
|
List<String> queryList = new ArrayList<>();
|
|
|
- for (int i = 0; i < querys.length; i++) {
|
|
|
- String query = querys[i].replaceAll("\\(|\\)", "");
|
|
|
- queryList.add(query);
|
|
|
- content = content.replaceFirst(query, i + placeholder);
|
|
|
- }
|
|
|
- for (int i = 0; i < queryList.size(); i++) {
|
|
|
+
|
|
|
+ if (content.split(",").length > 1) {
|
|
|
+ String[] a = content.split(",");
|
|
|
StringBuffer sb = new StringBuffer();
|
|
|
- content = content.replaceAll(i + placeholder, sb.append(keyword).append(like).append(left).append(queryList.get(i)).append(right).toString());
|
|
|
+
|
|
|
+ for (int j = 0; j < a.length; j++) {
|
|
|
+ content = sb.append(keyword).append(like).append(left).append(a[j]).append(right).append(" or ").toString();
|
|
|
+
|
|
|
+ if (j == a.length - 1) {
|
|
|
+ content = sb.delete(sb.length() - 4, sb.length()).toString();
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ for (int i = 0; i < querys.length; i++) {
|
|
|
+ String query = querys[i].replaceAll("\\(|\\)", "");
|
|
|
+ queryList.add(query);
|
|
|
+ content = content.replaceFirst(query, i + placeholder);
|
|
|
+ }
|
|
|
+ for (int i = 0; i < queryList.size(); i++) {
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
+ content = content.replaceAll(i + placeholder, sb.append(keyword).append(like).append(left).append(queryList.get(i)).append(right).toString());
|
|
|
+ }
|
|
|
}
|
|
|
return content;
|
|
|
}
|