wangliang 4 years ago
parent
commit
b5ce79def9

+ 13 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/TaskLogicServiceImpl.java

@@ -11,6 +11,7 @@ import com.qmth.distributed.print.business.annotation.ExcelDBFieldDesc;
 import com.qmth.distributed.print.business.bean.dto.*;
 import com.qmth.distributed.print.business.bean.params.ArraysParams;
 import com.qmth.distributed.print.business.bean.params.SerialNumberParams;
+import com.qmth.distributed.print.business.cache.CreatePdfCacheUtil;
 import com.qmth.distributed.print.business.entity.*;
 import com.qmth.distributed.print.business.enums.*;
 import com.qmth.distributed.print.business.service.*;
@@ -231,7 +232,18 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                             List<ExamCardDetail> examCardDetailList = examCardDetailService.list(examCardDetailQueryWrapper);
 
                             //抽取卷型
-                            String paperType = Objects.nonNull(paperTypeParam) ? paperTypeParam : createPdfUtil.getPaperType(examPrintPlan, examTaskDetail, examDetail, examDetailCourse);
+                            String key = examDetail.getSchoolId()
+                                    + "_" + examDetail.getExamStartTime()
+                                    + "_" + examDetail.getExamEndTime()
+                                    + "_" + examDetailCourse.getCourseCode()
+                                    + "_" + examDetailCourse.getPaperNumber();
+                            String paperType = null;
+                            if (Objects.nonNull(paperTypeParam)) {
+                                paperType = paperTypeParam;
+                                CreatePdfCacheUtil.setPaperType(key, paperType);
+                            } else {
+                                createPdfUtil.getPaperType(examPrintPlan, examTaskDetail, key);
+                            }
                             examTaskDetail.setRelatePaperType(paperType);
                             examDetailCourse.setPaperType(paperType);
 

+ 3 - 10
distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/CreatePdfUtil.java

@@ -379,17 +379,10 @@ public class CreatePdfUtil {
      *
      * @param examPrintPlan
      * @param examTaskDetail
-     * @param examDetail
-     * @param examDetailCourse
+     * @param key
      * @return
      */
-    public String getPaperType(ExamPrintPlan examPrintPlan, ExamTaskDetail examTaskDetail, ExamDetail examDetail, ExamDetailCourse examDetailCourse) {
-        String key = examDetail.getSchoolId()
-                + "_" + examDetail.getExamStartTime()
-                + "_" + examDetail.getExamEndTime()
-                + "_" + examDetailCourse.getCourseCode()
-                + "_" + examDetailCourse.getPaperNumber();
-
+    public String getPaperType(ExamPrintPlan examPrintPlan, ExamTaskDetail examTaskDetail, String key) {
         //抽取卷型
         DrawRuleEnum drawRule = Objects.nonNull(examPrintPlan.getDrawRule()) ? examPrintPlan.getDrawRule() : DrawRuleEnum.ONE;
         //未曝光卷型
@@ -443,7 +436,7 @@ public class CreatePdfUtil {
                 }
             }
         }
-        log.info("getPaperType key:{},paperType:{},lock:{},examDetailId:{},examDetailCourseId:{}", key, paperType, lock, examDetail.getId(), examDetailCourse.getId());
+        log.info("getPaperType key:{},paperType:{},lock:{}", key, paperType, lock);
         if (!lock) {
             log.info("getPaperType 未获取到锁,key:{}", key);
             throw ExceptionResultEnum.ERROR.exception("未获取到试卷类型");

+ 0 - 8
distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/SerialNumberUtil.java

@@ -1,8 +0,0 @@
-package com.qmth.distributed.print.business.util;
-
-/**
- * 编号生成工具
- * @Date: 2021/4/1.
- */
-public class SerialNumberUtil {
-}