Przeglądaj źródła

准考证号生成和唯一校验

wangliang 2 lat temu
rodzic
commit
52fe21e579

+ 8 - 10
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamDetailServiceImpl.java

@@ -656,12 +656,12 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
     public void disposeExamStudentByExaminationExcel(Long examId, List<ExaminationImportDto> dataList, Long userId, SysUser sysUser) throws IllegalAccessException {
         BasicExam basicExam = basicExamService.getById(examId);
         // 查询学期下所有考务数据的准考证号集合
-//        List<String> examStudentTicketNumberList = examStudentService.listTicketNumberBySemesterId(basicExam.getSemesterId(), examId);
+        List<String> examStudentTicketNumberList = examStudentService.listTicketNumberBySemesterId(basicExam.getSemesterId(), examId);
 
         List<ExamStudent> examStudentList = new ArrayList<>();
         List<BasicStudentExtrasParam> basicStudentExtrasParamList = new ArrayList<>();
         Map<String, Integer> ticketNumberCodeMap = new HashMap<>();
-//        Set<String> ticketNumberRepeatList = new HashSet<>();
+        Set<String> ticketNumberRepeatList = new HashSet<>();
         StringJoiner stringJoiner = new StringJoiner(",");
         for (ExaminationImportDto examinationImportDto : dataList) {
             Long schoolId = examinationImportDto.getSchoolId();
@@ -692,9 +692,9 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
                 ticketNumberCodeMap.put(ticketNumber, 1);
             }
 
-//            if (!examStudentTicketNumberList.isEmpty() && examStudentTicketNumberList.contains(ticketNumber)) {
-//                ticketNumberRepeatList.add(ticketNumber);
-//            }
+            if (!examStudentTicketNumberList.isEmpty() && examStudentTicketNumberList.contains(ticketNumber)) {
+                ticketNumberRepeatList.add(ticketNumber);
+            }
 
             List<FieldsDto> fieldsDtoList = examinationImportDto.getSecondaryFieldList();
             List<ExtendFieldsDto> extendFieldsDtoList = this.getExtendFieldsByFields(fieldsDtoList);
@@ -753,9 +753,9 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
         if (!stringList.isEmpty()) {
             stringJoiner.add(String.join(",", stringList));
         }
-//        if (!ticketNumberRepeatList.isEmpty()) {
-//            stringJoiner.add("考号[" + String.join(",", ticketNumberRepeatList) + "]在当前考试下已存在");
-//        }
+        if (!ticketNumberRepeatList.isEmpty()) {
+            stringJoiner.add("考号[" + String.join(",", ticketNumberRepeatList) + "]在当前考试下已存在");
+        }
         if (stringJoiner.toString().length() > 1) {
             throw ExceptionResultEnum.ERROR.exception(stringJoiner.toString());
         }
@@ -769,8 +769,6 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
                     .eq(BasicClazz::getSchoolId, examStudent.getSchoolId())).getId()));
         }
         examStudentService.saveBatch(examStudentList);
-
-
     }
 
     @Override