|
@@ -168,7 +168,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public void deleteCourseSchedules(List<Long> courseScheduleIds) {
|
|
|
+ public void batchDeleteCourseSchedules(List<Long> courseScheduleIds) {
|
|
|
|
|
|
List<CourseSchedule> courseScheduleList = courseScheduleDao.findByCourseScheduleIds(courseScheduleIds);
|
|
|
|
|
@@ -211,7 +211,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
List<Long> courseScheduleIds = musicGroupCourseSchedules.stream()
|
|
|
.map(CourseSchedule::getId)
|
|
|
.collect(Collectors.toList());
|
|
|
- deleteCourseSchedules(courseScheduleIds);
|
|
|
+ batchDeleteCourseSchedules(courseScheduleIds);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -565,6 +565,29 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
+ public boolean batchUpdateCourseSchedule(BatchInsertCoursesDto batchInsertCoursesDto) {
|
|
|
+
|
|
|
+ List<CourseSchedule> courseScheduleList = courseScheduleDao.findByCourseScheduleIds(batchInsertCoursesDto.getCourseScheduleIdList());
|
|
|
+ List<Integer> classGroupList = courseScheduleList.stream().distinct().map(CourseSchedule::getClassGroupId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ if (classGroupList == null || classGroupList.size() != 1) {
|
|
|
+ throw new BizException("修改失败,只支持同一个班级的课程批量调整");
|
|
|
+ }
|
|
|
+
|
|
|
+ Integer classGroupId = classGroupList.get(0);
|
|
|
+
|
|
|
+ // 批量上课
|
|
|
+ batchDeleteCourseSchedules(batchInsertCoursesDto.getCourseScheduleIdList());
|
|
|
+
|
|
|
+ // 批量加课
|
|
|
+ batchAddCourseSchedule(classGroupId, batchInsertCoursesDto.getCourseScheduleIdList().size(), batchInsertCoursesDto.getStartDate(),
|
|
|
+ batchInsertCoursesDto.getTeachingArrangementList(), batchInsertCoursesDto.getTeachMode(), batchInsertCoursesDto.getType(),
|
|
|
+ batchInsertCoursesDto.getSchoolId(), batchInsertCoursesDto.getIsJumpHoliday());
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public void batchAddCourseSchedule(List<CourseSchedule> courseSchedules) {
|
|
|
if (Objects.isNull(courseSchedules) && courseSchedules.size() <= 0) {
|
|
|
throw new BizException("参数错误!");
|