| 
					
				 | 
			
			
				@@ -2292,6 +2292,11 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new BizException("班级不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Boolean confirmGenerate = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(Objects.nonNull(classGroup4MixDtos.get(0).getConfirmGenerate())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            confirmGenerate = classGroup4MixDtos.get(0).getConfirmGenerate(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         TeachModeEnum teachMode = TeachModeEnum.OFFLINE; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (classGroup.getType().equals(HIGH_ONLINE) || classGroup.getType().equals(ClassGroupTypeEnum.MUSIC_NETWORK)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             teachMode = TeachModeEnum.ONLINE; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2409,6 +2414,12 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 throw new BizException("{}课程类型剩余课程时长不足", classGroup4MixDto.getCourseType().getMsg()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            int totalCourseTimes = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            int generateCourseTimes = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(!CollectionUtils.isEmpty(classGroup4MixDto.getCourseTimeDtoList())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                totalCourseTimes = classGroup4MixDto.getCourseTimeDtoList().stream().mapToInt(CourseTimeDto::getExpectCourseNum).reduce(0, Integer::sum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Set<String> holidayDays = new HashSet<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (classGroup4MixDto.getHoliday()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 SysConfig holidaySetting = sysConfigService.findByParamName(SysConfigService.HOLIDAY_SETTING); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2417,35 +2428,35 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if(!CollectionUtils.isEmpty(classGroup4MixDto.getCourseTimeDtoList())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                int cycleNum = classGroup4MixDto.getCourseTimeDtoList().size(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                long num = classGroup4MixDto.getCourseTimeDtoList().stream().filter(c -> Objects.nonNull(c.getStartDate())).count(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if(num>0&&num!=cycleNum){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    throw new BizException("循环周期排课日期未设置"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if(num>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    for (int i = 0;i<cycleNum-1; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        classGroup4MixDto.getCourseTimeDtoList().get(i).setEndDate(classGroup4MixDto.getCourseTimeDtoList().get(i+1).getStartDate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             WhileNode: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             while (true) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (classGroup4MixDto.getHoliday() && holidayDays.contains(now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    now = now.plusDays(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 int dayOfWeek = now.getDayOfWeek().getValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 for (CourseTimeDto courseTimeDto : classGroup4MixDto.getCourseTimeDtoList()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if (courseTimeDto.getDayOfWeek() < 1 || courseTimeDto.getDayOfWeek() > 7) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         throw new BizException("排课循环周期错误,请核查"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if(Objects.isNull(courseTimeDto.getStartDate())||Objects.isNull(courseTimeDto.getEndDate())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        throw new BizException("排课循环周期错误,请核查"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //跳过节假日 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (courseTimeDto.getHoliday() && holidayDays.contains(now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if (!courseTimeDto.getDayOfWeek().equals(dayOfWeek)) continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     Date classDate = DateConvertor.toDate(now); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if((Objects.nonNull(courseTimeDto.getStartDate())&&courseTimeDto.getStartDate().compareTo(classDate)>0)||(Objects.nonNull(courseTimeDto.getEndDate())&&courseTimeDto.getEndDate().compareTo(classDate)<0)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if(courseTimeDto.getStartDate().compareTo(classDate)>0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            ||courseTimeDto.getEndDate().compareTo(classDate)<0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            ||courseTimeDto.getExpectCourseNum()<=courseTimeDto.getCourseNum()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if(courseTimeDto.getEndDate().compareTo(classDate)<0&&courseTimeDto.getExpectCourseNum()>courseTimeDto.getCourseNum()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            throw new BizException("在指定的排课时间段内({}-{})无法完成预计课时数的排课", DateUtil.dateToString(courseTimeDto.getStartDate(), "yyyy.MM.dd"), DateUtil.dateToString(courseTimeDto.getEndDate(), "yyyy.MM.dd")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if(totalCourseTimes<=generateCourseTimes){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            break WhileNode; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2456,7 +2467,14 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     totalCourseDuration += classCourseDuration; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (totalCourseDuration > totalMinutes) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    if (totalCourseDuration > totalMinutes) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                        break WhileNode; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    courseTimeDto.setCourseNum(courseTimeDto.getCourseNum()+1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    generateCourseTimes+=1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if(totalCourseTimes<generateCourseTimes){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         break WhileNode; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2469,6 +2487,9 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     courseSchedule.setStatus(CourseStatusEnum.NOT_START); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     courseSchedule.setClassDate(classDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     courseSchedule.setStartClassTime(DateUtil.stringToDate(startClassTime)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if(date.compareTo(courseSchedule.getStartClassTime())>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        throw new BizException("课程开始时间不得早于当前时间"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     courseSchedule.setEndClassTime(DateUtil.stringToDate(endClassTime)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     courseSchedule.setCreateTime(date); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     courseSchedule.setUpdateTime(date); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2513,6 +2534,10 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         courseScheduleService.checkNewCourseSchedules(courseScheduleList, false, false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(!confirmGenerate){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return BaseController.failed(HttpStatus.PARTIAL_CONTENT, courseScheduleList, ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //老师结算表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (courseScheduleTeacherSalaryList.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             courseScheduleTeacherSalaryService.batchInsert(courseScheduleTeacherSalaryList); 
			 |