|
@@ -1,16 +1,18 @@
|
|
|
package cn.cslg.pas.service.outApi;
|
|
|
|
|
|
import cn.cslg.pas.common.model.PatentCell;
|
|
|
-import cn.cslg.pas.common.model.dto.GetClaimsInfoParamsDTO;
|
|
|
-import cn.cslg.pas.common.model.dto.GetDescriptionInfoParamsDTO;
|
|
|
-import cn.cslg.pas.common.model.dto.GetFuTuParamsDTO;
|
|
|
-import cn.cslg.pas.common.model.dto.GetSearchBiblioParamsDTO;
|
|
|
+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;
|
|
@@ -22,6 +24,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import okhttp3.*;
|
|
|
import org.apache.commons.lang3.StringEscapeUtils;
|
|
|
import org.junit.Test;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -42,7 +45,9 @@ import java.util.regex.Pattern;
|
|
|
@Service
|
|
|
|
|
|
public class PatentStarApiService {
|
|
|
-
|
|
|
+ private final RetrieveRecordService retrieveRecordService;
|
|
|
+ private final CacheUtils cacheUtils;
|
|
|
+ private final LoginUtils loginUtils;
|
|
|
public static String formatValue(String value) {
|
|
|
return value.replace("~", ">");
|
|
|
}
|
|
@@ -209,17 +214,48 @@ 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();
|
|
|
|
|
|
+ }
|
|
|
+ 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;
|
|
|
}
|
|
|
-
|
|
|
- String json = JSONObject.toJSONString(patentStarListDto);
|
|
|
+ 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;
|
|
|
String Sign = "FNYJD7902206FFB741E163BE6536C3689D55" + currentTimeMillis.toString();
|
|
@@ -308,6 +344,7 @@ public class PatentStarApiService {
|
|
|
return "{}";
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* @param
|
|
|
* @return
|
|
@@ -439,7 +476,6 @@ public class PatentStarApiService {
|
|
|
* @author 李仁杰
|
|
|
* 从专利之星获取中国专利全文图片
|
|
|
*/
|
|
|
-
|
|
|
public String getCnPdfApi(String appNo) throws IOException {
|
|
|
String url = "https://api.patentstar.com.cn/api/Patent/CnPdf/" + appNo;
|
|
|
String appId = "2000041";
|