|
@@ -1252,7 +1252,17 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
} else {
|
|
|
allCourseSchedules = courseSchedules;
|
|
|
}
|
|
|
- //所有课程的班级编号
|
|
|
+
|
|
|
+ //所有课程编号
|
|
|
+ List<Long> allCourseScheduleIds = allCourseSchedules.stream().map(CourseSchedule::getId).collect(Collectors.toList());
|
|
|
+ //所有课程学员签到记录
|
|
|
+ List<StudentAttendance> studentAttendances = studentAttendanceDao.findByCourseIds(allCourseScheduleIds);
|
|
|
+ //课程请假学员字典
|
|
|
+ Map<Long, Set<Integer>> courseLeaveStudentMap = studentAttendances.stream()
|
|
|
+ .filter(e -> StudentAttendanceStatusEnum.LEAVE.equals(e.getStatus()))
|
|
|
+ .collect(Collectors.groupingBy(StudentAttendance::getCourseScheduleId, Collectors.mapping(StudentAttendance::getUserId, Collectors.toSet())));
|
|
|
+
|
|
|
+ //所有课程的班级编号
|
|
|
List<Integer> classGroupIds = allCourseSchedules
|
|
|
.stream()
|
|
|
.map(CourseSchedule::getClassGroupId)
|
|
@@ -1359,12 +1369,26 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
if (CollectionUtils.isEmpty(preClassGroupStudents) || CollectionUtils.isEmpty(backClassGroupStudents)) {
|
|
|
continue;
|
|
|
}
|
|
|
- //当前课程所在班级的学生编号列表
|
|
|
- List<Integer> preClassGroupStudentIds = preClassGroupStudents.stream()
|
|
|
+ //课程对应请假学员编号集合
|
|
|
+ Set<Integer> preLeaveStudentIds = courseLeaveStudentMap.get(preCourseSchedule.getId());
|
|
|
+ if(null == preLeaveStudentIds){
|
|
|
+ preLeaveStudentIds = Collections.EMPTY_SET;
|
|
|
+ }
|
|
|
+ Set<Integer> backLeaveStudentIds = courseLeaveStudentMap.get(backCourseSchedule.getId());
|
|
|
+ if(null == backLeaveStudentIds){
|
|
|
+ backLeaveStudentIds = Collections.EMPTY_SET;
|
|
|
+ }
|
|
|
+
|
|
|
+ //当前课程所在班级的学生编号列表
|
|
|
+ Set<Integer> finalPreLeaveStudentIds = preLeaveStudentIds;
|
|
|
+ List<Integer> preClassGroupStudentIds = preClassGroupStudents.stream()
|
|
|
+ .filter(e->!finalPreLeaveStudentIds.contains(e.getUserId()))
|
|
|
.map(ClassGroupStudentMapper::getUserId)
|
|
|
.collect(Collectors.toList());
|
|
|
//后面一节课程所在班级的学生编号列表
|
|
|
- Set<Integer> backClassGroupStudentIds = backClassGroupStudents.stream()
|
|
|
+ Set<Integer> finalBackLeaveStudentIds = backLeaveStudentIds;
|
|
|
+ Set<Integer> backClassGroupStudentIds = backClassGroupStudents.stream()
|
|
|
+ .filter(e->!finalBackLeaveStudentIds.contains(e.getUserId()))
|
|
|
.map(ClassGroupStudentMapper::getUserId)
|
|
|
.collect(Collectors.toSet());
|
|
|
List<Integer> repeatStudentIds = preClassGroupStudentIds.stream()
|