|
@@ -4,6 +4,7 @@ import cn.cslg.report.common.core.base.Constants;
|
|
|
import cn.cslg.report.common.model.vo.LoginVO;
|
|
|
import cn.cslg.report.common.model.vo.PatentVO;
|
|
|
import cn.cslg.report.common.model.vo.PersonnelVO;
|
|
|
+import cn.cslg.report.common.model.vo.TaskParams;
|
|
|
import cn.cslg.report.common.utils.CacheUtils;
|
|
|
import cn.cslg.report.common.utils.JsonUtils;
|
|
|
import cn.cslg.report.common.utils.SecurityUtils.LoginUtils;
|
|
@@ -14,18 +15,19 @@ import cn.cslg.report.service.business.ReportService;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.google.gson.Gson;
|
|
|
+import io.lettuce.core.event.EventBus;
|
|
|
import io.swagger.v3.oas.models.security.SecurityScheme;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
-import okhttp3.MediaType;
|
|
|
-import okhttp3.OkHttpClient;
|
|
|
-import okhttp3.Request;
|
|
|
-import okhttp3.RequestBody;
|
|
|
+import lombok.val;
|
|
|
+import okhttp3.*;
|
|
|
+import okio.ByteString;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -328,6 +330,7 @@ if(personnelVO.getName()==null)
|
|
|
map.put("size", patentVO.getSize());
|
|
|
map.put("current", patentVO.getCurrent());
|
|
|
map.put("patentNos",patentVO.getPatentNos());
|
|
|
+ map.put("notInPatentNos",patentVO.getNotInPatentNos());
|
|
|
JSONObject json = new JSONObject(map);
|
|
|
RequestBody requestBody = RequestBody.create(JSON, String.valueOf(json));
|
|
|
OkHttpClient okHttpClient = new OkHttpClient();
|
|
@@ -360,4 +363,51 @@ if(personnelVO.getName()==null)
|
|
|
.build();
|
|
|
return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
|
|
|
}
|
|
|
+
|
|
|
+ public String importPatents(TaskParams taskParams) throws IOException {
|
|
|
+ OkHttpClient httpClient = new OkHttpClient.Builder()
|
|
|
+ .pingInterval(40, TimeUnit.SECONDS) // 设置 PING 帧发送间隔
|
|
|
+ .build();
|
|
|
+ String param = new Gson().toJson(taskParams);
|
|
|
+ RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), param);
|
|
|
+ Request request = new Request.Builder()
|
|
|
+ .url(PASUrl + "/api/v2/project/import/sysPatent")
|
|
|
+ .get()
|
|
|
+ .build();
|
|
|
+
|
|
|
+ httpClient.newWebSocket(request, new WebSocketListener() {
|
|
|
+ @Override
|
|
|
+ public void onOpen(WebSocket webSocket, Response response) {
|
|
|
+ super.onOpen(webSocket, response);
|
|
|
+// EventBus.getDefault().post(taskParams);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onMessage(WebSocket webSocket, String text) {
|
|
|
+ super.onMessage(webSocket, text);
|
|
|
+ //收到消息...(一般是这里处理json)
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onMessage(WebSocket webSocket, ByteString bytes) {
|
|
|
+ super.onMessage(webSocket, bytes);
|
|
|
+ //收到消息...(一般很少这种消息)
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onClosed(WebSocket webSocket, int code, String reason) {
|
|
|
+ super.onClosed(webSocket, code, reason);
|
|
|
+ //连接关闭...
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFailure(WebSocket webSocket, Throwable throwable, Response response) {
|
|
|
+ super.onFailure(webSocket, throwable, response);
|
|
|
+ //连接失败...
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ return Objects.requireNonNull(httpClient.newCall(request).execute().body()).string();
|
|
|
+ }
|
|
|
}
|