|  | @@ -6,7 +6,6 @@ import static com.ym.mec.biz.dal.enums.GroupType.MUSIC;
 | 
	
		
			
				|  |  |  import static com.ym.mec.biz.dal.enums.GroupType.PRACTICE;
 | 
	
		
			
				|  |  |  import static com.ym.mec.biz.dal.enums.GroupType.VIP;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -import java.lang.reflect.InvocationTargetException;
 | 
	
		
			
				|  |  |  import java.math.BigDecimal;
 | 
	
		
			
				|  |  |  import java.time.Duration;
 | 
	
		
			
				|  |  |  import java.time.Instant;
 | 
	
	
		
			
				|  | @@ -27,20 +26,16 @@ import java.util.Objects;
 | 
	
		
			
				|  |  |  import java.util.Set;
 | 
	
		
			
				|  |  |  import java.util.stream.Collectors;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -import com.alibaba.fastjson.JSONArray;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.dao.*;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.dto.*;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.entity.*;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.service.*;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.service.IdGeneratorService;
 | 
	
		
			
				|  |  | -import org.apache.commons.beanutils.BeanUtils;
 | 
	
		
			
				|  |  |  import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  | -import org.springframework.transaction.annotation.Isolation;
 | 
	
		
			
				|  |  |  import org.springframework.transaction.annotation.Propagation;
 | 
	
		
			
				|  |  |  import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  | -import org.springframework.transaction.interceptor.TransactionAspectSupport;
 | 
	
		
			
				|  |  |  import org.springframework.util.CollectionUtils;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import com.alibaba.fastjson.JSON;
 | 
	
	
		
			
				|  | @@ -218,10 +213,13 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          //基础技能班和线上基础技能班,可分班原则为声部人数/6向上取整
 | 
	
		
			
				|  |  | -//        if(classGroup.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE)||classGroup.getType().equals(ClassGroupTypeEnum.HIGH)){
 | 
	
		
			
				|  |  | -//            int classGroupNum = classGroupDao.getMusicGroupHighClassNumBySubject(classGroup.getMusicGroupId(), classGroup.getSubjectIdList());
 | 
	
		
			
				|  |  | -//            int musicGroupSubjectNum = studentRegistrationDao.getMusicGroupSubjectNum(classGroup.getMusicGroupId(), classGroup.getSubjectIdList());
 | 
	
		
			
				|  |  | -//        }
 | 
	
		
			
				|  |  | +        if (classGroup.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE) || classGroup.getType().equals(ClassGroupTypeEnum.HIGH)) {
 | 
	
		
			
				|  |  | +            HighClassGroupNumDto highClassGroupNumDto = getSubjectMaxHighClassGroupNum(classGroup.getMusicGroupId(), classGroup.getType(), classGroup.getSubjectIdList());
 | 
	
		
			
				|  |  | +            if (highClassGroupNumDto.getNowHighClassGroupNum() >= highClassGroupNumDto.getMaxHighClassGroupNum()) {
 | 
	
		
			
				|  |  | +                String errMsg = classGroup.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE) ? "线上基础技能班" : "基础技能班";
 | 
	
		
			
				|  |  | +                throw new BizException("此乐团所选声部," + errMsg + "数量不能大于" + highClassGroupNumDto.getMaxHighClassGroupNum());
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          String userIds = classGroup.getUserIds();
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -367,7 +365,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  | -    public ClassGroup addMixClassGroup(String musicGroupId, String name, String classGroupIds){
 | 
	
		
			
				|  |  | +    public ClassGroup addMixClassGroup(String musicGroupId, String name, String classGroupIds) {
 | 
	
		
			
				|  |  |          Date date;
 | 
	
		
			
				|  |  |          date = new Date();
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -578,7 +576,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |              batchAddImGroup(classGroupImGroupList);
 | 
	
		
			
				|  |  |              classGroupTeacherMapperService.classGroupTeachersInsert(classGroupTeacherMapperList);
 | 
	
		
			
				|  |  |              // 检测新排课冲突
 | 
	
		
			
				|  |  | -            courseScheduleService.checkNewCourseSchedules(courseScheduleList, false,false);
 | 
	
		
			
				|  |  | +            courseScheduleService.checkNewCourseSchedules(courseScheduleList, false, false);
 | 
	
		
			
				|  |  |              courseScheduleDao.batchAddCourseSchedules(courseScheduleList);
 | 
	
		
			
				|  |  |          } finally {
 | 
	
		
			
				|  |  |              redisCache.releaseLocked(key, value);
 | 
	
	
		
			
				|  | @@ -601,7 +599,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |              param.put("teacherId", queryInfo.getSearch());
 | 
	
		
			
				|  |  |              param.put("attendanceStatus", YesOrNoEnum.YES);
 | 
	
		
			
				|  |  |              Set<String> classGroupIds = dataList.stream().map(e -> e.getClassGroupIds()).collect(Collectors.toSet());
 | 
	
		
			
				|  |  | -            Map<Integer,Long> hasRestClassMap = MapUtil.convertIntegerMap(courseScheduleDao.queryHasReatClass(classGroupIds,queryInfo.getSearch()));
 | 
	
		
			
				|  |  | +            Map<Integer, Long> hasRestClassMap = MapUtil.convertIntegerMap(courseScheduleDao.queryHasReatClass(classGroupIds, queryInfo.getSearch()));
 | 
	
		
			
				|  |  |              int teacherPersonalAttendancesCount = teacherAttendanceDao.getTeacherPersonalAttendancesCount(param);
 | 
	
		
			
				|  |  |              dataList.forEach(e -> {
 | 
	
		
			
				|  |  |                  param.put("musicGroupId", e.getMusicGroupId());
 | 
	
	
		
			
				|  | @@ -739,8 +737,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  for (TeacherDefaultMusicGroupSalary teacherDefaultMusicGroupSalary : teacherSalaryByUserIdAndType) {
 | 
	
		
			
				|  |  |                      if (teacherDefaultMusicGroupSalary.getCourseScheduleType().equals(CourseSchedule.CourseScheduleType.HIGH_ONLINE) && teacherDefaultMusicGroupSalary.getSalaryRuleJson() != null) {
 | 
	
		
			
				|  |  | -                        if(studentNum>5){
 | 
	
		
			
				|  |  | -                            studentNum=Long.valueOf(5);
 | 
	
		
			
				|  |  | +                        if (studentNum > 5) {
 | 
	
		
			
				|  |  | +                            studentNum = Long.valueOf(5);
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |                          BigDecimal salary = JSON.parseObject(teacherDefaultMusicGroupSalary.getSalaryRuleJson()).getBigDecimal(studentNum.toString());
 | 
	
		
			
				|  |  |                          teacherDefaultMusicGroupSalary.setMainTeacher30MinSalary(salary);
 | 
	
	
		
			
				|  | @@ -1066,8 +1064,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |                      List<TeacherDefaultMusicGroupSalary> teacherSalaryList = teacherDefaultMusicGroupSalaryService.getTeacherSalaryByUserIdAndType(classGroupTeacher.getUserId(), ClassGroupTypeEnum.HIGH_ONLINE.getCode(), null);
 | 
	
		
			
				|  |  |                      Map<CourseSchedule.CourseScheduleType, TeacherDefaultMusicGroupSalary> collect = teacherSalaryList.stream().collect(Collectors.toMap(TeacherDefaultMusicGroupSalary::getCourseScheduleType, teacherDefaultMusicGroupSalary -> teacherDefaultMusicGroupSalary));
 | 
	
		
			
				|  |  |                      TeacherDefaultMusicGroupSalary teacherDefaultMusicGroupSalary = collect.get(courseSchedule.getType());
 | 
	
		
			
				|  |  | -                    if(studentNum>5){
 | 
	
		
			
				|  |  | -                        studentNum=5;
 | 
	
		
			
				|  |  | +                    if (studentNum > 5) {
 | 
	
		
			
				|  |  | +                        studentNum = 5;
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                      BigDecimal salary = JSON.parseObject(teacherDefaultMusicGroupSalary.getSalaryRuleJson()).getBigDecimal(studentNum.toString());
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -1096,108 +1094,108 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  | -	public boolean addStudentToClassGroupAndCourseArranging(Integer studentId, String classGroupIdListStr,
 | 
	
		
			
				|  |  | +    public boolean addStudentToClassGroupAndCourseArranging(Integer studentId, String classGroupIdListStr,
 | 
	
		
			
				|  |  |                                                              String batchNo,
 | 
	
		
			
				|  |  | -			List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList) {
 | 
	
		
			
				|  |  | +                                                            List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList) {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          //如果学员已经在某些班级,
 | 
	
		
			
				|  |  | -        Boolean isExistClassGroup = classGroupStudentMapperDao.existByClassGroupIds(classGroupIdListStr,studentId);
 | 
	
		
			
				|  |  | -        if(isExistClassGroup){
 | 
	
		
			
				|  |  | +        Boolean isExistClassGroup = classGroupStudentMapperDao.existByClassGroupIds(classGroupIdListStr, studentId);
 | 
	
		
			
				|  |  | +        if (isExistClassGroup) {
 | 
	
		
			
				|  |  |              return true;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -		List<ClassGroup> classGroupList = classGroupDao.findClassGroupByIds(classGroupIdListStr);
 | 
	
		
			
				|  |  | -		if (classGroupList == null || classGroupList.size() == 0) {
 | 
	
		
			
				|  |  | -			throw new BizException("班级查询失败");
 | 
	
		
			
				|  |  | -		}
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -		Date date = new Date();
 | 
	
		
			
				|  |  | -		List<CourseScheduleStudentPayment> courseScheduleStudentPayments = new ArrayList<CourseScheduleStudentPayment>();
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -		// 计算单价
 | 
	
		
			
				|  |  | -		Map<CourseScheduleType, BigDecimal> unitPriceMap = new HashMap<CourseSchedule.CourseScheduleType, BigDecimal>();
 | 
	
		
			
				|  |  | -		Map<CourseScheduleType, BigDecimal> originUnitPriceMap = new HashMap<CourseSchedule.CourseScheduleType, BigDecimal>();
 | 
	
		
			
				|  |  | -		Map<CourseScheduleType, BigDecimal> totalCurrentPriceMap = new HashMap<CourseSchedule.CourseScheduleType, BigDecimal>();
 | 
	
		
			
				|  |  | -		Map<CourseScheduleType, BigDecimal> totalOriginPriceMap = new HashMap<CourseSchedule.CourseScheduleType, BigDecimal>();
 | 
	
		
			
				|  |  | -		for (MusicGroupPaymentCalenderCourseSettings musicGroupPaymentCalenderCourseSettings : musicGroupPaymentCalenderCourseSettingsList) {
 | 
	
		
			
				|  |  | -			unitPriceMap.put(
 | 
	
		
			
				|  |  | -					musicGroupPaymentCalenderCourseSettings.getCourseType(),
 | 
	
		
			
				|  |  | -					musicGroupPaymentCalenderCourseSettings.getCourseCurrentPrice().divide(
 | 
	
		
			
				|  |  | -							new BigDecimal(musicGroupPaymentCalenderCourseSettings.getCourseTotalMinuties()),CommonConstants.DECIMAL_FINAL_PLACE,BigDecimal.ROUND_DOWN));
 | 
	
		
			
				|  |  | -			
 | 
	
		
			
				|  |  | -			originUnitPriceMap.put(
 | 
	
		
			
				|  |  | -					musicGroupPaymentCalenderCourseSettings.getCourseType(),
 | 
	
		
			
				|  |  | -					musicGroupPaymentCalenderCourseSettings.getCourseOriginalPrice().divide(
 | 
	
		
			
				|  |  | -							new BigDecimal(musicGroupPaymentCalenderCourseSettings.getCourseTotalMinuties()),CommonConstants.DECIMAL_FINAL_PLACE,BigDecimal.ROUND_DOWN));
 | 
	
		
			
				|  |  | -			
 | 
	
		
			
				|  |  | -			totalCurrentPriceMap.put(musicGroupPaymentCalenderCourseSettings.getCourseType(), musicGroupPaymentCalenderCourseSettings.getCourseCurrentPrice());
 | 
	
		
			
				|  |  | -			totalOriginPriceMap.put(musicGroupPaymentCalenderCourseSettings.getCourseType(), musicGroupPaymentCalenderCourseSettings.getCourseOriginalPrice());
 | 
	
		
			
				|  |  | -		}
 | 
	
		
			
				|  |  | -		
 | 
	
		
			
				|  |  | -		Map<CourseScheduleType, BigDecimal> totalPriceMap = new HashMap<CourseSchedule.CourseScheduleType, BigDecimal>();
 | 
	
		
			
				|  |  | -		Map<CourseScheduleType, BigDecimal> totalOrignPriceMap = new HashMap<CourseSchedule.CourseScheduleType, BigDecimal>();
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -		BigDecimal unitPrice = new BigDecimal(0);
 | 
	
		
			
				|  |  | -		BigDecimal originUnitPrice = new BigDecimal(0);
 | 
	
		
			
				|  |  | -		CourseScheduleType courseType = null;
 | 
	
		
			
				|  |  | -		for (ClassGroup classGroup : classGroupList) {
 | 
	
		
			
				|  |  | -			// 1、增加班级人数
 | 
	
		
			
				|  |  | -			classGroupDao.addStudentNum(classGroup);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -			// 2、插入关联关系
 | 
	
		
			
				|  |  | -			ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper();
 | 
	
		
			
				|  |  | -			classGroupStudentMapper.setMusicGroupId(classGroup.getMusicGroupId());
 | 
	
		
			
				|  |  | -			classGroupStudentMapper.setClassGroupId(classGroup.getId());
 | 
	
		
			
				|  |  | -			classGroupStudentMapper.setUserId(studentId);
 | 
	
		
			
				|  |  | -			classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
 | 
	
		
			
				|  |  | -			classGroupStudentMapper.setGroupType(classGroup.getGroupType());
 | 
	
		
			
				|  |  | -			classGroupStudentMapper.setCreateTime(date);
 | 
	
		
			
				|  |  | -			classGroupStudentMapperDao.insert(classGroupStudentMapper);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -			// 3、学生加入级未开始课程
 | 
	
		
			
				|  |  | -			List<CourseSchedule> courseScheduleList = courseScheduleService.findNoStartCoursesByClassGroupId(classGroup.getId());
 | 
	
		
			
				|  |  | -			for (CourseSchedule courseSchedule : courseScheduleList) {
 | 
	
		
			
				|  |  | -				CourseScheduleStudentPayment courseScheduleStudentPayment = new CourseScheduleStudentPayment();
 | 
	
		
			
				|  |  | -				courseScheduleStudentPayment.setCourseSchedule(courseSchedule);
 | 
	
		
			
				|  |  | -				courseScheduleStudentPayment.setGroupType(classGroup.getGroupType());
 | 
	
		
			
				|  |  | -				courseScheduleStudentPayment.setMusicGroupId(classGroup.getMusicGroupId());
 | 
	
		
			
				|  |  | -				courseScheduleStudentPayment.setCourseScheduleId(courseSchedule.getId());
 | 
	
		
			
				|  |  | -				courseScheduleStudentPayment.setUserId(studentId);
 | 
	
		
			
				|  |  | -				courseScheduleStudentPayment.setBatchNo(batchNo);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -				unitPrice = unitPriceMap.get(courseSchedule.getType());
 | 
	
		
			
				|  |  | -				if (unitPrice != null) {
 | 
	
		
			
				|  |  | -					courseType = courseSchedule.getType();
 | 
	
		
			
				|  |  | -					BigDecimal duration = new BigDecimal(DateUtil.minutesBetween(courseSchedule.getStartClassTime(), courseSchedule.getEndClassTime()));
 | 
	
		
			
				|  |  | -					courseScheduleStudentPayment.setExpectPrice(unitPrice.multiply(duration).setScale(2, BigDecimal.ROUND_DOWN));
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -					if (totalPriceMap.containsKey(courseType)) {
 | 
	
		
			
				|  |  | -						totalPriceMap.put(courseType, totalPriceMap.get(courseType).add(courseScheduleStudentPayment.getExpectPrice()));
 | 
	
		
			
				|  |  | -					} else {
 | 
	
		
			
				|  |  | -						totalPriceMap.put(courseType, courseScheduleStudentPayment.getExpectPrice());
 | 
	
		
			
				|  |  | -					}
 | 
	
		
			
				|  |  | -				}
 | 
	
		
			
				|  |  | -				
 | 
	
		
			
				|  |  | -				originUnitPrice = originUnitPriceMap.get(courseSchedule.getType());
 | 
	
		
			
				|  |  | -				if (originUnitPrice != null) {
 | 
	
		
			
				|  |  | -					courseType = courseSchedule.getType();
 | 
	
		
			
				|  |  | -					BigDecimal duration = new BigDecimal(DateUtil.minutesBetween(courseSchedule.getStartClassTime(), courseSchedule.getEndClassTime()));
 | 
	
		
			
				|  |  | -					courseScheduleStudentPayment.setOriginalPrice(originUnitPrice.multiply(duration).setScale(2, BigDecimal.ROUND_DOWN));
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -					if (totalOrignPriceMap.containsKey(courseType)) {
 | 
	
		
			
				|  |  | -						totalOrignPriceMap.put(courseType, totalOrignPriceMap.get(courseType).add(courseScheduleStudentPayment.getOriginalPrice()));
 | 
	
		
			
				|  |  | -					} else {
 | 
	
		
			
				|  |  | -						totalOrignPriceMap.put(courseType, courseScheduleStudentPayment.getOriginalPrice());
 | 
	
		
			
				|  |  | -					}
 | 
	
		
			
				|  |  | -				}
 | 
	
		
			
				|  |  | -				courseScheduleStudentPayment.setClassGroupId(classGroup.getId());
 | 
	
		
			
				|  |  | -				courseScheduleStudentPayment.setCreateTime(date);
 | 
	
		
			
				|  |  | -				courseScheduleStudentPayment.setUpdateTime(date);
 | 
	
		
			
				|  |  | -				courseScheduleStudentPayments.add(courseScheduleStudentPayment);
 | 
	
		
			
				|  |  | -			}
 | 
	
		
			
				|  |  | +        List<ClassGroup> classGroupList = classGroupDao.findClassGroupByIds(classGroupIdListStr);
 | 
	
		
			
				|  |  | +        if (classGroupList == null || classGroupList.size() == 0) {
 | 
	
		
			
				|  |  | +            throw new BizException("班级查询失败");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        Date date = new Date();
 | 
	
		
			
				|  |  | +        List<CourseScheduleStudentPayment> courseScheduleStudentPayments = new ArrayList<CourseScheduleStudentPayment>();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        // 计算单价
 | 
	
		
			
				|  |  | +        Map<CourseScheduleType, BigDecimal> unitPriceMap = new HashMap<CourseSchedule.CourseScheduleType, BigDecimal>();
 | 
	
		
			
				|  |  | +        Map<CourseScheduleType, BigDecimal> originUnitPriceMap = new HashMap<CourseSchedule.CourseScheduleType, BigDecimal>();
 | 
	
		
			
				|  |  | +        Map<CourseScheduleType, BigDecimal> totalCurrentPriceMap = new HashMap<CourseSchedule.CourseScheduleType, BigDecimal>();
 | 
	
		
			
				|  |  | +        Map<CourseScheduleType, BigDecimal> totalOriginPriceMap = new HashMap<CourseSchedule.CourseScheduleType, BigDecimal>();
 | 
	
		
			
				|  |  | +        for (MusicGroupPaymentCalenderCourseSettings musicGroupPaymentCalenderCourseSettings : musicGroupPaymentCalenderCourseSettingsList) {
 | 
	
		
			
				|  |  | +            unitPriceMap.put(
 | 
	
		
			
				|  |  | +                    musicGroupPaymentCalenderCourseSettings.getCourseType(),
 | 
	
		
			
				|  |  | +                    musicGroupPaymentCalenderCourseSettings.getCourseCurrentPrice().divide(
 | 
	
		
			
				|  |  | +                            new BigDecimal(musicGroupPaymentCalenderCourseSettings.getCourseTotalMinuties()), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            originUnitPriceMap.put(
 | 
	
		
			
				|  |  | +                    musicGroupPaymentCalenderCourseSettings.getCourseType(),
 | 
	
		
			
				|  |  | +                    musicGroupPaymentCalenderCourseSettings.getCourseOriginalPrice().divide(
 | 
	
		
			
				|  |  | +                            new BigDecimal(musicGroupPaymentCalenderCourseSettings.getCourseTotalMinuties()), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            totalCurrentPriceMap.put(musicGroupPaymentCalenderCourseSettings.getCourseType(), musicGroupPaymentCalenderCourseSettings.getCourseCurrentPrice());
 | 
	
		
			
				|  |  | +            totalOriginPriceMap.put(musicGroupPaymentCalenderCourseSettings.getCourseType(), musicGroupPaymentCalenderCourseSettings.getCourseOriginalPrice());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        Map<CourseScheduleType, BigDecimal> totalPriceMap = new HashMap<CourseSchedule.CourseScheduleType, BigDecimal>();
 | 
	
		
			
				|  |  | +        Map<CourseScheduleType, BigDecimal> totalOrignPriceMap = new HashMap<CourseSchedule.CourseScheduleType, BigDecimal>();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        BigDecimal unitPrice = new BigDecimal(0);
 | 
	
		
			
				|  |  | +        BigDecimal originUnitPrice = new BigDecimal(0);
 | 
	
		
			
				|  |  | +        CourseScheduleType courseType = null;
 | 
	
		
			
				|  |  | +        for (ClassGroup classGroup : classGroupList) {
 | 
	
		
			
				|  |  | +            // 1、增加班级人数
 | 
	
		
			
				|  |  | +            classGroupDao.addStudentNum(classGroup);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            // 2、插入关联关系
 | 
	
		
			
				|  |  | +            ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper();
 | 
	
		
			
				|  |  | +            classGroupStudentMapper.setMusicGroupId(classGroup.getMusicGroupId());
 | 
	
		
			
				|  |  | +            classGroupStudentMapper.setClassGroupId(classGroup.getId());
 | 
	
		
			
				|  |  | +            classGroupStudentMapper.setUserId(studentId);
 | 
	
		
			
				|  |  | +            classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
 | 
	
		
			
				|  |  | +            classGroupStudentMapper.setGroupType(classGroup.getGroupType());
 | 
	
		
			
				|  |  | +            classGroupStudentMapper.setCreateTime(date);
 | 
	
		
			
				|  |  | +            classGroupStudentMapperDao.insert(classGroupStudentMapper);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            // 3、学生加入级未开始课程
 | 
	
		
			
				|  |  | +            List<CourseSchedule> courseScheduleList = courseScheduleService.findNoStartCoursesByClassGroupId(classGroup.getId());
 | 
	
		
			
				|  |  | +            for (CourseSchedule courseSchedule : courseScheduleList) {
 | 
	
		
			
				|  |  | +                CourseScheduleStudentPayment courseScheduleStudentPayment = new CourseScheduleStudentPayment();
 | 
	
		
			
				|  |  | +                courseScheduleStudentPayment.setCourseSchedule(courseSchedule);
 | 
	
		
			
				|  |  | +                courseScheduleStudentPayment.setGroupType(classGroup.getGroupType());
 | 
	
		
			
				|  |  | +                courseScheduleStudentPayment.setMusicGroupId(classGroup.getMusicGroupId());
 | 
	
		
			
				|  |  | +                courseScheduleStudentPayment.setCourseScheduleId(courseSchedule.getId());
 | 
	
		
			
				|  |  | +                courseScheduleStudentPayment.setUserId(studentId);
 | 
	
		
			
				|  |  | +                courseScheduleStudentPayment.setBatchNo(batchNo);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                unitPrice = unitPriceMap.get(courseSchedule.getType());
 | 
	
		
			
				|  |  | +                if (unitPrice != null) {
 | 
	
		
			
				|  |  | +                    courseType = courseSchedule.getType();
 | 
	
		
			
				|  |  | +                    BigDecimal duration = new BigDecimal(DateUtil.minutesBetween(courseSchedule.getStartClassTime(), courseSchedule.getEndClassTime()));
 | 
	
		
			
				|  |  | +                    courseScheduleStudentPayment.setExpectPrice(unitPrice.multiply(duration).setScale(2, BigDecimal.ROUND_DOWN));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                    if (totalPriceMap.containsKey(courseType)) {
 | 
	
		
			
				|  |  | +                        totalPriceMap.put(courseType, totalPriceMap.get(courseType).add(courseScheduleStudentPayment.getExpectPrice()));
 | 
	
		
			
				|  |  | +                    } else {
 | 
	
		
			
				|  |  | +                        totalPriceMap.put(courseType, courseScheduleStudentPayment.getExpectPrice());
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                originUnitPrice = originUnitPriceMap.get(courseSchedule.getType());
 | 
	
		
			
				|  |  | +                if (originUnitPrice != null) {
 | 
	
		
			
				|  |  | +                    courseType = courseSchedule.getType();
 | 
	
		
			
				|  |  | +                    BigDecimal duration = new BigDecimal(DateUtil.minutesBetween(courseSchedule.getStartClassTime(), courseSchedule.getEndClassTime()));
 | 
	
		
			
				|  |  | +                    courseScheduleStudentPayment.setOriginalPrice(originUnitPrice.multiply(duration).setScale(2, BigDecimal.ROUND_DOWN));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                    if (totalOrignPriceMap.containsKey(courseType)) {
 | 
	
		
			
				|  |  | +                        totalOrignPriceMap.put(courseType, totalOrignPriceMap.get(courseType).add(courseScheduleStudentPayment.getOriginalPrice()));
 | 
	
		
			
				|  |  | +                    } else {
 | 
	
		
			
				|  |  | +                        totalOrignPriceMap.put(courseType, courseScheduleStudentPayment.getOriginalPrice());
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                courseScheduleStudentPayment.setClassGroupId(classGroup.getId());
 | 
	
		
			
				|  |  | +                courseScheduleStudentPayment.setCreateTime(date);
 | 
	
		
			
				|  |  | +                courseScheduleStudentPayment.setUpdateTime(date);
 | 
	
		
			
				|  |  | +                courseScheduleStudentPayments.add(courseScheduleStudentPayment);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              //4、调整未上课课酬
 | 
	
		
			
				|  |  |              List<ClassGroupTeacherMapper> classGroupTeachers = classGroupTeacherMapperService.getClassGroupTeachers(classGroup.getId());
 | 
	
		
			
				|  |  | -            if ((classGroup.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE)||classGroup.getType().equals(ClassGroupTypeEnum.HIGH)) && courseScheduleList.size() > 0) {
 | 
	
		
			
				|  |  | +            if ((classGroup.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE) || classGroup.getType().equals(ClassGroupTypeEnum.HIGH)) && courseScheduleList.size() > 0) {
 | 
	
		
			
				|  |  |                  Date nowDate = new Date();
 | 
	
		
			
				|  |  |                  List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaryList = new ArrayList<>();
 | 
	
		
			
				|  |  |                  List<Long> courseScheduleIds = courseScheduleList.stream().map(CourseSchedule::getId).collect(Collectors.toList());
 | 
	
	
		
			
				|  | @@ -1211,12 +1209,12 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |                          Map<CourseSchedule.CourseScheduleType, TeacherDefaultMusicGroupSalary> collect = teacherSalaryList.stream().collect(Collectors.toMap(TeacherDefaultMusicGroupSalary::getCourseScheduleType, teacherDefaultMusicGroupSalary -> teacherDefaultMusicGroupSalary));
 | 
	
		
			
				|  |  |                          TeacherDefaultMusicGroupSalary teacherDefaultMusicGroupSalary = collect.get(CourseSchedule.CourseScheduleType.HIGH_ONLINE);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -                        int studentNum = classGroup.getStudentNum()+1;
 | 
	
		
			
				|  |  | -                        if(studentNum>5){
 | 
	
		
			
				|  |  | -                            studentNum=5;
 | 
	
		
			
				|  |  | +                        int studentNum = classGroup.getStudentNum() + 1;
 | 
	
		
			
				|  |  | +                        if (studentNum > 5) {
 | 
	
		
			
				|  |  | +                            studentNum = 5;
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -                        BigDecimal salary = JSON.parseObject(teacherDefaultMusicGroupSalary.getSalaryRuleJson()).getBigDecimal(studentNum+"");
 | 
	
		
			
				|  |  | +                        BigDecimal salary = JSON.parseObject(teacherDefaultMusicGroupSalary.getSalaryRuleJson()).getBigDecimal(studentNum + "");
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                          CourseScheduleTeacherSalary courseScheduleTeacherSalary = new CourseScheduleTeacherSalary();
 | 
	
		
			
				|  |  |                          courseScheduleTeacherSalary.setCourseScheduleId(courseSchedule.getId());
 | 
	
	
		
			
				|  | @@ -1234,36 +1232,36 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |                  courseScheduleTeacherSalaryService.batchInsert(courseScheduleTeacherSalaryList);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -			// 5、加入班级群组
 | 
	
		
			
				|  |  | -			ImGroupMember[] imGroupMembers = new ImGroupMember[] { new ImGroupMember(studentId.toString()) };
 | 
	
		
			
				|  |  | -			imFeignService.groupJoin(new ImGroupModel(classGroup.getId().toString(), imGroupMembers, classGroup.getName()));
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -		}
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -		if (courseScheduleStudentPayments.size() > 0) {
 | 
	
		
			
				|  |  | -			// 排序
 | 
	
		
			
				|  |  | -			Collections.sort(courseScheduleStudentPayments);
 | 
	
		
			
				|  |  | -			List<CourseScheduleType> list = new ArrayList<CourseSchedule.CourseScheduleType>();
 | 
	
		
			
				|  |  | -			for (CourseScheduleStudentPayment courseScheduleStudentPayment : courseScheduleStudentPayments) {
 | 
	
		
			
				|  |  | -				courseType = courseScheduleStudentPayment.getCourseSchedule().getType();
 | 
	
		
			
				|  |  | -				if (!list.contains(courseType)) {
 | 
	
		
			
				|  |  | -					list.add(courseType);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -					// 修改第一节课的金额
 | 
	
		
			
				|  |  | -					courseScheduleStudentPayment.setExpectPrice(courseScheduleStudentPayment.getExpectPrice().add(
 | 
	
		
			
				|  |  | -							totalCurrentPriceMap.get(courseType).subtract(totalPriceMap.get(courseType))));
 | 
	
		
			
				|  |  | -					
 | 
	
		
			
				|  |  | -					courseScheduleStudentPayment.setOriginalPrice(courseScheduleStudentPayment.getOriginalPrice().add(
 | 
	
		
			
				|  |  | -							totalOriginPriceMap.get(courseType).subtract(totalOrignPriceMap.get(courseType))));
 | 
	
		
			
				|  |  | -				}
 | 
	
		
			
				|  |  | -			}
 | 
	
		
			
				|  |  | -			courseScheduleStudentPaymentService.batchInsert(courseScheduleStudentPayments);
 | 
	
		
			
				|  |  | -		}
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -		return true;
 | 
	
		
			
				|  |  | -	}
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -	@Override
 | 
	
		
			
				|  |  | +            // 5、加入班级群组
 | 
	
		
			
				|  |  | +            ImGroupMember[] imGroupMembers = new ImGroupMember[]{new ImGroupMember(studentId.toString())};
 | 
	
		
			
				|  |  | +            imFeignService.groupJoin(new ImGroupModel(classGroup.getId().toString(), imGroupMembers, classGroup.getName()));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if (courseScheduleStudentPayments.size() > 0) {
 | 
	
		
			
				|  |  | +            // 排序
 | 
	
		
			
				|  |  | +            Collections.sort(courseScheduleStudentPayments);
 | 
	
		
			
				|  |  | +            List<CourseScheduleType> list = new ArrayList<CourseSchedule.CourseScheduleType>();
 | 
	
		
			
				|  |  | +            for (CourseScheduleStudentPayment courseScheduleStudentPayment : courseScheduleStudentPayments) {
 | 
	
		
			
				|  |  | +                courseType = courseScheduleStudentPayment.getCourseSchedule().getType();
 | 
	
		
			
				|  |  | +                if (!list.contains(courseType)) {
 | 
	
		
			
				|  |  | +                    list.add(courseType);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                    // 修改第一节课的金额
 | 
	
		
			
				|  |  | +                    courseScheduleStudentPayment.setExpectPrice(courseScheduleStudentPayment.getExpectPrice().add(
 | 
	
		
			
				|  |  | +                            totalCurrentPriceMap.get(courseType).subtract(totalPriceMap.get(courseType))));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                    courseScheduleStudentPayment.setOriginalPrice(courseScheduleStudentPayment.getOriginalPrice().add(
 | 
	
		
			
				|  |  | +                            totalOriginPriceMap.get(courseType).subtract(totalOrignPriceMap.get(courseType))));
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            courseScheduleStudentPaymentService.batchInsert(courseScheduleStudentPayments);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        return true;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  |      public List<ClassGroup> findNoClassSubjects(String musicGroupId) {
 | 
	
		
			
				|  |  |          return classGroupDao.findNoClassSubjects(musicGroupId);
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -1512,8 +1510,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -	public boolean updateClassStudentNum(Integer classGroupId) {
 | 
	
		
			
				|  |  | -    	ClassGroup classGroup = classGroupDao.lockClassGroup(classGroupId);
 | 
	
		
			
				|  |  | +    public boolean updateClassStudentNum(Integer classGroupId) {
 | 
	
		
			
				|  |  | +        ClassGroup classGroup = classGroupDao.lockClassGroup(classGroupId);
 | 
	
		
			
				|  |  |          if (Objects.isNull(classGroup)) {
 | 
	
		
			
				|  |  |              throw new BizException("班级不存在");
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -1524,9 +1522,9 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |          classGroupDao.update(classGroup);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          return true;
 | 
	
		
			
				|  |  | -	}
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -	@Override
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  |      public TeacherClassHeadInfo findTeacherClassGroupInfo(Integer classGroupId) {
 | 
	
		
			
				|  |  |          if (Objects.isNull(classGroupId)) {
 | 
	
		
			
				|  |  |              throw new BizException("请指定班级");
 | 
	
	
		
			
				|  | @@ -1616,9 +1614,9 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |          truantStudent.addAll(leaveStudent);
 | 
	
		
			
				|  |  |          if (!CollectionUtils.isEmpty(truantStudent)) {
 | 
	
		
			
				|  |  |              CourseSchedule schedule = courseScheduleDao.get(courseScheduleId);
 | 
	
		
			
				|  |  | -            if(schedule.getGroupType() == MUSIC){
 | 
	
		
			
				|  |  | +            if (schedule.getGroupType() == MUSIC) {
 | 
	
		
			
				|  |  |                  Set<Long> collect = truantStudent.stream().map(e -> e.getStudentId()).collect(Collectors.toSet());
 | 
	
		
			
				|  |  | -                Map<Integer,String> paymentStatusMap = MapUtil.convertIntegerMap(musicGroupPaymentCalenderDao.queryUserCoursePaymentStatus(collect,schedule.getMusicGroupId()));
 | 
	
		
			
				|  |  | +                Map<Integer, String> paymentStatusMap = MapUtil.convertIntegerMap(musicGroupPaymentCalenderDao.queryUserCoursePaymentStatus(collect, schedule.getMusicGroupId()));
 | 
	
		
			
				|  |  |                  truantStudent.forEach(studentAttendanceViewDto -> {
 | 
	
		
			
				|  |  |                      studentAttendanceViewDto.setPaymentStatus(paymentStatusMap.get(studentAttendanceViewDto.getStudentId().intValue()));
 | 
	
		
			
				|  |  |                  });
 | 
	
	
		
			
				|  | @@ -1671,7 +1669,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  | -    public ClassGroup classGroupAdjust(List<ClassGroup4MixDto> classGroup4MixDtos){
 | 
	
		
			
				|  |  | +    public ClassGroup classGroupAdjust(List<ClassGroup4MixDto> classGroup4MixDtos) {
 | 
	
		
			
				|  |  |          Date date = new Date();
 | 
	
		
			
				|  |  |          String musicGroupId = classGroup4MixDtos.get(0).getMusicGroupId();
 | 
	
		
			
				|  |  |          MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
 | 
	
	
		
			
				|  | @@ -1701,7 +1699,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |          String subjectIds = subjectList.stream().map(subject -> subject.getId().toString()).collect(Collectors.joining(","));
 | 
	
		
			
				|  |  |          String subjectNames = subjectList.stream().map(subject -> subject.getName()).collect(Collectors.joining("/"));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        if(classGroup4MixDtos.get(0).getType().equals(ClassGroupTypeEnum.MUSIC_NETWORK)){
 | 
	
		
			
				|  |  | +        if (classGroup4MixDtos.get(0).getType().equals(ClassGroupTypeEnum.MUSIC_NETWORK)) {
 | 
	
		
			
				|  |  |              teachMode = TeachModeEnum.ONLINE;
 | 
	
		
			
				|  |  |              List<String> studentNames = studentDao.getStudentNames(studentIdList);
 | 
	
		
			
				|  |  |              classGroup4MixDtos.get(0).setClassGroupName(subjectNames + "•" + StringUtils.join(studentNames, ","));
 | 
	
	
		
			
				|  | @@ -1754,7 +1752,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |          List<ClassGroupTeacherMapper> classGroupTeacherMapperList = classGroup4MixDtos.get(0).getClassGroupTeacherMapperList();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          Set<Integer> noRepeatTeacherIds = classGroupTeacherMapperList.stream().map(ClassGroupTeacherMapper::getUserId).collect(Collectors.toSet());
 | 
	
		
			
				|  |  | -        if(noRepeatTeacherIds.size()!=classGroupTeacherMapperList.size()){
 | 
	
		
			
				|  |  | +        if (noRepeatTeacherIds.size() != classGroupTeacherMapperList.size()) {
 | 
	
		
			
				|  |  |              throw new BizException("主教与助教存在冲突");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -1791,7 +1789,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
 | 
	
		
			
				|  |  |          for (ClassGroup4MixDto classGroup4MixDto : classGroup4MixDtos) {
 | 
	
		
			
				|  |  | -            if(classGroup4MixDto.getCourseTimeDtoList() == null || classGroup4MixDto.getCourseTimeDtoList().size() == 0){
 | 
	
		
			
				|  |  | +            if (classGroup4MixDto.getCourseTimeDtoList() == null || classGroup4MixDto.getCourseTimeDtoList().size() == 0) {
 | 
	
		
			
				|  |  |                  break;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              //5、插入班级排课信息
 | 
	
	
		
			
				|  | @@ -1799,13 +1797,13 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              long totalCourseDuration = 0;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            if(!courseTypeMinutesMap.containsKey(classGroup4MixDto.getCourseType().getCode())){
 | 
	
		
			
				|  |  | +            if (!courseTypeMinutesMap.containsKey(classGroup4MixDto.getCourseType().getCode())) {
 | 
	
		
			
				|  |  |                  throw new BizException("{}课程类型暂无剩余课程时长", classGroup4MixDto.getCourseType().getMsg());
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              Integer totalMinutes = courseTypeMinutesMap.get(classGroup4MixDto.getCourseType().getCode());
 | 
	
		
			
				|  |  |  //            classGroup4MixDto.setCourseTimes(totalMinutes/(int)courseDuration);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            if(classGroup4MixDto.getCourseTimes()<=0){
 | 
	
		
			
				|  |  | +            if (classGroup4MixDto.getCourseTimes() <= 0) {
 | 
	
		
			
				|  |  |                  throw new BizException("{}课程类型剩余课程时长不足", classGroup4MixDto.getCourseType().getMsg());
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -1838,7 +1836,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                      totalCourseDuration += classCourseDuration;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -                    if (totalCourseDuration>totalMinutes) {
 | 
	
		
			
				|  |  | +                    if (totalCourseDuration > totalMinutes) {
 | 
	
		
			
				|  |  |                          break WhileNode;
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -1862,7 +1860,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |                      courseSchedule.setOrganId(musicGroup.getOrganId());
 | 
	
		
			
				|  |  |                      if (classGroup4MixDto.getCourseType().equals(CourseSchedule.CourseScheduleType.MIX)) {
 | 
	
		
			
				|  |  |                          courseSchedule.setName(classGroup4MixDto.getCourseType().getMsg());
 | 
	
		
			
				|  |  | -                    }else if(classGroup4MixDto.getCourseType().equals(CourseScheduleType.MUSIC_NETWORK)){
 | 
	
		
			
				|  |  | +                    } else if (classGroup4MixDto.getCourseType().equals(CourseScheduleType.MUSIC_NETWORK)) {
 | 
	
		
			
				|  |  |                          courseSchedule.setName(classGroup.getName());
 | 
	
		
			
				|  |  |                      } else {
 | 
	
		
			
				|  |  |                          courseSchedule.setName(subjectNames + "-" + classGroup4MixDto.getCourseType().getMsg());
 | 
	
	
		
			
				|  | @@ -1892,9 +1890,9 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        if(courseScheduleList.size() > 0){
 | 
	
		
			
				|  |  | +        if (courseScheduleList.size() > 0) {
 | 
	
		
			
				|  |  |              //检测新排课冲突
 | 
	
		
			
				|  |  | -            courseScheduleService.checkNewCourseSchedules(courseScheduleList, false,false);
 | 
	
		
			
				|  |  | +            courseScheduleService.checkNewCourseSchedules(courseScheduleList, false, false);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          //老师结算表
 | 
	
	
		
			
				|  | @@ -1909,7 +1907,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  | -    public List<CourseSchedule> getCourseSchedules(ClassGroup4MixDto classGroup4MixDto,List<CourseSchedule> courseScheduleList,MusicGroupStudentClassAdjust classAdjust){
 | 
	
		
			
				|  |  | +    public List<CourseSchedule> getCourseSchedules(ClassGroup4MixDto classGroup4MixDto, List<CourseSchedule> courseScheduleList, MusicGroupStudentClassAdjust classAdjust) {
 | 
	
		
			
				|  |  |          Date date = new Date();
 | 
	
		
			
				|  |  |          String musicGroupId = classGroup4MixDto.getMusicGroupId();
 | 
	
		
			
				|  |  |          MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
 | 
	
	
		
			
				|  | @@ -1918,7 +1916,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |          TeachModeEnum teachMode = TeachModeEnum.OFFLINE;
 | 
	
		
			
				|  |  |          if (classGroup4MixDto.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE)) {
 | 
	
		
			
				|  |  |              teachMode = TeachModeEnum.ONLINE;
 | 
	
		
			
				|  |  | -        }else if(classGroup4MixDto.getType().equals(ClassGroupTypeEnum.MUSIC_NETWORK)){
 | 
	
		
			
				|  |  | +        } else if (classGroup4MixDto.getType().equals(ClassGroupTypeEnum.MUSIC_NETWORK)) {
 | 
	
		
			
				|  |  |              teachMode = TeachModeEnum.ONLINE;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -1945,7 +1943,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |          long classCourseDuration = Integer.parseInt(jsonObject.get(classGroup4MixDto.getCourseType().getCode()).toString());
 | 
	
		
			
				|  |  |  //
 | 
	
		
			
				|  |  |          Map<String, Integer> classCourseMinuteMap = JSON.parseObject(classCourseMinute, Map.class);
 | 
	
		
			
				|  |  | -        classGroup4MixDto.setCourseTimes(classCourseMinuteMap.get(classGroup4MixDto.getCourseType().getCode())/(int)classCourseDuration);
 | 
	
		
			
				|  |  | +        classGroup4MixDto.setCourseTimes(classCourseMinuteMap.get(classGroup4MixDto.getCourseType().getCode()) / (int) classCourseDuration);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          List<Integer> studentIdList = classGroup4MixDto.getStudents();
 | 
	
		
			
				|  |  |          List<StudentRegistration> studentList = studentRegistrationService.findStudentListByUserIdList(musicGroupId, studentIdList);
 | 
	
	
		
			
				|  | @@ -1999,7 +1997,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |                  courseSchedule.setClassGroupId(classGroup.getId());
 | 
	
		
			
				|  |  |                  if (classGroup4MixDto.getCourseType().equals(CourseSchedule.CourseScheduleType.MIX)) {
 | 
	
		
			
				|  |  |                      courseSchedule.setName(classGroup4MixDto.getCourseType().getMsg());
 | 
	
		
			
				|  |  | -                }else if(classGroup4MixDto.getCourseType().equals(CourseScheduleType.MUSIC_NETWORK)){
 | 
	
		
			
				|  |  | +                } else if (classGroup4MixDto.getCourseType().equals(CourseScheduleType.MUSIC_NETWORK)) {
 | 
	
		
			
				|  |  |                      courseSchedule.setName(classGroup.getName());
 | 
	
		
			
				|  |  |                  } else {
 | 
	
		
			
				|  |  |                      courseSchedule.setName(subjectNames + "-" + classGroup4MixDto.getCourseType().getMsg());
 | 
	
	
		
			
				|  | @@ -2018,7 +2016,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  | -    public ClassGroup createClassGroup(ClassGroup4MixDto classGroup4MixDto){
 | 
	
		
			
				|  |  | +    public ClassGroup createClassGroup(ClassGroup4MixDto classGroup4MixDto) {
 | 
	
		
			
				|  |  |          Date date = new Date();
 | 
	
		
			
				|  |  |          String musicGroupId = classGroup4MixDto.getMusicGroupId();
 | 
	
		
			
				|  |  |          List<Integer> studentIdList = classGroup4MixDto.getStudents();
 | 
	
	
		
			
				|  | @@ -2032,7 +2030,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          List<Subject> subjectList = subjectService.findBySubjectByIdList(subjectIdList);
 | 
	
		
			
				|  |  |          String subjectIds = subjectList.stream().map(subject -> subject.getId().toString()).collect(Collectors.joining(","));
 | 
	
		
			
				|  |  | -            //1、新建班级
 | 
	
		
			
				|  |  | +        //1、新建班级
 | 
	
		
			
				|  |  |          ClassGroup classGroup = new ClassGroup();
 | 
	
		
			
				|  |  |          classGroup.setMusicGroupId(classGroup4MixDto.getMusicGroupId());
 | 
	
		
			
				|  |  |          classGroup.setSubjectIdList(subjectIds);
 | 
	
	
		
			
				|  | @@ -2051,22 +2049,22 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  | -    public List<CourseSchedule> autoAdjust(ClassGroup4MixDto classGroup4MixDto,List<CourseSchedule> courseScheduleList,MusicGroupStudentClassAdjust classAdjust){
 | 
	
		
			
				|  |  | +    public List<CourseSchedule> autoAdjust(ClassGroup4MixDto classGroup4MixDto, List<CourseSchedule> courseScheduleList, MusicGroupStudentClassAdjust classAdjust) {
 | 
	
		
			
				|  |  |          Boolean checkFlag = courseScheduleService.checkNewCourseSchedules(courseScheduleList, false, true);
 | 
	
		
			
				|  |  | -        if(!checkFlag){
 | 
	
		
			
				|  |  | +        if (!checkFlag) {
 | 
	
		
			
				|  |  |              //排课开始时间加一周
 | 
	
		
			
				|  |  |              Date stringToDate = DateUtil.stringToDate(classGroup4MixDto.getStartDate(), DateUtil.ISO_EXPANDED_DATE_FORMAT);
 | 
	
		
			
				|  |  | -            classGroup4MixDto.setStartDate(DateUtil.format(DateUtil.addDays(stringToDate, 7),DateUtil.ISO_EXPANDED_DATE_FORMAT));
 | 
	
		
			
				|  |  | +            classGroup4MixDto.setStartDate(DateUtil.format(DateUtil.addDays(stringToDate, 7), DateUtil.ISO_EXPANDED_DATE_FORMAT));
 | 
	
		
			
				|  |  |              //再次尝试排课
 | 
	
		
			
				|  |  | -            courseScheduleList = getCourseSchedules(classGroup4MixDto,courseScheduleList,classAdjust);
 | 
	
		
			
				|  |  | -            autoAdjust(classGroup4MixDto,courseScheduleList,classAdjust);
 | 
	
		
			
				|  |  | +            courseScheduleList = getCourseSchedules(classGroup4MixDto, courseScheduleList, classAdjust);
 | 
	
		
			
				|  |  | +            autoAdjust(classGroup4MixDto, courseScheduleList, classAdjust);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return courseScheduleList;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  | -    public ClassGroup classGroupAdjust2(ClassGroup4MixDto classGroup4MixDto){
 | 
	
		
			
				|  |  | +    public ClassGroup classGroupAdjust2(ClassGroup4MixDto classGroup4MixDto) {
 | 
	
		
			
				|  |  |          Date date = new Date();
 | 
	
		
			
				|  |  |          String musicGroupId = classGroup4MixDto.getMusicGroupId();
 | 
	
		
			
				|  |  |          MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
 | 
	
	
		
			
				|  | @@ -2092,7 +2090,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |          JSONObject jsonObject = JSON.parseObject(classAdjust.getDefaultCourseTypeMinute());
 | 
	
		
			
				|  |  |          long classCourseDuration = Integer.parseInt(jsonObject.get(classGroup4MixDto.getCourseType().getCode()).toString());
 | 
	
		
			
				|  |  |          ClassGroup classGroup = classGroup4MixDto.getClassGroup();
 | 
	
		
			
				|  |  | -        if(classGroup == null){
 | 
	
		
			
				|  |  | +        if (classGroup == null) {
 | 
	
		
			
				|  |  |              //建班
 | 
	
		
			
				|  |  |              classGroup = createClassGroup(classGroup4MixDto);
 | 
	
		
			
				|  |  |              classGroup4MixDto.setClassGroup(classGroup);
 | 
	
	
		
			
				|  | @@ -2131,12 +2129,12 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          //排课
 | 
	
		
			
				|  |  |          List<CourseSchedule> courseScheduleList = new ArrayList<>();
 | 
	
		
			
				|  |  | -        getCourseSchedules(classGroup4MixDto,courseScheduleList,classAdjust);
 | 
	
		
			
				|  |  | +        getCourseSchedules(classGroup4MixDto, courseScheduleList, classAdjust);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          //自动排课,校验冲突
 | 
	
		
			
				|  |  | -        if(courseScheduleList.size() > 0){
 | 
	
		
			
				|  |  | +        if (courseScheduleList.size() > 0) {
 | 
	
		
			
				|  |  |              //冲突校验
 | 
	
		
			
				|  |  | -            courseScheduleList = autoAdjust(classGroup4MixDto,courseScheduleList,classAdjust);
 | 
	
		
			
				|  |  | +            courseScheduleList = autoAdjust(classGroup4MixDto, courseScheduleList, classAdjust);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              List<Integer> allTeacherIds = classGroupTeacherMapperList.stream()
 | 
	
		
			
				|  |  |                      .map(ClassGroupTeacherMapper::getUserId)
 | 
	
	
		
			
				|  | @@ -2176,7 +2174,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              Integer musicGroupStudentClassAdjustId = classGroup4MixDto.getMusicGroupStudentClassAdjustId();
 | 
	
		
			
				|  |  |              //学生结算表
 | 
	
		
			
				|  |  | -            courseScheduleStudentPaymentService.createForMusicGroup(courseScheduleList, studentIdList,musicGroupStudentClassAdjustId);
 | 
	
		
			
				|  |  | +            courseScheduleStudentPaymentService.createForMusicGroup(courseScheduleList, studentIdList, musicGroupStudentClassAdjustId);
 | 
	
		
			
				|  |  |              return classGroup;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return null;
 | 
	
	
		
			
				|  | @@ -2220,7 +2218,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |                  imFeignService.groupJoin(new ImGroupModel(classGroupId.toString(), imGroupMembers, classGroup.getName()));
 | 
	
		
			
				|  |  |              });
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        if (Objects.nonNull(classGroup4MixDtos.get(0).getCourseAddType())&&classGroup4MixDtos.get(0).getCourseAddType().equals("onlyUpdateTeacher")) {
 | 
	
		
			
				|  |  | +        if (Objects.nonNull(classGroup4MixDtos.get(0).getCourseAddType()) && classGroup4MixDtos.get(0).getCourseAddType().equals("onlyUpdateTeacher")) {
 | 
	
		
			
				|  |  |              List<Integer> classGroupIds = new ArrayList<>();
 | 
	
		
			
				|  |  |              classGroupIds.add(classGroupId);
 | 
	
		
			
				|  |  |              // 删除历史记录
 | 
	
	
		
			
				|  | @@ -2244,7 +2242,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          MusicGroup musicGroup = musicGroupDao.get(classGroup.getMusicGroupId());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        Integer schoolId = teachMode.equals(TeachModeEnum.ONLINE)? null : musicGroup.getSchoolId();
 | 
	
		
			
				|  |  | +        Integer schoolId = teachMode.equals(TeachModeEnum.ONLINE) ? null : musicGroup.getSchoolId();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          List<Subject> subjectList = subjectService.findBySubjectByIdList(classGroup.getSubjectIdList());
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -2254,7 +2252,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |          List<ClassGroupTeacherMapper> newClassGroupTeacherMapperList = classGroup4MixDtos.get(0).getClassGroupTeacherMapperList();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          Set<Integer> noRepeatTeacherIds = newClassGroupTeacherMapperList.stream().map(ClassGroupTeacherMapper::getUserId).collect(Collectors.toSet());
 | 
	
		
			
				|  |  | -        if(noRepeatTeacherIds.size()!=newClassGroupTeacherMapperList.size()){
 | 
	
		
			
				|  |  | +        if (noRepeatTeacherIds.size() != newClassGroupTeacherMapperList.size()) {
 | 
	
		
			
				|  |  |              throw new BizException("主教与助教存在冲突");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -2308,14 +2306,14 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |              //3、插入班级排课信息
 | 
	
		
			
				|  |  |              LocalDateTime now = LocalDate.parse(classGroup4MixDto.getStartDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd")).atStartOfDay();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            if(!courseTypeMinutesMap.containsKey(classGroup4MixDto.getCourseType().getCode())){
 | 
	
		
			
				|  |  | +            if (!courseTypeMinutesMap.containsKey(classGroup4MixDto.getCourseType().getCode())) {
 | 
	
		
			
				|  |  |                  throw new BizException("{}课程类型暂无剩余课程时长", classGroup4MixDto.getCourseType().getMsg());
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              Integer totalMinutes = courseTypeMinutesMap.get(classGroup4MixDto.getCourseType().getCode());
 | 
	
		
			
				|  |  |              long totalCourseDuration = 0;
 | 
	
		
			
				|  |  |  //            classGroup4MixDto.setCourseTimes(totalMinutes/(int)courseDuration);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            if(classGroup4MixDto.getCourseTimes()<=0){
 | 
	
		
			
				|  |  | +            if (classGroup4MixDto.getCourseTimes() <= 0) {
 | 
	
		
			
				|  |  |                  throw new BizException("{}课程类型剩余课程时长不足", classGroup4MixDto.getCourseType().getMsg());
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -2347,7 +2345,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                      totalCourseDuration += classCourseDuration;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -                    if (totalCourseDuration>totalMinutes) {
 | 
	
		
			
				|  |  | +                    if (totalCourseDuration > totalMinutes) {
 | 
	
		
			
				|  |  |                          break WhileNode;
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -2403,7 +2401,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |  //        if (classGroup.getType().equals(ClassGroupTypeEnum.SNAP)) {
 | 
	
		
			
				|  |  |  //            courseScheduleService.checkSnapCourseShchedules(courseScheduleList);
 | 
	
		
			
				|  |  |  //        } else {
 | 
	
		
			
				|  |  | -        courseScheduleService.checkNewCourseSchedules(courseScheduleList, false,false);
 | 
	
		
			
				|  |  | +        courseScheduleService.checkNewCourseSchedules(courseScheduleList, false, false);
 | 
	
		
			
				|  |  |  //        }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          //老师结算表
 | 
	
	
		
			
				|  | @@ -2483,7 +2481,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |          List<ClassGroupTeacherMapper> classGroupTeacherMapperList = classGroup4MixDtos.get(0).getClassGroupTeacherMapperList();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          Set<Integer> noRepeatTeacherIds = classGroupTeacherMapperList.stream().map(ClassGroupTeacherMapper::getUserId).collect(Collectors.toSet());
 | 
	
		
			
				|  |  | -        if(noRepeatTeacherIds.size()!=classGroupTeacherMapperList.size()){
 | 
	
		
			
				|  |  | +        if (noRepeatTeacherIds.size() != classGroupTeacherMapperList.size()) {
 | 
	
		
			
				|  |  |              throw new BizException("主教与助教存在冲突");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -2522,14 +2520,14 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |              //5、插入班级排课信息
 | 
	
		
			
				|  |  |              LocalDateTime now = LocalDate.parse(classGroup4MixDto.getStartDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd")).atStartOfDay();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            if(!courseTypeMinutesMap.containsKey(classGroup4MixDto.getCourseType().getCode())){
 | 
	
		
			
				|  |  | +            if (!courseTypeMinutesMap.containsKey(classGroup4MixDto.getCourseType().getCode())) {
 | 
	
		
			
				|  |  |                  throw new BizException("{}课程类型暂无剩余课程时长", classGroup4MixDto.getCourseType().getMsg());
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              Integer totalMinutes = courseTypeMinutesMap.get(classGroup4MixDto.getCourseType().getCode());
 | 
	
		
			
				|  |  |              long totalCourseDuration = 0;
 | 
	
		
			
				|  |  |  //            classGroup4MixDto.setCourseTimes(totalMinutes/(int)courseDuration);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            if(classGroup4MixDto.getCourseTimes()<=0){
 | 
	
		
			
				|  |  | +            if (classGroup4MixDto.getCourseTimes() <= 0) {
 | 
	
		
			
				|  |  |                  throw new BizException("{}课程类型剩余课程时长不足", classGroup4MixDto.getCourseType().getMsg());
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -2562,7 +2560,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                      totalCourseDuration += classCourseDuration;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -                    if (totalCourseDuration>totalMinutes) {
 | 
	
		
			
				|  |  | +                    if (totalCourseDuration > totalMinutes) {
 | 
	
		
			
				|  |  |                          break WhileNode;
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -2618,7 +2616,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  //        courseScheduleService.checkSnapCourseShchedules(courseScheduleList);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        courseScheduleService.checkNewCourseSchedules(courseScheduleList, false,false);
 | 
	
		
			
				|  |  | +        courseScheduleService.checkNewCourseSchedules(courseScheduleList, false, false);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          //老师结算表
 | 
	
		
			
				|  |  |          if (courseScheduleTeacherSalaryList.size() > 0) {
 | 
	
	
		
			
				|  | @@ -3240,13 +3238,13 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |          return classGroup;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -	@Override
 | 
	
		
			
				|  |  | -	public List<RemainCourseTypeDurationDto> queryRemainCourseTypeDuration(String classGroupIdList) {
 | 
	
		
			
				|  |  | -		return courseScheduleDao.queryRemainCourseTypeDuration(classGroupIdList);
 | 
	
		
			
				|  |  | -	}
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public List<RemainCourseTypeDurationDto> queryRemainCourseTypeDuration(String classGroupIdList) {
 | 
	
		
			
				|  |  | +        return courseScheduleDao.queryRemainCourseTypeDuration(classGroupIdList);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    public Map<String,Integer> classGroupSubCourseNum(Integer classGroupId) {
 | 
	
		
			
				|  |  | +    public Map<String, Integer> classGroupSubCourseNum(Integer classGroupId) {
 | 
	
		
			
				|  |  |          return MapUtil.convertIntegerMap(courseScheduleDao.querySubCourseNumMap(classGroupId));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  //        List<Map<String,Object>> result = new ArrayList<>();
 | 
	
	
		
			
				|  | @@ -3266,43 +3264,43 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    public Map<String,Object> getDefaultPaymentCalender(List<Integer> classGroupIds) {
 | 
	
		
			
				|  |  | -        if(classGroupIds == null || classGroupIds.size() == 0){
 | 
	
		
			
				|  |  | +    public Map<String, Object> getDefaultPaymentCalender(List<Integer> classGroupIds) {
 | 
	
		
			
				|  |  | +        if (classGroupIds == null || classGroupIds.size() == 0) {
 | 
	
		
			
				|  |  |              throw new BizException("参数校验失败");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        Map<String,Object> result = new HashMap<>();
 | 
	
		
			
				|  |  | -        Map<Integer,Map<String,MusicGroupOrganizationCourseSettingsDetail>> resultMap = new HashMap<>();
 | 
	
		
			
				|  |  | +        Map<String, Object> result = new HashMap<>();
 | 
	
		
			
				|  |  | +        Map<Integer, Map<String, MusicGroupOrganizationCourseSettingsDetail>> resultMap = new HashMap<>();
 | 
	
		
			
				|  |  |          //获取默认的排课时长
 | 
	
		
			
				|  |  |  //        JSONObject jsonObject = JSON.parseObject(classAdjust.getDefaultCourseTypeMinute());
 | 
	
		
			
				|  |  |  //        String courseDefaultMinutes = sysConfigDao.findConfigValue("music_course_default_minutes");
 | 
	
		
			
				|  |  |  //        JSONObject jsonObject = JSON.parseObject(courseDefaultMinutes);
 | 
	
		
			
				|  |  |          //获取所选班级最大剩余课时
 | 
	
		
			
				|  |  | -        Map<String,Long> map = MapUtil.convertIntegerMap(courseScheduleDao.findClassMaxCourseNumMap(classGroupIds));
 | 
	
		
			
				|  |  | +        Map<String, Long> map = MapUtil.convertIntegerMap(courseScheduleDao.findClassMaxCourseNumMap(classGroupIds));
 | 
	
		
			
				|  |  |          //获取分布默认的课程类型单价
 | 
	
		
			
				|  |  |          MusicGroup musicGroup = musicGroupDao.findByClassGroupId(classGroupIds.get(0));
 | 
	
		
			
				|  |  | -        Map<String,BigDecimal> unitPriceMap = MapUtil.convertIntegerMap(organizationCourseUnitPriceSettingsDao.queryMapByOrganIdAndChargeTypeId(musicGroup.getChargeTypeId(),musicGroup.getOrganId()));
 | 
	
		
			
				|  |  | +        Map<String, BigDecimal> unitPriceMap = MapUtil.convertIntegerMap(organizationCourseUnitPriceSettingsDao.queryMapByOrganIdAndChargeTypeId(musicGroup.getChargeTypeId(), musicGroup.getOrganId()));
 | 
	
		
			
				|  |  |          Set<String> courseTypes = map.keySet();
 | 
	
		
			
				|  |  |          Set<String> groupType = new HashSet<>();
 | 
	
		
			
				|  |  |          for (Integer classGroupId : classGroupIds) {
 | 
	
		
			
				|  |  | -            Map<String,MusicGroupOrganizationCourseSettingsDetail> courseMap = new HashMap<>();
 | 
	
		
			
				|  |  | +            Map<String, MusicGroupOrganizationCourseSettingsDetail> courseMap = new HashMap<>();
 | 
	
		
			
				|  |  |              //获取当前班级剩余课次
 | 
	
		
			
				|  |  | -            Map<String,Long> subCourseNumMap = MapUtil.convertIntegerMap(courseScheduleDao.querySubCourseNumMap(classGroupId));
 | 
	
		
			
				|  |  | +            Map<String, Long> subCourseNumMap = MapUtil.convertIntegerMap(courseScheduleDao.querySubCourseNumMap(classGroupId));
 | 
	
		
			
				|  |  |              for (String courseType : courseTypes) {
 | 
	
		
			
				|  |  |                  groupType.add(courseType);
 | 
	
		
			
				|  |  |                  Long currentNum = subCourseNumMap.get(courseType);
 | 
	
		
			
				|  |  | -                if(currentNum == null){
 | 
	
		
			
				|  |  | +                if (currentNum == null) {
 | 
	
		
			
				|  |  |                      currentNum = 0l;
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  Long maxNum = map.get(courseType);
 | 
	
		
			
				|  |  |                  //如果当前课程类型不需要新增缴费项目
 | 
	
		
			
				|  |  | -                if(currentNum >= maxNum){
 | 
	
		
			
				|  |  | +                if (currentNum >= maxNum) {
 | 
	
		
			
				|  |  |                      continue;
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  Long subNum = maxNum - currentNum;
 | 
	
		
			
				|  |  |                  //生成缴费项目
 | 
	
		
			
				|  |  |                  MusicGroupOrganizationCourseSettingsDetail settingsDetail = new MusicGroupOrganizationCourseSettingsDetail();
 | 
	
		
			
				|  |  |                  BigDecimal unitPrice = unitPriceMap.get(courseType);
 | 
	
		
			
				|  |  | -                if(unitPrice == null){
 | 
	
		
			
				|  |  | +                if (unitPrice == null) {
 | 
	
		
			
				|  |  |                      throw new BizException("分部默认课程类型单价不存在,请设置");
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  settingsDetail.setCourseTotalNum(subNum.intValue());
 | 
	
	
		
			
				|  | @@ -3311,30 +3309,30 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |  //                settingsDetail.setCourseTotalMinuties(Integer.parseInt(jsonObject.get(courseType).toString()) * subNum.intValue());
 | 
	
		
			
				|  |  |  //                settingsDetail.setCourseCurrentPrice(unitPrice.multiply(new BigDecimal(settingsDetail.getCourseTotalMinuties())));
 | 
	
		
			
				|  |  |  //                settingsDetail.setCourseOriginalPrice(settingsDetail.getCourseCurrentPrice());
 | 
	
		
			
				|  |  | -                courseMap.put(courseType,settingsDetail);
 | 
	
		
			
				|  |  | +                courseMap.put(courseType, settingsDetail);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -            resultMap.put(classGroupId,courseMap);
 | 
	
		
			
				|  |  | +            resultMap.put(classGroupId, courseMap);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        result.put("defaultPaymentCalender",resultMap);
 | 
	
		
			
				|  |  | -        result.put("groupTypeSet",groupType);
 | 
	
		
			
				|  |  | -        result.put("classMaxCourseNumMap",map);
 | 
	
		
			
				|  |  | +        result.put("defaultPaymentCalender", resultMap);
 | 
	
		
			
				|  |  | +        result.put("groupTypeSet", groupType);
 | 
	
		
			
				|  |  | +        result.put("classMaxCourseNumMap", map);
 | 
	
		
			
				|  |  |          return result;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  | -    public String mergeClassSplitClassAffirm(MergeClassSplitClassAffirmDto mergeClassSplitClassAffirmDto){
 | 
	
		
			
				|  |  | +    public String mergeClassSplitClassAffirm(MergeClassSplitClassAffirmDto mergeClassSplitClassAffirmDto) {
 | 
	
		
			
				|  |  |          List<Integer> classGroupIds = mergeClassSplitClassAffirmDto.getClassGroupIds();
 | 
	
		
			
				|  |  | -        if(classGroupIds == null || classGroupIds.size() == 0){
 | 
	
		
			
				|  |  | +        if (classGroupIds == null || classGroupIds.size() == 0) {
 | 
	
		
			
				|  |  |              throw new BizException("参数校验失败");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          //班级信息
 | 
	
		
			
				|  |  |          List<ClassGroup4MixDto> classGroup4MixDtos = mergeClassSplitClassAffirmDto.getClassGroup4MixDtos();
 | 
	
		
			
				|  |  | -        if(CollectionUtils.isEmpty(classGroup4MixDtos)){
 | 
	
		
			
				|  |  | +        if (CollectionUtils.isEmpty(classGroup4MixDtos)) {
 | 
	
		
			
				|  |  |              throw new BizException("请填写班级信息");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          List<Integer> studentIds = mergeClassSplitClassAffirmDto.getStudentIds();
 | 
	
		
			
				|  |  | -        if(CollectionUtils.isEmpty(studentIds)){
 | 
	
		
			
				|  |  | +        if (CollectionUtils.isEmpty(studentIds)) {
 | 
	
		
			
				|  |  |              throw new BizException("学员列表不可为空");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          SysUser sysUser = sysUserFeignService.queryUserInfo();
 | 
	
	
		
			
				|  | @@ -3344,9 +3342,9 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |          MusicGroupPaymentCalender.PaymentCalenderStatusEnum status = null;
 | 
	
		
			
				|  |  |          List<MusicGroupPaymentCalenderDto> paymentCalenderDtos = mergeClassSplitClassAffirmDto.getMusicGroupPaymentCalenderDtos();
 | 
	
		
			
				|  |  |          StringBuffer batchNos = new StringBuffer();
 | 
	
		
			
				|  |  | -        if(paymentCalenderDtos != null && paymentCalenderDtos.size() > 0){
 | 
	
		
			
				|  |  | +        if (paymentCalenderDtos != null && paymentCalenderDtos.size() > 0) {
 | 
	
		
			
				|  |  |              for (MusicGroupPaymentCalenderDto calenderDto : paymentCalenderDtos) {
 | 
	
		
			
				|  |  | -                if(status == null || status != AUDITING){
 | 
	
		
			
				|  |  | +                if (status == null || status != AUDITING) {
 | 
	
		
			
				|  |  |                      List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList = calenderDto.getMusicGroupPaymentCalenderCourseSettingsList();
 | 
	
		
			
				|  |  |                      for (MusicGroupPaymentCalenderCourseSettings courseSettings : musicGroupPaymentCalenderCourseSettingsList) {
 | 
	
		
			
				|  |  |                          OrganizationCourseUnitPriceSettings defaultUnitPrice = organizationCourseUnitPriceSettingsDao.queryByOrganIdAndCourseTypeAndChargeType(
 | 
	
	
		
			
				|  | @@ -3366,12 +3364,12 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |              List<String> batchNoList = new ArrayList<>();
 | 
	
		
			
				|  |  |              //创建缴费项目,  多个缴费项目分成多个批次号
 | 
	
		
			
				|  |  |              for (MusicGroupPaymentCalenderDto calenderDto : paymentCalenderDtos) {
 | 
	
		
			
				|  |  | -                if(batchNoList.size() > 0){
 | 
	
		
			
				|  |  | +                if (batchNoList.size() > 0) {
 | 
	
		
			
				|  |  |                      calenderDto.setIgnoreBatchNoList(batchNoList);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  calenderDto.setMergeClassFlag(true);
 | 
	
		
			
				|  |  |                  musicGroupPaymentCalenderService.create(calenderDto);
 | 
	
		
			
				|  |  | -                if(batchNos.length() > 0){
 | 
	
		
			
				|  |  | +                if (batchNos.length() > 0) {
 | 
	
		
			
				|  |  |                      batchNos.append(",");
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  batchNoList.add(calenderDto.getBatchNo());
 | 
	
	
		
			
				|  | @@ -3388,28 +3386,28 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |          musicGroupStudentClassAdjust.setClassGroupIds(JSON.toJSONString(classGroupIds));
 | 
	
		
			
				|  |  |          musicGroupStudentClassAdjust.setStudentIds(JSON.toJSONString(studentIds));
 | 
	
		
			
				|  |  |          List<Map<Integer, String>> classGroupStudents = mergeClassSplitClassAffirmDto.getClassGroupStudents();
 | 
	
		
			
				|  |  | -        if(classGroupStudents != null && classGroupStudents.size() > 0){
 | 
	
		
			
				|  |  | +        if (classGroupStudents != null && classGroupStudents.size() > 0) {
 | 
	
		
			
				|  |  |              musicGroupStudentClassAdjust.setClassGroupStudents(JSON.toJSONString(mergeClassSplitClassAffirmDto.getClassGroupStudents()));
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          //获取需要冻结的课程
 | 
	
		
			
				|  |  | -        List<Long> allLockCourseIds = courseScheduleDao.queryStudentNotStartByClassIdsAndStudentIds(classGroupIds,null);
 | 
	
		
			
				|  |  | +        List<Long> allLockCourseIds = courseScheduleDao.queryStudentNotStartByClassIdsAndStudentIds(classGroupIds, null);
 | 
	
		
			
				|  |  |          musicGroupStudentClassAdjust.setAllLockCourseIds(JSON.toJSONString(allLockCourseIds));
 | 
	
		
			
				|  |  |          //获取需要删除的学员关联的课程
 | 
	
		
			
				|  |  | -        List<Long> courseIds = courseScheduleDao.queryStudentNotStartByClassIdsAndStudentIds(classGroupIds,studentIds);
 | 
	
		
			
				|  |  | +        List<Long> courseIds = courseScheduleDao.queryStudentNotStartByClassIdsAndStudentIds(classGroupIds, studentIds);
 | 
	
		
			
				|  |  |          musicGroupStudentClassAdjust.setSubLockCourseIds(JSON.toJSONString(courseIds));
 | 
	
		
			
				|  |  | -        List<Long> studentPaymentIds = courseScheduleStudentPaymentDao.queryStudentNotStartByClassIdsAndStudentIds(classGroupIds,studentIds);
 | 
	
		
			
				|  |  | +        List<Long> studentPaymentIds = courseScheduleStudentPaymentDao.queryStudentNotStartByClassIdsAndStudentIds(classGroupIds, studentIds);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          musicGroupStudentClassAdjust.setStudentPaymentIds(JSON.toJSONString(studentPaymentIds));
 | 
	
		
			
				|  |  |          //保存老师选择的课程时长
 | 
	
		
			
				|  |  |          musicGroupStudentClassAdjust.setDefaultCourseTypeMinute(JSON.toJSONString(mergeClassSplitClassAffirmDto.getClassCourseMinuteMap()));
 | 
	
		
			
				|  |  |          //计算新增班级的可排课时长,总课次*默认时长  (用学员剩余的课程时长加上购买的时长,可能导致同一班级学员时长不一致)
 | 
	
		
			
				|  |  | -        musicGroupStudentClassAdjust.setClassCourseMinute(JSON.toJSONString(findClassCourseMinuteMap(classGroupIds,mergeClassSplitClassAffirmDto.getClassCourseMinuteMap())));
 | 
	
		
			
				|  |  | +        musicGroupStudentClassAdjust.setClassCourseMinute(JSON.toJSONString(findClassCourseMinuteMap(classGroupIds, mergeClassSplitClassAffirmDto.getClassCourseMinuteMap())));
 | 
	
		
			
				|  |  |          musicGroupStudentClassAdjustDao.insert(musicGroupStudentClassAdjust);
 | 
	
		
			
				|  |  |          //如果需要审核,校验参数配置
 | 
	
		
			
				|  |  |          checkMergeClassSplitClassAffirmParam(mergeClassSplitClassAffirmDto);
 | 
	
		
			
				|  |  |          //如果缴费项目不需要审核,那么生成班级以及课表
 | 
	
		
			
				|  |  | -        if(status == null || status != AUDITING){
 | 
	
		
			
				|  |  | +        if (status == null || status != AUDITING) {
 | 
	
		
			
				|  |  |              //每种课程类型单独进行排课
 | 
	
		
			
				|  |  |              ClassGroup classGroup = null;
 | 
	
		
			
				|  |  |              for (ClassGroup4MixDto classGroup4MixDto : classGroup4MixDtos) {
 | 
	
	
		
			
				|  | @@ -3419,18 +3417,18 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |                  classGroup = classGroupService.classGroupAdjust2(classGroup4MixDto);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              //排课完成后删除所选课程
 | 
	
		
			
				|  |  | -            courseScheduleDao.deleteMusicGroupCourseSchedulesWithStudents(courseIds,studentIds);
 | 
	
		
			
				|  |  | +            courseScheduleDao.deleteMusicGroupCourseSchedulesWithStudents(courseIds, studentIds);
 | 
	
		
			
				|  |  |              //删除班级关联的学员
 | 
	
		
			
				|  |  | -            if(classGroupStudents != null && classGroupStudents.size() > 0){
 | 
	
		
			
				|  |  | +            if (classGroupStudents != null && classGroupStudents.size() > 0) {
 | 
	
		
			
				|  |  |                  for (Map<Integer, String> classGroupStudent : classGroupStudents) {
 | 
	
		
			
				|  |  |                      Set<Integer> integers = classGroupStudent.keySet();
 | 
	
		
			
				|  |  |                      for (Integer integer : integers) {
 | 
	
		
			
				|  |  | -                        classGroupStudentMapperDao.deleteByClassGroupIdAndStudents(integer,classGroupStudent.get(integer));
 | 
	
		
			
				|  |  | +                        classGroupStudentMapperDao.deleteByClassGroupIdAndStudents(integer, classGroupStudent.get(integer));
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              List<Long> delCourseIds = courseScheduleDao.findNoStudentCourseIds(courseIds);
 | 
	
		
			
				|  |  | -            if(delCourseIds != null && delCourseIds.size() > 0){
 | 
	
		
			
				|  |  | +            if (delCourseIds != null && delCourseIds.size() > 0) {
 | 
	
		
			
				|  |  |                  //删除课程
 | 
	
		
			
				|  |  |                  courseScheduleDao.deleteCourseSchedulesByClassGroupIds(delCourseIds);
 | 
	
		
			
				|  |  |                  //删除教师考勤
 | 
	
	
		
			
				|  | @@ -3439,41 +3437,41 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |                  courseScheduleTeacherSalaryDao.batchDeleteByCourseScheduleIds(delCourseIds);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              return "学员班级调整完成";
 | 
	
		
			
				|  |  | -        }else {
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  |              //冻结班级
 | 
	
		
			
				|  |  | -            classGroupDao.batchUpdateLockByClassGroupIds(classGroupIds,1);
 | 
	
		
			
				|  |  | +            classGroupDao.batchUpdateLockByClassGroupIds(classGroupIds, 1);
 | 
	
		
			
				|  |  |              //冻结所选班级的课程
 | 
	
		
			
				|  |  | -            courseScheduleDao.batchUpdateLockByCourseIds(allLockCourseIds,1);
 | 
	
		
			
				|  |  | +            courseScheduleDao.batchUpdateLockByCourseIds(allLockCourseIds, 1);
 | 
	
		
			
				|  |  |              return "学员班级调整申请已提交,缴费项目审核中";
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    public void checkMergeClassSplitClassAffirmParam(MergeClassSplitClassAffirmDto mergeClassSplitClassAffirmDto){
 | 
	
		
			
				|  |  | +    public void checkMergeClassSplitClassAffirmParam(MergeClassSplitClassAffirmDto mergeClassSplitClassAffirmDto) {
 | 
	
		
			
				|  |  |          ClassGroup4MixDto classGroup4MixDto = mergeClassSplitClassAffirmDto.getClassGroup4MixDtos().get(0);
 | 
	
		
			
				|  |  |          if (classGroup4MixDto.getCourseTimes().compareTo(0) <= 0) {
 | 
	
		
			
				|  |  |              throw new BizException("排课次数必须大于0");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          List<ClassGroupTeacherMapper> classGroupTeacherMapperList = classGroup4MixDto.getClassGroupTeacherMapperList();
 | 
	
		
			
				|  |  | -        if(classGroupTeacherMapperList == null || classGroupTeacherMapperList.size() == 0){
 | 
	
		
			
				|  |  | +        if (classGroupTeacherMapperList == null || classGroupTeacherMapperList.size() == 0) {
 | 
	
		
			
				|  |  |              throw new BizException("请设置上课老师");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          Set<Integer> noRepeatTeacherIds = classGroupTeacherMapperList.stream().map(ClassGroupTeacherMapper::getUserId).collect(Collectors.toSet());
 | 
	
		
			
				|  |  | -        if(noRepeatTeacherIds.size()!=classGroupTeacherMapperList.size()){
 | 
	
		
			
				|  |  | +        if (noRepeatTeacherIds.size() != classGroupTeacherMapperList.size()) {
 | 
	
		
			
				|  |  |              throw new BizException("主教与助教存在冲突");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          //所选班级不能有未开始的临时合并课程
 | 
	
		
			
				|  |  |          List<Integer> classGroupIds = mergeClassSplitClassAffirmDto.getClassGroupIds();
 | 
	
		
			
				|  |  | -        if(classGroupIds == null || classGroupIds.size() == 0){
 | 
	
		
			
				|  |  | +        if (classGroupIds == null || classGroupIds.size() == 0) {
 | 
	
		
			
				|  |  |              throw new BizException("请填写班级信息");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          //所选班级列表,是否包含已冻结的班级
 | 
	
		
			
				|  |  |          List<ClassGroup> lockClassGroupIds = classGroupDao.findByClassGroupIds(classGroupIds, 1);
 | 
	
		
			
				|  |  | -        if(lockClassGroupIds != null && lockClassGroupIds.size() > 0){
 | 
	
		
			
				|  |  | +        if (lockClassGroupIds != null && lockClassGroupIds.size() > 0) {
 | 
	
		
			
				|  |  |              throw new BizException("所选班级包含审核中的学员班级调整申请");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          //所选班级不能有未开始的临时合并课程
 | 
	
		
			
				|  |  |          int courseNum = courseScheduleDao.findNoStartMasterCourseNum(classGroupIds);
 | 
	
		
			
				|  |  | -        if(courseNum > 0){
 | 
	
		
			
				|  |  | +        if (courseNum > 0) {
 | 
	
		
			
				|  |  |              throw new BizException("所选班级不能有未开始的临时合并课程");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          List<Integer> allTeacherIds = classGroupTeacherMapperList.stream()
 | 
	
	
		
			
				|  | @@ -3507,18 +3505,36 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    public Map<String,Long> findClassCourseMinuteMap(List<Integer> classGroupIds,Map<String,Long> classCourseMinuteMap){
 | 
	
		
			
				|  |  | -        Map<String,Long> resultMap = new HashMap<>();
 | 
	
		
			
				|  |  | +    public Map<String, Long> findClassCourseMinuteMap(List<Integer> classGroupIds, Map<String, Long> classCourseMinuteMap) {
 | 
	
		
			
				|  |  | +        Map<String, Long> resultMap = new HashMap<>();
 | 
	
		
			
				|  |  |          //获取默认的排课时长
 | 
	
		
			
				|  |  |  //        String courseDefaultMinutes = sysConfigDao.findConfigValue("music_course_default_minutes");
 | 
	
		
			
				|  |  |  //        JSONObject jsonObject = JSON.parseObject(courseDefaultMinutes);
 | 
	
		
			
				|  |  |          //获取所选班级最大剩余课时
 | 
	
		
			
				|  |  | -        Map<String,Long> map = MapUtil.convertIntegerMap(courseScheduleDao.findClassMaxCourseNumMap(classGroupIds));
 | 
	
		
			
				|  |  | +        Map<String, Long> map = MapUtil.convertIntegerMap(courseScheduleDao.findClassMaxCourseNumMap(classGroupIds));
 | 
	
		
			
				|  |  |          Set<String> courseTypes = map.keySet();
 | 
	
		
			
				|  |  |          for (String courseType : courseTypes) {
 | 
	
		
			
				|  |  |  //            剩余时长*默认排课时长
 | 
	
		
			
				|  |  | -            resultMap.put(courseType,classCourseMinuteMap.get(courseType) * map.get(courseType));
 | 
	
		
			
				|  |  | +            resultMap.put(courseType, classCourseMinuteMap.get(courseType) * map.get(courseType));
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return resultMap;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public HighClassGroupNumDto getSubjectMaxHighClassGroupNum(String musicGroupId, ClassGroupTypeEnum type, String subjectIds) {
 | 
	
		
			
				|  |  | +        //基础技能班和线上基础技能班,可分班原则为声部人数/6向上取整
 | 
	
		
			
				|  |  | +        String[] subjectIdArr = subjectIds.split(",");
 | 
	
		
			
				|  |  | +        List<String> subjectIdList = Arrays.asList(subjectIdArr);
 | 
	
		
			
				|  |  | +        if(subjectIdList.contains("14") || subjectIdList.contains("15")){
 | 
	
		
			
				|  |  | +            subjectIds += ",14,15";
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        HighClassGroupNumDto highClassGroupNumDto = new HighClassGroupNumDto();
 | 
	
		
			
				|  |  | +        int nowClassGroupNum = classGroupDao.getMusicGroupHighClassNumBySubject(musicGroupId, subjectIds, type);
 | 
	
		
			
				|  |  | +        int subjectStudentNum = studentRegistrationDao.getMusicGroupSubjectStudentNum(musicGroupId, subjectIds);
 | 
	
		
			
				|  |  | +        int maxClassGroupNum = subjectStudentNum / 6;
 | 
	
		
			
				|  |  | +        maxClassGroupNum += (subjectStudentNum % 6) > 0 ? 1 : 0;
 | 
	
		
			
				|  |  | +        highClassGroupNumDto.setNowHighClassGroupNum(nowClassGroupNum);
 | 
	
		
			
				|  |  | +        highClassGroupNumDto.setMaxHighClassGroupNum(maxClassGroupNum);
 | 
	
		
			
				|  |  | +        return highClassGroupNumDto;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  }
 |