|
@@ -1,31 +1,23 @@
|
|
|
package cn.cslg.pas.service.outApi;
|
|
|
|
|
|
-import cn.cslg.pas.common.model.PatentCell;
|
|
|
import cn.cslg.pas.common.model.PersonnelVO;
|
|
|
-import cn.cslg.pas.common.model.dto.*;
|
|
|
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.FormatUtil;
|
|
|
-import cn.cslg.pas.common.utils.JsonUtils;
|
|
|
import cn.cslg.pas.common.utils.SecurityUtils.LoginUtils;
|
|
|
-import cn.cslg.pas.common.utils.SecurityUtils.SecurityUtils;
|
|
|
import cn.cslg.pas.domain.*;
|
|
|
import cn.cslg.pas.service.upLoadPatent.RetrieveRecordService;
|
|
|
-import cn.hutool.crypto.SecureUtil;
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.google.gson.Gson;
|
|
|
-import com.google.gson.JsonObject;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import okhttp3.*;
|
|
|
-import org.apache.commons.lang3.StringEscapeUtils;
|
|
|
-import org.junit.Test;
|
|
|
+import okhttp3.FormBody;
|
|
|
+import okhttp3.OkHttpClient;
|
|
|
+import okhttp3.Request;
|
|
|
+import okhttp3.Response;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.io.IOException;
|
|
@@ -45,9 +37,10 @@ import java.util.regex.Pattern;
|
|
|
@Service
|
|
|
|
|
|
public class PatentStarApiService {
|
|
|
- private final RetrieveRecordService retrieveRecordService;
|
|
|
+ private final RetrieveRecordService retrieveRecordService;
|
|
|
private final CacheUtils cacheUtils;
|
|
|
private final LoginUtils loginUtils;
|
|
|
+
|
|
|
public static String formatValue(String value) {
|
|
|
return value.replace("~", ">");
|
|
|
}
|
|
@@ -133,12 +126,18 @@ public class PatentStarApiService {
|
|
|
//装载专利信息
|
|
|
public void loadStarPatentVOS(List<StarPatentVO> starPatentVOS) {
|
|
|
starPatentVOS.forEach(item -> {
|
|
|
+ //如果有公开号,则将公开号作为专利号
|
|
|
if (item.getPublicNo() != null && !item.getPublicNo().equals("")) {
|
|
|
item.setPatentNo(item.getPublicNo());
|
|
|
+ //如果没有公开号,但是有公告号,则将公告号作为公开号和专利号
|
|
|
} else if (item.getAnnounceNo() != null && !item.getAnnounceNo().equals("")) {
|
|
|
item.setPublicNo(item.getAnnounceNo());
|
|
|
item.setPatentNo(item.getAnnounceNo());
|
|
|
}
|
|
|
+ //陈宇 ↓ 如果没有公开日就将公告日作为公开日
|
|
|
+ if (item.getPublicDate() == null || item.getPublicDate().equals("")) {
|
|
|
+ item.setPublicDate(item.getAnnounceDate());
|
|
|
+ }
|
|
|
item.setApplicant(new ArrayList<>());
|
|
|
item.setAgent(new ArrayList<>());
|
|
|
item.setIpcList(Arrays.asList(item.getIpcListStr().split(";")));
|
|
@@ -153,7 +152,7 @@ public class PatentStarApiService {
|
|
|
item.getApplicant().add(patentApplicant);
|
|
|
}
|
|
|
);
|
|
|
- if (item.getCurrentApplicantStr() != null && item.getCurrentApplicantStr() != "") {
|
|
|
+ if (item.getCurrentApplicantStr() != null && !item.getCurrentApplicantStr().equals("")) {
|
|
|
List<String> cApplicants = Arrays.asList(item.getCurrentApplicantStr().split(";"));
|
|
|
cApplicants.forEach(
|
|
|
tem -> {
|
|
@@ -166,13 +165,13 @@ public class PatentStarApiService {
|
|
|
);
|
|
|
}
|
|
|
//代理机构
|
|
|
- if (item.getAgencyStr() != null && item.getAgencyStr() != "") {
|
|
|
+ if (item.getAgencyStr() != null && !item.getAgencyStr().equals("")) {
|
|
|
PatentAgency patentAgency = new PatentAgency();
|
|
|
patentAgency.setName(item.getAgencyStr().split(" ")[0]);
|
|
|
item.setAgency(patentAgency);
|
|
|
}
|
|
|
//发明人
|
|
|
- if (item.getInventorStr() != null && item.getInventorStr() != "") {
|
|
|
+ if (item.getInventorStr() != null && !item.getInventorStr().equals("")) {
|
|
|
item.setInventor(new ArrayList<>());
|
|
|
List<String> inventors = Arrays.asList(item.getInventorStr().split(";"));
|
|
|
inventors.forEach(
|
|
@@ -185,7 +184,7 @@ public class PatentStarApiService {
|
|
|
);
|
|
|
}
|
|
|
//代理人
|
|
|
- if (item.getAgentStr() != null && item.getAgentStr() != "") {
|
|
|
+ if (item.getAgentStr() != null && !item.getAgentStr().equals("")) {
|
|
|
List<String> agent = Arrays.asList(item.getAgentStr().split(";"));
|
|
|
agent.forEach(
|
|
|
tem -> {
|
|
@@ -214,47 +213,47 @@ public class PatentStarApiService {
|
|
|
//法律状态
|
|
|
});
|
|
|
}
|
|
|
-public Map<String,Object>patentStarSearchLocal(PatentStarListDto patentStarListDto)throws IOException{
|
|
|
|
|
|
- RetrieveRecord retrieveRecord =new RetrieveRecord();
|
|
|
- retrieveRecord.setConditions(patentStarListDto.getCurrentQuery());
|
|
|
- if(patentStarListDto.getRetrieveRecordId()!=null){
|
|
|
- retrieveRecord=retrieveRecordService.getById(patentStarListDto.getRetrieveRecordId());
|
|
|
- patentStarListDto.setCurrentQuery(retrieveRecord.getConditions());
|
|
|
- patentStarListDto.setDBType(retrieveRecord.getDbType());
|
|
|
- }
|
|
|
-Map<String,Object> map = this.patentStarSearchApi(patentStarListDto);
|
|
|
- //记录检索历史
|
|
|
- retrieveRecord.setRetrieveTime(new Date());
|
|
|
- retrieveRecord.setTotalNum(Integer.parseInt(map.get("total").toString()));
|
|
|
- retrieveRecord.setDbType(patentStarListDto.getDBType());
|
|
|
- if(patentStarListDto.getRetrieveRecordId()==null) {
|
|
|
- //获取创建人信息
|
|
|
- PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
|
|
|
- retrieveRecord.setCreateTime(new Date());
|
|
|
- retrieveRecord.setCreateId(personnelVO.getId());
|
|
|
- retrieveRecord.setTenantId(personnelVO.getTenantId());
|
|
|
- retrieveRecord.insert();
|
|
|
+ public Map<String, Object> patentStarSearchLocal(PatentStarListDto patentStarListDto) throws IOException {
|
|
|
|
|
|
- }
|
|
|
- else {
|
|
|
- retrieveRecord.updateById();
|
|
|
- }
|
|
|
- map.put("retrieveRecordId",retrieveRecord.getId());
|
|
|
- return map ;
|
|
|
+ RetrieveRecord retrieveRecord = new RetrieveRecord();
|
|
|
+ retrieveRecord.setConditions(patentStarListDto.getCurrentQuery());
|
|
|
+ if (patentStarListDto.getRetrieveRecordId() != null) {
|
|
|
+ //retrieveRecord = retrieveRecordService.getById(patentStarListDto.getRetrieveRecordId());
|
|
|
+ //patentStarListDto.setCurrentQuery(retrieveRecord.getConditions());
|
|
|
+ //patentStarListDto.setDBType(retrieveRecord.getDbType());
|
|
|
+ }
|
|
|
+ Map<String, Object> map = this.patentStarSearchApi(patentStarListDto);
|
|
|
+ //记录检索历史
|
|
|
+ retrieveRecord.setRetrieveTime(new Date());
|
|
|
+ retrieveRecord.setTotalNum(Integer.parseInt(map.get("total").toString()));
|
|
|
+ retrieveRecord.setDbType(patentStarListDto.getDBType());
|
|
|
+ if (patentStarListDto.getRetrieveRecordId() == null) {
|
|
|
+ //获取创建人信息
|
|
|
+ PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
|
|
|
+ retrieveRecord.setCreateTime(new Date());
|
|
|
+ retrieveRecord.setCreateId(personnelVO.getId());
|
|
|
+ retrieveRecord.setTenantId(personnelVO.getTenantId());
|
|
|
+ retrieveRecord.insert();
|
|
|
+ }
|
|
|
+// else {
|
|
|
+// retrieveRecord.updateById();
|
|
|
+// }
|
|
|
+ map.put("retrieveRecordId", retrieveRecord.getId());
|
|
|
+ return map;
|
|
|
|
|
|
-}
|
|
|
+ }
|
|
|
|
|
|
public Map<String, Object> patentStarSearchApi(PatentStarListDto patentStarListDto) throws IOException {
|
|
|
try {
|
|
|
- String formQuery = patentStarListDto.getCurrentQuery();
|
|
|
- patentStarListDto.setCurrentQuery(PatentStarApiService.formatQuery(formQuery));
|
|
|
+ String formQuery = patentStarListDto.getCurrentQuery();
|
|
|
+ patentStarListDto.setCurrentQuery(PatentStarApiService.formatQuery(formQuery));
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
return null;
|
|
|
}
|
|
|
- PatentStarDto patentStarDto= new PatentStarDto();
|
|
|
- BeanUtils.copyProperties(patentStarListDto,patentStarDto);
|
|
|
+ PatentStarDto patentStarDto = new PatentStarDto();
|
|
|
+ BeanUtils.copyProperties(patentStarListDto, patentStarDto);
|
|
|
String json = JSONObject.toJSONString(patentStarDto);
|
|
|
String url = "http://s.patentstar.com.cn/SearchAPI/PatentSearch/ResultGet";
|
|
|
Long currentTimeMillis = System.currentTimeMillis() / 1000;
|