|
@@ -190,7 +190,6 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
|
|
|
}
|
|
|
if(!CollectionUtils.isEmpty(examRoomStudentRelations)){
|
|
|
examRoomStudentRelationDao.batchInsert(examRoomStudentRelations);
|
|
|
- examTeacherSalaryService.teacherSalarySettlementWithExam(examRoom.getExaminationBasicId());
|
|
|
examRoom.setExamRoomStudentNum(examRoomStudentRelationDao.countStudentsWithRoom(examRoom.getId()));
|
|
|
examRoomDao.update(examRoom);
|
|
|
}
|
|
@@ -264,6 +263,9 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
|
|
|
Set<Integer> subjectIds = subjectRegistMap.keySet();
|
|
|
//未排考学员可排考考场
|
|
|
List<ExamRoom> examRooms = examRoomDao.getWithExamAndSubjects(examId, new ArrayList<>(subjectIds));
|
|
|
+ if(CollectionUtils.isEmpty(examRooms)){
|
|
|
+ throw new BizException("请先建立考场");
|
|
|
+ }
|
|
|
Set<Long> roomIds = examRooms.stream().map(ExamRoom::getId).collect(Collectors.toSet());
|
|
|
//未排考学员可排考考场学员
|
|
|
List<ExamRoomStudentRelation> examRoomStudents = examRoomStudentRelationDao.getWithExamRooms(new ArrayList<>(roomIds));
|
|
@@ -274,15 +276,17 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
|
|
|
//每个考场可分配学员数
|
|
|
Integer roomStudentNum=allStudentNum/roomNum;
|
|
|
|
|
|
+ Integer existRoomStudentAvgNum = examRoomStudents.size()/roomNum;
|
|
|
+
|
|
|
Set<Long> inRoomRegistIds=new HashSet<>();
|
|
|
|
|
|
List<ExamRoomStudentRelation> newRoomStudents = new ArrayList<>();
|
|
|
Map<Long, Integer> roomStudentNumMap = examRooms.stream().collect(Collectors.toMap(ExamRoom::getId, e->Objects.isNull(e.getExamRoomStudentNum())?0:e.getExamRoomStudentNum()));
|
|
|
|
|
|
- if(roomStudentNum>0){
|
|
|
+ if(roomStudentNum>existRoomStudentAvgNum){
|
|
|
int startIndex=0;
|
|
|
for (ExamRoom examRoom : examRooms) {
|
|
|
- List<ExamRegistration> examRegistrations = notInRoomStudents.subList(startIndex, roomStudentNum - examRoom.getExamRoomStudentNum());
|
|
|
+ List<ExamRegistration> examRegistrations = notInRoomStudents.subList(startIndex, startIndex + roomStudentNum - examRoom.getExamRoomStudentNum());
|
|
|
startIndex = startIndex+examRegistrations.size();
|
|
|
for (ExamRegistration examRegistration : examRegistrations) {
|
|
|
ExamRoomStudentRelation e=new ExamRoomStudentRelation();
|
|
@@ -298,7 +302,7 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- List<ExamRegistration> surplusRegist = notInRoomStudents.stream().filter(e -> !inRoomRegistIds.contains(e.getId())).collect(Collectors.toList());
|
|
|
+ List<ExamRegistration> surplusRegist = notInRoomStudents.stream().filter(e -> !inRoomRegistIds.contains(e.getId().longValue())).collect(Collectors.toList());
|
|
|
|
|
|
for (ExamRegistration examRegistration : surplusRegist) {
|
|
|
List<Long> sortedRoomIds=new LinkedList<>();
|
|
@@ -311,6 +315,7 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
|
|
|
e.setStudentId(examRegistration.getStudentId());
|
|
|
e.setTenantId(examinationBasic.getTenantId());
|
|
|
newRoomStudents.add(e);
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -448,7 +453,6 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
|
|
|
studentExamResultDao.deleteWithRegists(registIds);
|
|
|
examRoom.setExamRoomStudentNum(examRoomStudentRelationDao.countStudentsWithRoom(examRoom.getId()));
|
|
|
examRoomDao.update(examRoom);
|
|
|
- examTeacherSalaryService.teacherSalarySettlementWithExam(examRoom.getExaminationBasicId());
|
|
|
}
|
|
|
|
|
|
@Override
|