|
@@ -10,6 +10,8 @@ import cn.cslg.pas.common.model.vo.outApi.StarPatentVO;
|
|
import cn.cslg.pas.common.utils.FormatUtil;
|
|
import cn.cslg.pas.common.utils.FormatUtil;
|
|
import cn.cslg.pas.common.utils.JsonUtils;
|
|
import cn.cslg.pas.common.utils.JsonUtils;
|
|
import cn.cslg.pas.common.utils.SecurityUtils.SecurityUtils;
|
|
import cn.cslg.pas.common.utils.SecurityUtils.SecurityUtils;
|
|
|
|
+import cn.cslg.pas.domain.PatentAgency;
|
|
|
|
+import cn.cslg.pas.domain.PatentAgent;
|
|
import cn.cslg.pas.domain.PatentApplicant;
|
|
import cn.cslg.pas.domain.PatentApplicant;
|
|
import cn.cslg.pas.domain.PubNo;
|
|
import cn.cslg.pas.domain.PubNo;
|
|
import cn.hutool.crypto.SecureUtil;
|
|
import cn.hutool.crypto.SecureUtil;
|
|
@@ -50,19 +52,15 @@ public class PatentStarApiService {
|
|
@Value("${PASUrl}")
|
|
@Value("${PASUrl}")
|
|
private String PASUrl;
|
|
private String PASUrl;
|
|
public static String formatValue(String value){
|
|
public static String formatValue(String value){
|
|
- return value.replace("-","<");
|
|
|
|
|
|
+ return value.replace("~",">");
|
|
}
|
|
}
|
|
- public static String formatKey(String Key){
|
|
|
|
- return "";
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
public static String formatQuery(String query) {
|
|
public static String formatQuery(String query) {
|
|
query = query
|
|
query = query
|
|
.replace(" AND ", "*")
|
|
.replace(" AND ", "*")
|
|
.replace(" OR ", "+")
|
|
.replace(" OR ", "+")
|
|
.replace(" NOT ", "-");
|
|
.replace(" NOT ", "-");
|
|
StringBuilder sb = new StringBuilder(query);
|
|
StringBuilder sb = new StringBuilder(query);
|
|
- String regex = "(?<=[\\(\\)\\+\\-=\\*])[\\w\\W]+?(?=[\\(\\+\\-=\\)\\*])";
|
|
|
|
|
|
+ String regex = "(?<=[\\(\\)\\+\\-=\\*])[^\\*^\\-^\\+]+?(?=[\\(\\+\\-=\\)\\*])";
|
|
Pattern pattern = Pattern.compile(regex);
|
|
Pattern pattern = Pattern.compile(regex);
|
|
Matcher matcher = pattern.matcher(query);
|
|
Matcher matcher = pattern.matcher(query);
|
|
Map<Integer, Integer> map = new LinkedHashMap<>();
|
|
Map<Integer, Integer> map = new LinkedHashMap<>();
|
|
@@ -90,17 +88,88 @@ public class PatentStarApiService {
|
|
int len2 = end2 - start2;
|
|
int len2 = end2 - start2;
|
|
int diff = len2 - len1;
|
|
int diff = len2 - len1;
|
|
if (diff > 0) {
|
|
if (diff > 0) {
|
|
- sb.replace(start1, end1, query.substring(start2, end2));
|
|
|
|
|
|
+ sb.replace(start1, end1,formatValue(query.substring(start2, end2)));
|
|
sb.replace(start2 + diff, end2 + diff, query.substring(start1, end1));
|
|
sb.replace(start2 + diff, end2 + diff, query.substring(start1, end1));
|
|
} else {
|
|
} else {
|
|
sb.replace(start2, end2, query.substring(start1, end1));
|
|
sb.replace(start2, end2, query.substring(start1, end1));
|
|
- sb.replace(start1, end1, query.substring(start2, end2));
|
|
|
|
|
|
+ sb.replace(start1, end1, formatValue(query.substring(start2, end2)));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
String reStr = sb.toString();
|
|
String reStr = sb.toString();
|
|
reStr = "FXX" + reStr.replace("=", "/");
|
|
reStr = "FXX" + reStr.replace("=", "/");
|
|
return reStr;
|
|
return reStr;
|
|
}
|
|
}
|
|
|
|
+ public void loadStarPatentVOS(List<StarPatentVO> starPatentVOS){
|
|
|
|
+ starPatentVOS.forEach(item->{
|
|
|
|
+ if(item.getPublicNo()!=null&&item.getPublicNo()!=""){
|
|
|
|
+ item.setPatentNo(item.getPublicNo());
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ else if(item.getAnnounceNo()!=null&&item.getAnnounceNo()!=""){
|
|
|
|
+ item.setPublicNo(item.getAnnounceNo());
|
|
|
|
+ item.setPatentNo(item.getAnnounceNo());
|
|
|
|
+ }
|
|
|
|
+ item.setApplicant(new ArrayList<>());
|
|
|
|
+ item.setAgent(new ArrayList<>());
|
|
|
|
+ item.setInventor(Arrays.asList(item.getInventorStr().split(";")));
|
|
|
|
+ item.setIpcList(Arrays.asList(item.getIpcListStr().split(";")));
|
|
|
|
+ List<String> applicants = Arrays.asList( item.getApplicantStr().split(";"));
|
|
|
|
+ //装载申请人
|
|
|
|
+ applicants.forEach(
|
|
|
|
+ tem->{
|
|
|
|
+ PatentApplicant patentApplicant =new PatentApplicant();
|
|
|
|
+ patentApplicant.setType(2);
|
|
|
|
+ patentApplicant.setDataType(2);
|
|
|
|
+ patentApplicant.setName(tem);
|
|
|
|
+ item.getApplicant().add(patentApplicant);
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ if(item.getCurrentApplicantStr()!=null&&item.getCurrentApplicantStr()!=""){
|
|
|
|
+ List<String> cApplicants = Arrays.asList(item.getCurrentApplicantStr().split(";"));
|
|
|
|
+ cApplicants.forEach(
|
|
|
|
+ tem->{
|
|
|
|
+ PatentApplicant patentApplicant =new PatentApplicant();
|
|
|
|
+ patentApplicant.setType(2);
|
|
|
|
+ patentApplicant.setDataType(1);
|
|
|
|
+ patentApplicant.setName(tem);
|
|
|
|
+ item.getApplicant().add(patentApplicant);
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ //代理机构
|
|
|
|
+ if(item.getAgencyStr()!=null&&item.getAgencyStr()!=""){
|
|
|
|
+ PatentAgency patentAgency =new PatentAgency();
|
|
|
|
+ patentAgency.setName(item.getAgencyStr().split(" ")[0]);
|
|
|
|
+ item.setAgency(patentAgency);
|
|
|
|
+ }
|
|
|
|
+ //代理人
|
|
|
|
+ if(item.getAgentStr()!=null&&item.getAgentStr()!=""){
|
|
|
|
+ List<String> agent = Arrays.asList(item.getAgentStr().split(";"));
|
|
|
|
+ agent.forEach(
|
|
|
|
+ tem->{
|
|
|
|
+ PatentAgent patentAgent =new PatentAgent();
|
|
|
|
+ patentAgent.setName(tem);
|
|
|
|
+ item.getAgent().add(patentAgent);
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ if(item.getLG()!=null){
|
|
|
|
+ switch (item.getLG()){
|
|
|
|
+ case 1:
|
|
|
|
+ item.setSimpleStatus("有效");
|
|
|
|
+ break;
|
|
|
|
+ case 2:
|
|
|
|
+ item.setSimpleStatus("失效");
|
|
|
|
+ break;
|
|
|
|
+ case 3:
|
|
|
|
+ item.setSimpleStatus("审中");
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //法律状态
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
|
|
public Map<String, Object> patentStarSearchApi(PatentStarListDto patentStarListDto) throws IOException {
|
|
public Map<String, Object> patentStarSearchApi(PatentStarListDto patentStarListDto) throws IOException {
|
|
String formQuery = patentStarListDto.getCurrentQuery();
|
|
String formQuery = patentStarListDto.getCurrentQuery();
|
|
@@ -132,45 +201,17 @@ public class PatentStarApiService {
|
|
if (response.isSuccessful()) {
|
|
if (response.isSuccessful()) {
|
|
JSONObject jsonObject = JSONObject.parseObject(Objects.requireNonNull(response.body()).string());
|
|
JSONObject jsonObject = JSONObject.parseObject(Objects.requireNonNull(response.body()).string());
|
|
if(jsonObject.get("Ret").equals(500)){
|
|
if(jsonObject.get("Ret").equals(500)){
|
|
-
|
|
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
JSONObject Data = (JSONObject) jsonObject.get("Data");
|
|
JSONObject Data = (JSONObject) jsonObject.get("Data");
|
|
List<StarPatentVO> starPatentVOS = JSONArray.parseArray(Data.get("List").toString(), StarPatentVO.class);
|
|
List<StarPatentVO> starPatentVOS = JSONArray.parseArray(Data.get("List").toString(), StarPatentVO.class);
|
|
- starPatentVOS.forEach(item->{
|
|
|
|
- item.setApplicant(new ArrayList<>());
|
|
|
|
- item.setInventor(Arrays.asList(item.getInventorStr().split(";")));
|
|
|
|
- item.setIpcList(Arrays.asList(item.getIpcListStr().split(";")));
|
|
|
|
- List<String> applicants = Arrays.asList( item.getApplicantStr().split(";"));
|
|
|
|
- applicants.forEach(
|
|
|
|
- tem->{
|
|
|
|
- PatentApplicant patentApplicant =new PatentApplicant();
|
|
|
|
- patentApplicant.setType(2);
|
|
|
|
- patentApplicant.setDataType(2);
|
|
|
|
- patentApplicant.setName(tem);
|
|
|
|
- item.getApplicant().add(patentApplicant);
|
|
|
|
- }
|
|
|
|
- );
|
|
|
|
- if(item.getCurrentApplicantStr()!=null){
|
|
|
|
- List<String> cApplicants = Arrays.asList(item.getCurrentApplicantStr().split(";"));
|
|
|
|
- cApplicants.forEach(
|
|
|
|
- tem->{
|
|
|
|
- PatentApplicant patentApplicant =new PatentApplicant();
|
|
|
|
- patentApplicant.setType(2);
|
|
|
|
- patentApplicant.setDataType(1);
|
|
|
|
- patentApplicant.setName(tem);
|
|
|
|
- item.getApplicant().add(patentApplicant);
|
|
|
|
- }
|
|
|
|
- );
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- });
|
|
|
|
|
|
+ this.loadStarPatentVOS(starPatentVOS);
|
|
// 打印服务端返回结果
|
|
// 打印服务端返回结果
|
|
// return Objects.requireNonNull(response.body()).string();
|
|
// return Objects.requireNonNull(response.body()).string();
|
|
Map<String, Object> reMap = new HashMap<>();
|
|
Map<String, Object> reMap = new HashMap<>();
|
|
reMap.put("size", patentStarListDto.getRowCount());
|
|
reMap.put("size", patentStarListDto.getRowCount());
|
|
reMap.put("current", patentStarListDto.getPageNum());
|
|
reMap.put("current", patentStarListDto.getPageNum());
|
|
- reMap.put("records",starPatentVOS);
|
|
|
|
|
|
+ reMap.put("records",Data.get("List"));
|
|
reMap.put("total", Data.get("HitCount"));
|
|
reMap.put("total", Data.get("HitCount"));
|
|
return reMap;
|
|
return reMap;
|
|
}
|
|
}
|