|  | @@ -1799,54 +1799,49 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 | 
	
		
			
				|  |  |  		return true;
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -	@Override
 | 
	
		
			
				|  |  |  	@Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  | -    public Boolean checkNewCourseSchedules(List<CourseSchedule> courseSchedules, boolean checkExistCourseSchedule,Boolean postponeFlag) {
 | 
	
		
			
				|  |  | -        if (CollectionUtils.isEmpty(courseSchedules)) {
 | 
	
		
			
				|  |  | -            return false;
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        //
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        List<String> classDates = courseSchedules.stream().map(courseSchedule -> DateUtil.dateToString(courseSchedule.getClassDate(), "yyyy-MM-dd"))
 | 
	
		
			
				|  |  | -                .collect(Collectors.toList());
 | 
	
		
			
				|  |  | +    public Boolean checkCourseSchedules(List<CourseSchedule> courseSchedules, boolean checkExistCourseSchedule,Boolean postponeFlag,ClassGroupStudentMapper classGroupStudentMapper) {
 | 
	
		
			
				|  |  | +		if (CollectionUtils.isEmpty(courseSchedules)) {
 | 
	
		
			
				|  |  | +			return false;
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		List<String> classDates = courseSchedules.stream().map(courseSchedule -> DateUtil.dateToString(courseSchedule.getClassDate(), "yyyy-MM-dd"))
 | 
	
		
			
				|  |  | +				.collect(Collectors.toList());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        List<CourseSchedule> existCourseSchedules = courseScheduleDao.findByClassDate(classDates, TenantContextHolder.getTenantId());
 | 
	
		
			
				|  |  | +		List<CourseSchedule> existCourseSchedules = courseScheduleDao.findByClassDate(classDates, TenantContextHolder.getTenantId());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        //只需要调整课程信息的课程编号列表
 | 
	
		
			
				|  |  | -        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> updateCourseScheduleIds = courseSchedules
 | 
	
		
			
				|  |  | +				.stream()
 | 
	
		
			
				|  |  | +				.filter(courseSchedule -> Objects.nonNull(courseSchedule.getId()))
 | 
	
		
			
				|  |  | +				.map(CourseSchedule::getId)
 | 
	
		
			
				|  |  | +				.collect(Collectors.toList());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        List<Long> existCourseScheduleIds = existCourseSchedules.stream()
 | 
	
		
			
				|  |  | -                .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());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -//        HashSet<Long> courseScheduleIdsSet = new HashSet<>(existCourseScheduleIds);
 | 
	
		
			
				|  |  | +		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<CourseSchedule> allCourseSchedules;
 | 
	
		
			
				|  |  | +		if (!CollectionUtils.isEmpty(existCourseSchedules)) {
 | 
	
		
			
				|  |  | +			allCourseSchedules = ListUtils.sum(courseSchedules, existCourseSchedules);
 | 
	
		
			
				|  |  | +		} else {
 | 
	
		
			
				|  |  | +			allCourseSchedules = courseSchedules;
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        //所有课程编号
 | 
	
		
			
				|  |  | +		//所有课程编号
 | 
	
		
			
				|  |  |  		Set<Long> allCourseScheduleIds = allCourseSchedules.stream().map(CourseSchedule::getId).collect(Collectors.toSet());
 | 
	
		
			
				|  |  | -        //所有课程学员签到记录
 | 
	
		
			
				|  |  | +		//所有课程学员签到记录
 | 
	
		
			
				|  |  |  		List<StudentAttendance> studentAttendances = studentAttendanceDao.findByCourseIds(new ArrayList<>(allCourseScheduleIds));
 | 
	
		
			
				|  |  |  		//课程请假学员字典
 | 
	
		
			
				|  |  |  		Map<Long, Set<Integer>> courseLeaveStudentMap = studentAttendances.stream()
 | 
	
	
		
			
				|  | @@ -1854,45 +1849,48 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 | 
	
		
			
				|  |  |  				.collect(Collectors.groupingBy(StudentAttendance::getCourseScheduleId, Collectors.mapping(StudentAttendance::getUserId, Collectors.toSet())));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  		//所有课程的班级编号
 | 
	
		
			
				|  |  | -        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));
 | 
	
		
			
				|  |  | +		List<Integer> classGroupIds = allCourseSchedules
 | 
	
		
			
				|  |  | +				.stream()
 | 
	
		
			
				|  |  | +				.map(CourseSchedule::getClassGroupId)
 | 
	
		
			
				|  |  | +				.distinct()
 | 
	
		
			
				|  |  | +				.collect(Collectors.toList());
 | 
	
		
			
				|  |  | +		//班级与学生的关联记录
 | 
	
		
			
				|  |  | +		List<ClassGroupStudentMapper> classGroupStudentMappers = classGroupStudentMapperDao.findByClassGroups(classGroupIds);
 | 
	
		
			
				|  |  | +		if(Objects.nonNull(classGroupStudentMapper)){
 | 
	
		
			
				|  |  | +			classGroupStudentMappers.add(classGroupStudentMapper);
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		Map<Integer, List<ClassGroupStudentMapper>> classGroupStudentsMap = classGroupStudentMappers
 | 
	
		
			
				|  |  | +				.stream()
 | 
	
		
			
				|  |  | +				.collect(Collectors.groupingBy(ClassGroupStudentMapper::getClassGroupId));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        //根据课程获取助教id关联集合
 | 
	
		
			
				|  |  | -        List<IntegerAndIntegerListDto> courseScheduleTeachingTeacherIdList = new ArrayList<>();
 | 
	
		
			
				|  |  | -        if (!CollectionUtils.isEmpty(allCourseScheduleIds)) {
 | 
	
		
			
				|  |  | -            courseScheduleTeachingTeacherIdList = courseScheduleDao.findCourseScheduleIdAndUserIdsMap(new ArrayList<>(allCourseScheduleIds), TeachTypeEnum.TEACHING.getCode());
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        Map<Long, IntegerAndIntegerListDto> courseScheduleTeachingTeacherMap = courseScheduleTeachingTeacherIdList.stream()
 | 
	
		
			
				|  |  | -                .collect(Collectors.toMap(IntegerAndIntegerListDto::getId, integerAndIntegerListDto -> integerAndIntegerListDto));
 | 
	
		
			
				|  |  | +		//根据课程获取助教id关联集合
 | 
	
		
			
				|  |  | +		List<IntegerAndIntegerListDto> courseScheduleTeachingTeacherIdList = new ArrayList<>();
 | 
	
		
			
				|  |  | +		if (!CollectionUtils.isEmpty(allCourseScheduleIds)) {
 | 
	
		
			
				|  |  | +			courseScheduleTeachingTeacherIdList = courseScheduleDao.findCourseScheduleIdAndUserIdsMap(new ArrayList<>(allCourseScheduleIds), 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));
 | 
	
		
			
				|  |  | +		//班级助教关联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) {
 | 
	
		
			
				|  |  | -                	//调整后的课程截止日期不能超过学期时间
 | 
	
		
			
				|  |  | +		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) {
 | 
	
		
			
				|  |  | +					//调整后的课程截止日期不能超过学期时间
 | 
	
		
			
				|  |  |  					if(preCourseSchedule.getValidEndTime() != null){
 | 
	
		
			
				|  |  |  						if(preCourseSchedule.getValidEndTime().compareTo(preCourseSchedule.getClassDate()) < 0){
 | 
	
		
			
				|  |  |  							throw new BizException("操作失败:不允许跨学期调整");
 | 
	
	
		
			
				|  | @@ -1903,33 +1901,33 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 | 
	
		
			
				|  |  |  							throw new BizException("操作失败:不允许跨学期调整");
 | 
	
		
			
				|  |  |  						}
 | 
	
		
			
				|  |  |  					}
 | 
	
		
			
				|  |  | -                    for (CourseSchedule backCourseSchedule : existClassDateCourses) {
 | 
	
		
			
				|  |  | +					for (CourseSchedule backCourseSchedule : existClassDateCourses) {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -                        //判断前后两节课是否存在冲突
 | 
	
		
			
				|  |  | -                        if (!preCourseSchedule.getStartClassTime().before(backCourseSchedule.getEndClassTime())
 | 
	
		
			
				|  |  | -                                ||!preCourseSchedule.getEndClassTime().after(backCourseSchedule.getStartClassTime())) {
 | 
	
		
			
				|  |  | -                            continue;
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | -                        if (preCourseSchedule.equals(backCourseSchedule)) {
 | 
	
		
			
				|  |  | -                            continue;
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | +						//判断前后两节课是否存在冲突
 | 
	
		
			
				|  |  | +						if (!preCourseSchedule.getStartClassTime().before(backCourseSchedule.getEndClassTime())
 | 
	
		
			
				|  |  | +								||!preCourseSchedule.getEndClassTime().after(backCourseSchedule.getStartClassTime())) {
 | 
	
		
			
				|  |  | +							continue;
 | 
	
		
			
				|  |  | +						}
 | 
	
		
			
				|  |  | +						if (preCourseSchedule.equals(backCourseSchedule)) {
 | 
	
		
			
				|  |  | +							continue;
 | 
	
		
			
				|  |  | +						}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -                        //如果存在时间重叠,则需要判断前后两节课的教师和学生是否存在冲突
 | 
	
		
			
				|  |  | -                        //主教冲突检测
 | 
	
		
			
				|  |  | -                        if (Objects.nonNull(preCourseSchedule.getActualTeacherId())
 | 
	
		
			
				|  |  | -                                && preCourseSchedule.getActualTeacherId().equals(backCourseSchedule.getActualTeacherId())) {
 | 
	
		
			
				|  |  | +						//如果存在时间重叠,则需要判断前后两节课的教师和学生是否存在冲突
 | 
	
		
			
				|  |  | +						//主教冲突检测
 | 
	
		
			
				|  |  | +						if (Objects.nonNull(preCourseSchedule.getActualTeacherId())
 | 
	
		
			
				|  |  | +								&& preCourseSchedule.getActualTeacherId().equals(backCourseSchedule.getActualTeacherId())) {
 | 
	
		
			
				|  |  |  							if(postponeFlag){
 | 
	
		
			
				|  |  |  								return false;
 | 
	
		
			
				|  |  |  							}else {
 | 
	
		
			
				|  |  |  								throw new BizException(courseCheckInfo(preCourseSchedule, backCourseSchedule, existCourseScheduleIds, 1));
 | 
	
		
			
				|  |  |  							}
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | +						}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  //                        if(Objects.isNull(preCourseSchedule.getId())){
 | 
	
		
			
				|  |  |  //                            continue;
 | 
	
		
			
				|  |  |  //                        }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -                        //助教冲突检测
 | 
	
		
			
				|  |  | +						//助教冲突检测
 | 
	
		
			
				|  |  |  						List<Integer> preTeachingTeacherIdList = new ArrayList<>();
 | 
	
		
			
				|  |  |  						List<Integer> backTeachingTeacherIdList = new ArrayList<>();
 | 
	
		
			
				|  |  |  						if (allCourseScheduleIds.contains(preCourseSchedule.getId())) {
 | 
	
	
		
			
				|  | @@ -1938,12 +1936,12 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 | 
	
		
			
				|  |  |  								preTeachingTeacherIdList.addAll(integerAndIntegerListDto.getIds());
 | 
	
		
			
				|  |  |  							}
 | 
	
		
			
				|  |  |  						}
 | 
	
		
			
				|  |  | -                        if (CollectionUtils.isEmpty(preTeachingTeacherIdList)&&Objects.isNull(preCourseSchedule.getId())) {
 | 
	
		
			
				|  |  | -                            IntegerAndIntegerListDto integerAndIntegerListDto = classGroupTeachingTeacherMap.get(preCourseSchedule.getClassGroupId().longValue());
 | 
	
		
			
				|  |  | -                            if (Objects.nonNull(integerAndIntegerListDto)) {
 | 
	
		
			
				|  |  | +						if (CollectionUtils.isEmpty(preTeachingTeacherIdList)&&Objects.isNull(preCourseSchedule.getId())) {
 | 
	
		
			
				|  |  | +							IntegerAndIntegerListDto integerAndIntegerListDto = classGroupTeachingTeacherMap.get(preCourseSchedule.getClassGroupId().longValue());
 | 
	
		
			
				|  |  | +							if (Objects.nonNull(integerAndIntegerListDto)) {
 | 
	
		
			
				|  |  |  								preTeachingTeacherIdList.addAll(integerAndIntegerListDto.getIds());
 | 
	
		
			
				|  |  | -                            }
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | +							}
 | 
	
		
			
				|  |  | +						}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  						if (allCourseScheduleIds.contains(backCourseSchedule.getId())) {
 | 
	
		
			
				|  |  |  							IntegerAndIntegerListDto integerAndIntegerListDto = courseScheduleTeachingTeacherMap.get(backCourseSchedule.getId());
 | 
	
	
		
			
				|  | @@ -1961,39 +1959,39 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 | 
	
		
			
				|  |  |  						preTeachingTeacherIdList.add(preCourseSchedule.getActualTeacherId());
 | 
	
		
			
				|  |  |  						backTeachingTeacherIdList.add(backCourseSchedule.getActualTeacherId());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -                        if (!CollectionUtils.isEmpty(preTeachingTeacherIdList)
 | 
	
		
			
				|  |  | -                                && !CollectionUtils.isEmpty(backTeachingTeacherIdList)) {
 | 
	
		
			
				|  |  | -                            List<Integer> repeatIds = preTeachingTeacherIdList
 | 
	
		
			
				|  |  | -                                    .stream().filter(backTeachingTeacherIdList::contains)
 | 
	
		
			
				|  |  | -                                    .collect(Collectors.toList());
 | 
	
		
			
				|  |  | -                            if (!CollectionUtils.isEmpty(repeatIds)) {
 | 
	
		
			
				|  |  | +						if (!CollectionUtils.isEmpty(preTeachingTeacherIdList)
 | 
	
		
			
				|  |  | +								&& !CollectionUtils.isEmpty(backTeachingTeacherIdList)) {
 | 
	
		
			
				|  |  | +							List<Integer> repeatIds = preTeachingTeacherIdList
 | 
	
		
			
				|  |  | +									.stream().filter(backTeachingTeacherIdList::contains)
 | 
	
		
			
				|  |  | +									.collect(Collectors.toList());
 | 
	
		
			
				|  |  | +							if (!CollectionUtils.isEmpty(repeatIds)) {
 | 
	
		
			
				|  |  |  								if(postponeFlag){
 | 
	
		
			
				|  |  |  									return false;
 | 
	
		
			
				|  |  |  								}else {
 | 
	
		
			
				|  |  |  									throw new BizException(courseCheckInfo(preCourseSchedule, backCourseSchedule, existCourseScheduleIds, 2));
 | 
	
		
			
				|  |  |  								}
 | 
	
		
			
				|  |  | -                            }
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | -                        //学生冲突检测
 | 
	
		
			
				|  |  | -                        if (preCourseSchedule.getClassGroupId().equals(backCourseSchedule.getClassGroupId())) {
 | 
	
		
			
				|  |  | -                            //如果班级相同,则学生肯定存在冲突
 | 
	
		
			
				|  |  | +							}
 | 
	
		
			
				|  |  | +						}
 | 
	
		
			
				|  |  | +						//学生冲突检测
 | 
	
		
			
				|  |  | +						if (preCourseSchedule.getClassGroupId().equals(backCourseSchedule.getClassGroupId())) {
 | 
	
		
			
				|  |  | +							//如果班级相同,则学生肯定存在冲突
 | 
	
		
			
				|  |  |  							if(postponeFlag){
 | 
	
		
			
				|  |  |  								return false;
 | 
	
		
			
				|  |  |  							}else {
 | 
	
		
			
				|  |  |  								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<ClassGroupStudentMapper> preClassGroupStudents = classGroupStudentsMap.get(preCourseSchedule.getClassGroupId());
 | 
	
		
			
				|  |  | +						List<ClassGroupStudentMapper> backClassGroupStudents = classGroupStudentsMap.get(backCourseSchedule.getClassGroupId());
 | 
	
		
			
				|  |  | +						//如果有一个存在没有学生的班级则不存在冲突
 | 
	
		
			
				|  |  | +						if (CollectionUtils.isEmpty(preClassGroupStudents) || CollectionUtils.isEmpty(backClassGroupStudents)) {
 | 
	
		
			
				|  |  | +							continue;
 | 
	
		
			
				|  |  | +						}
 | 
	
		
			
				|  |  | +						//课程对应请假学员编号集合
 | 
	
		
			
				|  |  |  						Set<Integer> preLeaveStudentIds = courseLeaveStudentMap.get(preCourseSchedule.getId());
 | 
	
		
			
				|  |  | -                        if(null == preLeaveStudentIds){
 | 
	
		
			
				|  |  | -                        	preLeaveStudentIds = Collections.EMPTY_SET;
 | 
	
		
			
				|  |  | +						if(null == preLeaveStudentIds){
 | 
	
		
			
				|  |  | +							preLeaveStudentIds = Collections.EMPTY_SET;
 | 
	
		
			
				|  |  |  						}
 | 
	
		
			
				|  |  |  						Set<Integer> backLeaveStudentIds = courseLeaveStudentMap.get(backCourseSchedule.getId());
 | 
	
		
			
				|  |  |  						if(null == backLeaveStudentIds){
 | 
	
	
		
			
				|  | @@ -2004,29 +2002,41 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 | 
	
		
			
				|  |  |  						Set<Integer> finalPreLeaveStudentIds = preLeaveStudentIds;
 | 
	
		
			
				|  |  |  						List<Integer> preClassGroupStudentIds = preClassGroupStudents.stream()
 | 
	
		
			
				|  |  |  								.filter(e->!finalPreLeaveStudentIds.contains(e.getUserId()))
 | 
	
		
			
				|  |  | -                                .map(ClassGroupStudentMapper::getUserId)
 | 
	
		
			
				|  |  | -                                .collect(Collectors.toList());
 | 
	
		
			
				|  |  | -                        //后面一节课程所在班级的学生编号列表
 | 
	
		
			
				|  |  | +								.map(ClassGroupStudentMapper::getUserId)
 | 
	
		
			
				|  |  | +								.collect(Collectors.toList());
 | 
	
		
			
				|  |  | +						//后面一节课程所在班级的学生编号列表
 | 
	
		
			
				|  |  |  						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()
 | 
	
		
			
				|  |  | -                                .filter(backClassGroupStudentIds::contains)
 | 
	
		
			
				|  |  | -                                .collect(Collectors.toList());
 | 
	
		
			
				|  |  | -                        if (!CollectionUtils.isEmpty(repeatStudentIds)) {
 | 
	
		
			
				|  |  | +								.map(ClassGroupStudentMapper::getUserId)
 | 
	
		
			
				|  |  | +								.collect(Collectors.toSet());
 | 
	
		
			
				|  |  | +						List<Integer> repeatStudentIds = preClassGroupStudentIds.stream()
 | 
	
		
			
				|  |  | +								.filter(backClassGroupStudentIds::contains)
 | 
	
		
			
				|  |  | +								.collect(Collectors.toList());
 | 
	
		
			
				|  |  | +						if (!CollectionUtils.isEmpty(repeatStudentIds)) {
 | 
	
		
			
				|  |  |  							if(postponeFlag){
 | 
	
		
			
				|  |  |  								return false;
 | 
	
		
			
				|  |  |  							}else {
 | 
	
		
			
				|  |  |  								throw new BizException(courseCheckInfo(preCourseSchedule, backCourseSchedule, existCourseScheduleIds, 3));
 | 
	
		
			
				|  |  |  							}
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -        return true;
 | 
	
		
			
				|  |  | +						}
 | 
	
		
			
				|  |  | +					}
 | 
	
		
			
				|  |  | +				}
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		return true;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	@Override
 | 
	
		
			
				|  |  | +	@Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  | +    public Boolean checkNewCourseSchedules(List<CourseSchedule> courseSchedules, boolean checkExistCourseSchedule,Boolean postponeFlag,ClassGroupStudentMapper classGroupStudentMapper) {
 | 
	
		
			
				|  |  | +		return this.checkCourseSchedules(courseSchedules,checkExistCourseSchedule,postponeFlag,classGroupStudentMapper);
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	@Override
 | 
	
		
			
				|  |  | +	@Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  | +    public Boolean checkNewCourseSchedules(List<CourseSchedule> courseSchedules, boolean checkExistCourseSchedule,Boolean postponeFlag) {
 | 
	
		
			
				|  |  | +		return this.checkCourseSchedules(courseSchedules,checkExistCourseSchedule,postponeFlag,null);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      private String courseCheckInfo(CourseSchedule preCourseSchedule, CourseSchedule backCourseSchedule, List<Long> existCourseScheduleIds, Integer type) {
 | 
	
	
		
			
				|  | @@ -3295,7 +3305,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 | 
	
		
			
				|  |  |  						map.put(tdms.getCourseScheduleType(), tdms);
 | 
	
		
			
				|  |  |  						musicGroupSalaryMap.put(tdms.getUserId(), map);
 | 
	
		
			
				|  |  |  					}
 | 
	
		
			
				|  |  | -				} else if (newCourseSchedule.getGroupType() == GroupType.VIP) {
 | 
	
		
			
				|  |  | +				} else if (newCourseSchedule.getGroupType() == GroupType.VIP || newCourseSchedule.getGroupType() == GroupType.LIVE) {
 | 
	
		
			
				|  |  |  					// 所有老师默认vip课酬
 | 
	
		
			
				|  |  |  					List<TeacherDefaultVipGroupSalary> teacherDefaultVipGroupSalaries = teacherDefaultVipGroupSalaryDao.queryByUserIdList(newTeacherIdList);
 | 
	
		
			
				|  |  |  					for (TeacherDefaultVipGroupSalary tdvs : teacherDefaultVipGroupSalaries) {
 |