浏览代码

Merge branch 'dev' into release
update

wangliang 4 年之前
父节点
当前提交
ef45d79a77

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/CommonServiceImpl.java

@@ -608,7 +608,7 @@ public class CommonServiceImpl implements CommonService {
         // 1.命题任务已完成
         if (examTask != null && examTask.getStatus().name().equals(ExamStatusEnum.FINISH.name())) {
             // 2.校验考务数据是否导入
-            List<ExamDetail> examDetails = examDetailService.listByCourseCodeAndPaperNumberAndPaperTypeIsNull(schoolId, courseCode, paperNumber);
+            List<ExamDetail> examDetails = examDetailService.listByCourseCodeAndPaperNumber(schoolId, courseCode, paperNumber);
             if (examDetails != null && examDetails.size() > 0) {
                 // 3.检查examDetailId下有无其它课程
                 for (ExamDetail examDetail : examDetails) {

+ 3 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskDetailServiceImpl.java

@@ -25,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.io.IOException;
+import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -161,8 +162,8 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
         for (ExamDetailCourse examDetailCours : examDetailCourses) {
             SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
             Map<String, Object> map = tbTaskService.saveTask(TaskTypeEnum.CREATE_PDF, paperParam.getPrintPlanId(), sysUser, null);
-            map.computeIfAbsent("examDetailId", v -> examDetailCours.getExamDetailId());
-            map.computeIfAbsent("examDetailCourseIds", v -> examDetailCours.getId());
+            map.computeIfAbsent("examDetailIds", v -> Arrays.asList(examDetailCours.getExamDetailId()));
+            map.computeIfAbsent("examDetailCourseIds", v -> Arrays.asList(examDetailCours.getId()));
             map.computeIfAbsent("paperType", v -> paperParam.getRelatePaperType());
             asyncCreatePdfTempleteService.createPdf(map, null);
         }

+ 7 - 7
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamTaskServiceImpl.java

@@ -634,7 +634,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
             this.update(updateWrapper);
         } else {
             // 更新记录表状态
-            taskAfterPass(taskReviewLog, examTaskPaperLog, sysUser);
+            taskAfterPass(taskReviewLog.getReviewStatus(), taskReviewLog.getExamTaskId() , examTaskPaperLog, sysUser);
         }
         return true;
     }
@@ -671,22 +671,22 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                 this.update(updateWrapper);
             } else {
                 // 更新记录表状态
-                taskAfterPass(taskReviewLog, examTaskPaperLog, sysUser);
+                taskAfterPass(taskReviewLog.getReviewStatus(), examTaskId, examTaskPaperLog, sysUser);
             }
         }
         return true;
     }
 
-    private void taskAfterPass(ExamTaskReviewLog taskReviewLog, ExamTaskPaperLog examTaskPaperLog, SysUser sysUser) {
+    private void taskAfterPass(ReviewStatusEnum statusEnum , Long examTaskId, ExamTaskPaperLog examTaskPaperLog, SysUser sysUser) {
         // 更新记录表状态
         examTaskPaperLog.setReview(true);
-        examTaskPaperLog.setReviewStatus(taskReviewLog.getReviewStatus());
+        examTaskPaperLog.setReviewStatus(statusEnum);
         examTaskPaperLog.setUpdateId(sysUser.getId());
         examTaskPaperLog.setUpdateTime(System.currentTimeMillis());
         examTaskPaperLogService.updateById(examTaskPaperLog);
 
-        if (taskReviewLog.getReviewStatus().name().equals(ReviewStatusEnum.PASS.name())) {
-            ExamTaskDetail examTaskDetail = examTaskDetailService.getByExamTaskId(taskReviewLog.getExamTaskId());
+        if (statusEnum.name().equals(ReviewStatusEnum.PASS.name())) {
+            ExamTaskDetail examTaskDetail = examTaskDetailService.getByExamTaskId(examTaskId);
             String exposedPaperType = examTaskDetail.getExposedPaperType();
             Set<String> exposedPaperSet = StringUtils.isBlank(exposedPaperType) ? new HashSet<>() : new HashSet<>(Arrays.asList(exposedPaperType.split(",")));
             String unexposedPaperType = examTaskPaperLog.getPaperType();
@@ -707,7 +707,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
                     .set(ExamTaskDetail::getPaperAttachmentIds, examTaskPaperLog.getPaperAttachmentIds())
                     .set(ExamTaskDetail::getCardId, examTaskPaperLog.getCardId())
                     .set(ExamTaskDetail::getUnexposedPaperType, newUnexposedPaperType)
-                    .eq(ExamTaskDetail::getExamTaskId, taskReviewLog.getExamTaskId());
+                    .eq(ExamTaskDetail::getExamTaskId, examTaskId);
             examTaskDetailService.update(examTaskDetailUpdateWrapper);
         }
     }

+ 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 {
+                                paperType = 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 {
-}