| 
					
				 | 
			
			
				@@ -1039,7 +1039,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if(StringUtils.isNotBlank(organIdList)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			organIds = Arrays.stream(organIdList.split(",")).map(s->Integer.valueOf(s)).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		return courseScheduleDao.getCourseScheduleDateWithOrgan(organIds, month, type, transactionTeacherId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		return courseScheduleDao.getCourseScheduleDateWithOrgan(organIds, month, type, transactionTeacherId, TenantContextHolder.getTenantId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1742,7 +1742,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if(!DateUtil.isSameDay(courseSchedule.getStartClassTime(), courseSchedule.getEndClassTime())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			throw new BizException("课程时间不允许跨天"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		List<CourseSchedule> allCourseSchedules = courseScheduleDao.findByClassDate(Arrays.asList(DateUtil.dateToString(courseSchedule.getClassDate(), "yyyy-MM-dd"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		List<CourseSchedule> allCourseSchedules = courseScheduleDao.findByClassDate(Arrays.asList(DateUtil.dateToString(courseSchedule.getClassDate(), "yyyy-MM-dd")),TenantContextHolder.getTenantId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if(null == allCourseSchedules){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			allCourseSchedules = new ArrayList<>(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1884,7 +1884,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<String> classDates = courseSchedules.stream().map(courseSchedule -> DateUtil.dateToString(courseSchedule.getClassDate(), "yyyy-MM-dd")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<CourseSchedule> existCourseSchedules = courseScheduleDao.findByClassDate(classDates); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<CourseSchedule> existCourseSchedules = courseScheduleDao.findByClassDate(classDates, TenantContextHolder.getTenantId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //只需要调整课程信息的课程编号列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<Long> updateCourseScheduleIds = courseSchedules 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2103,369 +2103,6 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public void checkNewCourseSchedulesWithoutMusicGroup(List<CourseSchedule> courseSchedules, boolean checkExistCourseSchedule) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (CollectionUtils.isEmpty(courseSchedules)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<String> classDates = courseSchedules.stream().map(courseSchedule -> DateUtil.dateToString(courseSchedule.getClassDate(), "yyyy-MM-dd")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<CourseSchedule> existCourseSchedules = courseScheduleDao.findByClassDateWithoutMusicGroup(classDates); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //只需要调整课程信息的课程编号列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<Long> updateCourseScheduleIds = courseSchedules 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .filter(courseSchedule -> Objects.nonNull(courseSchedule.getId())) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .map(CourseSchedule::getId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //排除只需调整的课程 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        existCourseSchedules = existCourseSchedules.stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .filter(courseSchedule -> !updateCourseScheduleIds.contains(courseSchedule.getId())) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //新课程对应的班级编号列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<Integer> newCourseScheduleClassGroupIds = courseSchedules 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .map(CourseSchedule::getClassGroupId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .distinct() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<Long> existCourseScheduleIds = existCourseSchedules.stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .map(CourseSchedule::getId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        HashSet<Long> courseScheduleIdsSet = new HashSet<>(existCourseScheduleIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //合并新课程和已存在的课程 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<CourseSchedule> allCourseSchedules; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (!CollectionUtils.isEmpty(existCourseSchedules)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            allCourseSchedules = ListUtils.sum(courseSchedules, existCourseSchedules); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            allCourseSchedules = courseSchedules; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //所有课程的班级编号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<Integer> classGroupIds = allCourseSchedules 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .map(CourseSchedule::getClassGroupId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .distinct() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //班级与学生的关联记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<ClassGroupStudentMapper> classGroupStudentMappers = classGroupStudentMapperDao.findByClassGroups(classGroupIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Map<Integer, List<ClassGroupStudentMapper>> classGroupStudentsMap = classGroupStudentMappers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .collect(Collectors.groupingBy(ClassGroupStudentMapper::getClassGroupId)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //根据课程获取助教id关联集合 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<IntegerAndIntegerListDto> courseScheduleTeachingTeacherIdList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (!CollectionUtils.isEmpty(existCourseScheduleIds)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            courseScheduleTeachingTeacherIdList = courseScheduleDao.findCourseScheduleIdAndUserIdsMap(existCourseScheduleIds, TeachTypeEnum.TEACHING.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Map<Long, IntegerAndIntegerListDto> courseScheduleTeachingTeacherMap = courseScheduleTeachingTeacherIdList.stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .collect(Collectors.toMap(IntegerAndIntegerListDto::getId, integerAndIntegerListDto -> integerAndIntegerListDto)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //班级助教关联ID集合 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<IntegerAndIntegerListDto> classGroupAndUserIdsMap = courseScheduleDao.findClassGroupAndUserIdsMap(newCourseScheduleClassGroupIds, TeachTypeEnum.TEACHING.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Map<Long, IntegerAndIntegerListDto> classGroupTeachingTeacherMap = classGroupAndUserIdsMap.stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .collect(Collectors.toMap(IntegerAndIntegerListDto::getId, integerAndIntegerListDto -> integerAndIntegerListDto)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Set<Long> existCourseScheduleIdsSet=new HashSet<>(existCourseScheduleIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Map<String, List<CourseSchedule>> existClassDateCoursesMap = allCourseSchedules.stream().collect(Collectors.groupingBy(c -> DateUtil.dateToString(c.getClassDate(), "yyyy-MM-dd"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Map<String, List<CourseSchedule>> newClassDateCoursesMap = courseSchedules.stream().collect(Collectors.groupingBy(c -> DateUtil.dateToString(c.getClassDate(), "yyyy-MM-dd"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (allCourseSchedules.size() > 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            for (Map.Entry<String, List<CourseSchedule>> classDateCourseEntry : newClassDateCoursesMap.entrySet()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                List<CourseSchedule> existClassDateCourses = existClassDateCoursesMap.get(classDateCourseEntry.getKey()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if(CollectionUtils.isEmpty(existClassDateCourses)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                List<CourseSchedule> newClassDateCourses=classDateCourseEntry.getValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                existClassDateCourses.sort(Comparator.comparing(CourseSchedule::getStartClassTime)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                newClassDateCourses.sort(Comparator.comparing(CourseSchedule::getStartClassTime)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                for (CourseSchedule preCourseSchedule : newClassDateCourses) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    for (CourseSchedule backCourseSchedule : existClassDateCourses) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        //判断前后两节课是否存在冲突 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if (!preCourseSchedule.getStartClassTime().before(backCourseSchedule.getEndClassTime()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                ||!preCourseSchedule.getEndClassTime().after(backCourseSchedule.getStartClassTime())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if (!checkExistCourseSchedule 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                && !courseScheduleIdsSet.contains(backCourseSchedule.getId())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        //如果存在时间重叠,则需要判断前后两节课的教师和学生是否存在冲突 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        //主教冲突检测 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if (Objects.nonNull(preCourseSchedule.getActualTeacherId()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                && preCourseSchedule.getActualTeacherId().equals(backCourseSchedule.getActualTeacherId())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            throw new BizException(courseCheckInfo(preCourseSchedule, backCourseSchedule, existCourseScheduleIds, 1)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        //助教冲突检测 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if (Objects.isNull(preCourseSchedule.getId())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            IntegerAndIntegerListDto integerAndIntegerListDto = classGroupTeachingTeacherMap.get(preCourseSchedule.getClassGroupId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            if (Objects.nonNull(integerAndIntegerListDto)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                preCourseSchedule.setTeachingTeacherIdList(integerAndIntegerListDto.getIds()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        } else if (existCourseScheduleIdsSet.contains(preCourseSchedule.getId())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            IntegerAndIntegerListDto integerAndIntegerListDto = courseScheduleTeachingTeacherMap.get(preCourseSchedule.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            if (Objects.nonNull(integerAndIntegerListDto)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                preCourseSchedule.setTeachingTeacherIdList(integerAndIntegerListDto.getIds()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if (Objects.isNull(backCourseSchedule.getId())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            IntegerAndIntegerListDto integerAndIntegerListDto = classGroupTeachingTeacherMap.get(backCourseSchedule.getClassGroupId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            if (Objects.nonNull(integerAndIntegerListDto)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                backCourseSchedule.setTeachingTeacherIdList(integerAndIntegerListDto.getIds()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        } else if (existCourseScheduleIdsSet.contains(backCourseSchedule.getId())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            IntegerAndIntegerListDto integerAndIntegerListDto = courseScheduleTeachingTeacherMap.get(backCourseSchedule.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            if (Objects.nonNull(integerAndIntegerListDto)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                backCourseSchedule.setTeachingTeacherIdList(integerAndIntegerListDto.getIds()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if (!CollectionUtils.isEmpty(preCourseSchedule.getTeachingTeacherIdList()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                && !CollectionUtils.isEmpty(backCourseSchedule.getTeachingTeacherIdList())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            List<Integer> repeatIds = preCourseSchedule.getTeachingTeacherIdList() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    .stream().filter(backCourseSchedule.getTeachingTeacherIdList()::contains) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                    .collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            if (!CollectionUtils.isEmpty(repeatIds)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                throw new BizException(courseCheckInfo(preCourseSchedule, backCourseSchedule, existCourseScheduleIds, 2)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        //学生冲突检测 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if (preCourseSchedule.getClassGroupId().equals(backCourseSchedule.getClassGroupId())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            //如果班级相同,则学生肯定存在冲突 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            throw new BizException(courseCheckInfo(preCourseSchedule, backCourseSchedule, existCourseScheduleIds, 3)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        //如果班级不同,则需要检测两个班级是否存在重复的学生 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        List<ClassGroupStudentMapper> preClassGroupStudents = classGroupStudentsMap.get(preCourseSchedule.getClassGroupId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        List<ClassGroupStudentMapper> backClassGroupStudents = classGroupStudentsMap.get(backCourseSchedule.getClassGroupId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        //如果有一个存在没有学生的班级则不存在冲突 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if (CollectionUtils.isEmpty(preClassGroupStudents) || CollectionUtils.isEmpty(backClassGroupStudents)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        //当前课程所在班级的学生编号列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        List<Integer> preClassGroupStudentIds = preClassGroupStudents.stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                .map(ClassGroupStudentMapper::getUserId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                .collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        //后面一节课程所在班级的学生编号列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        Set<Integer> backClassGroupStudentIds = backClassGroupStudents.stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                .map(ClassGroupStudentMapper::getUserId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                .collect(Collectors.toSet()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        List<Integer> repeatStudentIds = preClassGroupStudentIds.stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                .filter(backClassGroupStudentIds::contains) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                .collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        if (!CollectionUtils.isEmpty(repeatStudentIds)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            throw new BizException(courseCheckInfo(preCourseSchedule, backCourseSchedule, existCourseScheduleIds, 3)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public List<Long> checkSnapCourseShchedules(List<CourseSchedule> courseSchedules) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<Long> courseScheduleIds = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<CourseScheduleStudentDto> courseScheduleStudents = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (CollectionUtils.isEmpty(courseSchedules)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return courseScheduleIds; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //第一节课 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        CourseSchedule firstCourseSchedule; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //最后一节课 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        CourseSchedule latestCourseSchedule; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (courseSchedules.size() == 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            firstCourseSchedule = courseSchedules.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            latestCourseSchedule = courseSchedules.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            firstCourseSchedule = courseSchedules.stream().min(Comparator.comparing(CourseSchedule::getStartClassTime)).get(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            latestCourseSchedule = courseSchedules.stream().max(Comparator.comparing(CourseSchedule::getEndClassTime)).get(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //获取第一节课和最后一节课所包含的时间段内已存在的课程 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<CourseSchedule> existCourseSchedules = courseScheduleDao 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .findAllCourseByDateZone(firstCourseSchedule.getStartClassTime(), latestCourseSchedule.getEndClassTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (existCourseSchedules == null || existCourseSchedules.size() == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //只需要调整课程信息的课程编号列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<Long> updateCourseScheduleIds = courseSchedules 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .filter(courseSchedule -> Objects.nonNull(courseSchedule.getId())) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .map(CourseSchedule::getId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //排除只需调整的课程 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        existCourseSchedules = existCourseSchedules.stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .filter(courseSchedule -> !updateCourseScheduleIds.contains(courseSchedule.getId())) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (existCourseSchedules == null || existCourseSchedules.size() == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<Long> existCourseScheduleIds = existCourseSchedules.stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .map(CourseSchedule::getId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //合并新课程和已存在的课程 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<CourseSchedule> allCourseSchedules; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (!CollectionUtils.isEmpty(existCourseSchedules)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            allCourseSchedules = ListUtils.sum(courseSchedules, existCourseSchedules); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            allCourseSchedules = courseSchedules; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //新课程对应的班级编号列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<Integer> newCourseScheduleClassGroupIds = allCourseSchedules 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .map(CourseSchedule::getClassGroupId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .distinct() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //所有课程的班级编号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<Integer> classGroupIds = allCourseSchedules 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .map(CourseSchedule::getClassGroupId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .distinct() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //班级与学生的关联记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<CourseScheduleStudentPayment> exitStudentPaymentList = courseScheduleStudentPaymentDao.findByCourseScheduleIds(existCourseScheduleIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<ClassGroupStudentMapper> classGroupStudentMappers = classGroupStudentMapperDao.findByClassGroups(classGroupIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Map<Integer, List<ClassGroupStudentMapper>> classGroupStudentsMap = classGroupStudentMappers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .collect(Collectors.groupingBy(ClassGroupStudentMapper::getClassGroupId)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Map<Long, List<CourseScheduleStudentPayment>> exitStudentPaymentMap = exitStudentPaymentList.stream().collect(Collectors.groupingBy(CourseScheduleStudentPayment::getCourseScheduleId)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //根据课程获取教师id关联集合 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<IntegerAndIntegerListDto> courseScheduleTeachingTeacherIdList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (!CollectionUtils.isEmpty(existCourseScheduleIds)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            courseScheduleTeachingTeacherIdList = courseScheduleDao.findCourseScheduleIdAndUserIdsMap(existCourseScheduleIds, null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Map<Long, IntegerAndIntegerListDto> courseScheduleTeacherMap = courseScheduleTeachingTeacherIdList.stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .collect(Collectors.toMap(IntegerAndIntegerListDto::getId, integerAndIntegerListDto -> integerAndIntegerListDto)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //班级教师关联ID集合 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<IntegerAndIntegerListDto> classGroupAndUserIdsMap = courseScheduleDao.findClassGroupAndUserIdsMap(newCourseScheduleClassGroupIds, null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Map<Long, IntegerAndIntegerListDto> classGroupTeachingTeacherMap = classGroupAndUserIdsMap.stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .collect(Collectors.toMap(IntegerAndIntegerListDto::getId, integerAndIntegerListDto -> integerAndIntegerListDto)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		allCourseSchedules.sort(Comparator.comparing(CourseSchedule::getStartClassTime)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        courseSchedules.sort(Comparator.comparing(CourseSchedule::getStartClassTime)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        newNode: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        for (CourseSchedule newCourseSchedule : courseSchedules) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            for (CourseSchedule existCourseSchedule : allCourseSchedules) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (newCourseSchedule.getEndClassTime().compareTo(existCourseSchedule.getStartClassTime()) <= 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    continue newNode; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (existCourseSchedule.getEndClassTime().compareTo(newCourseSchedule.getStartClassTime()) <= 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if(newCourseSchedule.equals(existCourseSchedule)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                	continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                boolean isTeacherRepeat = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                boolean isStudentRepeat = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //检测老师冲突 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				if (courseScheduleTeacherMap.containsKey(existCourseSchedule.getId())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					existCourseSchedule.setTeachingTeacherIdList(courseScheduleTeacherMap.get(existCourseSchedule.getId()).getIds()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				} else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					existCourseSchedule.setTeachingTeacherIdList(classGroupTeachingTeacherMap.get(existCourseSchedule.getClassGroupId().longValue()).getIds()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				newCourseSchedule.setTeachingTeacherIdList(classGroupTeachingTeacherMap.get(newCourseSchedule.getClassGroupId().longValue()).getIds()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (!CollectionUtils.isEmpty(newCourseSchedule.getTeachingTeacherIdList()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        && !CollectionUtils.isEmpty(existCourseSchedule.getTeachingTeacherIdList())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    List<Integer> repeatIds = newCourseSchedule.getTeachingTeacherIdList() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            .stream().filter(existCourseSchedule.getTeachingTeacherIdList()::contains) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            .collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (!CollectionUtils.isEmpty(repeatIds)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        isTeacherRepeat = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //学生冲突检测 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (newCourseSchedule.getClassGroupId().equals(existCourseSchedule.getClassGroupId())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    //如果班级相同,则学生肯定全部存在冲突,当做老师冲突处理 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    isTeacherRepeat = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                List<Integer> repeatStudentIds = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (!isTeacherRepeat && classGroupStudentsMap.containsKey(newCourseSchedule.getClassGroupId()) && exitStudentPaymentMap.containsKey(existCourseSchedule.getId())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    //如果班级不同,则需要检测两个班级是否存在重复的学生 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    List<ClassGroupStudentMapper> preClassGroupStudents = classGroupStudentsMap.get(newCourseSchedule.getClassGroupId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    List<CourseScheduleStudentPayment> backClassGroupStudents = exitStudentPaymentMap.get(existCourseSchedule.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    //当前课程所在班级的学生编号列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    List<Integer> preClassGroupStudentIds = preClassGroupStudents.stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            .map(ClassGroupStudentMapper::getUserId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            .collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    //后面一节课程所在班级的学生编号列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    List<Integer> backClassGroupStudentIds = backClassGroupStudents.stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            .map(CourseScheduleStudentPayment::getUserId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            .collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    repeatStudentIds = preClassGroupStudentIds.stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            .filter(backClassGroupStudentIds::contains) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            .collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (!CollectionUtils.isEmpty(repeatStudentIds)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        isStudentRepeat = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if(isStudentRepeat && (backClassGroupStudentIds.size() == repeatStudentIds.size())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        isStudentRepeat = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        isTeacherRepeat = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (!isTeacherRepeat && !isStudentRepeat) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (ClassGroupTypeEnum.SNAP.getCode().equals(existCourseSchedule.getClassGroupType()) || ClassGroupTypeEnum.VIP.getCode().equals(existCourseSchedule.getClassGroupType())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    throw new BizException(courseCheckInfo(newCourseSchedule, existCourseSchedule, existCourseScheduleIds, isTeacherRepeat?1:3)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (!existCourseSchedule.getGroupType().equals(newCourseSchedule.getGroupType()) || !existCourseSchedule.getMusicGroupId().equals(newCourseSchedule.getMusicGroupId())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    throw new BizException(courseCheckInfo(newCourseSchedule, existCourseSchedule, existCourseScheduleIds, isTeacherRepeat?1:3)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (isTeacherRepeat) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    courseScheduleIds.add(existCourseSchedule.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (isStudentRepeat) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    CourseScheduleStudentDto courseScheduleStudentDto = new CourseScheduleStudentDto(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    courseScheduleStudentDto.setId(existCourseSchedule.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    courseScheduleStudentDto.setStudentIds(repeatStudentIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    courseScheduleStudents.add(courseScheduleStudentDto); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //老师冲突删除课程课程 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (courseScheduleIds.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            courseScheduleDao.batchDeleteCourseSchedules(courseScheduleIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            courseScheduleTeacherSalaryDao.batchDeleteByCourseScheduleIds(courseScheduleIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            teacherAttendanceDao.batchDeleteByCourseSchedules(courseScheduleIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            courseScheduleStudentPaymentDao.deleteByCourseSchedule(courseScheduleIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //学生冲突删除学生课程 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (courseScheduleStudents.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            for (CourseScheduleStudentDto courseScheduleStudent : courseScheduleStudents) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                courseScheduleStudentPaymentDao.deleteStudentCourseScheduleByUserId(courseScheduleStudent.getId(), courseScheduleStudent.getStudentIds()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return courseScheduleIds; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private String courseCheckInfo(CourseSchedule preCourseSchedule, CourseSchedule backCourseSchedule, List<Long> existCourseScheduleIds, Integer type) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<CourseSchedule> courseSchedules=new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         courseSchedules.add(preCourseSchedule); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2552,7 +2189,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private void checkCourseSchedule(List<CourseSchedule> courseSchedules) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<Date> classDates = courseSchedules.stream().map(CourseSchedule::getClassDate).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<CourseSchedule> byClassGroupAndDate = courseScheduleDao.findByClassGroupAndDate(classDates, null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<CourseSchedule> byClassGroupAndDate = courseScheduleDao.findByClassGroupAndDate(classDates, null, TenantContextHolder.getTenantId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<CourseSchedule> collect3 = Stream.of(courseSchedules, byClassGroupAndDate).flatMap(Collection::stream).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Map<Date, List<CourseSchedule>> collect = collect3.stream().collect(Collectors.groupingBy(CourseSchedule::getClassDate)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (Date keyDate : collect.keySet()) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -5706,12 +5343,12 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		CourseSchedule courseSchedule; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if(schedule.getGroupType() == MUSIC){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			//获取当前班级 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			courseScheduleRateDtos = courseScheduleDao.findCourseRate(null,schedule.getGroupType().getCode(),schedule.getClassGroupId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			courseScheduleRateDtos = courseScheduleDao.findCourseRate(null,schedule.getGroupType().getCode(),schedule.getClassGroupId(), TenantContextHolder.getTenantId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			//获取最近一次已结束的课程 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			courseSchedule = courseScheduleDao.getLastEndCourse(null,schedule.getGroupType().getCode(),schedule.getClassGroupId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		}else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			//获取课程列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			courseScheduleRateDtos = courseScheduleDao.findCourseRate(schedule.getMusicGroupId(),schedule.getGroupType().getCode(),null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			courseScheduleRateDtos = courseScheduleDao.findCourseRate(schedule.getMusicGroupId(),schedule.getGroupType().getCode(),null, TenantContextHolder.getTenantId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			//获取最近一次已结束的课程 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			courseSchedule = courseScheduleDao.getLastEndCourse(schedule.getMusicGroupId(),schedule.getGroupType().getCode(),null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 |