|
@@ -1,11 +1,14 @@
|
|
|
package cn.cslg.report.service.business;
|
|
|
|
|
|
|
|
|
+import cn.cslg.report.common.model.vo.PatentVO;
|
|
|
import cn.cslg.report.common.utils.Response;
|
|
|
|
|
|
import cn.cslg.report.entity.asso.AssoTaskPersonel;
|
|
|
import cn.cslg.report.mapper.AssoTaskPersonelMapper;
|
|
|
|
|
|
+import cn.cslg.report.service.OutInterfaceService;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
@@ -34,6 +37,7 @@ import java.util.stream.Collectors;
|
|
|
@SuppressWarnings({"all"})
|
|
|
public class AssoTaskPersonelService extends ServiceImpl<AssoTaskPersonelMapper, AssoTaskPersonel> {
|
|
|
public final AssoTaskPersonelMapper assoTaskPersonelMapper ;
|
|
|
+ public final OutInterfaceService outInterfaceService;
|
|
|
public static final MediaType JSON = MediaType.parse("application/json; charset=utf-8");
|
|
|
@Value("${PCSUrl}")
|
|
|
private String PCSUrl;
|
|
@@ -63,35 +67,51 @@ public class AssoTaskPersonelService extends ServiceImpl<AssoTaskPersonelMapper,
|
|
|
* @return 专利号
|
|
|
* @throws IOException
|
|
|
*/
|
|
|
- public String pagination(int personelId , int state, int taskId,int location)throws IOException{
|
|
|
- Map<String,Object> map =new HashMap<>();
|
|
|
- List<String> patentNumber =new ArrayList<>();
|
|
|
- if(state==3){
|
|
|
- LambdaQueryWrapper<AssoTaskPersonel> wrappers =new LambdaQueryWrapper();
|
|
|
- wrappers.eq(AssoTaskPersonel::getPersonelId,personelId)
|
|
|
- .eq(AssoTaskPersonel::getTaskId,taskId);
|
|
|
+ public String pagination(PatentVO patentVO)throws IOException {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ List<String> patentNumber = new ArrayList<>();
|
|
|
+ if (patentVO.getState() == 3) {
|
|
|
+ //3类型包括1和2
|
|
|
+ LambdaQueryWrapper<AssoTaskPersonel> wrappers = new LambdaQueryWrapper();
|
|
|
+ wrappers.eq(AssoTaskPersonel::getTaskId, patentVO.getTaskId());
|
|
|
List<AssoTaskPersonel> list = this.list(wrappers);
|
|
|
- patentNumber=list.stream().map(AssoTaskPersonel ::getPatentNo).collect(Collectors.toList());
|
|
|
+ //专利号
|
|
|
+ patentNumber = list.stream().map(AssoTaskPersonel::getPatentNo).collect(Collectors.toList());
|
|
|
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
//拿到专利号
|
|
|
- patentNumber = assoTaskPersonelMapper.getPatentNumber(personelId, state, taskId);
|
|
|
- }
|
|
|
-
|
|
|
+ LambdaQueryWrapper<AssoTaskPersonel> wrappers = new LambdaQueryWrapper();
|
|
|
+ wrappers.eq(AssoTaskPersonel::getTaskId, patentVO.getTaskId())
|
|
|
+ .eq(AssoTaskPersonel::getState, patentVO.getState());
|
|
|
|
|
|
- map.put("patentNos",patentNumber);
|
|
|
- map.put("startNumber",location);
|
|
|
- JSONObject json = new JSONObject(map);
|
|
|
- RequestBody requestBody =RequestBody.create(JSON,String.valueOf(json));
|
|
|
- //网络通信协议调 分析系统api/v2/patent/getPagination
|
|
|
- OkHttpClient okHttpClient = new OkHttpClient();
|
|
|
- Request request = new Request.Builder()
|
|
|
- .url(PASUrl + "/api/v2/patent/getPagination")
|
|
|
- .post(requestBody)
|
|
|
- .build();
|
|
|
- //获取分析系统api/v2/patent/getPagination 返回值
|
|
|
- return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ patentVO.setPatentNos(patentNumber);
|
|
|
+
|
|
|
+ if (patentVO.getLocPosition() <= 1) {
|
|
|
+ patentVO.setStartNumber(0);
|
|
|
+ patentVO.setEndNumber(1);
|
|
|
+ String res = outInterfaceService.getPatentFromPAS(patentVO, 1);
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(res);
|
|
|
+ JSONObject jsonObject1 = JSONObject.parseObject(jsonObject.get("data").toString());
|
|
|
+ List<JSONObject> jsonObjects = JSONArray.parseArray(jsonObject1.get("records").toString(), JSONObject.class);
|
|
|
+ jsonObject1.put("type", "first");
|
|
|
+ } else {
|
|
|
+ patentVO.setStartNumber(patentVO.getLocPosition() - 2);
|
|
|
+ patentVO.setEndNumber(patentVO.getLocPosition());
|
|
|
+ String res = outInterfaceService.getPatentFromPAS(patentVO, 1);
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(res);
|
|
|
+ JSONObject jsonObject1 = JSONObject.parseObject(jsonObject.get("data").toString());
|
|
|
+ List<JSONObject> jsonObjects = JSONArray.parseArray(jsonObject1.get("records").toString(), JSONObject.class);
|
|
|
+ if (jsonObjects.size() < 3) {
|
|
|
+
|
|
|
+ jsonObject1.put("type", "end");
|
|
|
+
|
|
|
+ } else {
|
|
|
+ jsonObject1.put("type", "normal");
|
|
|
+ }
|
|
|
+ return "11";
|
|
|
+ }
|
|
|
|
|
|
+ return "11"; }
|
|
|
}
|