Joburgess 5 年之前
父节点
当前提交
d32b9f2d0d

+ 5 - 4
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRoomServiceImpl.java

@@ -305,16 +305,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;