|
@@ -153,6 +153,10 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
|
|
|
throw new BizException("请指定考试时间");
|
|
|
}
|
|
|
|
|
|
+ if(ExamModeEnum.ONLINE.equals(examRoom.getExamMode())){
|
|
|
+ examRoom.setExamLocationId(null);
|
|
|
+ }
|
|
|
+
|
|
|
ExamOrganizationRelation examOrganizationRelation = examOrganizationRelationDao.getExamOrganizationRelation(examinationBasic.getId(), examRoom.getOrganId());
|
|
|
if(Objects.isNull(examOrganizationRelation)||examOrganizationRelation.getIsAllowArrangeExam()==0){
|
|
|
throw new BizException("无权操作");
|
|
@@ -170,6 +174,10 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
|
|
|
teacherIds.add(examRoom.getMainTeacherUserId());
|
|
|
if(StringUtils.isNotBlank(examRoom.getAssistantTeacherUserIdList())){
|
|
|
teacherIds.addAll(Arrays.stream(examRoom.getAssistantTeacherUserIdList().split(",")).map(id->Integer.valueOf(id)).collect(Collectors.toList()));
|
|
|
+ HashSet<Integer> noRepeatTeacherIds = new HashSet<>(teacherIds);
|
|
|
+ if(teacherIds.size()!=noRepeatTeacherIds.size()){
|
|
|
+ throw new BizException("主考老师与监考老师不可重复");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
Map<Integer, String> teacherIdNameMap = this.getMap("sys_user", "id_", "real_name_", teacherIds, Integer.class, String.class);
|
|
@@ -236,10 +244,20 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
|
|
|
throw new BizException("请指定教室");
|
|
|
}
|
|
|
|
|
|
+ ExamRoom existExamRoom = examRoomDao.get(examRoom.getId());
|
|
|
+
|
|
|
+ if(ExamModeEnum.ONLINE.equals(examRoom.getExamMode())){
|
|
|
+ examRoom.setExamLocationId(null);
|
|
|
+ }
|
|
|
+
|
|
|
List<Integer> teacherIds=new ArrayList<>();
|
|
|
teacherIds.add(examRoom.getMainTeacherUserId());
|
|
|
if(StringUtils.isNotBlank(examRoom.getAssistantTeacherUserIdList())){
|
|
|
teacherIds.addAll(Arrays.stream(examRoom.getAssistantTeacherUserIdList().split(",")).map(id->Integer.valueOf(id)).collect(Collectors.toList()));
|
|
|
+ HashSet<Integer> noRepeatTeacherIds = new HashSet<>(teacherIds);
|
|
|
+ if(teacherIds.size()!=noRepeatTeacherIds.size()){
|
|
|
+ throw new BizException("主考老师与监考老师不可重复");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
Map<Integer, String> teacherIdNameMap = this.getMap("sys_user", "id_", "real_name_", teacherIds, Integer.class, String.class);
|
|
@@ -253,7 +271,23 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
|
|
|
}
|
|
|
examRoom.setAssistantTeacherUserNameList(StringUtils.join(assistantTeacherNames, ","));
|
|
|
}
|
|
|
+
|
|
|
+ List<Integer> subjectIds = Arrays.stream(examRoom.getSubjectIdList().split(",")).map(e -> Integer.valueOf(e)).collect(Collectors.toList());
|
|
|
+ Map<Integer, String> subjectIdNameMap = this.getMap("subject", "id_", "name_", subjectIds, Integer.class, String.class);
|
|
|
+ examRoom.setSubjectNameList(StringUtils.join(subjectIdNameMap.values(),","));
|
|
|
+
|
|
|
+ if(Objects.isNull(examRoom.getExamStartTime())){
|
|
|
+ examRoom.setExamStartTime(existExamRoom.getExamStartTime());
|
|
|
+ }
|
|
|
+ if(Objects.isNull(examRoom.getExamEndTime())){
|
|
|
+ examRoom.setExamEndTime(existExamRoom.getExamEndTime());
|
|
|
+ }
|
|
|
+
|
|
|
+ List<ExamRoom> examRooms=new ArrayList<>(Arrays.asList(examRoom));
|
|
|
+ checkRoomTeachers(examRooms);
|
|
|
+
|
|
|
examRoomDao.update(examRoom);
|
|
|
+ examTeacherSalaryService.teacherSalarySettlementWithExam(examRoom.getExaminationBasicId());
|
|
|
return examRoom;
|
|
|
}
|
|
|
|
|
@@ -272,13 +306,13 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
|
|
|
|
|
|
examRoomStudentRelationService.deleteWithExamRooms(examRoomIds);
|
|
|
|
|
|
- examCertificationDao.deleteWithRegist(registIds);
|
|
|
-
|
|
|
- studentExamResultDao.deleteWithRegists(registIds);
|
|
|
-
|
|
|
- examTeacherSalaryService.teacherSalarySettlementWithExam(examRoom.getExaminationBasicId());
|
|
|
+ if(!CollectionUtils.isEmpty(registIds)){
|
|
|
+ examCertificationDao.deleteWithRegist(registIds);
|
|
|
+ studentExamResultDao.deleteWithRegists(registIds);
|
|
|
+ }
|
|
|
|
|
|
examRoomDao.batchDeleteExamRooms(examRoomIds);
|
|
|
+ examTeacherSalaryService.teacherSalarySettlementWithExam(examRoom.getExaminationBasicId());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -306,16 +340,17 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
|
|
|
examRoomStatisticsInfo.setExamRoomNum(examRooms.size());
|
|
|
examRoomStatisticsInfo.setFirstExamTime(examRooms.stream().min(Comparator.comparing(ExamRoom::getExamStartTime)).get().getExamStartTime());
|
|
|
examRoomStatisticsInfo.setLastExamTime(examRooms.stream().max(Comparator.comparing(ExamRoom::getExamStartTime)).get().getExamStartTime());
|
|
|
- int teacherNum=0;
|
|
|
+ Set<Integer> teacherIds=new HashSet<>();
|
|
|
for (ExamRoom examRoom : examRooms) {
|
|
|
if(Objects.nonNull(examRoom.getMainTeacherUserId())){
|
|
|
- teacherNum+=1;
|
|
|
+ teacherIds.add(examRoom.getMainTeacherUserId());
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(examRoom.getAssistantTeacherUserIdList())){
|
|
|
- teacherNum = teacherNum + StringUtils.countMatches(examRoom.getAssistantTeacherUserIdList(), ",") + 1;
|
|
|
+ Set<Integer> assistantTeacherIds = Arrays.stream(examRoom.getAssistantTeacherUserIdList().split(",")).map(e -> Integer.valueOf(e)).collect(Collectors.toSet());
|
|
|
+ teacherIds.addAll(assistantTeacherIds);
|
|
|
}
|
|
|
}
|
|
|
- examRoomStatisticsInfo.setExamRoomTeacherNum(teacherNum);
|
|
|
+ examRoomStatisticsInfo.setExamRoomTeacherNum(teacherIds.size());
|
|
|
}
|
|
|
|
|
|
return examRoomStatisticsInfo;
|
|
@@ -385,6 +420,9 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
|
|
|
}
|
|
|
ExamRoom preExamRoom=teacherRooms.get(i-1);
|
|
|
ExamRoom currentExamRoom = teacherRooms.get(i);
|
|
|
+ if(Objects.nonNull(preExamRoom.getId())&&preExamRoom.getId().equals(currentExamRoom.getId())){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
if(preExamRoom.getExamEndTime().compareTo(currentExamRoom.getExamStartTime())>0){
|
|
|
SysUser sysUser = sysUserDao.get(teacherRoomEntry.getKey());
|
|
|
throw new BizException("{}教师时间存在冲突", sysUser.getRealName());
|