|
@@ -4,28 +4,30 @@ import cn.cslg.pas.common.model.PersonnelVO;
|
|
|
import cn.cslg.pas.common.model.outApi.PatentStarDto;
|
|
|
import cn.cslg.pas.common.model.outApi.PatentStarListDto;
|
|
|
import cn.cslg.pas.common.model.vo.outApi.StarPatentVO;
|
|
|
-import cn.cslg.pas.common.utils.CacheUtils;
|
|
|
-import cn.cslg.pas.common.utils.DateUtils2;
|
|
|
-import cn.cslg.pas.common.utils.FormatUtil;
|
|
|
+import cn.cslg.pas.common.utils.*;
|
|
|
import cn.cslg.pas.common.utils.SecurityUtils.LoginUtils;
|
|
|
-import cn.cslg.pas.common.utils.ThrowException;
|
|
|
import cn.cslg.pas.domain.*;
|
|
|
import cn.cslg.pas.service.upLoadPatent.RetrieveRecordService;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import io.swagger.v3.oas.models.security.SecurityScheme;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import okhttp3.FormBody;
|
|
|
import okhttp3.OkHttpClient;
|
|
|
import okhttp3.Request;
|
|
|
import okhttp3.Response;
|
|
|
+
|
|
|
import org.joda.time.DateTime;
|
|
|
+import org.joda.time.Days;
|
|
|
+import org.joda.time.Months;
|
|
|
import org.joda.time.format.DateTimeFormat;
|
|
|
import org.joda.time.format.DateTimeFormatter;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.regex.Matcher;
|
|
@@ -63,7 +65,6 @@ public class PatentStarApiService {
|
|
|
i++;
|
|
|
System.out.println(query);
|
|
|
}
|
|
|
-
|
|
|
// 统一改成大写
|
|
|
query = query.toUpperCase();
|
|
|
query = "(" + query + ")";
|
|
@@ -80,7 +81,7 @@ public class PatentStarApiService {
|
|
|
int t = 0;
|
|
|
StringBuilder query2 = new StringBuilder(query);
|
|
|
//匹配形如ab=(cd OR ef);
|
|
|
- String regexOrg = "([^=^\\*^\\+^\\(^\\)^\\-]+=\\([^=^\\)]+\\))+?";
|
|
|
+ String regexOrg = "([^=^\\*^\\+^\\(^\\)^\\-]+=[\\s]*\\([^=^\\)]+\\))+?";
|
|
|
Pattern patternOrg = Pattern.compile(regexOrg);
|
|
|
Matcher matcherOrg = patternOrg.matcher(query);
|
|
|
while (matcherOrg.find()) {
|
|
@@ -91,7 +92,7 @@ public class PatentStarApiService {
|
|
|
query2.delete(matcherOrg.start() + t, matcherOrg.start() + b.length() + 1 + t);
|
|
|
t = t - b.length() - 1;
|
|
|
String c = bc[1];
|
|
|
- String regexOrg1 = "([^\\+^\\*^\\-^\\(^\\)])+";
|
|
|
+ String regexOrg1 = "(?<=[\\(\\)\\+\\-=\\*])[^\\+^\\*^\\-^\\(^\\)]+?(?=[\\(\\+\\-=\\)\\*])";
|
|
|
Pattern patternOrg1 = Pattern.compile(regexOrg1);
|
|
|
Matcher matcherOrg1 = patternOrg1.matcher(c);
|
|
|
while (matcherOrg1.find()) {
|
|
@@ -114,14 +115,17 @@ public class PatentStarApiService {
|
|
|
Map<Integer, Integer> map = new LinkedHashMap<>();
|
|
|
while (matcher.find()) {
|
|
|
String a = matcher.group();
|
|
|
- String regex2 = "[^\\(^\\)^\\+^-^=^*]";
|
|
|
- Pattern pattern2 = Pattern.compile(regex2);
|
|
|
- Matcher matcher2 = pattern2.matcher(a);
|
|
|
- Integer start = matcher.start();
|
|
|
- if (matcher2.find()) {
|
|
|
- start += matcher2.start();
|
|
|
+ String tme = a.replace(" ", "");
|
|
|
+ if (!tme.equals("")) {
|
|
|
+ String regex2 = "[^\\(^\\)^\\+^-^=^*]";
|
|
|
+ Pattern pattern2 = Pattern.compile(regex2);
|
|
|
+ Matcher matcher2 = pattern2.matcher(a);
|
|
|
+ Integer start = matcher.start();
|
|
|
+ if (matcher2.find()) {
|
|
|
+ start += matcher2.start();
|
|
|
+ }
|
|
|
+ map.put(start, matcher.end());
|
|
|
}
|
|
|
- map.put(start, matcher.end());
|
|
|
}
|
|
|
if (map.size() == 0) {
|
|
|
return "";
|
|
@@ -285,10 +289,10 @@ public class PatentStarApiService {
|
|
|
|
|
|
public Map<String, Object> patentStarSearchApi(PatentStarListDto patentStarListDto) throws IOException {
|
|
|
try {
|
|
|
- if (patentStarListDto.getFormed() == null || patentStarListDto.getFormed() == false) {
|
|
|
- String formQuery = patentStarListDto.getCurrentQuery();
|
|
|
- patentStarListDto.setCurrentQuery(PatentStarApiService.formatQuery(formQuery));
|
|
|
- }
|
|
|
+if(patentStarListDto.getFormed()==null||patentStarListDto.getFormed()==false) {
|
|
|
+ String formQuery = patentStarListDto.getCurrentQuery();
|
|
|
+ patentStarListDto.setCurrentQuery(PatentStarApiService.formatQuery(formQuery));
|
|
|
+}
|
|
|
} catch (Exception e) {
|
|
|
return null;
|
|
|
}
|
|
@@ -388,12 +392,12 @@ public class PatentStarApiService {
|
|
|
|
|
|
public void setConditions(PatentStarListDto patentStarListDto) {
|
|
|
DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyyMMdd");
|
|
|
- String startStr = formatter.print(patentStarListDto.getStartTime());
|
|
|
- String endStr = formatter.print(patentStarListDto.getEndTime());
|
|
|
- String cond = "*(" + startStr + ">" + endStr + "/" + "AD)";
|
|
|
- Integer len = patentStarListDto.getOrginCondition().length();
|
|
|
- StringBuilder stringBuilder = new StringBuilder(patentStarListDto.getOrginCondition());
|
|
|
- stringBuilder.insert(len - 1, cond);
|
|
|
+ String startStr =formatter.print(patentStarListDto.getStartTime());
|
|
|
+ String endStr =formatter.print(patentStarListDto.getEndTime());
|
|
|
+ String cond = "*(" + startStr+ ">" + endStr + "/" + "AD)";
|
|
|
+ Integer len =patentStarListDto.getOrginCondition().length();
|
|
|
+ StringBuilder stringBuilder =new StringBuilder(patentStarListDto.getOrginCondition());
|
|
|
+ stringBuilder.insert(len-1,cond);
|
|
|
patentStarListDto.setCurrentQuery(stringBuilder.toString());
|
|
|
}
|
|
|
|