|
@@ -32,7 +32,10 @@ import com.qmth.teachcloud.common.entity.*;
|
|
import com.qmth.teachcloud.common.enums.*;
|
|
import com.qmth.teachcloud.common.enums.*;
|
|
import com.qmth.teachcloud.common.service.*;
|
|
import com.qmth.teachcloud.common.service.*;
|
|
import com.qmth.teachcloud.common.util.*;
|
|
import com.qmth.teachcloud.common.util.*;
|
|
-import com.qmth.teachcloud.mark.service.ScanPaperService;
|
|
|
|
|
|
+import com.qmth.teachcloud.mark.entity.MarkPaperPackage;
|
|
|
|
+import com.qmth.teachcloud.mark.entity.MarkStudent;
|
|
|
|
+import com.qmth.teachcloud.mark.entity.ScanAnswerCard;
|
|
|
|
+import com.qmth.teachcloud.mark.service.*;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.poi.ss.usermodel.FillPatternType;
|
|
import org.apache.poi.ss.usermodel.FillPatternType;
|
|
import org.apache.poi.ss.usermodel.Font;
|
|
import org.apache.poi.ss.usermodel.Font;
|
|
@@ -124,10 +127,18 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
|
|
@Lazy
|
|
@Lazy
|
|
private PrintCommonService printCommonService;
|
|
private PrintCommonService printCommonService;
|
|
|
|
|
|
- @Resource
|
|
|
|
- private AsyncExaminationImportTemplateService asyncExaminationImportTemplateService;
|
|
|
|
@Resource
|
|
@Resource
|
|
private AsyncExamStudentImportService asyncExamStudentImportService;
|
|
private AsyncExamStudentImportService asyncExamStudentImportService;
|
|
|
|
+ @Resource
|
|
|
|
+ private MarkStudentService markStudentService;
|
|
|
|
+ @Resource
|
|
|
|
+ private MarkPaperService markPaperService;
|
|
|
|
+ @Resource
|
|
|
|
+ private MarkQuestionService markQuestionService;
|
|
|
|
+ @Resource
|
|
|
|
+ private MarkPaperPackageService markPaperPackageService;
|
|
|
|
+ @Resource
|
|
|
|
+ private ScanAnswerCardService scanAnswerCardService;
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Override
|
|
@Override
|
|
@@ -465,20 +476,14 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
|
|
// 检查前置操作是否完成(是否生成pdf)
|
|
// 检查前置操作是否完成(是否生成pdf)
|
|
ExamDetail detail = this.getById(examDetail.getId());
|
|
ExamDetail detail = this.getById(examDetail.getId());
|
|
if (detail == null) {
|
|
if (detail == null) {
|
|
- throw ExceptionResultEnum.ERROR.exception("考场数据异常");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 印刷计划必须为就绪才可提交印刷
|
|
|
|
- ExamPrintPlan examPrintPlan = examPrintPlanService.getById(detail.getPrintPlanId());
|
|
|
|
- if (!PrintPlanStatusEnum.READY.equals(examPrintPlan.getStatus()) && !PrintPlanStatusEnum.PRINTING.equals(examPrintPlan.getStatus())) {
|
|
|
|
- throw ExceptionResultEnum.ERROR.exception("印刷计划就绪、印刷中状态才可提交印刷");
|
|
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("印刷任务数据不存在");
|
|
}
|
|
}
|
|
|
|
|
|
// 只有就绪状态并且附件生成才可提交
|
|
// 只有就绪状态并且附件生成才可提交
|
|
if (!ExamDetailStatusEnum.READY.equals(detail.getStatus())) {
|
|
if (!ExamDetailStatusEnum.READY.equals(detail.getStatus())) {
|
|
- throw ExceptionResultEnum.ERROR.exception("考场就绪状态才可提交印刷");
|
|
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("印刷任务就绪状态才可提交印刷");
|
|
} else if (detail.getAttachmentId() == null && detail.getCardAttachmentId() == null) {
|
|
} else if (detail.getAttachmentId() == null && detail.getCardAttachmentId() == null) {
|
|
- throw ExceptionResultEnum.ERROR.exception("考场文件未生成");
|
|
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("印刷任务PDF文件未生成");
|
|
}
|
|
}
|
|
|
|
|
|
// 修改印刷计划状态为印刷中
|
|
// 修改印刷计划状态为印刷中
|
|
@@ -499,12 +504,12 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
|
|
// 检查前置操作是否完成(是否生成pdf)
|
|
// 检查前置操作是否完成(是否生成pdf)
|
|
ExamDetail detail = this.getById(examDetail.getId());
|
|
ExamDetail detail = this.getById(examDetail.getId());
|
|
if (detail == null) {
|
|
if (detail == null) {
|
|
- throw ExceptionResultEnum.ERROR.exception("考场数据异常");
|
|
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("印刷任务数据不存在");
|
|
}
|
|
}
|
|
|
|
|
|
// 只有待印刷状态并且附件生成才可提交
|
|
// 只有待印刷状态并且附件生成才可提交
|
|
if (!ExamDetailStatusEnum.WAITING.equals(detail.getStatus())) {
|
|
if (!ExamDetailStatusEnum.WAITING.equals(detail.getStatus())) {
|
|
- throw ExceptionResultEnum.ERROR.exception("考场待印刷状态才可完成");
|
|
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("印刷任务[待印刷]状态才可完成");
|
|
}
|
|
}
|
|
|
|
|
|
// 修改考场状态为已完成
|
|
// 修改考场状态为已完成
|
|
@@ -528,7 +533,7 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
|
|
public boolean taskCancel(Long id) {
|
|
public boolean taskCancel(Long id) {
|
|
ExamDetail detail = this.getById(id);
|
|
ExamDetail detail = this.getById(id);
|
|
if (!detail.getStatus().equals(ExamDetailStatusEnum.WAITING)) {
|
|
if (!detail.getStatus().equals(ExamDetailStatusEnum.WAITING)) {
|
|
- throw ExceptionResultEnum.ERROR.exception("印刷状态为[" + ExamDetailStatusEnum.WAITING.getName() + "]的任务可撤回提交");
|
|
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("印刷任务状态为[" + ExamDetailStatusEnum.WAITING.getName() + "]的任务可撤回提交");
|
|
}
|
|
}
|
|
UpdateWrapper<ExamDetail> updateWrapper = new UpdateWrapper<>();
|
|
UpdateWrapper<ExamDetail> updateWrapper = new UpdateWrapper<>();
|
|
updateWrapper.lambda().set(ExamDetail::getStatus, ExamDetailStatusEnum.READY).eq(ExamDetail::getId, id);
|
|
updateWrapper.lambda().set(ExamDetail::getStatus, ExamDetailStatusEnum.READY).eq(ExamDetail::getId, id);
|
|
@@ -911,6 +916,22 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
|
|
List<ExamStudent> examStudents = examStudentService.list(examStudentQueryWrapper);
|
|
List<ExamStudent> examStudents = examStudentService.list(examStudentQueryWrapper);
|
|
if (!examStudents.isEmpty()) {
|
|
if (!examStudents.isEmpty()) {
|
|
List<Long> examStudentIds = examStudents.stream().map(ExamStudent::getId).collect(Collectors.toList());
|
|
List<Long> examStudentIds = examStudents.stream().map(ExamStudent::getId).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ // 已扫描
|
|
|
|
+ QueryWrapper<MarkStudent> queryWrapper = new QueryWrapper<>();
|
|
|
|
+ queryWrapper.lambda().in(MarkStudent::getId, examStudentIds).eq(MarkStudent::getUpload, true);
|
|
|
|
+ if (markStudentService.count(queryWrapper) > 0) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("有考生已扫描,不允许删除");
|
|
|
|
+ } else {
|
|
|
|
+ // 删除扫描数据
|
|
|
|
+ markStudentService.removeByIds(examStudentIds);
|
|
|
|
+ if(markPaperService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber(), true)){
|
|
|
|
+ markPaperPackageService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
|
|
|
|
+ markQuestionService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
|
|
|
|
+ scanAnswerCardService.deleteByExamIdAndPaperNumber(examDetail.getExamId(), examDetailCourse.getPaperNumber());
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+
|
|
examStudentService.removeByIds(examStudentIds);
|
|
examStudentService.removeByIds(examStudentIds);
|
|
}
|
|
}
|
|
}
|
|
}
|