|
@@ -7,24 +7,12 @@ import static com.ym.mec.biz.dal.enums.PracticeGroupType.*;
|
|
|
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.Calendar;
|
|
|
-import java.util.Collection;
|
|
|
-import java.util.Collections;
|
|
|
-import java.util.Comparator;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.HashSet;
|
|
|
-import java.util.Iterator;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Objects;
|
|
|
-import java.util.Set;
|
|
|
-import java.util.TreeSet;
|
|
|
+import java.time.LocalTime;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
@@ -36,6 +24,7 @@ import com.ym.mec.common.controller.BaseController;
|
|
|
import com.ym.mec.common.entity.HttpResponseResult;
|
|
|
import org.apache.commons.collections.ListUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.codehaus.jackson.map.util.BeanUtil;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
@@ -269,16 +258,24 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
|
|
|
List<CourseSchedule> courseScheduleList = courseScheduleDao.findByCourseScheduleIds(courseScheduleIds);
|
|
|
|
|
|
+ List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaries = courseScheduleTeacherSalaryDao.findByCourseSchedules(courseScheduleIds);
|
|
|
+ Set<Long> settlementCourseIds = new HashSet<>();
|
|
|
+ if(!CollectionUtils.isEmpty(courseScheduleTeacherSalaries)){
|
|
|
+ settlementCourseIds = courseScheduleTeacherSalaries.stream().filter(c->Objects.nonNull(c.getSettlementTime())).map(CourseScheduleTeacherSalary::getCourseScheduleId).collect(Collectors.toSet());
|
|
|
+ }
|
|
|
+
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
Date date = new Date();
|
|
|
if (courseScheduleList != null) {
|
|
|
for (CourseSchedule cs : courseScheduleList) {
|
|
|
- if (cs.getStatus() != CourseStatusEnum.NOT_START) {
|
|
|
- throw new BizException("删除失败,未开始的课程才能删除");
|
|
|
+ if(settlementCourseIds.contains(cs.getId())){
|
|
|
+ throw new BizException("删除失败,已结算的课程不能删除");
|
|
|
+ }
|
|
|
+ if (CourseStatusEnum.UNDERWAY.equals(cs.getStatus())) {
|
|
|
+ throw new BizException("删除失败,进行中的课程不能删除");
|
|
|
}
|
|
|
- String endDateStr = DateUtil.format(cs.getClassDate(), "yyyy-MM-dd") + " " + DateUtil.format(cs.getStartClassTime(), "HH:mm:ss");
|
|
|
- if (DateUtil.stringToDate(endDateStr, sdf).before(date)) {
|
|
|
- throw new BizException("删除失败,未开始的课程才能删除");
|
|
|
+ if (Objects.nonNull(cs.getIsLock())&&cs.getIsLock()==1) {
|
|
|
+ throw new BizException("删除失败,被锁定的课程不能删除");
|
|
|
}
|
|
|
if(Objects.nonNull(cs.getNewCourseId())){
|
|
|
throw new BizException("删除失败,被合并课程不能删除");
|
|
@@ -2822,7 +2819,268 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
saveModifyLog(modifyLogs,courseScheduleIds);
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public HttpResponseResult batchCourseAdjust(BatchCourseAdjustDto courseAdjustInfo) {
|
|
|
+ if(CollectionUtils.isEmpty(courseAdjustInfo.getCourseScheduleIds())){
|
|
|
+ return BaseController.failed("请指定需要调整的课程");
|
|
|
+ }
|
|
|
+
|
|
|
+ //未更新课程列表
|
|
|
+ List<CourseSchedule> oldCourses = courseScheduleDao.findByCourseScheduleIds(courseAdjustInfo.getCourseScheduleIds());
|
|
|
+
|
|
|
+ if(CollectionUtils.isEmpty(oldCourses)){
|
|
|
+ return BaseController.succeed();
|
|
|
+ }
|
|
|
+
|
|
|
+ Set<String> musicGroupIds = oldCourses.stream().filter(c -> MUSIC.equals(c.getGroupType())).map(CourseSchedule::getMusicGroupId).collect(Collectors.toSet());
|
|
|
+ if(!CollectionUtils.isEmpty(musicGroupIds)){
|
|
|
+ List<MusicGroup> musicGroups = musicGroupDao.getMusicGroupByIds(new ArrayList<>(musicGroupIds));
|
|
|
+ if(CollectionUtils.isEmpty(musicGroups)){
|
|
|
+ throw new BizException("调整失败:乐团信息异常");
|
|
|
+ }
|
|
|
+ long errMusicGroupNum = musicGroups.stream().filter(m -> !MusicGroupStatusEnum.PROGRESS.equals(m.getStatus())).count();
|
|
|
+ if(errMusicGroupNum>0){
|
|
|
+ throw new BizException("调整失败:调整的课程所在乐团处于非进行中");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Date now = new Date();
|
|
|
+
|
|
|
+ //获取修改日志
|
|
|
+ List<CourseScheduleModifyLog> modifyLogs = getModifyLogs(courseAdjustInfo.getCourseScheduleIds(),oldCourses,courseAdjustInfo.getOperatorId(),now);
|
|
|
+
|
|
|
+ List<CourseScheduleTeacherSalary> oldCourseScheduleTeacherSalaryList = courseScheduleTeacherSalaryDao.findByCourseSchedules(courseAdjustInfo.getCourseScheduleIds());
|
|
|
+ Map<Long, List<CourseScheduleTeacherSalary>> courseSalaryListMap = new HashMap<>();
|
|
|
+ if(!CollectionUtils.isEmpty(oldCourseScheduleTeacherSalaryList)){
|
|
|
+ courseSalaryListMap = oldCourseScheduleTeacherSalaryList.stream().collect(Collectors.groupingBy(CourseScheduleTeacherSalary::getCourseScheduleId));
|
|
|
+ }
|
|
|
+
|
|
|
+ //需要变更课酬的教师类型
|
|
|
+ Set<TeachTypeEnum> changeSalaryTeachTypes = new HashSet<>();
|
|
|
+
|
|
|
+ if(courseAdjustInfo.getChangeMainTeacher()){
|
|
|
+ changeSalaryTeachTypes.add(TeachTypeEnum.BISHOP);
|
|
|
+ courseScheduleTeacherSalaryDao.deleteWithCourseAndTeachRole(courseAdjustInfo.getCourseScheduleIds(), TeachTypeEnum.BISHOP);
|
|
|
+ }
|
|
|
+ if(courseAdjustInfo.getChangeTeachingTeacher()){
|
|
|
+ changeSalaryTeachTypes.add(TeachTypeEnum.TEACHING);
|
|
|
+ courseScheduleTeacherSalaryDao.deleteWithCourseAndTeachRole(courseAdjustInfo.getCourseScheduleIds(), TeachTypeEnum.TEACHING);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(CollectionUtils.isEmpty(courseAdjustInfo.getClassGroupTeacherMapperList())){
|
|
|
+ courseAdjustInfo.setClassGroupTeacherMapperList(new ArrayList<>());
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取主教编号
|
|
|
+ Integer mainTeacherId = null;
|
|
|
+ if(!CollectionUtils.isEmpty(courseAdjustInfo.getClassGroupTeacherMapperList())){
|
|
|
+ Map<Integer, Long> userNumMap = courseAdjustInfo.getClassGroupTeacherMapperList().stream().collect(Collectors.groupingBy(ClassGroupTeacherMapper::getUserId, Collectors.counting()));
|
|
|
+ if(userNumMap.containsValue(Long.valueOf("2"))){
|
|
|
+ throw new BizException("主教与助教不可重复");
|
|
|
+ }
|
|
|
+ ClassGroupTeacherMapper classGroupTeacherMapper = courseAdjustInfo.getClassGroupTeacherMapperList().stream().filter(c -> TeachTypeEnum.BISHOP.equals(c.getTeacherRole())).findAny().get();
|
|
|
+ if(Objects.nonNull(classGroupTeacherMapper)){
|
|
|
+ mainTeacherId = classGroupTeacherMapper.getUserId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //上课日期变更
|
|
|
+ //间隔天数
|
|
|
+ int betweenDays = 0;
|
|
|
+ //节假日
|
|
|
+ Set<String> holidayDays = new HashSet<>();
|
|
|
+ if(Objects.nonNull(courseAdjustInfo.getPauseDate())&&Objects.nonNull(courseAdjustInfo.getRecoveryDate())){
|
|
|
+ if (courseAdjustInfo.getHoliday()) {
|
|
|
+ SysConfig holidaySetting = sysConfigService.findByParamName(SysConfigService.HOLIDAY_SETTING);
|
|
|
+ if(Objects.nonNull(holidaySetting)&&StringUtils.isNotBlank(holidaySetting.getParanValue())){
|
|
|
+ holidayDays = new HashSet<>(JSON.parseArray(holidaySetting.getParanValue(), String.class));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ LocalDate pauseDate = LocalDate.parse(courseAdjustInfo.getPauseDate(), DateUtil.dateFormatter);
|
|
|
+ LocalDate recoveryDate = LocalDate.parse(courseAdjustInfo.getRecoveryDate(), DateUtil.dateFormatter);
|
|
|
+
|
|
|
+ betweenDays = (int) (recoveryDate.toEpochDay()-pauseDate.toEpochDay());
|
|
|
+ }
|
|
|
+
|
|
|
+ //上课时间变更
|
|
|
+ LocalTime startTime = null;
|
|
|
+ if(Objects.nonNull(courseAdjustInfo.getStartTime())){
|
|
|
+ startTime = LocalTime.parse(courseAdjustInfo.getStartTime(), DateUtil.timeFormatter);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaries = new ArrayList<>();
|
|
|
+
|
|
|
+ oldCourses.sort(Comparator.comparing(CourseSchedule::getStartClassTime));
|
|
|
+ for (int i = 0; i < oldCourses.size(); i++) {
|
|
|
+ if(Objects.nonNull(oldCourses.get(i).getNewCourseId())){
|
|
|
+ throw new BizException("选择的课程中存在已合并课程,无法进行调整");
|
|
|
+ }
|
|
|
+ if(!CourseStatusEnum.NOT_START.equals(oldCourses.get(i).getStatus())){
|
|
|
+ throw new BizException("选择的课程中存在进行中或已结束的课程,无法进行调整");
|
|
|
+ }
|
|
|
+ //上课日期变更
|
|
|
+ if(betweenDays!=0){
|
|
|
+ LocalDate classDate = LocalDateTime.ofInstant(oldCourses.get(i).getClassDate().toInstant(), DateUtil.zoneId).toLocalDate();
|
|
|
+ classDate = classDate.plusDays(betweenDays);
|
|
|
+ if (courseAdjustInfo.getHoliday() && holidayDays.contains(classDate.toString())) {
|
|
|
+ betweenDays=betweenDays+7;
|
|
|
+ i=i-1;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ oldCourses.get(i).setClassDate(Date.from(classDate.atStartOfDay().atZone(DateUtil.zoneId).toInstant()));
|
|
|
+ }
|
|
|
+
|
|
|
+ //上课时间变更
|
|
|
+ if(Objects.nonNull(startTime)){
|
|
|
+ //课程时长
|
|
|
+ int minutes = DateUtil.minutesBetween(oldCourses.get(i).getStartClassTime(), oldCourses.get(i).getEndClassTime());
|
|
|
+ LocalTime endTime = startTime.plusMinutes(minutes);
|
|
|
+ String courseStartTimeStr = DateUtil.dateToString(oldCourses.get(i).getClassDate(), "yyyy-MM-dd") + " " + startTime.toString();
|
|
|
+ String courseEndTimeStr = DateUtil.dateToString(oldCourses.get(i).getClassDate(), "yyyy-MM-dd") + " " + endTime.toString();
|
|
|
+ oldCourses.get(i).setStartClassTime(DateUtil.stringToDate(courseStartTimeStr, "yyyy-MM-dd HH:mm"));
|
|
|
+ try {
|
|
|
+ oldCourses.get(i).setStartClassTimeStr(startTime.toString());
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ oldCourses.get(i).setEndClassTime(DateUtil.stringToDate(courseEndTimeStr, "yyyy-MM-dd HH:mm"));
|
|
|
+ try {
|
|
|
+ oldCourses.get(i).setEndClassTimeStr(endTime.toString());
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(Objects.nonNull(courseAdjustInfo.getSchoolId())){
|
|
|
+ oldCourses.get(i).setSchoolId(courseAdjustInfo.getSchoolId());
|
|
|
+ }
|
|
|
+
|
|
|
+ if(Objects.nonNull(courseAdjustInfo.getTeachMode())&&!courseAdjustInfo.getTeachMode().equals(oldCourses.get(i).getTeachMode())){
|
|
|
+ oldCourses.get(i).setTeachMode(courseAdjustInfo.getTeachMode());
|
|
|
+ if(VIP.equals(oldCourses.get(i).getGroupType())){
|
|
|
+ changeSalaryTeachTypes.add(TeachTypeEnum.BISHOP);
|
|
|
+ if(courseSalaryListMap.containsKey(oldCourses.get(i).getId())){
|
|
|
+ List<CourseScheduleTeacherSalary> ctss = courseSalaryListMap.get(oldCourses.get(i).getId());
|
|
|
+ for (CourseScheduleTeacherSalary teacherSalary : ctss) {
|
|
|
+ courseScheduleTeacherSalaryService.updateSingleCourseTeacherSalary(oldCourses.get(i), teacherSalary);
|
|
|
+ }
|
|
|
+ courseScheduleTeacherSalaryDao.batchUpdate(ctss);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(TeachModeEnum.ONLINE.equals(oldCourses.get(i).getTeachMode())){
|
|
|
+ oldCourses.get(i).setSchoolId(null);
|
|
|
+ }
|
|
|
+
|
|
|
+ //主教变更
|
|
|
+ if(Objects.nonNull(mainTeacherId)){
|
|
|
+ oldCourses.get(i).setActualTeacherId(mainTeacherId);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(oldCourses.get(i).getStartClassTime().compareTo(now)<0){
|
|
|
+ throw new BizException("上课时间不得早于当前时间");
|
|
|
+ }
|
|
|
+
|
|
|
+ for (ClassGroupTeacherMapper classGroupTeacherMapper : courseAdjustInfo.getClassGroupTeacherMapperList()) {
|
|
|
+ if(!changeSalaryTeachTypes.contains(classGroupTeacherMapper.getTeacherRole())){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ CourseScheduleTeacherSalary courseScheduleTeacherSalary = new CourseScheduleTeacherSalary();
|
|
|
+ courseScheduleTeacherSalary.setCourseScheduleId(oldCourses.get(i).getId());
|
|
|
+ courseScheduleTeacherSalary.setGroupType(oldCourses.get(i).getGroupType());
|
|
|
+ courseScheduleTeacherSalary.setMusicGroupId(oldCourses.get(i).getMusicGroupId());
|
|
|
+ courseScheduleTeacherSalary.setTeacherRole(classGroupTeacherMapper.getTeacherRole());
|
|
|
+ courseScheduleTeacherSalary.setUserId(classGroupTeacherMapper.getUserId());
|
|
|
+ courseScheduleTeacherSalary.setClassGroupId(oldCourses.get(i).getClassGroupId());
|
|
|
+ courseScheduleTeacherSalary.setCreateTime(now);
|
|
|
+ courseScheduleTeacherSalary.setUpdateTime(now);
|
|
|
+ if(CourseScheduleType.PRACTICE.equals(oldCourses.get(i).getType())&&courseSalaryListMap.containsKey(oldCourses.get(i).getId())){
|
|
|
+ courseScheduleTeacherSalary.setExpectSalary(courseSalaryListMap.get(oldCourses.get(i).getId()).get(0).getExpectSalary());
|
|
|
+ }
|
|
|
+ courseScheduleTeacherSalaryService.updateSingleCourseTeacherSalary(oldCourses.get(i), courseScheduleTeacherSalary);
|
|
|
+ courseScheduleTeacherSalaries.add(courseScheduleTeacherSalary);
|
|
|
+
|
|
|
+ if (courseAdjustInfo.getConfirmGenerate() && !courseAdjustInfo.getAllowZeroSalary() && BigDecimal.ZERO.compareTo(courseScheduleTeacherSalary.getExpectSalary()) == 0) {
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return BaseController.failed(HttpStatus.MULTI_STATUS, "当前课程课酬预计为0,是否继续");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //老师结算表
|
|
|
+ if (courseScheduleTeacherSalaries.size() > 0) {
|
|
|
+ teacherAttendanceDao.batchDeleteByCourseSchedules(courseAdjustInfo.getCourseScheduleIds());
|
|
|
+ courseScheduleTeacherSalaryService.batchInsert(courseScheduleTeacherSalaries);
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ checkNewCourseSchedules(oldCourses, false, false);
|
|
|
+ } catch (Exception e) {
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ String errMessage = e.getMessage();
|
|
|
+ if (errMessage.equals("您设置的循环周期存在时间冲突")) {
|
|
|
+ errMessage = "日期相同课程不可批量调整上课时间";
|
|
|
+ }
|
|
|
+ return BaseController.failed(HttpStatus.INTERNAL_SERVER_ERROR, errMessage);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!courseAdjustInfo.getConfirmGenerate()) {
|
|
|
+ List<CourseScheduleTeacherSalary> cstss = courseScheduleTeacherSalaryDao.findByCourseSchedules(courseAdjustInfo.getCourseScheduleIds());
|
|
|
+ Map<Long, Set<Integer>> courseTeachTypeTeacherIdsMap = new HashMap<>();
|
|
|
+ if(!CollectionUtils.isEmpty(cstss)){
|
|
|
+ courseTeachTypeTeacherIdsMap = cstss.stream().filter(c->TeachTypeEnum.TEACHING.equals(c.getTeacherRole())).collect(Collectors.groupingBy(CourseScheduleTeacherSalary::getCourseScheduleId, Collectors.mapping(CourseScheduleTeacherSalary::getUserId, Collectors.toSet())));
|
|
|
+ }
|
|
|
+ Set<Integer> allTeacherIds = cstss.stream().map(CourseScheduleTeacherSalary::getUserId).collect(Collectors.toSet());
|
|
|
+ List<SimpleUserDto> teachers = teacherDao.getUsersSimpleInfo(new ArrayList<>(allTeacherIds));
|
|
|
+ Map<Integer, String> idNameMap = new HashMap<>();
|
|
|
+ if(!CollectionUtils.isEmpty(teachers)){
|
|
|
+ idNameMap = teachers.stream().collect(Collectors.toMap(SimpleUserDto::getUserId, s->s.getRealName(), (s1, s2)->s1));
|
|
|
+ }
|
|
|
+ //获取班级声部名称
|
|
|
+ List<Map<Integer, String>> classGroupSubjectNameMaps = classGroupDao.findClassGroupSubjectNameMaps(courseAdjustInfo.getCourseScheduleIds());
|
|
|
+ Map<Integer, String> classGroupSubjectNameMap = MapUtil.convertIntegerMap(classGroupSubjectNameMaps);
|
|
|
+
|
|
|
+ List<Integer> schoolIds = oldCourses.stream().filter(o -> Objects.nonNull(o.getSchoolId())).map(CourseSchedule::getSchoolId).collect(Collectors.toList());
|
|
|
+ Map<Integer, String> idSchoolNameMap = new HashMap<>();
|
|
|
+ if(!CollectionUtils.isEmpty(schoolIds)){
|
|
|
+ List<School> schools = schoolDao.getSchools(schoolIds);
|
|
|
+ idSchoolNameMap = schools.stream().collect(Collectors.toMap(School::getId, s->s.getName(), (s1, s2)->s1));
|
|
|
+ }
|
|
|
+
|
|
|
+ List<CourseScheduleEndDto> results = new ArrayList<>();
|
|
|
+ for (CourseSchedule oldCours : oldCourses) {
|
|
|
+ CourseScheduleEndDto courseEnd = new CourseScheduleEndDto();
|
|
|
+ BeanUtils.copyProperties(oldCours, courseEnd);
|
|
|
+ courseEnd.setTeacherName(idNameMap.get(oldCours.getActualTeacherId()));
|
|
|
+ if(courseTeachTypeTeacherIdsMap.containsKey(oldCours.getId())){
|
|
|
+ Set<Integer> teacherIds = courseTeachTypeTeacherIdsMap.get(oldCours.getId());
|
|
|
+ Set<String> teacherNames = new HashSet<>();
|
|
|
+ for (Integer teacherId : teacherIds) {
|
|
|
+ teacherNames.add(idNameMap.get(teacherId));
|
|
|
+ }
|
|
|
+ courseEnd.setTeachingTeacherNames(StringUtils.join(teacherNames, ","));
|
|
|
+ }
|
|
|
+ courseEnd.setSubjectName(classGroupSubjectNameMap.get(oldCours.getId()));
|
|
|
+ courseEnd.setSchoolName(idSchoolNameMap.get(oldCours.getSchoolId()));
|
|
|
+
|
|
|
+ results.add(courseEnd);
|
|
|
+ }
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ oldCourses.sort(Comparator.comparing(CourseSchedule::getStartClassTime));
|
|
|
+ return BaseController.failed(HttpStatus.PARTIAL_CONTENT, results, "");
|
|
|
+ }
|
|
|
+
|
|
|
+ courseScheduleDao.batchUpdate(oldCourses);
|
|
|
+
|
|
|
+ saveModifyLog(modifyLogs, courseAdjustInfo.getCourseScheduleIds());
|
|
|
+
|
|
|
+ return BaseController.succeed();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void coursePostpone(CoursePostponeDto coursePostPoneInfo) {
|
|
|
SysUser user = sysUserFeignService.queryUserInfo();
|
|
@@ -3160,7 +3418,19 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //课程冲突检测
|
|
|
+ Set<String> musicGroupIds = oldCourseScheduleList.stream().filter(c -> MUSIC.equals(c.getGroupType())).map(CourseSchedule::getMusicGroupId).collect(Collectors.toSet());
|
|
|
+ if(!CollectionUtils.isEmpty(musicGroupIds)){
|
|
|
+ List<MusicGroup> musicGroups = musicGroupDao.getMusicGroupByIds(new ArrayList<>(musicGroupIds));
|
|
|
+ if(CollectionUtils.isEmpty(musicGroups)){
|
|
|
+ throw new BizException("调整失败:乐团信息异常");
|
|
|
+ }
|
|
|
+ long errMusicGroupNum = musicGroups.stream().filter(m -> !MusicGroupStatusEnum.PROGRESS.equals(m.getStatus())).count();
|
|
|
+ if(errMusicGroupNum>0){
|
|
|
+ throw new BizException("调整失败:调整的课程所在乐团处于非进行中");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //课程冲突检测
|
|
|
checkNewCourseSchedules(newCourseSchedules, false,false);
|
|
|
|
|
|
Map<Long, List<TeacherAttendance>> teacherAttendanceMap = new HashMap<Long, List<TeacherAttendance>>();
|