|
@@ -6,9 +6,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
|
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
|
import com.qmth.paper.library.business.bean.result.SelectResult;
|
|
import com.qmth.paper.library.business.bean.result.SelectResult;
|
|
import com.qmth.paper.library.business.entity.ExamCourse;
|
|
import com.qmth.paper.library.business.entity.ExamCourse;
|
|
|
|
+import com.qmth.paper.library.business.entity.PaperLibrary;
|
|
import com.qmth.paper.library.business.entity.PaperScanTask;
|
|
import com.qmth.paper.library.business.entity.PaperScanTask;
|
|
import com.qmth.paper.library.business.mapper.ExamCourseMapper;
|
|
import com.qmth.paper.library.business.mapper.ExamCourseMapper;
|
|
import com.qmth.paper.library.business.service.ExamCourseService;
|
|
import com.qmth.paper.library.business.service.ExamCourseService;
|
|
|
|
+import com.qmth.paper.library.business.service.PaperLibraryService;
|
|
import com.qmth.paper.library.business.service.PaperScanTaskService;
|
|
import com.qmth.paper.library.business.service.PaperScanTaskService;
|
|
import com.qmth.paper.library.common.entity.ExamStudent;
|
|
import com.qmth.paper.library.common.entity.ExamStudent;
|
|
import com.qmth.paper.library.common.enums.ExceptionResultEnum;
|
|
import com.qmth.paper.library.common.enums.ExceptionResultEnum;
|
|
@@ -35,6 +37,8 @@ public class ExamCourseServiceImpl extends MppServiceImpl<ExamCourseMapper, Exam
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
private PaperScanTaskService paperScanTaskService;
|
|
private PaperScanTaskService paperScanTaskService;
|
|
|
|
+ @Resource
|
|
|
|
+ private PaperLibraryService paperLibraryService;
|
|
|
|
|
|
@Transactional
|
|
@Transactional
|
|
@Override
|
|
@Override
|
|
@@ -43,8 +47,9 @@ public class ExamCourseServiceImpl extends MppServiceImpl<ExamCourseMapper, Exam
|
|
List<ExamCourse> examCourses = new ArrayList<>();
|
|
List<ExamCourse> examCourses = new ArrayList<>();
|
|
for (Map.Entry<String, String> entry : stringMap.entrySet()) {
|
|
for (Map.Entry<String, String> entry : stringMap.entrySet()) {
|
|
PaperScanTask paperScanTask = paperScanTaskService.getByExamIdAndCourseCode(examId, entry.getKey());
|
|
PaperScanTask paperScanTask = paperScanTaskService.getByExamIdAndCourseCode(examId, entry.getKey());
|
|
- if (paperScanTask != null) {
|
|
|
|
- throw ExceptionResultEnum.ERROR.exception(String.format("课程[%s(%s)]已创建扫描任务,不能导入该课程考生,请手动添加", entry.getValue(), entry.getKey()));
|
|
|
|
|
|
+ // 校验是否已扫描
|
|
|
|
+ if (paperScanTask != null && paperLibraryService.countByPaperScanTaskId(paperScanTask.getId()) > 0) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(String.format("课程[%s(%s)]已开始扫描,导入失败。请清除扫描数据后重试", entry.getValue(), entry.getKey()));
|
|
}
|
|
}
|
|
examCourses.add(new ExamCourse(examId, entry.getKey(), entry.getValue()));
|
|
examCourses.add(new ExamCourse(examId, entry.getKey(), entry.getValue()));
|
|
}
|
|
}
|