|
@@ -186,10 +186,6 @@ public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentMapper, ExamS
|
|
|
RecognitionTypeEnum recognitionType = RecognitionTypeEnum.valueOf(recognitionTypeSimpleObject.getValue());
|
|
|
StoreTypeEnum storeType = StoreTypeEnum.valueOf(storeTypeSimpleObject.getValue());
|
|
|
|
|
|
- // 校验是否已扫描
|
|
|
- if (paperLibraryService.countByExamId(examId) > 0) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("已开始扫描,导入失败。请清除扫描数据后重试");
|
|
|
- }
|
|
|
try {
|
|
|
ExcelReader excelReader = ExcelReader.create(ExcelType.XLSX, file.getInputStream(), 0);
|
|
|
List<ExamStudent> basicStudentList = excelReader.getObjectList(ExamStudent.class);
|
|
@@ -198,7 +194,10 @@ public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentMapper, ExamS
|
|
|
// 保存课程
|
|
|
List<ExamCourse> examCourses = examCourseService.saveBatchStudentCourse(examId, basicStudentList);
|
|
|
// 新建任务
|
|
|
- paperScanTaskService.addBatchScanTask(examId, recognitionType, storeType, examCourses, basicStudentList);
|
|
|
+ paperScanTaskService.addBatchScanTask(examId, recognitionType, storeType, examCourses, basicStudentList);
|
|
|
+ for (ExamCourse examCourse : examCourses) {
|
|
|
+ this.removeByExamIdAndCourseCode(examId, examCourse.getCourseCode());
|
|
|
+ }
|
|
|
// 保存学生
|
|
|
this.saveBatch(basicStudentList);
|
|
|
} catch (IOException e) {
|
|
@@ -217,9 +216,10 @@ public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentMapper, ExamS
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void removeByExamId(Long examId) {
|
|
|
+ public void removeByExamIdAndCourseCode(Long examId, String courseCode) {
|
|
|
QueryWrapper<ExamStudent> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.lambda().eq(ExamStudent::getExamId, examId);
|
|
|
+ queryWrapper.lambda().eq(ExamStudent::getExamId, examId)
|
|
|
+ .eq(ExamStudent::getCourseCode, courseCode);
|
|
|
this.remove(queryWrapper);
|
|
|
}
|
|
|
|