ソースを参照

Merge branch 'master' of http://git.dayaedu.com/yonge/mec

yonge 4 年 前
コミット
c33482a029

+ 28 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -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()

+ 2 - 1
mec-biz/src/main/resources/config/mybatis/ClassGroupStudentMapperMapper.xml

@@ -255,7 +255,8 @@
         LIMIT 1
     </select>
     <select id="findByClassGroups" resultMap="ClassGroupStudentMapper">
-        SELECT * FROM class_group_student_mapper WHERE class_group_id_ IN
+        SELECT * FROM class_group_student_mapper
+        WHERE class_group_id_ IN
         <foreach collection="classGroupIds" item="classGroupId" open="(" close=")" separator=",">
             #{classGroupId}
         </foreach>

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/PracticeGroupMapper.xml

@@ -570,7 +570,7 @@
             </if>
     </select>
     <select id="findEnableAssignTeachers" resultType="com.ym.mec.biz.dal.dto.SimpleUserDto">
-        SELECT su.id_ userId,su.username_ userName,su.avatar_ avatar
+        SELECT su.id_ userId,su.real_name_ userName,su.avatar_ avatar
         FROM teacher t
           LEFT JOIN sys_user su ON t.id_=su.id_
         WHERE