|
@@ -62,12 +62,12 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
|
- public void addStudentForRoom(Long examRoomId, String studentIdsStr) {
|
|
|
+ public void addStudentForRoom(Long examRoomId, String registIdsStr) {
|
|
|
if(Objects.isNull(examRoomId)){
|
|
|
throw new BizException("请指定教室");
|
|
|
}
|
|
|
- if(StringUtils.isBlank(studentIdsStr)){
|
|
|
- throw new BizException("请指定学员");
|
|
|
+ if(StringUtils.isBlank(registIdsStr)){
|
|
|
+ throw new BizException("请指定学员报名编号");
|
|
|
}
|
|
|
ExamRoom examRoom = examRoomDao.lockRoom(examRoomId);
|
|
|
if(Objects.isNull(examRoom)){
|
|
@@ -76,20 +76,21 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
|
|
|
ExamLocation examLocation = examLocationDao.get(examRoom.getExamLocationId());
|
|
|
|
|
|
List<ExamRoomStudentRelation> studentsWithExamRoom = examRoomStudentRelationDao.findStudentsWithExamRoom(examRoomId);
|
|
|
- Set<Integer> existStudentIds = studentsWithExamRoom.stream().map(ExamRoomStudentRelation::getStudentId).collect(Collectors.toSet());
|
|
|
- String[] studentIds = studentIdsStr.split(",");
|
|
|
+ Set<Long> existRegistIds = studentsWithExamRoom.stream().map(ExamRoomStudentRelation::getExamRegistrationId).collect(Collectors.toSet());
|
|
|
+
|
|
|
+ String[] registIds = registIdsStr.split(",");
|
|
|
|
|
|
- List<ExamRegistration> examRegistrations = examRegistrationDao.getWithExamAndStudents(examRoom.getExaminationBasicId(), Arrays.asList(studentIds).stream().map(e -> Integer.valueOf(e)).collect(Collectors.toList()));
|
|
|
- Map<Integer, ExamRegistration> studentRegistMap = examRegistrations.stream().collect(Collectors.toMap(ExamRegistration::getStudentId, e -> e));
|
|
|
+ List<ExamRegistration> examRegistrations = examRegistrationDao.getRegists(Arrays.asList(registIds).stream().map(e -> Long.valueOf(e)).collect(Collectors.toList()));
|
|
|
+ Map<Integer, ExamRegistration> studentRegistMap = examRegistrations.stream().collect(Collectors.toMap(ExamRegistration::getId, e -> e));
|
|
|
|
|
|
List<ExamRoomStudentRelation> examRoomStudentRelations=new ArrayList<>();
|
|
|
List<StudentExamResult> studentExamResults=new ArrayList<>();
|
|
|
List<ExamCertification> examCertifications=new ArrayList<>();
|
|
|
- for (String studentId : studentIds) {
|
|
|
- if(existStudentIds.contains(Integer.valueOf(studentId))){
|
|
|
+ for (String registId : registIds) {
|
|
|
+ if(existRegistIds.contains(Integer.valueOf(registId))){
|
|
|
continue;
|
|
|
}
|
|
|
- ExamRegistration examRegistration = studentRegistMap.get(Integer.valueOf(studentId));
|
|
|
+ ExamRegistration examRegistration = studentRegistMap.get(Integer.valueOf(registId));
|
|
|
if(Objects.isNull(examRegistration)){
|
|
|
throw new BizException("学员信息错误");
|
|
|
}
|
|
@@ -97,21 +98,23 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
|
|
|
ExamRoomStudentRelation e=new ExamRoomStudentRelation();
|
|
|
e.setExaminationBasicId(examRoom.getExaminationBasicId());
|
|
|
e.setExamRoomId(examRoom.getId());
|
|
|
- e.setStudentId(Integer.valueOf(studentId));
|
|
|
+ e.setStudentId(Integer.valueOf(registId));
|
|
|
e.setTenantId(TenantContextHolder.getTenantId());
|
|
|
examRoomStudentRelations.add(e);
|
|
|
|
|
|
StudentExamResult ser = new StudentExamResult();
|
|
|
+ ser.setExamRegistrationId(examRegistration.getId().longValue());
|
|
|
ser.setExaminationBasicId(examRoom.getExaminationBasicId());
|
|
|
- ser.setStudentId(Integer.valueOf(studentId));
|
|
|
+ ser.setStudentId(examRegistration.getStudentId());
|
|
|
ser.setIsFinishedExam(0);
|
|
|
ser.setConfirmStatus(0);
|
|
|
ser.setTenantId(TenantContextHolder.getTenantId());
|
|
|
studentExamResults.add(ser);
|
|
|
|
|
|
ExamCertification ec=new ExamCertification();
|
|
|
+ ec.setExamRegistrationId(examRegistration.getId().longValue());
|
|
|
ec.setExaminationBasicId(examRoom.getExaminationBasicId());
|
|
|
- ec.setStudentId(Integer.valueOf(studentId));
|
|
|
+ ec.setStudentId(examRegistration.getStudentId());
|
|
|
ec.setCardNo(String.valueOf(idGeneratorService.generatorId()));
|
|
|
ec.setSubjectId(examRegistration.getSubjectId());
|
|
|
ec.setLevel(examRegistration.getLevel());
|