|
@@ -6,11 +6,20 @@ 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.outApi.PatentStarListDto;
|
|
|
+import cn.cslg.pas.common.utils.FormatUtil;
|
|
|
+import cn.cslg.pas.common.utils.JsonUtils;
|
|
|
+import cn.cslg.pas.common.utils.SecurityUtils.SecurityUtils;
|
|
|
import cn.cslg.pas.domain.PubNo;
|
|
|
+import cn.hutool.crypto.SecureUtil;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+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 org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -28,6 +37,7 @@ import java.util.concurrent.TimeUnit;
|
|
|
@RequiredArgsConstructor
|
|
|
@Slf4j
|
|
|
@Service
|
|
|
+
|
|
|
public class PatentStarApiService {
|
|
|
@Value("${authorUrl}")
|
|
|
private String PCSUrl;
|
|
@@ -36,191 +46,407 @@ public class PatentStarApiService {
|
|
|
@Value("${PASUrl}")
|
|
|
private String PASUrl;
|
|
|
|
|
|
-
|
|
|
public String patentStarSearchApi(PatentStarListDto patentStarListDto) throws IOException {
|
|
|
-
|
|
|
-// // 创建一个OkHttpClient对象
|
|
|
-// OkHttpClient okHttpClient = new OkHttpClient();
|
|
|
-//
|
|
|
-// // 创建一个RequestBody(参数1:数据类型 参数2传递的json串)
|
|
|
-// FormBody.Builder builder = new FormBody.Builder();
|
|
|
-//
|
|
|
-// for (String key : param.keySet()) {
|
|
|
-// Object obj = param.get(key);
|
|
|
-// if (obj != null) {
|
|
|
-// builder.addEncoded(key, param.get(key).toString());
|
|
|
-// } else {
|
|
|
-// builder.addEncoded(key, "");
|
|
|
-// }
|
|
|
-// }
|
|
|
-// FormBody requestBody = builder.build();
|
|
|
-//
|
|
|
-// // 创建一个请求对象
|
|
|
-// Request request = new Request.Builder().url(url).post(requestBody).build();
|
|
|
-// // 发送请求获取响应
|
|
|
-// try {
|
|
|
-// Response response = okHttpClient.newCall(request).execute();
|
|
|
-// // 判断请求是否成功
|
|
|
-// if (response.isSuccessful()) {
|
|
|
-// // 打印服务端返回结果
|
|
|
-// return response.body().string();
|
|
|
-// }
|
|
|
-// } catch (IOException e) {
|
|
|
-// e.printStackTrace();
|
|
|
-// }
|
|
|
-// return "{}";
|
|
|
-// OkHttpClient okHttpClient = new OkHttpClient();
|
|
|
-// Request request = new Request.Builder()
|
|
|
-// .url(PCSUrl + "/permission/api/system/getPersonIdByName?personName=" + personName)
|
|
|
-// .get()
|
|
|
-// .build();
|
|
|
-// return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
|
|
|
- return "";
|
|
|
+ String json = JSONObject.toJSONString(patentStarListDto);
|
|
|
+ String url = "http://s.patentstar.com.cn/SearchAPI/PatentSearch/ResultGet";
|
|
|
+ Long currentTimeMillis = System.currentTimeMillis() / 1000;
|
|
|
+ String Sign = "FNYJD7902206FFB741E163BE6536C3689D55" + currentTimeMillis.toString();
|
|
|
+ String signMd5 = FormatUtil.MD5(Sign);
|
|
|
+ // 创建一个OkHttpClient对象
|
|
|
+ OkHttpClient okHttpClient = new OkHttpClient();
|
|
|
+ // 创建一个RequestBody(参数1:数据类型 参数2传递的json串)
|
|
|
+ FormBody.Builder builder = new FormBody.Builder();
|
|
|
+ builder.add("AppID", "K8FFB741E163BE6536");
|
|
|
+ builder.add("Stamp", currentTimeMillis.toString());
|
|
|
+ builder.add("Sign", signMd5);
|
|
|
+ builder.add("QueryJson", json);
|
|
|
+ FormBody requestBody = builder.build();
|
|
|
+ // 创建一个请求对象
|
|
|
+ Request request = new Request.Builder().url(url).post(requestBody).build();
|
|
|
+ // 发送请求获取响应
|
|
|
+ try {
|
|
|
+ Response response = okHttpClient.newCall(request).execute();
|
|
|
+ // 判断请求是否成功
|
|
|
+ if (response.isSuccessful()) {
|
|
|
+// JSONObject jsonObject =JSONObject.parseObject(Objects.requireNonNull(response.body()).string());
|
|
|
+// JSONObject jsonObject1= (JSONObject)jsonObject.get("Data");
|
|
|
+ // 打印服务端返回结果
|
|
|
+ return Objects.requireNonNull(response.body()).string();
|
|
|
+ }
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return "{}";
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * @param appNo
|
|
|
+ * @return
|
|
|
+ * @throws IOException
|
|
|
+ * @author 李仁杰
|
|
|
+ * 从专利之星获取摘要附图
|
|
|
+ */
|
|
|
+ public String getCnBibApi(String appNo) throws IOException {
|
|
|
+ String url = "https://api.patentstar.com.cn/api/Patent/CnBib/" + appNo;
|
|
|
+ String appId = "2000041";
|
|
|
+ String appkey = "F0E183D5F02C48E391F5FADF1B646F54";
|
|
|
+ Long currentTimeMillis = System.currentTimeMillis() / 1000;
|
|
|
+ String Sign = appId + appkey + currentTimeMillis.toString();
|
|
|
+ String signMd5 = FormatUtil.MD5(Sign);
|
|
|
+ // 创建一个OkHttpClient对象
|
|
|
+ OkHttpClient okHttpClient = new OkHttpClient();
|
|
|
+ // 创建一个请求对象
|
|
|
+ Request request = new Request.Builder().url(url)
|
|
|
+ .addHeader("_appid", "2000041")
|
|
|
+ .addHeader("_timestamp", currentTimeMillis.toString())
|
|
|
+ .addHeader("_sign", signMd5)
|
|
|
+ .get().build();
|
|
|
+ // 发送请求获取响应
|
|
|
+ try {
|
|
|
+ Response response = okHttpClient.newCall(request).execute();
|
|
|
+ // 判断请求是否成功
|
|
|
+ if (response.isSuccessful()) {
|
|
|
+ response.body().toString();
|
|
|
+ // 打印服务端返回结果
|
|
|
+ return Objects.requireNonNull(response.body()).string();
|
|
|
+ }
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return "{}";
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 根据人员ids查询人员列表
|
|
|
- *
|
|
|
- * @param ids 人员ids
|
|
|
- * @return 返回装载着人员列表数据的data的String
|
|
|
+ * @param patentNo
|
|
|
+ * @return
|
|
|
+ * @throws IOException
|
|
|
+ * @author 李仁杰
|
|
|
+ * 从专利之星获取摘要附图
|
|
|
*/
|
|
|
- public String getPersonnelByIdsFromPCS(List<Integer> ids) throws IOException {
|
|
|
-
|
|
|
- String param = new Gson().toJson(ids);
|
|
|
- RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), param);
|
|
|
- OkHttpClient okHttpClient = new OkHttpClient.Builder()
|
|
|
- .connectTimeout(60, TimeUnit.SECONDS)
|
|
|
- .writeTimeout(60, TimeUnit.SECONDS)
|
|
|
- .readTimeout(60, TimeUnit.SECONDS)
|
|
|
- .build();
|
|
|
- Request request = new Request.Builder()
|
|
|
- .url(PCSUrl + "/permission/api/system/getPersonnelByIds")
|
|
|
- .post(requestBody)
|
|
|
- .build();
|
|
|
- return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
|
|
|
+ public String getPictureApi(String patentNo) throws IOException {
|
|
|
+ String url = "https://api.patentstar.com.cn/api/Patent/CnMainImage/" + patentNo;
|
|
|
+ String appId = "2000041";
|
|
|
+ String appkey = "F0E183D5F02C48E391F5FADF1B646F54";
|
|
|
+ Long currentTimeMillis = System.currentTimeMillis() / 1000;
|
|
|
+ String Sign = appId + appkey + currentTimeMillis.toString();
|
|
|
+ String signMd5 = FormatUtil.MD5(Sign);
|
|
|
+ // 创建一个OkHttpClient对象
|
|
|
+ OkHttpClient okHttpClient = new OkHttpClient();
|
|
|
+ // 创建一个请求对象
|
|
|
+ Request request = new Request.Builder().url(url)
|
|
|
+ .addHeader("_appid", "2000041")
|
|
|
+ .addHeader("_timestamp", currentTimeMillis.toString())
|
|
|
+ .addHeader("_sign", signMd5)
|
|
|
+ .get().build();
|
|
|
+ // 发送请求获取响应
|
|
|
+ try {
|
|
|
+ Response response = okHttpClient.newCall(request).execute();
|
|
|
+ // 判断请求是否成功
|
|
|
+ if (response.isSuccessful()) {
|
|
|
+ response.body().toString();
|
|
|
+ // 打印服务端返回结果
|
|
|
+ return Objects.requireNonNull(response.body()).string();
|
|
|
+ }
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return "{}";
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 远程调用获取一批专利著录的接口
|
|
|
- *
|
|
|
+ * @param appNo
|
|
|
* @return
|
|
|
+ * @throws IOException
|
|
|
+ * @author 李仁杰
|
|
|
+ * 从专利之星获取中国专利外观图
|
|
|
*/
|
|
|
- public String getSearchBiblio(GetSearchBiblioParamsDTO getSearchBiblioParamsDTO) throws IOException {
|
|
|
- //String param = new Gson().toJson(getSearchBiblioParamsDTO);
|
|
|
- //RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), param);
|
|
|
- OkHttpClient okHttpClient = new OkHttpClient.Builder()
|
|
|
- .connectTimeout(60, TimeUnit.SECONDS)
|
|
|
- .writeTimeout(60, TimeUnit.SECONDS)
|
|
|
- .readTimeout(60, TimeUnit.SECONDS)
|
|
|
- .build();
|
|
|
- Request request = new Request.Builder()
|
|
|
- .url(OPSUrl + "/api/OPSQuery/SearchBiblio?query=" + getSearchBiblioParamsDTO.getQuery() + "&start=" + getSearchBiblioParamsDTO.getStart() + "&end=" + getSearchBiblioParamsDTO.getEnd())
|
|
|
- .get()
|
|
|
- .build();
|
|
|
- return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
|
|
|
+ public String getWGPictureApi(String appNo) throws IOException {
|
|
|
+
|
|
|
+ String url = "https://api.patentstar.com.cn/api/Patent/CnWGImage/" + appNo;
|
|
|
+ String appId = "2000041";
|
|
|
+ String appkey = "F0E183D5F02C48E391F5FADF1B646F54";
|
|
|
+ Long currentTimeMillis = System.currentTimeMillis() / 1000;
|
|
|
+ String Sign = appId + appkey + currentTimeMillis.toString();
|
|
|
+ String signMd5 = FormatUtil.MD5(Sign);
|
|
|
+ // 创建一个OkHttpClient对象
|
|
|
+ OkHttpClient okHttpClient = new OkHttpClient();
|
|
|
+ // 创建一个请求对象
|
|
|
+ Request request = new Request.Builder().url(url)
|
|
|
+ .addHeader("_appid", "2000041")
|
|
|
+ .addHeader("_timestamp", currentTimeMillis.toString())
|
|
|
+ .addHeader("_sign", signMd5)
|
|
|
+ .get().build();
|
|
|
+ // 发送请求获取响应
|
|
|
+ try {
|
|
|
+ Response response = okHttpClient.newCall(request).execute();
|
|
|
+ // 判断请求是否成功
|
|
|
+ if (response.isSuccessful()) {
|
|
|
+ response.body().toString();
|
|
|
+ // 打印服务端返回结果
|
|
|
+ return Objects.requireNonNull(response.body()).string();
|
|
|
+ }
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return "{}";
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 远程调用获取权要信息的接口
|
|
|
- *
|
|
|
+ * @param appNo
|
|
|
* @return
|
|
|
+ * @throws IOException
|
|
|
+ * @author 李仁杰
|
|
|
+ * 从专利之星获取中国专利法律状态
|
|
|
*/
|
|
|
- public String getClaimsInfo(GetClaimsInfoParamsDTO getClaimsInfoParamsDTO) throws IOException {
|
|
|
- //String param = new Gson().toJson(getClaimsInfoParamsDTO);
|
|
|
- //RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), param);
|
|
|
- OkHttpClient okHttpClient = new OkHttpClient.Builder()
|
|
|
- .connectTimeout(60, TimeUnit.SECONDS)
|
|
|
- .writeTimeout(60, TimeUnit.SECONDS)
|
|
|
- .readTimeout(60, TimeUnit.SECONDS)
|
|
|
- .build();
|
|
|
- Request request = new Request.Builder()
|
|
|
- .url(OPSUrl + "/api/OPSQuery/GetClaimsInfo?cc=" + getClaimsInfoParamsDTO.getCc() + "&number=" + getClaimsInfoParamsDTO.getNumber() + "&kind=" + getClaimsInfoParamsDTO.getKind())
|
|
|
- .get()
|
|
|
- .build();
|
|
|
- return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
|
|
|
+ public String getCnLegalApi(String appNo) throws IOException {
|
|
|
+ String url = "https://api.patentstar.com.cn/api/Patent/CnLegal/"+appNo;
|
|
|
+ String appId = "2000041";
|
|
|
+ String appkey = "F0E183D5F02C48E391F5FADF1B646F54";
|
|
|
+ Long currentTimeMillis = System.currentTimeMillis() / 1000;
|
|
|
+ String Sign = appId + appkey + currentTimeMillis.toString();
|
|
|
+ String signMd5 = FormatUtil.MD5(Sign);
|
|
|
+ // 创建一个OkHttpClient对象
|
|
|
+ OkHttpClient okHttpClient = new OkHttpClient();
|
|
|
+ // 创建一个请求对象
|
|
|
+ Request request = new Request.Builder().url(url)
|
|
|
+ .addHeader("_appid", "2000041")
|
|
|
+ .addHeader("_timestamp", currentTimeMillis.toString())
|
|
|
+ .addHeader("_sign", signMd5)
|
|
|
+ .get().build();
|
|
|
+ // 发送请求获取响应
|
|
|
+ try {
|
|
|
+ Response response = okHttpClient.newCall(request).execute();
|
|
|
+ // 判断请求是否成功
|
|
|
+ if (response.isSuccessful()) {
|
|
|
+ response.body().toString();
|
|
|
+ // 打印服务端返回结果
|
|
|
+ return Objects.requireNonNull(response.body()).string();
|
|
|
+ }
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return "{}";
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 远程调用获取说明书的接口
|
|
|
- *
|
|
|
+ * @param appNo
|
|
|
+ * @return
|
|
|
+ * @throws IOException
|
|
|
+ * @author 李仁杰
|
|
|
+ * 从专利之星获取中国专利全文图片
|
|
|
+ */
|
|
|
+
|
|
|
+ public String getCnPdfApi(String appNo) throws IOException {
|
|
|
+ String url = "https://api.patentstar.com.cn/api/Patent/CnPdf/"+appNo;
|
|
|
+ String appId = "2000041";
|
|
|
+ String appkey = "F0E183D5F02C48E391F5FADF1B646F54";
|
|
|
+ Long currentTimeMillis = System.currentTimeMillis() / 1000;
|
|
|
+ String Sign = appId + appkey + currentTimeMillis.toString();
|
|
|
+ String signMd5 = FormatUtil.MD5(Sign);
|
|
|
+ // 创建一个OkHttpClient对象
|
|
|
+ OkHttpClient okHttpClient = new OkHttpClient();
|
|
|
+ // 创建一个请求对象
|
|
|
+ Request request = new Request.Builder().url(url)
|
|
|
+ .addHeader("_appid", "2000041")
|
|
|
+ .addHeader("_timestamp", currentTimeMillis.toString())
|
|
|
+ .addHeader("_sign", signMd5)
|
|
|
+ .get().build();
|
|
|
+ // 发送请求获取响应
|
|
|
+ try {
|
|
|
+ Response response = okHttpClient.newCall(request).execute();
|
|
|
+ // 判断请求是否成功
|
|
|
+ if (response.isSuccessful()) {
|
|
|
+ response.body().toString();
|
|
|
+ // 打印服务端返回结果
|
|
|
+ return Objects.requireNonNull(response.body()).string();
|
|
|
+ }
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return "{}";
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * @param appNo
|
|
|
* @return
|
|
|
+ * @throws IOException
|
|
|
+ * @author 李仁杰
|
|
|
+ * 从专利之星获取中国专利全文文本
|
|
|
*/
|
|
|
- public String getDescriptionInfo(GetDescriptionInfoParamsDTO getDescriptionInfoParamsDTO) throws IOException {
|
|
|
- //String param = new Gson().toJson(getDescriptionInfoParamsDTO);
|
|
|
- //RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), param);
|
|
|
- OkHttpClient okHttpClient = new OkHttpClient.Builder()
|
|
|
- .connectTimeout(60, TimeUnit.SECONDS)
|
|
|
- .writeTimeout(60, TimeUnit.SECONDS)
|
|
|
- .readTimeout(60, TimeUnit.SECONDS)
|
|
|
- .build();
|
|
|
- Request request = new Request.Builder()
|
|
|
- .url(OPSUrl + "/api/OPSQuery/GetDescriptionInfo?cc=" + getDescriptionInfoParamsDTO.getCc() + "&number=" + getDescriptionInfoParamsDTO.getNumber() + "&kind=" + getDescriptionInfoParamsDTO.getKind())
|
|
|
- .get()
|
|
|
- .build();
|
|
|
- return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
|
|
|
+
|
|
|
+ public String getCnFullXmlApi(String appNo) throws IOException {
|
|
|
+ String url = "https://api.patentstar.com.cn/api/Patent/CnFullXml/"+appNo;
|
|
|
+ String appId = "2000041";
|
|
|
+ String appkey = "F0E183D5F02C48E391F5FADF1B646F54";
|
|
|
+ Long currentTimeMillis = System.currentTimeMillis() / 1000;
|
|
|
+ String Sign = appId + appkey + currentTimeMillis.toString();
|
|
|
+ String signMd5 = FormatUtil.MD5(Sign);
|
|
|
+ // 创建一个OkHttpClient对象
|
|
|
+ OkHttpClient okHttpClient = new OkHttpClient();
|
|
|
+ // 创建一个请求对象
|
|
|
+ Request request = new Request.Builder().url(url)
|
|
|
+ .addHeader("_appid", "2000041")
|
|
|
+ .addHeader("_timestamp", currentTimeMillis.toString())
|
|
|
+ .addHeader("_sign", signMd5)
|
|
|
+ .get().build();
|
|
|
+ // 发送请求获取响应
|
|
|
+ try {
|
|
|
+ Response response = okHttpClient.newCall(request).execute();
|
|
|
+ // 判断请求是否成功
|
|
|
+ if (response.isSuccessful()) {
|
|
|
+ response.body().toString();
|
|
|
+ // 打印服务端返回结果
|
|
|
+ return Objects.requireNonNull(response.body()).string();
|
|
|
+ }
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return "{}";
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 远程调用获取Image信息的接口
|
|
|
- *
|
|
|
+ * @param patentNo
|
|
|
* @return
|
|
|
+ * @throws IOException
|
|
|
+ * @author 李仁杰
|
|
|
+ * 从专利之星获取世界专利pdf
|
|
|
*/
|
|
|
- public String getImagesInfo(PubNo pubNo) throws IOException {
|
|
|
- String pn = pubNo.getCountry() + pubNo.getNumber() + "." + pubNo.getKind();
|
|
|
- //String param = new Gson().toJson(pn);
|
|
|
- //RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), param);
|
|
|
- OkHttpClient okHttpClient = new OkHttpClient.Builder()
|
|
|
- .connectTimeout(60, TimeUnit.SECONDS)
|
|
|
- .writeTimeout(60, TimeUnit.SECONDS)
|
|
|
- .readTimeout(60, TimeUnit.SECONDS)
|
|
|
- .build();
|
|
|
- Request request = new Request.Builder()
|
|
|
- .url(OPSUrl + "/api/OPSQuery/GetImagesInfo?Pn=" + pn)
|
|
|
- .get()
|
|
|
- .build();
|
|
|
- return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
|
|
|
+ public String getEnPdfApi(String patentNo) throws IOException {
|
|
|
+ String url = " https://api.patentstar.com.cn/api/Patent/EnPdf/"+patentNo;
|
|
|
+ String appId = "2000041";
|
|
|
+ String appkey = "F0E183D5F02C48E391F5FADF1B646F54";
|
|
|
+ Long currentTimeMillis = System.currentTimeMillis() / 1000;
|
|
|
+ String Sign = appId + appkey + currentTimeMillis.toString();
|
|
|
+ String signMd5 = FormatUtil.MD5(Sign);
|
|
|
+ // 创建一个OkHttpClient对象
|
|
|
+ OkHttpClient okHttpClient = new OkHttpClient();
|
|
|
+ // 创建一个请求对象
|
|
|
+ Request request = new Request.Builder().url(url)
|
|
|
+ .addHeader("_appid", "2000041")
|
|
|
+ .addHeader("_timestamp", currentTimeMillis.toString())
|
|
|
+ .addHeader("_sign", signMd5)
|
|
|
+ .get().build();
|
|
|
+ // 发送请求获取响应
|
|
|
+ try {
|
|
|
+ Response response = okHttpClient.newCall(request).execute();
|
|
|
+ // 判断请求是否成功
|
|
|
+ if (response.isSuccessful()) {
|
|
|
+ response.body().toString();
|
|
|
+ // 打印服务端返回结果
|
|
|
+ return Objects.requireNonNull(response.body()).string();
|
|
|
+ }
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return "{}";
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 远程调用获取附件文件流的接口
|
|
|
- *
|
|
|
+ * @param patentNo
|
|
|
* @return
|
|
|
+ * @throws IOException
|
|
|
+ * @author 李仁杰
|
|
|
+ * 从专利之星获取世界专利著录信息
|
|
|
*/
|
|
|
- public byte[] getPatentFile(GetFuTuParamsDTO getFuTuParamsDTO) throws IOException {
|
|
|
- //String param = new Gson().toJson(getFuTuParamsDTO);
|
|
|
- //RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), param);
|
|
|
- OkHttpClient okHttpClient = new OkHttpClient.Builder()
|
|
|
- .connectTimeout(60, TimeUnit.SECONDS)
|
|
|
- .writeTimeout(60, TimeUnit.SECONDS)
|
|
|
- .readTimeout(60, TimeUnit.SECONDS)
|
|
|
- .build();
|
|
|
- Request request = new Request.Builder()
|
|
|
- .url(OPSUrl + "/api/OPSQuery/GetPatentFile?link=" + getFuTuParamsDTO.getLink() + "&page=" + getFuTuParamsDTO.getPage() + "&type=" + getFuTuParamsDTO.getType())
|
|
|
- .get()
|
|
|
- .build();
|
|
|
- byte[] buffer = okHttpClient.newCall(request).execute().body().bytes();
|
|
|
- return buffer;
|
|
|
+ public String getENBibApi(String patentNo) throws IOException {
|
|
|
+ String url = "https://api.patentstar.com.cn/api/Patent/ENBib/"+patentNo;
|
|
|
+ String appId = "2000041";
|
|
|
+ String appkey = "F0E183D5F02C48E391F5FADF1B646F54";
|
|
|
+ Long currentTimeMillis = System.currentTimeMillis() / 1000;
|
|
|
+ String Sign = appId + appkey + currentTimeMillis.toString();
|
|
|
+ String signMd5 = FormatUtil.MD5(Sign);
|
|
|
+ // 创建一个OkHttpClient对象
|
|
|
+ OkHttpClient okHttpClient = new OkHttpClient();
|
|
|
+ // 创建一个请求对象
|
|
|
+ Request request = new Request.Builder().url(url)
|
|
|
+ .addHeader("_appid", "2000041")
|
|
|
+ .addHeader("_timestamp", currentTimeMillis.toString())
|
|
|
+ .addHeader("_sign", signMd5)
|
|
|
+ .get().build();
|
|
|
+ // 发送请求获取响应
|
|
|
+ try {
|
|
|
+ Response response = okHttpClient.newCall(request).execute();
|
|
|
+ // 判断请求是否成功
|
|
|
+ if (response.isSuccessful()) {
|
|
|
+ response.body().toString();
|
|
|
+ // 打印服务端返回结果
|
|
|
+ return Objects.requireNonNull(response.body()).string();
|
|
|
+ }
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return "{}";
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @params 传对象
|
|
|
- * @title 导入专利
|
|
|
- * @description 导入专利
|
|
|
- * @author lrj
|
|
|
+ * @param patentNo
|
|
|
+ * @return
|
|
|
+ * @throws IOException
|
|
|
+ * @author 李仁杰
|
|
|
+ * 从专利之星获取同族专利
|
|
|
*/
|
|
|
- public String importPatents(PatentCell patentCell) throws IOException {
|
|
|
- OkHttpClient httpClient = new OkHttpClient.Builder()
|
|
|
- .pingInterval(400, TimeUnit.SECONDS) // 设置 PING 帧发送间隔
|
|
|
- .connectTimeout(300, TimeUnit.SECONDS)//设置连接超时时间
|
|
|
- .readTimeout(300, TimeUnit.SECONDS)//设置读取超时时间
|
|
|
- .build();
|
|
|
- String param = new Gson().toJson(patentCell);
|
|
|
- RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), param);
|
|
|
- Request request = new Request.Builder()
|
|
|
- .url(PASUrl + "/api/v2/system/patentCellTODb")
|
|
|
- .post(requestBody)
|
|
|
- .build();
|
|
|
- return Objects.requireNonNull(httpClient.newCall(request).execute().body()).string();
|
|
|
+ public String getFamilyByPubNoApi(String patentNo) throws IOException {
|
|
|
+ String url = "https://api.patentstar.com.cn/api/Patent/FamilyByPubNo/"+patentNo;
|
|
|
+ String appId = "2000041";
|
|
|
+ String appkey = "F0E183D5F02C48E391F5FADF1B646F54";
|
|
|
+ Long currentTimeMillis = System.currentTimeMillis() / 1000;
|
|
|
+ String Sign = appId + appkey + currentTimeMillis.toString();
|
|
|
+ String signMd5 = FormatUtil.MD5(Sign);
|
|
|
+ // 创建一个OkHttpClient对象
|
|
|
+ OkHttpClient okHttpClient = new OkHttpClient();
|
|
|
+ // 创建一个请求对象
|
|
|
+ Request request = new Request.Builder().url(url)
|
|
|
+ .addHeader("_appid", "2000041")
|
|
|
+ .addHeader("_timestamp", currentTimeMillis.toString())
|
|
|
+ .addHeader("_sign", signMd5)
|
|
|
+ .get().build();
|
|
|
+ // 发送请求获取响应
|
|
|
+ try {
|
|
|
+ Response response = okHttpClient.newCall(request).execute();
|
|
|
+ // 判断请求是否成功
|
|
|
+ if (response.isSuccessful()) {
|
|
|
+ response.body().toString();
|
|
|
+ // 打印服务端返回结果
|
|
|
+ return Objects.requireNonNull(response.body()).string();
|
|
|
+ }
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return "{}";
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @param patentNo
|
|
|
+ * @return
|
|
|
+ * @throws IOException
|
|
|
+ * @author 李仁杰
|
|
|
+ * 获得专利被引用次数api
|
|
|
+ */
|
|
|
+ public String getCitedNumByPubNoApi(String patentNo) throws IOException {
|
|
|
+ String url = "https://api.patentstar.com.cn/api/Patent/CitedNumByPubNo/"+patentNo;
|
|
|
+ String appId = "2000041";
|
|
|
+ String appkey = "F0E183D5F02C48E391F5FADF1B646F54";
|
|
|
+ Long currentTimeMillis = System.currentTimeMillis()/ 1000;
|
|
|
+ String Sign = appId + appkey + currentTimeMillis.toString();
|
|
|
+ String signMd5 = FormatUtil.MD5(Sign);
|
|
|
+ // 创建一个OkHttpClient对象
|
|
|
+ OkHttpClient okHttpClient = new OkHttpClient();
|
|
|
+ // 创建一个请求对象
|
|
|
+ Request request = new Request.Builder().url(url)
|
|
|
+ .addHeader("_appid", "2000041")
|
|
|
+ .addHeader("_timestamp", currentTimeMillis.toString())
|
|
|
+ .addHeader("_sign", signMd5)
|
|
|
+ .get().build();
|
|
|
+ // 发送请求获取响应
|
|
|
+ try {
|
|
|
+ Response response = okHttpClient.newCall(request).execute();
|
|
|
+ // 判断请求是否成功
|
|
|
+ if (response.isSuccessful()) {
|
|
|
+ response.body().toString();
|
|
|
+ // 打印服务端返回结果
|
|
|
+ return Objects.requireNonNull(response.body()).string();
|
|
|
+ }
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return "{}";
|
|
|
+ }
|
|
|
}
|