|  | @@ -805,6 +805,10 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
 | 
	
		
			
				|  |  |          sysConfig.put("liveStartTime", sysConfigService.findConfigValue(SysConfigConstant.PRE_CREATE_LIVE_ROOM_MINUTE));
 | 
	
		
			
				|  |  |          //直播结束后,XX分钟关闭房间
 | 
	
		
			
				|  |  |          sysConfig.put("liveEndTime", sysConfigService.findConfigValue(SysConfigConstant.DESTROY_EXPIRED_LIVE_ROOM_MINUTE));
 | 
	
		
			
				|  |  | +        //提前XX分钟创建/进入琴房课房间时间
 | 
	
		
			
				|  |  | +        sysConfig.put("pianoStartTime", sysConfigService.findConfigValue(SysConfigConstant.PRE_CREATE_PIANO_ROOM_MINUTE));
 | 
	
		
			
				|  |  | +        //琴房课结束后,XX分钟关闭房间
 | 
	
		
			
				|  |  | +        sysConfig.put("pianoEndTime", sysConfigService.findConfigValue(SysConfigConstant.DESTROY_EXPIRED_PIANO_ROOM_MINUTE));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          Map map = new HashMap();
 | 
	
		
			
				|  |  |          map.put("sysConfig", sysConfig);
 | 
	
	
		
			
				|  | @@ -848,6 +852,10 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
 | 
	
		
			
				|  |  |          sysConfig.put("liveStartTime", sysConfigService.findConfigValue(SysConfigConstant.PRE_CREATE_LIVE_ROOM_MINUTE));
 | 
	
		
			
				|  |  |          //直播结束后,XX分钟关闭房间
 | 
	
		
			
				|  |  |          sysConfig.put("liveEndTime", sysConfigService.findConfigValue(SysConfigConstant.DESTROY_EXPIRED_LIVE_ROOM_MINUTE));
 | 
	
		
			
				|  |  | +        //提前XX分钟创建/进入琴房课房间时间
 | 
	
		
			
				|  |  | +        sysConfig.put("pianoStartTime", sysConfigService.findConfigValue(SysConfigConstant.PRE_CREATE_PIANO_ROOM_MINUTE));
 | 
	
		
			
				|  |  | +        //琴房课结束后,XX分钟关闭房间
 | 
	
		
			
				|  |  | +        sysConfig.put("pianoEndTime", sysConfigService.findConfigValue(SysConfigConstant.DESTROY_EXPIRED_PIANO_ROOM_MINUTE));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          Map map = new HashMap();
 | 
	
		
			
				|  |  |          map.put("sysConfig", sysConfig);
 | 
	
	
		
			
				|  | @@ -1451,6 +1459,10 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
 | 
	
		
			
				|  |  |          sysConfig.put("liveStartTime", sysConfigService.findConfigValue(SysConfigConstant.PRE_CREATE_LIVE_ROOM_MINUTE));
 | 
	
		
			
				|  |  |          //直播结束后,XX分钟关闭房间
 | 
	
		
			
				|  |  |          sysConfig.put("liveEndTime", sysConfigService.findConfigValue(SysConfigConstant.DESTROY_EXPIRED_LIVE_ROOM_MINUTE));
 | 
	
		
			
				|  |  | +        //提前XX分钟创建/进入琴房课房间时间
 | 
	
		
			
				|  |  | +        sysConfig.put("pianoStartTime", sysConfigService.findConfigValue(SysConfigConstant.PRE_CREATE_PIANO_ROOM_MINUTE));
 | 
	
		
			
				|  |  | +        //琴房课结束后,XX分钟关闭房间
 | 
	
		
			
				|  |  | +        sysConfig.put("pianoEndTime", sysConfigService.findConfigValue(SysConfigConstant.DESTROY_EXPIRED_PIANO_ROOM_MINUTE));
 | 
	
		
			
				|  |  |          return sysConfig;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -1620,7 +1632,6 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
 | 
	
		
			
				|  |  |                  //老师课酬状态改为已完成
 | 
	
		
			
				|  |  |                  courseScheduleTeacherSalaryService.update(null, Wrappers.<CourseScheduleTeacherSalary>lambdaUpdate()
 | 
	
		
			
				|  |  |                          .set(CourseScheduleTeacherSalary::getStatus, TeacherSalaryEnum.WAIT.getCode())
 | 
	
		
			
				|  |  | -                        .set(CourseScheduleTeacherSalary::getSettlementTime, new Date())
 | 
	
		
			
				|  |  |                          .in(CourseScheduleTeacherSalary::getCourseScheduleId, practiceList.stream().map(CourseScheduleStudentVo::getCourseId).collect(Collectors.toList())));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  //清除缓存
 | 
	
	
		
			
				|  | @@ -1647,6 +1658,9 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
 | 
	
		
			
				|  |  |                          .map(s -> {
 | 
	
		
			
				|  |  |                              Integer studentCount = s.getStudentCount();
 | 
	
		
			
				|  |  |                              Integer n = (Integer) WrapperUtil.strToFormula(formula, "n", String.valueOf(studentCount + 1));
 | 
	
		
			
				|  |  | +                            if (n == null) {
 | 
	
		
			
				|  |  | +                                throw new BizException("公式转换失败");
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  |                              s.setConsumTime(s.getSingleCourseTime() * n);
 | 
	
		
			
				|  |  |                              return s;
 | 
	
		
			
				|  |  |                          })
 | 
	
	
		
			
				|  | @@ -1700,7 +1714,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
 | 
	
		
			
				|  |  |          String day = DateUtil.getDayAgoOrAftString(-settlementDay);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          List<UserAccountRecordDto> list = baseMapper.selectWaitCourse(day);
 | 
	
		
			
				|  |  | -        if (CollectionUtils.isNotEmpty(list)){
 | 
	
		
			
				|  |  | +        if (CollectionUtils.isNotEmpty(list)) {
 | 
	
		
			
				|  |  |              for (UserAccountRecordDto dto : list) {
 | 
	
		
			
				|  |  |                  userAccountService.accountChange(dto);
 | 
	
		
			
				|  |  |              }
 | 
	
	
		
			
				|  | @@ -1709,7 +1723,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
 | 
	
		
			
				|  |  |              courseScheduleTeacherSalaryService.update(null, Wrappers.<CourseScheduleTeacherSalary>lambdaUpdate()
 | 
	
		
			
				|  |  |                      .set(CourseScheduleTeacherSalary::getStatus, TeacherSalaryEnum.COMPLETE.getCode())
 | 
	
		
			
				|  |  |                      .set(CourseScheduleTeacherSalary::getSettlementTime, new Date())
 | 
	
		
			
				|  |  | -                    .in(CourseScheduleTeacherSalary::getCourseScheduleId,bizIds));
 | 
	
		
			
				|  |  | +                    .in(CourseScheduleTeacherSalary::getCourseScheduleId, bizIds));
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -1764,6 +1778,9 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          String formula = sysConfigService.findConfigValue(SysConfigConstant.PIANO_ROOM_TIME_FORMULA);
 | 
	
		
			
				|  |  |          Integer n = (Integer) WrapperUtil.strToFormula(formula, "n", String.valueOf(studentIds.size() + 1));//人数计算 公式n*(n-1) n包含老师
 | 
	
		
			
				|  |  | +        if (n == null) {
 | 
	
		
			
				|  |  | +            throw new BizException("公式转换失败");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          Integer consumTime = classNum * singleClssTime * n;//消耗时长 课程数*单课时长*人数
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          List<CourseTimeEntity> timeList = arrangeCourseVo.getTimeList();//选课时间
 | 
	
	
		
			
				|  | @@ -1995,6 +2012,9 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          String formula = sysConfigService.findConfigValue(SysConfigConstant.PIANO_ROOM_TIME_FORMULA);
 | 
	
		
			
				|  |  |          Integer n = (Integer) WrapperUtil.strToFormula(formula, "n", String.valueOf(studentPaymentList.size() + 1));//人数计算 公式n*(n-1) n包含老师
 | 
	
		
			
				|  |  | +        if (n == null) {
 | 
	
		
			
				|  |  | +            throw new BizException("公式转换失败");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          Integer time = schedule.getSingleCourseTime() * n;//消耗时长 课程数*单课时长*人数
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          PianoRoomTime pianoRoomTime = pianoRoomTimeDao.selectOne(Wrappers.<PianoRoomTime>lambdaQuery().eq(PianoRoomTime::getTeacherId, teacherId));
 | 
	
	
		
			
				|  | @@ -2153,6 +2173,9 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
 | 
	
		
			
				|  |  |          String formula = sysConfigService.findConfigValue(SysConfigConstant.PIANO_ROOM_TIME_FORMULA);
 | 
	
		
			
				|  |  |          Integer after = (Integer) WrapperUtil.strToFormula(formula, "n", String.valueOf(studentIds.size() + 1));//变更后
 | 
	
		
			
				|  |  |          Integer before = (Integer) WrapperUtil.strToFormula(formula, "n", String.valueOf(paymentList.size() + 1));//变更前
 | 
	
		
			
				|  |  | +        if (after == null || before == null) {
 | 
	
		
			
				|  |  | +            throw new BizException("公式转换失败");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          int diffTime = singleCourseTime * (after - before);//人数变更后单课耗时
 | 
	
		
			
				|  |  |          if (remainTime - diffTime < 0) {
 | 
	
		
			
				|  |  |              throw new BizException("剩余时长不足");
 |