|
@@ -12,7 +12,6 @@ import com.qmth.distributed.print.business.bean.dto.*;
|
|
|
import com.qmth.distributed.print.business.bean.dto.pdf.ExamStudentInfo;
|
|
|
import com.qmth.distributed.print.business.entity.*;
|
|
|
import com.qmth.distributed.print.business.enums.ExamDetailStatusEnum;
|
|
|
-import com.qmth.teachcloud.common.enums.ExamNumberStyleEnum;
|
|
|
import com.qmth.distributed.print.business.enums.PrintPlanStatusEnum;
|
|
|
import com.qmth.distributed.print.business.enums.RequiredFieldsEnum;
|
|
|
import com.qmth.distributed.print.business.service.*;
|
|
@@ -33,6 +32,7 @@ import com.qmth.teachcloud.common.service.BasicCourseService;
|
|
|
import com.qmth.teachcloud.common.service.BasicSemesterService;
|
|
|
import com.qmth.teachcloud.common.service.FileUploadService;
|
|
|
import com.qmth.teachcloud.common.util.FileUtil;
|
|
|
+import io.swagger.models.auth.In;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
@@ -74,8 +74,6 @@ public class CreatePdfUtil {
|
|
|
@Resource
|
|
|
private BasicSemesterService basicSemesterService;
|
|
|
@Resource
|
|
|
- private ExamTaskService examTaskService;
|
|
|
- @Resource
|
|
|
private ExamTaskDetailService examTaskDetailService;
|
|
|
@Resource
|
|
|
private ExamPrintPlanService examPrintPlanService;
|
|
@@ -590,7 +588,7 @@ public class CreatePdfUtil {
|
|
|
// value = examDetail.getExamRoom();
|
|
|
// }
|
|
|
// 江西中医药大学题卡回填字段clazzName单独处理
|
|
|
- if(RequiredFieldsEnum.CLASS_NAME.getCode().equals(extendDto.getCode())) {
|
|
|
+ if (RequiredFieldsEnum.CLASS_NAME.getCode().equals(extendDto.getCode())) {
|
|
|
studentHtml = studentHtml.replaceAll("\\$\\{clazzName\\}", value);
|
|
|
}
|
|
|
studentHtml = studentHtml.replaceAll("\\$\\{" + extendDto.getCode() + "\\}", value);
|
|
@@ -718,29 +716,37 @@ public class CreatePdfUtil {
|
|
|
return htmlContent;
|
|
|
}
|
|
|
|
|
|
- public ExamTaskDetail getPaperType(Long printPlanId, Long examId, String paperNumber) {
|
|
|
+ public ExamTaskDetail getPaperType(Long printPlanId, Long examId, String paperNumber, Integer defaultSerialNumber) {
|
|
|
ExamPrintPlan examPrintPlan = examPrintPlanService.getById(printPlanId);
|
|
|
//抽取卷型
|
|
|
DrawRuleEnum drawRule = Objects.nonNull(examPrintPlan.getDrawRule()) ? examPrintPlan.getDrawRule() : DrawRuleEnum.ONE;
|
|
|
List<ExamTaskDetail> examTaskDetailList = examTaskDetailService.listByExamIdAndPaperNumber(examId, paperNumber);
|
|
|
|
|
|
try {
|
|
|
- // 未曝光备用卷
|
|
|
- List<ExamTaskDetail> unexposedExamTaskDetailList = examTaskDetailList.stream().filter(m -> !m.getExposed()).collect(Collectors.toList());
|
|
|
- if (drawRule == DrawRuleEnum.ONE) {
|
|
|
- if (CollectionUtils.isEmpty(unexposedExamTaskDetailList)) {
|
|
|
- throw ExceptionResultEnum.PAPER_ERROR.exception();
|
|
|
+ if (defaultSerialNumber == 0) {
|
|
|
+ // 未曝光备用卷
|
|
|
+ List<ExamTaskDetail> unexposedExamTaskDetailList = examTaskDetailList.stream().filter(m -> !m.getExposed()).collect(Collectors.toList());
|
|
|
+ if (drawRule == DrawRuleEnum.ONE) {
|
|
|
+ if (CollectionUtils.isEmpty(unexposedExamTaskDetailList)) {
|
|
|
+ throw ExceptionResultEnum.PAPER_ERROR.exception();
|
|
|
+ }
|
|
|
+ return randomPaperType(unexposedExamTaskDetailList);
|
|
|
+ } else {
|
|
|
+ if (CollectionUtils.isEmpty(examTaskDetailList)) {
|
|
|
+ throw ExceptionResultEnum.PAPER_ERROR.exception();
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isNotEmpty(unexposedExamTaskDetailList)) {
|
|
|
+ return randomPaperType(unexposedExamTaskDetailList);
|
|
|
+ } else {
|
|
|
+ return randomPaperType(examTaskDetailList);
|
|
|
+ }
|
|
|
}
|
|
|
- return randomPaperType(unexposedExamTaskDetailList);
|
|
|
} else {
|
|
|
- if (CollectionUtils.isEmpty(examTaskDetailList)) {
|
|
|
+ ExamTaskDetail examTaskDetail = examTaskDetailList.stream().filter(m -> m.getSerialNumber().equals(defaultSerialNumber)).findFirst().orElse(null);
|
|
|
+ if (examTaskDetail == null) {
|
|
|
throw ExceptionResultEnum.PAPER_ERROR.exception();
|
|
|
}
|
|
|
- if (CollectionUtils.isNotEmpty(unexposedExamTaskDetailList)) {
|
|
|
- return randomPaperType(unexposedExamTaskDetailList);
|
|
|
- } else {
|
|
|
- return randomPaperType(examTaskDetailList);
|
|
|
- }
|
|
|
+ return examTaskDetail;
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
throw ExceptionResultEnum.ERROR.exception(e.getMessage());
|
|
@@ -758,8 +764,9 @@ public class CreatePdfUtil {
|
|
|
}
|
|
|
return examTaskDetail;
|
|
|
} else {
|
|
|
+ BasicPrintConfig basicPrintConfig = basicPrintConfigService.getByExamId(tbTaskPdf.getExamId());
|
|
|
ExamDetail examDetail = examDetailService.getById(tbTaskPdf.getId());
|
|
|
- ExamTaskDetail examTaskDetail = this.getPaperType(examDetail.getPrintPlanId(), examDetail.getExamId(), examDetailCourse.getPaperNumber());
|
|
|
+ ExamTaskDetail examTaskDetail = this.getPaperType(examDetail.getPrintPlanId(), examDetail.getExamId(), examDetailCourse.getPaperNumber(), basicPrintConfig.getDefaultSerialNumber());
|
|
|
// 更新绑定的考试ID
|
|
|
examTaskDetailService.updateExposedExamIdById(tbTaskPdf.getExamId(), examTaskDetail.getId());
|
|
|
return examTaskDetail;
|