|  | @@ -7,24 +7,12 @@ import static com.ym.mec.biz.dal.enums.PracticeGroupType.*;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  import java.lang.reflect.InvocationTargetException;
 |  |  import java.lang.reflect.InvocationTargetException;
 | 
											
												
													
														|  |  import java.math.BigDecimal;
 |  |  import java.math.BigDecimal;
 | 
											
												
													
														|  | 
 |  | +import java.text.ParseException;
 | 
											
												
													
														|  |  import java.text.SimpleDateFormat;
 |  |  import java.text.SimpleDateFormat;
 | 
											
												
													
														|  |  import java.time.LocalDate;
 |  |  import java.time.LocalDate;
 | 
											
												
													
														|  |  import java.time.LocalDateTime;
 |  |  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.Collectors;
 | 
											
												
													
														|  |  import java.util.stream.Stream;
 |  |  import java.util.stream.Stream;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
										
											
												
													
														|  | @@ -36,6 +24,7 @@ import com.ym.mec.common.controller.BaseController;
 | 
											
												
													
														|  |  import com.ym.mec.common.entity.HttpResponseResult;
 |  |  import com.ym.mec.common.entity.HttpResponseResult;
 | 
											
												
													
														|  |  import org.apache.commons.collections.ListUtils;
 |  |  import org.apache.commons.collections.ListUtils;
 | 
											
												
													
														|  |  import org.apache.commons.lang3.StringUtils;
 |  |  import org.apache.commons.lang3.StringUtils;
 | 
											
												
													
														|  | 
 |  | +import org.codehaus.jackson.map.util.BeanUtil;
 | 
											
												
													
														|  |  import org.slf4j.Logger;
 |  |  import org.slf4j.Logger;
 | 
											
												
													
														|  |  import org.slf4j.LoggerFactory;
 |  |  import org.slf4j.LoggerFactory;
 | 
											
												
													
														|  |  import org.springframework.beans.BeanUtils;
 |  |  import org.springframework.beans.BeanUtils;
 | 
											
										
											
												
													
														|  | @@ -2822,7 +2811,239 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 | 
											
												
													
														|  |  		saveModifyLog(modifyLogs,courseScheduleIds);
 |  |  		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();
 | 
											
												
													
														|  | 
 |  | +		}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +		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(Collections.EMPTY_LIST);
 | 
											
												
													
														|  | 
 |  | +		}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +		//获取主教编号
 | 
											
												
													
														|  | 
 |  | +		Integer mainTeacherId = null;
 | 
											
												
													
														|  | 
 |  | +		if(!CollectionUtils.isEmpty(courseAdjustInfo.getClassGroupTeacherMapperList())){
 | 
											
												
													
														|  | 
 |  | +			ClassGroupTeacherMapper classGroupTeacherMapper = courseAdjustInfo.getClassGroupTeacherMapperList().stream().filter(c -> TeachTypeEnum.BISHOP.equals(c.getTeacherRole())).findAny().get();
 | 
											
												
													
														|  | 
 |  | +			if(Objects.nonNull(classGroupTeacherMapper)){
 | 
											
												
													
														|  | 
 |  | +				mainTeacherId = classGroupTeacherMapper.getUserId();
 | 
											
												
													
														|  | 
 |  | +			}
 | 
											
												
													
														|  | 
 |  | +		}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +		//上课日期变更
 | 
											
												
													
														|  | 
 |  | +		//间隔天数
 | 
											
												
													
														|  | 
 |  | +		int betweenDays = 0, initBetweenDays = 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());
 | 
											
												
													
														|  | 
 |  | +			initBetweenDays = betweenDays;
 | 
											
												
													
														|  | 
 |  | +		}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +		//上课时间变更
 | 
											
												
													
														|  | 
 |  | +		LocalTime startTime = null;
 | 
											
												
													
														|  | 
 |  | +		if(Objects.nonNull(courseAdjustInfo.getStartTime())){
 | 
											
												
													
														|  | 
 |  | +			startTime = LocalTime.parse(courseAdjustInfo.getStartTime(), DateUtil.timeFormatter);
 | 
											
												
													
														|  | 
 |  | +		}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +		Date now = new Date();
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +		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+initBetweenDays;
 | 
											
												
													
														|  | 
 |  | +					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(TeachModeEnum.ONLINE.equals(courseAdjustInfo.getTeachMode())){
 | 
											
												
													
														|  | 
 |  | +					oldCourses.get(i).setSchoolId(null);
 | 
											
												
													
														|  | 
 |  | +				}
 | 
											
												
													
														|  | 
 |  | +				if(VIP.equals(oldCourses.get(i).getGroupType())){
 | 
											
												
													
														|  | 
 |  | +					changeSalaryTeachTypes.add(TeachTypeEnum.BISHOP);
 | 
											
												
													
														|  | 
 |  | +					courseScheduleTeacherSalaryDao.deleteWithCourseAndTeachRole(Arrays.asList(oldCourses.get(i).getId()), TeachTypeEnum.BISHOP);
 | 
											
												
													
														|  | 
 |  | +				}
 | 
											
												
													
														|  | 
 |  | +			}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +			//主教变更
 | 
											
												
													
														|  | 
 |  | +			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) {
 | 
											
												
													
														|  | 
 |  | +			courseScheduleTeacherSalaryService.batchInsert(courseScheduleTeacherSalaries);
 | 
											
												
													
														|  | 
 |  | +		}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +		try {
 | 
											
												
													
														|  | 
 |  | +			checkNewCourseSchedules(oldCourses, false, false);
 | 
											
												
													
														|  | 
 |  | +		} catch (Exception e) {
 | 
											
												
													
														|  | 
 |  | +			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);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +		return BaseController.succeed();
 | 
											
												
													
														|  | 
 |  | +	}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +	@Override
 | 
											
												
													
														|  |      @Transactional(rollbackFor = Exception.class)
 |  |      @Transactional(rollbackFor = Exception.class)
 | 
											
												
													
														|  |      public void coursePostpone(CoursePostponeDto coursePostPoneInfo) {
 |  |      public void coursePostpone(CoursePostponeDto coursePostPoneInfo) {
 | 
											
												
													
														|  |          SysUser user = sysUserFeignService.queryUserInfo();
 |  |          SysUser user = sysUserFeignService.queryUserInfo();
 |