chendayu пре 2 година
родитељ
комит
493dffad90

+ 21 - 22
PAS/src/main/java/cn/cslg/pas/service/upLoadPatent/PantentQueueService.java

@@ -36,31 +36,31 @@ public class PantentQueueService {
     private final FileUtils fileUtils;
     private final MessageService messageService;
     private final TaskService taskService;
-    private Queue<QueueData> patentImageQueue = new LinkedList<>();
-    private Queue<QueueData> patentZhuluQueue = new LinkedList<>();
-    private Queue<QueueData> patentRightQueue = new LinkedList<>();
-    private Queue<QueueData> patentInstructionTextQueue = new LinkedList<>();
-    private Queue<QueueData> patentAssoQueue = new LinkedList<>();
-    private List<Integer> taskQueueList = new ArrayList<>();
+    private final Queue<QueueData> patentImageQueue = new LinkedList<>();
+    private final Queue<QueueData> patentZhuluQueue = new LinkedList<>();
+    private final Queue<QueueData> patentRightQueue = new LinkedList<>();
+    private final Queue<QueueData> patentInstructionTextQueue = new LinkedList<>();
+    private final Queue<QueueData> patentAssoQueue = new LinkedList<>();
+    private final List<Integer> taskQueueList = new ArrayList<>();
     private Boolean flag = false;
-    private Lock taskLock = new ReentrantLock();
-    private Lock patentImageLock = new ReentrantLock();
-    private Lock patentZhuluLock = new ReentrantLock();
-    private Lock patentRightLock = new ReentrantLock();
-    private Lock patentInstructionTextLock = new ReentrantLock();
-    private Lock patentAssoLock = new ReentrantLock();
-    Condition taskCondition = taskLock.newCondition();
-    private Condition patentImageCondition = patentImageLock.newCondition();
-    private Condition patentZhuluCondition = patentZhuluLock.newCondition();
-    private Condition patentRightCondition = patentRightLock.newCondition();
-    private Condition patentInstructionTextCondition = patentInstructionTextLock.newCondition();
-    private Condition patentAssoCondition = patentAssoLock.newCondition();
-    private HashMap<Integer, Integer> patentIdMap = new HashMap<>();
+    private final Lock taskLock = new ReentrantLock();
+    private final Lock patentImageLock = new ReentrantLock();
+    private final Lock patentZhuluLock = new ReentrantLock();
+    private final Lock patentRightLock = new ReentrantLock();
+    private final Lock patentInstructionTextLock = new ReentrantLock();
+    private final Lock patentAssoLock = new ReentrantLock();
+    private final Condition taskCondition = taskLock.newCondition();
+    private final Condition patentImageCondition = patentImageLock.newCondition();
+    private final Condition patentZhuluCondition = patentZhuluLock.newCondition();
+    private final Condition patentRightCondition = patentRightLock.newCondition();
+    private final Condition patentInstructionTextCondition = patentInstructionTextLock.newCondition();
+    private final Condition patentAssoCondition = patentAssoLock.newCondition();
+    private final HashMap<Integer, Integer> patentIdMap = new HashMap<>();
     private Task task = null;
     private Integer patentFinishNum = 0;
 
     /**
-     * 生产者:从任务队列取出任务解析成专利实体类,分配给三个消费者队列
+     * 生产者:从任务队列取出任务解析专利,将专利分配给消费者消费
      */
     public void addPatnetToQueue() {
         try {
@@ -168,6 +168,7 @@ public class PantentQueueService {
 
             } catch (Exception e) {
                 e.printStackTrace();
+
             }
 
         }
@@ -316,9 +317,7 @@ public class PantentQueueService {
                     percentage = 100L;
                     //任务表更新状态为成功
                     task.setStatus(2);
-                    task.setEndTime(DateUtils.getDateTime());
                     taskService.updateById(task);
-                    System.out.println("结束时间:" + new Date());
                 }
                 messageService.sendWebsocketMessage(task, total, patentFinishNum, percentage);
                 //任务表更新数据

+ 3 - 3
PAS/src/main/java/cn/cslg/pas/service/upLoadPatent/UploadPatentToDBService.java

@@ -161,7 +161,7 @@ public class UploadPatentToDBService {
      */
     public void uploadAssoThemaPat(UploadParamsVO uploadParamsVO, ProjectImportPatentVO projectImportPatentVO) {
         //保存专题库与专利关联(表"os_thematic_pid")
-        if (uploadParamsVO.getPatent() != null) {
+        if (uploadParamsVO.getPatent() != null && projectImportPatentVO != null) {
             uploadPatentBatchService.patentThematicPidBusiness(uploadParamsVO, projectImportPatentVO);
         }
     }
@@ -174,7 +174,7 @@ public class UploadPatentToDBService {
      */
     public void uploadAssoFieldPat(UploadParamsVO uploadParamsVO, ProjectImportPatentVO projectImportPatentVO) {
         //保存标引内容与专利关联(表"os_patent_field_patent_link"、"os_patent_field_text")
-        if (uploadParamsVO.getPatent() != null) {
+        if (uploadParamsVO.getPatent() != null && projectImportPatentVO != null) {
             uploadPatentBatchService.patentProjectFieldPatentLinkBusiness(uploadParamsVO, projectImportPatentVO);
         }
     }
@@ -187,7 +187,7 @@ public class UploadPatentToDBService {
      */
     public void uploadAssoPorPat(UploadParamsVO uploadParamsVO, ProjectImportPatentVO projectImportPatentVO) {
         //保存文件夹与专利关联(表"os_portfolio_link")
-        if (uploadParamsVO.getPatent() != null) {
+        if (uploadParamsVO.getPatent() != null && projectImportPatentVO != null) {
             uploadPatentBatchService.patentProjectFolderPatentLinkBusiness(uploadParamsVO, projectImportPatentVO);
         }
     }

+ 1 - 1
PAS/src/main/java/cn/cslg/pas/service/upLoadPatent/UploadTaskService.java

@@ -35,7 +35,7 @@ public class UploadTaskService {
     private final PantentQueueService pantentQueueService;
 
     /**
-     * 添加导入任务
+     * 新增Excel导入任务
      */
     public void addTask(MultipartFile file, String json) throws IOException {
         //将包含多件专利的Excel文件上传至本地,并返回文件对象fileDTO