|
@@ -2,6 +2,7 @@ package com.qmth.distributed.print.business.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.Update;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.qmth.distributed.print.business.bean.dto.ExamTaskDetailDto;
|
|
@@ -31,6 +32,7 @@ import com.qmth.teachcloud.mark.service.ScanPaperService;
|
|
|
import org.activiti.engine.TaskService;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.bouncycastle.jce.exception.ExtCertPathBuilderException;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
@@ -178,30 +180,40 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
|
|
|
|
|
|
// 更新命题任务中关联卷型
|
|
|
ExamTask newExamTask = examTaskService.getByExamIdAndCourseIdAndPaperNumber(examTask.getExamId(), examTask.getCourseId(), paperParam.getPaperNumber());
|
|
|
- UpdateWrapper<ExamTaskDetail> updateWrapper = new UpdateWrapper<>();
|
|
|
- updateWrapper.lambda().set(ExamTaskDetail::getRelatePaperType, paperParam.getRelatePaperType()).eq(ExamTaskDetail::getExamTaskId, newExamTask.getId());
|
|
|
- this.update(updateWrapper);
|
|
|
+ List<ExamTaskDetail> examDetailCourseList = this.listByExamIdAndPaperNumber(examTask.getExamId(), paperParam.getPaperNumber());
|
|
|
+
|
|
|
+ ExamTaskDetail examTaskDetailOld = examDetailCourseList.stream().filter(m -> m.getExposedExamId() != null && m.getExposedExamId().equals(paperParam.getExamId())).findFirst().orElse(null);
|
|
|
+ if(examTaskDetailOld == null ){
|
|
|
+ ExamTaskDetail examTaskDetail = examDetailCourseList.stream().filter(m -> m.getSerialNumber().toString().equals(paperParam.getRelatePaperType())).findFirst().orElse(null);
|
|
|
+ if(examTaskDetail == null){
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("备用卷不存在");
|
|
|
+ } else if(examTaskDetail.getExposedExamId() != null){
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("备用卷已在其它考试中使用");
|
|
|
+ } else {
|
|
|
+ this.updateExposedExamIdById(paperParam.getExamId(), examTaskDetail.getId());
|
|
|
+ }
|
|
|
+ } else if(examTaskDetailOld.getSerialNumber().equals(paperParam.getRelatePaperType())) {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ this.updateExposedExamIdById(null, examTaskDetailOld.getId());
|
|
|
+ ExamTaskDetail examTaskDetail = examDetailCourseList.stream().filter(m -> m.getSerialNumber().toString().equals(paperParam.getRelatePaperType())).findFirst().orElse(null);
|
|
|
+ if(examTaskDetail == null){
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("备用卷不存在");
|
|
|
+ } else if(examTaskDetail.getExposedExamId() != null){
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("备用卷已在其它考试中使用");
|
|
|
+ } else {
|
|
|
+ this.updateExposedExamIdById(paperParam.getExamId(), examTaskDetail.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
// 更新选中的试卷编号、卷型
|
|
|
String examDetailCourseIdStr = paperParam.getExamDetailCourseIds();
|
|
|
List<Long> examDetailCourseIds = Arrays.asList(examDetailCourseIdStr.split(",")).stream().map(m -> Long.valueOf(m)).collect(Collectors.toList());
|
|
|
examDetailCourseService.updatePaperNumber(examDetailCourseIds, paperParam.getPaperNumber(), paperParam.getRelatePaperType());
|
|
|
|
|
|
- // 更新抽取卷型数据
|
|
|
- for (ExamDetail examDetail : examDetails) {
|
|
|
- ExamTaskAssignPaperType examTaskAssignPaperType = new ExamTaskAssignPaperType(paperParam.getExamId(), paperParam.getPaperNumber(), examDetail.getExamStartTime(), examDetail.getExamEndTime(), paperParam.getRelatePaperType(), AssignModeEnum.MANUAL);
|
|
|
- examTaskAssignPaperTypeService.saveOrUpdateByMultiId(examTaskAssignPaperType);
|
|
|
- }
|
|
|
-
|
|
|
- // 更新考生关联类型
|
|
|
- List<String> types = Arrays.asList(paperParam.getRelatePaperType().split(","));
|
|
|
- int drawCount = examTask.getOpenAb() ? 2 : 1;
|
|
|
- if (drawCount - types.size() != 0) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("关联卷型与设置数量不一致");
|
|
|
- }
|
|
|
-
|
|
|
// 初始化PDF生成任务数据
|
|
|
for (ExamDetail examDetail : examDetails) {
|
|
|
+ examDetailService.resetExamDetail(examDetail.getId(), CreatePdfTypeEnum.ALL, ExamDetailStatusEnum.NEW, false);
|
|
|
tbTaskPdfService.resetRunningCreatePdf(examDetail.getId(), CreatePdfTypeEnum.ALL);
|
|
|
}
|
|
|
return true;
|