|
@@ -1651,7 +1651,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void batchAppendVipGroupCourses(VipGroupCourseAdjustInfoDto vipGroupCourseAdjustInfo) {
|
|
|
if (Objects.isNull(vipGroupCourseAdjustInfo.getVipGroupId())) {
|
|
|
- throw new BizException("请指定小课");
|
|
|
+ throw new BizException("请指定课程");
|
|
|
}
|
|
|
if (Objects.isNull(vipGroupCourseAdjustInfo.getCourseCreateStartTime())) {
|
|
|
throw new BizException("请指定排课起始时间;");
|
|
@@ -1672,17 +1672,32 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
if (courseCreateStartTime.before(today)) {
|
|
|
throw new BizException("排课起始时间不能小于当前时间");
|
|
|
}
|
|
|
-
|
|
|
- VipGroup vipGroup = vipGroupDao.get(vipGroupCourseAdjustInfo.getVipGroupId().longValue());
|
|
|
- if (Objects.isNull(vipGroup)) {
|
|
|
- throw new BizException("指定课程不存在");
|
|
|
- }
|
|
|
-
|
|
|
- if (vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)) {
|
|
|
- throw new BizException("报名中的课程不能加课");
|
|
|
+ int singleClassMinutes = 0;
|
|
|
+ Integer schoolId = null;
|
|
|
+ String groupId;
|
|
|
+ switch (vipGroupCourseAdjustInfo.getGroupType()){
|
|
|
+ case PRACTICE:
|
|
|
+ PracticeGroup practiceGroup = practiceGroupDao.get(vipGroupCourseAdjustInfo.getVipGroupId().longValue());
|
|
|
+ if (Objects.isNull(practiceGroup)) {
|
|
|
+ throw new BizException("指定课程不存在");
|
|
|
+ }
|
|
|
+ singleClassMinutes = practiceGroup.getSingleClassMinutes();
|
|
|
+ groupId = practiceGroup.getId().toString();
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ VipGroup vipGroup = vipGroupDao.get(vipGroupCourseAdjustInfo.getVipGroupId().longValue());
|
|
|
+ if (Objects.isNull(vipGroup)) {
|
|
|
+ throw new BizException("指定课程不存在");
|
|
|
+ }
|
|
|
+ schoolId = vipGroup.getTeacherSchoolId();
|
|
|
+ groupId = vipGroup.getId().toString();
|
|
|
+ singleClassMinutes = vipGroup.getSingleClassMinutes();
|
|
|
+ if (vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)) {
|
|
|
+ throw new BizException("报名中的课程不能加课");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- ClassGroup classGroup = classGroupDao.findByGroupAndType(vipGroupCourseAdjustInfo.getVipGroupId().toString(), GroupType.VIP.getCode());
|
|
|
+ ClassGroup classGroup = classGroupDao.findByGroupAndType(vipGroupCourseAdjustInfo.getVipGroupId().toString(), vipGroupCourseAdjustInfo.getGroupType().getCode());
|
|
|
if (Objects.isNull(classGroup)) {
|
|
|
throw new BizException("对应班级不存在");
|
|
|
}
|
|
@@ -1731,15 +1746,15 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
String dateYmdStr = DateUtil.dateToString(calendar.getTime(), DateUtil.ISO_EXPANDED_DATE_FORMAT);
|
|
|
dateYmdStr = dateYmdStr + " " + courseTime.getStartClassTime();
|
|
|
Date courseStartTime = DateUtil.stringToDate(dateYmdStr, "yyyy-MM-dd HH:mm");
|
|
|
- Date courseEndTime = DateUtil.addMinutes(courseStartTime, vipGroup.getSingleClassMinutes());
|
|
|
+ Date courseEndTime = DateUtil.addMinutes(courseStartTime, singleClassMinutes);
|
|
|
CourseSchedule courseSchedule = new CourseSchedule();
|
|
|
courseSchedule.setGroupType(GroupType.VIP);
|
|
|
- courseSchedule.setMusicGroupId(vipGroup.getId().toString());
|
|
|
+ courseSchedule.setMusicGroupId(groupId);
|
|
|
courseSchedule.setClassGroupId(classGroup.getId());
|
|
|
courseSchedule.setClassDate(courseStartTime);
|
|
|
courseSchedule.setStartClassTime(courseStartTime);
|
|
|
courseSchedule.setEndClassTime(courseEndTime);
|
|
|
- courseSchedule.setSchoolId(vipGroup.getTeacherSchoolId());
|
|
|
+ courseSchedule.setSchoolId(schoolId);
|
|
|
courseSchedule.setStatus(CourseStatusEnum.NOT_START);
|
|
|
courseSchedule.setTeachMode(vipGroupCourseAdjustInfo.getTeachMode());
|
|
|
courseSchedules.add(courseSchedule);
|
|
@@ -1757,7 +1772,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
// courseScheduleDao.batchUpdate(courseSchedules);
|
|
|
VipGroupApplyDto vipGroupApplyDto = new VipGroupApplyDto();
|
|
|
VipGroupApplyBaseInfoDto vipGroupApplyBaseInfoDto = new VipGroupApplyBaseInfoDto();
|
|
|
- vipGroupApplyBaseInfoDto.setId(vipGroup.getId());
|
|
|
+ vipGroupApplyBaseInfoDto.setId(Long.parseLong(groupId));
|
|
|
vipGroupApplyDto.setVipGroupApplyBaseInfo(vipGroupApplyBaseInfoDto);
|
|
|
vipGroupApplyDto.setCourseSchedules(courseSchedules);
|
|
|
vipGroupApplyDto.setSingleClassPrice(vipGroupCourseAdjustInfo.getSingleClassPrice());
|