Răsfoiți Sursa

3.2.0-抽卷问题修改。按实际使用卷型

xiaof 2 ani în urmă
părinte
comite
08e91017ad

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

@@ -323,9 +323,6 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                     } else {
                         paperType = createPdfUtil.getPaperType(examPrintPlan.getDrawRule(), examTaskDetail, key);//抽取卷型
                     }
-                    examTaskDetail.setRelatePaperType(paperType);
-                    examDetailCourse.setPaperType(paperType);
-
                     //查询考生
                     QueryWrapper<ExamStudent> examStudentQueryWrapper = new QueryWrapper<>();
                     examStudentQueryWrapper.lambda().eq(ExamStudent::getExamDetailCourseId, examDetailCourse.getId());
@@ -337,15 +334,35 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                     List<String> paperTypes = Arrays.stream(paperType.split(",")).sorted(Comparator.comparing(String::valueOf)).collect(Collectors.toList());
                     int backupCount = examPrintPlan.getBackupCount() != null ? examPrintPlan.getBackupCount() : 0;
 
-                    if (examStudentList != null && examStudentList.size() > 0) {
+                    // 当前关联试卷类型
+                    List<String> relatePaperTypes = new ArrayList<>();
+                    if (StringUtils.isNotBlank(examTaskDetail.getRelatePaperType())) {
+                        String[] strings = examTaskDetail.getRelatePaperType().split(",");
+                        if (strings.length > 0) {
+                            relatePaperTypes.addAll(Arrays.asList(strings));
+                        }
+                    }
+
+                    // 考生实际关联试卷类型
+                    List<String> studentPaperTypes = new ArrayList<>();
+                    if (examStudentList != null && !examStudentList.isEmpty()) {
                         AtomicInteger atomicInteger = new AtomicInteger(0);
                         for (ExamStudent t : examStudentList) {
                             int i1 = atomicInteger.getAndIncrement();
                             int mod = i1 % examTaskDetail.getDrawCount();
                             t.setPaperType(paperTypes.get(mod));
+                            if (!relatePaperTypes.contains(t.getPaperType())) {
+                                relatePaperTypes.add(t.getPaperType());
+                            }
+                            if (!studentPaperTypes.contains(t.getPaperType())) {
+                                studentPaperTypes.add(t.getPaperType());
+                            }
                         }
                     }
 
+                    examTaskDetail.setRelatePaperType(String.join(",", relatePaperTypes));
+                    examDetailCourse.setPaperType(String.join(",", studentPaperTypes));
+
                     // 试卷数据组装
                     if (printContent.contains("PAPER")) {
                         List<PaperPdfDto> paperPdfDto = createPdfUtil.getPaperPdfFile(paperType, examTaskDetail);