|
@@ -647,18 +647,37 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
List<CourseSchedule> courseSchedules = createCourseScheduleDto.getCourseSchedules();
|
|
List<CourseSchedule> courseSchedules = createCourseScheduleDto.getCourseSchedules();
|
|
|
|
|
|
if(!CollectionUtils.isEmpty(courseSchedules)){
|
|
if(!CollectionUtils.isEmpty(courseSchedules)){
|
|
- List<ClassGroupTeacherMapper> byMusicGroup = classGroupTeacherMapperDao.findByMusicGroup(createCourseScheduleDto.getMusicGroupID());
|
|
|
|
|
|
+ List<ClassGroupTeacherMapper> byMusicGroup = classGroupTeacherMapperDao.findAllByMusicGroup(createCourseScheduleDto.getMusicGroupID());
|
|
Map<Integer, List<ClassGroupTeacherMapper>> teacherByClassGroup = byMusicGroup.stream().collect(Collectors.groupingBy(ClassGroupTeacherMapper::getClassGroupId));
|
|
Map<Integer, List<ClassGroupTeacherMapper>> teacherByClassGroup = byMusicGroup.stream().collect(Collectors.groupingBy(ClassGroupTeacherMapper::getClassGroupId));
|
|
|
|
|
|
Map<Integer, List<CourseSchedule>> classGroupCourseSchedules = courseSchedules.stream().collect(Collectors.groupingBy(CourseSchedule::getClassGroupId));
|
|
Map<Integer, List<CourseSchedule>> classGroupCourseSchedules = courseSchedules.stream().collect(Collectors.groupingBy(CourseSchedule::getClassGroupId));
|
|
for (Map.Entry<Integer, List<CourseSchedule>> classGroupCoursesEntry : classGroupCourseSchedules.entrySet()) {
|
|
for (Map.Entry<Integer, List<CourseSchedule>> classGroupCoursesEntry : classGroupCourseSchedules.entrySet()) {
|
|
List<ClassGroupTeacherMapper> classGroupTeacherMappers = teacherByClassGroup.get(classGroupCoursesEntry.getKey());
|
|
List<ClassGroupTeacherMapper> classGroupTeacherMappers = teacherByClassGroup.get(classGroupCoursesEntry.getKey());
|
|
|
|
+ Set<Integer> teachingTeacherIds = classGroupTeacherMappers.stream().filter(t -> TeachTypeEnum.TEACHING.equals(t.getTeacherRole())).map(ClassGroupTeacherMapper::getUserId).collect(Collectors.toSet());
|
|
|
|
+ classGroupCoursesEntry.getValue().sort(Comparator.comparing(CourseSchedule::getStartClassTime));
|
|
|
|
+ for(int i=0;i<classGroupCoursesEntry.getValue().size();i++){
|
|
|
|
+ classGroupCoursesEntry.getValue().get(i).setTeachingTeacherIdList(new ArrayList<>(teachingTeacherIds));
|
|
|
|
+ if(i==0){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ CourseSchedule c1=classGroupCoursesEntry.getValue().get(i-1);
|
|
|
|
+ CourseSchedule c2=classGroupCoursesEntry.getValue().get(i);
|
|
|
|
+ if(c1.getStartClassTime().compareTo(c2.getEndClassTime())<0
|
|
|
|
+ &&c1.getEndClassTime().compareTo(c2.getStartClassTime())>0){
|
|
|
|
+ throw new BizException("排课循环周期时间存在重叠");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+// for (CourseSchedule courseSchedule : classGroupCoursesEntry.getValue()) {
|
|
|
|
+// courseSchedule.setTeachingTeacherIdList(new ArrayList<>(teachingTeacherIds));
|
|
|
|
+// }
|
|
//添加课程计划
|
|
//添加课程计划
|
|
batchAddCourseSchedule(classGroupCoursesEntry.getValue());
|
|
batchAddCourseSchedule(classGroupCoursesEntry.getValue());
|
|
//创建学生单节课的缴费记录,乐团课的缴费为0
|
|
//创建学生单节课的缴费记录,乐团课的缴费为0
|
|
courseScheduleStudentPaymentService.createCourseScheduleStudentPaymentByCourseSchedules(classGroupCoursesEntry.getValue());
|
|
courseScheduleStudentPaymentService.createCourseScheduleStudentPaymentByCourseSchedules(classGroupCoursesEntry.getValue());
|
|
classGroupTeacherMapperService.initCourseScheduleTeacherSalary(classGroupCoursesEntry.getValue(),classGroupTeacherMappers);
|
|
classGroupTeacherMapperService.initCourseScheduleTeacherSalary(classGroupCoursesEntry.getValue(),classGroupTeacherMappers);
|
|
}
|
|
}
|
|
|
|
+ List<Long> courseScheduleIds = courseSchedules.stream().map(CourseSchedule::getId).collect(Collectors.toList());
|
|
|
|
+ courseScheduleTeacherSalaryDao.batchDeleteByCourseScheduleIds(courseScheduleIds);
|
|
//更新课次
|
|
//更新课次
|
|
List<Integer> classGroupIds = courseSchedules.stream().map(CourseSchedule::getClassGroupId).collect(Collectors.toList());
|
|
List<Integer> classGroupIds = courseSchedules.stream().map(CourseSchedule::getClassGroupId).collect(Collectors.toList());
|
|
classGroupService.batchUpdateClassCourseTimes(classGroupIds);
|
|
classGroupService.batchUpdateClassCourseTimes(classGroupIds);
|
|
@@ -1647,12 +1666,12 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
if (!CollectionUtils.isEmpty(existCourseScheduleIds)) {
|
|
if (!CollectionUtils.isEmpty(existCourseScheduleIds)) {
|
|
courseScheduleTeachingTeacherIdList = courseScheduleDao.findCourseScheduleIdAndUserIdsMap(existCourseScheduleIds, TeachTypeEnum.TEACHING.getCode());
|
|
courseScheduleTeachingTeacherIdList = courseScheduleDao.findCourseScheduleIdAndUserIdsMap(existCourseScheduleIds, TeachTypeEnum.TEACHING.getCode());
|
|
}
|
|
}
|
|
- Map<Integer, IntegerAndIntegerListDto> courseScheduleTeachingTeacherMap = courseScheduleTeachingTeacherIdList.stream()
|
|
|
|
|
|
+ Map<Long, IntegerAndIntegerListDto> courseScheduleTeachingTeacherMap = courseScheduleTeachingTeacherIdList.stream()
|
|
.collect(Collectors.toMap(IntegerAndIntegerListDto::getId, integerAndIntegerListDto -> integerAndIntegerListDto));
|
|
.collect(Collectors.toMap(IntegerAndIntegerListDto::getId, integerAndIntegerListDto -> integerAndIntegerListDto));
|
|
|
|
|
|
//班级助教关联ID集合
|
|
//班级助教关联ID集合
|
|
List<IntegerAndIntegerListDto> classGroupAndUserIdsMap = courseScheduleDao.findClassGroupAndUserIdsMap(newCourseScheduleClassGroupIds, TeachTypeEnum.TEACHING.getCode());
|
|
List<IntegerAndIntegerListDto> classGroupAndUserIdsMap = courseScheduleDao.findClassGroupAndUserIdsMap(newCourseScheduleClassGroupIds, TeachTypeEnum.TEACHING.getCode());
|
|
- Map<Integer, IntegerAndIntegerListDto> classGroupTeachingTeacherMap = classGroupAndUserIdsMap.stream()
|
|
|
|
|
|
+ Map<Long, IntegerAndIntegerListDto> classGroupTeachingTeacherMap = classGroupAndUserIdsMap.stream()
|
|
.collect(Collectors.toMap(IntegerAndIntegerListDto::getId, integerAndIntegerListDto -> integerAndIntegerListDto));
|
|
.collect(Collectors.toMap(IntegerAndIntegerListDto::getId, integerAndIntegerListDto -> integerAndIntegerListDto));
|
|
|
|
|
|
Set<Long> existCourseScheduleIdsSet=new HashSet<>(existCourseScheduleIds);
|
|
Set<Long> existCourseScheduleIdsSet=new HashSet<>(existCourseScheduleIds);
|
|
@@ -1689,9 +1708,9 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
throw new BizException(courseCheckInfo(preCourseSchedule, backCourseSchedule, existCourseScheduleIds, 1));
|
|
throw new BizException(courseCheckInfo(preCourseSchedule, backCourseSchedule, existCourseScheduleIds, 1));
|
|
}
|
|
}
|
|
|
|
|
|
- if(Objects.isNull(preCourseSchedule.getId())){
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
|
|
+// if(Objects.isNull(preCourseSchedule.getId())){
|
|
|
|
+// continue;
|
|
|
|
+// }
|
|
|
|
|
|
//助教冲突检测
|
|
//助教冲突检测
|
|
if (Objects.isNull(preCourseSchedule.getId())) {
|
|
if (Objects.isNull(preCourseSchedule.getId())) {
|
|
@@ -1829,12 +1848,12 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
if (!CollectionUtils.isEmpty(existCourseScheduleIds)) {
|
|
if (!CollectionUtils.isEmpty(existCourseScheduleIds)) {
|
|
courseScheduleTeachingTeacherIdList = courseScheduleDao.findCourseScheduleIdAndUserIdsMap(existCourseScheduleIds, TeachTypeEnum.TEACHING.getCode());
|
|
courseScheduleTeachingTeacherIdList = courseScheduleDao.findCourseScheduleIdAndUserIdsMap(existCourseScheduleIds, TeachTypeEnum.TEACHING.getCode());
|
|
}
|
|
}
|
|
- Map<Integer, IntegerAndIntegerListDto> courseScheduleTeachingTeacherMap = courseScheduleTeachingTeacherIdList.stream()
|
|
|
|
|
|
+ Map<Long, IntegerAndIntegerListDto> courseScheduleTeachingTeacherMap = courseScheduleTeachingTeacherIdList.stream()
|
|
.collect(Collectors.toMap(IntegerAndIntegerListDto::getId, integerAndIntegerListDto -> integerAndIntegerListDto));
|
|
.collect(Collectors.toMap(IntegerAndIntegerListDto::getId, integerAndIntegerListDto -> integerAndIntegerListDto));
|
|
|
|
|
|
//班级助教关联ID集合
|
|
//班级助教关联ID集合
|
|
List<IntegerAndIntegerListDto> classGroupAndUserIdsMap = courseScheduleDao.findClassGroupAndUserIdsMap(newCourseScheduleClassGroupIds, TeachTypeEnum.TEACHING.getCode());
|
|
List<IntegerAndIntegerListDto> classGroupAndUserIdsMap = courseScheduleDao.findClassGroupAndUserIdsMap(newCourseScheduleClassGroupIds, TeachTypeEnum.TEACHING.getCode());
|
|
- Map<Integer, IntegerAndIntegerListDto> classGroupTeachingTeacherMap = classGroupAndUserIdsMap.stream()
|
|
|
|
|
|
+ Map<Long, IntegerAndIntegerListDto> classGroupTeachingTeacherMap = classGroupAndUserIdsMap.stream()
|
|
.collect(Collectors.toMap(IntegerAndIntegerListDto::getId, integerAndIntegerListDto -> integerAndIntegerListDto));
|
|
.collect(Collectors.toMap(IntegerAndIntegerListDto::getId, integerAndIntegerListDto -> integerAndIntegerListDto));
|
|
|
|
|
|
Set<Long> existCourseScheduleIdsSet=new HashSet<>(existCourseScheduleIds);
|
|
Set<Long> existCourseScheduleIdsSet=new HashSet<>(existCourseScheduleIds);
|
|
@@ -2016,12 +2035,12 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
if (!CollectionUtils.isEmpty(existCourseScheduleIds)) {
|
|
if (!CollectionUtils.isEmpty(existCourseScheduleIds)) {
|
|
courseScheduleTeachingTeacherIdList = courseScheduleDao.findCourseScheduleIdAndUserIdsMap(existCourseScheduleIds, null);
|
|
courseScheduleTeachingTeacherIdList = courseScheduleDao.findCourseScheduleIdAndUserIdsMap(existCourseScheduleIds, null);
|
|
}
|
|
}
|
|
- Map<Integer, IntegerAndIntegerListDto> courseScheduleTeacherMap = courseScheduleTeachingTeacherIdList.stream()
|
|
|
|
|
|
+ Map<Long, IntegerAndIntegerListDto> courseScheduleTeacherMap = courseScheduleTeachingTeacherIdList.stream()
|
|
.collect(Collectors.toMap(IntegerAndIntegerListDto::getId, integerAndIntegerListDto -> integerAndIntegerListDto));
|
|
.collect(Collectors.toMap(IntegerAndIntegerListDto::getId, integerAndIntegerListDto -> integerAndIntegerListDto));
|
|
|
|
|
|
//班级教师关联ID集合
|
|
//班级教师关联ID集合
|
|
List<IntegerAndIntegerListDto> classGroupAndUserIdsMap = courseScheduleDao.findClassGroupAndUserIdsMap(newCourseScheduleClassGroupIds, null);
|
|
List<IntegerAndIntegerListDto> classGroupAndUserIdsMap = courseScheduleDao.findClassGroupAndUserIdsMap(newCourseScheduleClassGroupIds, null);
|
|
- Map<Integer, IntegerAndIntegerListDto> classGroupTeachingTeacherMap = classGroupAndUserIdsMap.stream()
|
|
|
|
|
|
+ Map<Long, IntegerAndIntegerListDto> classGroupTeachingTeacherMap = classGroupAndUserIdsMap.stream()
|
|
.collect(Collectors.toMap(IntegerAndIntegerListDto::getId, integerAndIntegerListDto -> integerAndIntegerListDto));
|
|
.collect(Collectors.toMap(IntegerAndIntegerListDto::getId, integerAndIntegerListDto -> integerAndIntegerListDto));
|
|
|
|
|
|
existCourseSchedules.sort(Comparator.comparing(CourseSchedule::getStartClassTime));
|
|
existCourseSchedules.sort(Comparator.comparing(CourseSchedule::getStartClassTime));
|