|
@@ -6,12 +6,14 @@ import cn.cslg.pas.common.utils.DateUtils;
|
|
|
import cn.cslg.pas.common.utils.JsonUtils;
|
|
|
import cn.cslg.pas.common.utils.StringUtils;
|
|
|
import cn.cslg.pas.domain.*;
|
|
|
+import cn.cslg.pas.domain.asso.AssoProductPatent;
|
|
|
import cn.cslg.pas.domain.asso.TaskCondition;
|
|
|
import cn.cslg.pas.mapper.QuestionRecordMapper;
|
|
|
import cn.cslg.pas.service.OutInterfaceService;
|
|
|
import cn.cslg.pas.service.PatentInstructionService;
|
|
|
import cn.cslg.pas.service.TaskService;
|
|
|
import cn.cslg.pas.service.UploadPatentBatchService;
|
|
|
+import cn.cslg.pas.service.asso.AssoProductPatentService;
|
|
|
import cn.cslg.pas.service.asso.TaskConditionService;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
@@ -19,7 +21,11 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.*;
|
|
|
+import java.io.IOException;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
import java.util.concurrent.locks.Condition;
|
|
|
import java.util.concurrent.locks.Lock;
|
|
|
import java.util.concurrent.locks.ReentrantLock;
|
|
@@ -44,6 +50,7 @@ public class PantentQueueService {
|
|
|
private final PatentInstructionService patentInstructionService;
|
|
|
private final OutInterfaceService outInterfaceService;
|
|
|
private final QuestionRecordService questionRecordService;
|
|
|
+ private final AssoProductPatentService assoProductPatentService;
|
|
|
private final QuestionRecordMapper questionRecordMapper;
|
|
|
private final List<Integer> taskQueueList = new ArrayList<>();
|
|
|
private final List<PQueueData> setPatentImageQueueList = new ArrayList<>();
|
|
@@ -382,19 +389,6 @@ public class PantentQueueService {
|
|
|
queueData = patentZhuluQueueList.remove(0);
|
|
|
//著录项目入库
|
|
|
uploadPatentToDBService.uploadPatentZhulu(queueData.getUploadParamsVO());
|
|
|
- //判断是与专题库关联还是与报告关联
|
|
|
- if (queueData.getTask().getProjectId() != null && !queueData.getTask().getProjectId().equals(0)) {
|
|
|
- //与专题库关联入库
|
|
|
- uploadPatentToDBService.uploadAssoThemaPat(queueData.getUploadParamsVO(), queueData.getTask().getProjectId());
|
|
|
- } else if (queueData.getTask().getReportId() != null && !queueData.getTask().getReportId().equals(0)) {
|
|
|
- //与报告关联入库(调用报告系统接口)
|
|
|
- ImportTaskPatent importTaskPatent = new ImportTaskPatent();
|
|
|
- importTaskPatent.setImportTaskId(queueData.getTask().getId());
|
|
|
- importTaskPatent.setPatentNo(queueData.getUploadParamsVO().getPatent().getPatentNo());
|
|
|
- importTaskPatent.setReportId(queueData.getTask().getReportId());
|
|
|
- importTaskPatent.insert();
|
|
|
- outInterfaceService.importAssoReportPatentNo(queueData.getTask().getReportId(), queueData.getUploadParamsVO().getPatent().getPatentNo(), queueData.getUploadParamsVO().getPatent().getName(), queueData.getTask().getAsCompare());
|
|
|
- }
|
|
|
if (queueData.getTask().getPramJson() != null && !queueData.getTask().getPramJson().equals("")) {
|
|
|
ProjectImportPatentVO projectImportPatentVO = JsonUtils.jsonToPojo(queueData.getTask().getPramJson(), ProjectImportPatentVO.class);
|
|
|
//自定义字段标引与专利关联入库
|
|
@@ -563,7 +557,7 @@ public class PantentQueueService {
|
|
|
String currentPatent = task.getId() + "|" + queueData.getUploadParamsVO().getPatent().getId();
|
|
|
Integer num = patentIdMap.get(currentPatent);
|
|
|
int needNum = 3; //临界默认设为4(即Excel导入任务默认使用5个消费者)
|
|
|
- if (task.getType().equals(3) || task.getType().equals(4)) { //若是网站导入任务,则临界默认设为下载字段类型数量 - 1
|
|
|
+ if (task.getType().equals(3) || task.getType().equals(4) || task.getType().equals(5)) { //若是网站导入任务,则临界默认设为下载字段类型数量 - 1
|
|
|
needNum = task.getConfigCellsNum() - 1;
|
|
|
}
|
|
|
if (num == null && needNum > 0) {
|
|
@@ -578,6 +572,35 @@ public class PantentQueueService {
|
|
|
taskService.updateById(task);
|
|
|
}
|
|
|
patentIdMap.remove(currentPatent);
|
|
|
+
|
|
|
+ //与专题库/报告/产品关联
|
|
|
+ if (queueData.getTask().getProjectId() != null && !queueData.getTask().getProjectId().equals(0)) {
|
|
|
+ //与专题库关联入库
|
|
|
+ uploadPatentToDBService.uploadAssoThemaPat(queueData.getUploadParamsVO(), queueData.getTask().getProjectId());
|
|
|
+ } else if (queueData.getTask().getReportId() != null && !queueData.getTask().getReportId().equals(0)) {
|
|
|
+ //与报告关联入库(调用报告系统接口)
|
|
|
+ ImportTaskPatent importTaskPatent = new ImportTaskPatent();
|
|
|
+ importTaskPatent.setImportTaskId(queueData.getTask().getId());
|
|
|
+ importTaskPatent.setPatentNo(queueData.getUploadParamsVO().getPatent().getPatentNo());
|
|
|
+ importTaskPatent.setReportId(queueData.getTask().getReportId());
|
|
|
+ importTaskPatent.insert();
|
|
|
+ try {
|
|
|
+ outInterfaceService.importAssoReportPatentNo(queueData.getTask().getReportId(), queueData.getUploadParamsVO().getPatent().getPatentNo(), queueData.getUploadParamsVO().getPatent().getName(), queueData.getTask().getAsCompare());
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ } else if (queueData.getTask().getProductId() != null) {
|
|
|
+ //与产品关联入库(调用报告系统接口)
|
|
|
+ List<AssoProductPatent> assoProductPatents = assoProductPatentService.list(new LambdaQueryWrapper<AssoProductPatent>().eq(AssoProductPatent::getProductId, queueData.getTask().getProductId()).eq(AssoProductPatent::getPatentNo, queueData.getUploadParamsVO().getPatent().getPatentNo()));
|
|
|
+ if (assoProductPatents == null || assoProductPatents.size() == 0) {
|
|
|
+ AssoProductPatent assoProductPatent = new AssoProductPatent()
|
|
|
+ .setProductId(queueData.getTask().getProductId())
|
|
|
+ .setPatentNo(queueData.getUploadParamsVO().getPatent().getPatentNo());
|
|
|
+ assoProductPatentService.save(assoProductPatent);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//任务表更新 完成条数+1
|
|
|
task.setSuccessNum(task.getSuccessNum() + 1);
|
|
|
//根据专利号查询专利是否有导入失败记录
|