|
@@ -1154,6 +1154,48 @@ public class BasicDatasourceController {
|
|
|
return ResultUtil.ok(Collections.singletonMap(SystemConstant.SUCCESS, true));
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "留学生异常处理")
|
|
|
+ @RequestMapping(value = "/exception_student/dispose", method = RequestMethod.POST)
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
|
+ public Result exceptionStudentDispose(@RequestParam String schoolId, @RequestParam String examId, @RequestParam String courseCode) {
|
|
|
+
|
|
|
+ String courseName = basicCourseService.findByCourseCode(courseCode).getName();
|
|
|
+ if (tbExamCourseService.verifyExamCourseCantRun(SystemConstant.convertIdToLong(examId), SystemConstant.convertIdToLong(schoolId), courseCode, courseName)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("课程编号[" + courseCode + "]的课程分析数据已测试或发布,不能变更基础数据");
|
|
|
+ }
|
|
|
+ // 查找留学生
|
|
|
+ List<TAExamCourseRecord> taExamCourseRecordList = taExamCourseRecordService.list(new QueryWrapper<TAExamCourseRecord>().lambda()
|
|
|
+ .eq(TAExamCourseRecord::getCourseCode,courseCode)
|
|
|
+ .eq(TAExamCourseRecord::getExamId,examId)
|
|
|
+ .eq(TAExamCourseRecord::getTotalScore,0)
|
|
|
+ .gt(TAExamCourseRecord::getAssignedScore,0));
|
|
|
+ if (taExamCourseRecordList.size() > 0){
|
|
|
+ List<Long> willDeleteTAExamCourseRecordIds = taExamCourseRecordList.stream().map(TAExamCourseRecord::getId).distinct().collect(Collectors.toList());
|
|
|
+ List<String> willDeleteStudentCodeList = taExamCourseRecordList.stream().map(TAExamCourseRecord::getStudentCode).distinct().collect(Collectors.toList());
|
|
|
+ List<Long> willDeleteExamRecordIdList = taExamCourseRecordList.stream().map(TAExamCourseRecord::getExamRecordId).distinct().collect(Collectors.toList());
|
|
|
+
|
|
|
+ // 删除‘t_a_exam_course_record’
|
|
|
+ taExamCourseRecordService.removeByIds(willDeleteTAExamCourseRecordIds);
|
|
|
+
|
|
|
+ // 删除‘t_b_exam_student’
|
|
|
+ if (willDeleteStudentCodeList.size() > 0){
|
|
|
+ tbExamStudentService.remove(new QueryWrapper<TBExamStudent>().lambda().eq(TBExamStudent::getExamId,examId).eq(TBExamStudent::getCourseCode,courseCode).in(TBExamStudent::getStudentCode,willDeleteStudentCodeList).gt(TBExamStudent::getId,0));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (willDeleteExamRecordIdList.size() > 0){
|
|
|
+ // 删除't_b_exam_record'
|
|
|
+ tbExamRecordService.removeByIds(willDeleteExamRecordIdList);
|
|
|
+
|
|
|
+ // 删除‘t_b_answer’
|
|
|
+ tbAnswerService.remove(new QueryWrapper<TBAnswer>().lambda().in(TBAnswer::getExamRecordId,willDeleteExamRecordIdList).gt(TBAnswer::getId,0));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return ResultUtil.ok(Collections.singletonMap(SystemConstant.SUCCESS, true));
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
/**
|