|
@@ -48,6 +48,7 @@ import java.io.*;
|
|
|
import java.lang.reflect.Field;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.*;
|
|
|
+import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -118,6 +119,9 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
@Resource
|
|
|
TBTaskService tbTaskService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ BasicCardRuleService basicCardRuleService;
|
|
|
+
|
|
|
/**
|
|
|
* 创建pdf前置条件
|
|
|
*
|
|
@@ -187,6 +191,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
List<PdfDto>... list
|
|
|
) throws IOException, DocumentException {
|
|
|
if (Objects.nonNull(examDetailCourseList) && examDetailCourseList.size() > 0) {
|
|
|
+ Map<Long, BasicCardRule> basicCardRuleMap = new HashMap<>();
|
|
|
for (ExamDetailCourse examDetailCourse : examDetailCourseList) {
|
|
|
List<PdfDto> paperPdfTempList = new ArrayList<>();//所有试卷
|
|
|
List<PdfDto> examStudentTempPdfList = new ArrayList<>();//所有题卡
|
|
@@ -207,6 +212,8 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
throw ExceptionResultEnum.EXAM_TASK_IS_NULL.exception();
|
|
|
}
|
|
|
Set<Long> examTaskIds = examTaskList.stream().map(s -> s.getId()).collect(Collectors.toSet());
|
|
|
+ Map<Long, ExamTask> examTaskMap = examTaskList.stream().collect(
|
|
|
+ Collectors.toMap(ExamTask::getId, Function.identity(), (dto1, dto2) -> dto1));
|
|
|
|
|
|
QueryWrapper<ExamTaskDetail> examTaskDetailQueryWrapper = new QueryWrapper<>();
|
|
|
examTaskDetailQueryWrapper.lambda().in(ExamTaskDetail::getExamTaskId, examTaskIds)
|
|
@@ -220,6 +227,19 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
if (Objects.isNull(examCard)) {
|
|
|
throw ExceptionResultEnum.EXAM_CARD_IS_NULL.exception();
|
|
|
}
|
|
|
+
|
|
|
+ //查询题卡规则
|
|
|
+ ExamTask examTask = examTaskMap.get(examTaskDetail.getExamTaskId());
|
|
|
+ BasicCardRule basicCardRule = null;
|
|
|
+ if (Objects.nonNull(examTask)) {
|
|
|
+ if (!basicCardRuleMap.containsKey(examTask.getCardRuleId())) {
|
|
|
+ basicCardRule = basicCardRuleService.getById(examTask.getCardRuleId());
|
|
|
+ BasicCardRule finalBasicCardRule = basicCardRule;
|
|
|
+ basicCardRuleMap.computeIfAbsent(examTask.getCardRuleId(), v -> finalBasicCardRule);
|
|
|
+ } else {
|
|
|
+ basicCardRule = basicCardRuleMap.get(examTask.getCardRuleId());
|
|
|
+ }
|
|
|
+ }
|
|
|
QueryWrapper<ExamCardDetail> examCardDetailQueryWrapper = new QueryWrapper<>();
|
|
|
examCardDetailQueryWrapper.lambda().eq(ExamCardDetail::getCardId, examCard.getId());
|
|
|
List<ExamCardDetail> examCardDetailList = examCardDetailService.list(examCardDetailQueryWrapper);
|
|
@@ -256,7 +276,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
String studentContent = cardContent;
|
|
|
|
|
|
for (int i = 1; i <= examPrintPlan.getBackupCount(); i++) {
|
|
|
- BasicAttachment basicAttachment = createPdfUtil.cardHtml(String.format("%02d", i), cardContent, examDetail, examDetailCourse, examCard, jsonArray, sysUser.getId(), cardPdfTempList);
|
|
|
+ BasicAttachment basicAttachment = createPdfUtil.cardHtml(String.format("%02d", i), cardContent, examDetail, examDetailCourse, examCard, jsonArray, sysUser.getId(), cardPdfTempList, basicCardRule);
|
|
|
examDetailCourse.setCardPagesA3(basicAttachment.getPages());
|
|
|
basicAttachmentList.add(basicAttachment);
|
|
|
}
|