|
@@ -132,6 +132,8 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
private PracticeGroupService practiceGroupService;
|
|
private PracticeGroupService practiceGroupService;
|
|
@Autowired
|
|
@Autowired
|
|
private CoursesGroupModifyLogDao coursesGroupModifyLogDao;
|
|
private CoursesGroupModifyLogDao coursesGroupModifyLogDao;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ClassGroupTeacherMapperDao classGroupTeacherMapperDao;
|
|
|
|
|
|
private final Logger LOGGER = LoggerFactory
|
|
private final Logger LOGGER = LoggerFactory
|
|
.getLogger(this.getClass());
|
|
.getLogger(this.getClass());
|
|
@@ -220,7 +222,33 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public void batchDeleteCourseSchedulesWithoutCheck(List<CourseSchedule> courseScheduleList) {
|
|
|
|
+ if(CollectionUtils.isEmpty(courseScheduleList)){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ List<Long> courseScheduleIds = courseScheduleList.stream().map(CourseSchedule::getId).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ courseScheduleDao.batchDeleteCourseSchedulesWithoutCheck(courseScheduleIds);
|
|
|
|
+ courseScheduleTeacherSalaryDao.batchDeleteByCourseScheduleIds(courseScheduleIds);
|
|
|
|
+ courseScheduleStudentPaymentDao.deleteByCourseSchedule(courseScheduleIds);
|
|
|
|
+ // 删除考勤
|
|
|
|
+ teacherAttendanceDao.batchDeleteByCourseSchedules(courseScheduleIds);
|
|
|
|
+ studentAttendanceDao.deleteByCourseSchedules(courseScheduleIds);
|
|
|
|
+
|
|
|
|
+ // 删除作业
|
|
|
|
+ courseHomeworkService.delHomwworkByCourseScheduleId(courseScheduleIds);
|
|
|
|
+
|
|
|
|
+ List<Integer> classGroupIdList = courseScheduleList.stream().map(t -> t.getClassGroupId()).collect(Collectors.toList());
|
|
|
|
+ // 更新班级信息
|
|
|
|
+ if (classGroupIdList != null && classGroupIdList.size() > 0) {
|
|
|
|
+ for (Integer classGroupId : classGroupIdList) {
|
|
|
|
+ classGroupService.updateClassGroupInfo(classGroupId);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public void batchDeleteMusicGroupNotStartCourse(String musicGroupId, GroupType groupType) {
|
|
public void batchDeleteMusicGroupNotStartCourse(String musicGroupId, GroupType groupType) {
|
|
if (StringUtils.isBlank(musicGroupId)) {
|
|
if (StringUtils.isBlank(musicGroupId)) {
|
|
@@ -236,7 +264,19 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
batchDeleteCourseSchedules(courseScheduleIds);
|
|
batchDeleteCourseSchedules(courseScheduleIds);
|
|
}
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public void batchDeleteMusicGroup(String musicGroupId, GroupType groupType) {
|
|
|
|
+ if (StringUtils.isBlank(musicGroupId)) {
|
|
|
|
+ throw new BizException("请指定乐团");
|
|
|
|
+ }
|
|
|
|
+ List<CourseSchedule> musicGroupCourseSchedules = courseScheduleDao.findMusicGroupAllCourseSchedules(musicGroupId, groupType.getCode());
|
|
|
|
+ if (CollectionUtils.isEmpty(musicGroupCourseSchedules)) {
|
|
|
|
+ throw new BizException("此乐团不存在未上课程");
|
|
|
|
+ }
|
|
|
|
+ batchDeleteCourseSchedulesWithoutCheck(musicGroupCourseSchedules);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public void batchDeleteMusicGroupCourseWithStudent(String musicGroupId, Integer userId, GroupType groupType) {
|
|
public void batchDeleteMusicGroupCourseWithStudent(String musicGroupId, Integer userId, GroupType groupType) {
|
|
if (StringUtils.isBlank(musicGroupId)) {
|
|
if (StringUtils.isBlank(musicGroupId)) {
|
|
@@ -645,13 +685,40 @@ 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)){
|
|
- //添加课程计划
|
|
|
|
- batchAddCourseSchedule(courseSchedules);
|
|
|
|
|
|
+ List<ClassGroupTeacherMapper> byMusicGroup = classGroupTeacherMapperDao.findAllByMusicGroup(createCourseScheduleDto.getMusicGroupID());
|
|
|
|
+ Map<Integer, List<ClassGroupTeacherMapper>> teacherByClassGroup = byMusicGroup.stream().collect(Collectors.groupingBy(ClassGroupTeacherMapper::getClassGroupId));
|
|
|
|
+
|
|
|
|
+ Map<Integer, List<CourseSchedule>> classGroupCourseSchedules = courseSchedules.stream().collect(Collectors.groupingBy(CourseSchedule::getClassGroupId));
|
|
|
|
+ for (Map.Entry<Integer, List<CourseSchedule>> classGroupCoursesEntry : classGroupCourseSchedules.entrySet()) {
|
|
|
|
+ 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());
|
|
|
|
+ //创建学生单节课的缴费记录,乐团课的缴费为0
|
|
|
|
+ courseScheduleStudentPaymentService.createCourseScheduleStudentPaymentByCourseSchedules(classGroupCoursesEntry.getValue());
|
|
|
|
+ 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);
|
|
- //创建学生单节课的缴费记录,乐团课的缴费为0
|
|
|
|
- courseScheduleStudentPaymentService.createCourseScheduleStudentPaymentByCourseSchedules(courseSchedules);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
MusicGroup musicGroup = musicGroupService.get(createCourseScheduleDto.getMusicGroupID());
|
|
MusicGroup musicGroup = musicGroupService.get(createCourseScheduleDto.getMusicGroupID());
|
|
@@ -1637,12 +1704,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);
|
|
@@ -1679,9 +1746,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())) {
|
|
@@ -1819,12 +1886,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);
|
|
@@ -2006,12 +2073,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));
|