|
@@ -2027,8 +2027,56 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
}
|
|
|
return finalExcelList;
|
|
|
});
|
|
|
+ // 校验已经有的考生所在部门的信息是否正确
|
|
|
+ // 导入的excel创建或查询的学生集合
|
|
|
+ List<BasicStudentResult> studentDatasource = basicStudentService.basicStudentList(requestUser.getSchoolId(), null, null, null, null);
|
|
|
+
|
|
|
+ List<ExamStudentImportDto> existStudentList = examStudentImportDtoList
|
|
|
+ .stream()
|
|
|
+ .filter(e -> studentDatasource.stream().map(BasicStudentResult::getStudentCode).collect(Collectors.toList()).contains(e.getStudentCode()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ for (ExamStudentImportDto examStudentImportDto : existStudentList) {
|
|
|
+ String studentName = examStudentImportDto.getStudentName();
|
|
|
+ String studentCode = examStudentImportDto.getStudentCode();
|
|
|
+ String impCollegeName = examStudentImportDto.getCollegeName();
|
|
|
+ String impMajorName = examStudentImportDto.getMajorName();
|
|
|
+ String impClazzName = examStudentImportDto.getClazzName();
|
|
|
+
|
|
|
+
|
|
|
+ List<BasicStudentResult> basicStudentList = studentDatasource.stream().filter(e -> e.getStudentCode().equals(studentCode)).collect(Collectors.toList());
|
|
|
+ if (basicStudentList.size() != 1){
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("学号为:" + studentCode + "的考生数据异常");
|
|
|
+ }
|
|
|
+ BasicStudentResult basicStudent = basicStudentList.get(0);
|
|
|
+
|
|
|
+ String realityCollegeName = basicStudent.getCollegeName();
|
|
|
+ String realityMajorName = basicStudent.getMajorName();
|
|
|
+ String realityClazzName = basicStudent.getClazz();
|
|
|
+
|
|
|
+ // 学院核对
|
|
|
+ if (!impCollegeName.equals(realityCollegeName)){
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("导入的考生【" + studentName + "(" + studentCode + ")】所在学院【" + impCollegeName +
|
|
|
+ "】与该考生实际所在学院【" + realityCollegeName + "】不符,请检验excel数据是否异常或联系管理员核对");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 专业核对
|
|
|
+ if (!impMajorName.equals(realityMajorName)){
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("导入的考生【" + studentName + "(" + studentCode + ")】所在专业【" + impMajorName +
|
|
|
+ "】与该考生实际所在专业【" + realityMajorName + "】不符,请检验excel数据是否异常或联系管理员核对");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 班级核对
|
|
|
+ if (!impClazzName.equals(realityClazzName)){
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("导入的考生【" + studentName + "(" + studentCode + ")】所在班级【" + impClazzName +
|
|
|
+ "】与该考生实际所在班级【" + realityClazzName + "】不符,请检验excel数据是否异常或联系管理员核对");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 去掉已存在的学生集合
|
|
|
+ List<ExamStudentImportDto> willAddStudentList = new ArrayList<>(examStudentImportDtoList);
|
|
|
+ willAddStudentList.removeAll(existStudentList);
|
|
|
+
|
|
|
// 创建基础学生信息
|
|
|
- List<BasicStudentExtrasParam> basicStudentExtrasParamList = examStudentImportDtoList.stream().flatMap(e -> {
|
|
|
+ List<BasicStudentExtrasParam> basicStudentExtrasParamList = willAddStudentList.stream().flatMap(e -> {
|
|
|
BasicStudentExtrasParam basicStudentExtrasParam = new BasicStudentExtrasParam();
|
|
|
basicStudentExtrasParam.setStudentName(e.getStudentName());
|
|
|
basicStudentExtrasParam.setStudentCode(e.getStudentCode());
|
|
@@ -2045,32 +2093,30 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
List<ExamTaskExamStudentImportResult> result = new ArrayList<>();
|
|
|
|
|
|
List<String> studentCodeDatasource = examStudentImportDtoList.stream().map(ExamStudentImportDto::getStudentCode).distinct().collect(Collectors.toList());
|
|
|
- List<String> examRoomDatasource = examStudentImportDtoList.stream().map(ExamStudentImportDto::getExamRoom).distinct().collect(Collectors.toList());
|
|
|
// 导入的excel创建或查询的学生集合
|
|
|
List<BasicStudentResult> basicStudentResultDatasource = basicStudentService.basicStudentList(requestUser.getSchoolId(), null, null, null, studentCodeDatasource);
|
|
|
|
|
|
- for (String examRoom : examRoomDatasource) {
|
|
|
+ // 考试对象键(考点、考场)
|
|
|
+ List<Map<String,String>> examObjectKeyList = examStudentImportDtoList.stream().flatMap(e -> {
|
|
|
+ Map<String,String> key = new HashMap<>();
|
|
|
+ key.put("examPlace",e.getExamPlace());
|
|
|
+ key.put("examRoom",e.getExamRoom());
|
|
|
+ return Stream.of(key);
|
|
|
+ }).distinct().collect(Collectors.toList());
|
|
|
+
|
|
|
+ for (Map<String,String> key : examObjectKeyList) {
|
|
|
// 考点
|
|
|
- List<String> examPlaceList = examStudentImportDtoList
|
|
|
- .stream()
|
|
|
- .filter(e -> examRoom.equals(e.getExamRoom()))
|
|
|
- .map(ExamStudentImportDto::getExamPlace)
|
|
|
- .distinct()
|
|
|
- .collect(Collectors.toList());
|
|
|
- if (examPlaceList.size() > 1) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("异常:考场对应多个考点");
|
|
|
- }
|
|
|
- String examPlace = null;
|
|
|
- if (examPlaceList.size() > 0) {
|
|
|
- examPlace = examPlaceList.get(0);
|
|
|
- }
|
|
|
+ String examPlace = key.get("examPlace");
|
|
|
+ // 考场
|
|
|
+ String examRoom = key.get("examRoom");
|
|
|
|
|
|
- // 该考场学号集合
|
|
|
+ // 该考试对象考生考号集合
|
|
|
List<String> studentCodeList = examStudentImportDtoList.stream()
|
|
|
- .filter(e -> examRoom.equals(e.getExamRoom()))
|
|
|
+ .filter(e -> examPlace.equals(e.getExamPlace()) && examRoom.equals(e.getExamRoom()))
|
|
|
.map(ExamStudentImportDto::getStudentCode)
|
|
|
.distinct()
|
|
|
.collect(Collectors.toList());
|
|
|
+
|
|
|
List<ExamTaskStudentObjectResult> examTaskStudentObjectResultList = new ArrayList<>();
|
|
|
List<BasicStudentResult> basicStudentResultList = basicStudentResultDatasource.stream().filter(e -> studentCodeList.contains(e.getStudentCode())).collect(Collectors.toList());
|
|
|
List<Long> basicClazzIdList = basicStudentResultList.stream().map(BasicStudentResult::getClazzId).distinct().collect(Collectors.toList());
|
|
@@ -2094,7 +2140,6 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
examTaskStudentObjectResult.setStudentInfoList(studentInfoList);
|
|
|
examTaskStudentObjectResult.setStudentClazzType(ExamObjectType.IMPORT_STUDENT.getStudentClazzType());
|
|
|
examTaskStudentObjectResultList.add(examTaskStudentObjectResult);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|