Sfoglia il codice sorgente

add:
1.考生导入·逻辑更改

caozixuan 1 anno fa
parent
commit
8886dcff30

+ 10 - 1
src/main/java/cn/com/qmth/print/manage/service/impl/ExamStudentServiceImpl.java

@@ -330,6 +330,9 @@ public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentDao, ExamStud
         Map<String, List<ExamStudentEntity>> groupCollection = null;
         switch (groupType) {
             case COURSE:
+                if (studentList.stream().anyMatch(e -> e.getCourseCode() == null || e.getCourseCode().length() == 0)){
+                    throw new StatusException(String.format("不能导入分组字段[%s]为空的考生文件",groupType.getName()));
+                }
                 // 导入的新考生数据不能包含有之前科目的
                 List<String> dbCourseList = dbStudentList
                         .stream()
@@ -343,6 +346,9 @@ public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentDao, ExamStud
                 groupCollection = studentList.stream().collect(Collectors.groupingBy(ExamStudentEntity::getCourseCode));
                 break;
             case EXAM_SITE:
+                if (studentList.stream().anyMatch(e -> e.getExamSite() == null || e.getExamSite().length() == 0)){
+                    throw new StatusException(String.format("不能导入分组字段[%s]为空的考生文件",groupType.getName()));
+                }
                 // 导入的新考生数据不能包含有之前考点
                 List<String> dbExamSiteList = dbStudentList
                         .stream()
@@ -356,7 +362,10 @@ public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentDao, ExamStud
                 groupCollection = studentList.stream().collect(Collectors.groupingBy(ExamStudentEntity::getExamSite));
                 break;
             case EXAM_ROOM:
-                // 导入的新考生数据不能包含有之前烤成
+                if (studentList.stream().anyMatch(e -> e.getExamRoom() == null || e.getExamRoom().length() == 0)){
+                    throw new StatusException(String.format("不能导入分组字段[%s]为空的考生文件",groupType.getName()));
+                }
+                // 导入的新考生数据不能包含有之前考生
                 List<String> dbExamRoomList = dbStudentList
                         .stream()
                         .filter(e -> e.getExamRoom() != null && e.getExamRoom().length() > 0)