| 
					
				 | 
			
			
				@@ -168,6 +168,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private MusicGroupPaymentCalenderService musicGroupPaymentCalenderService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private MusicGroupStudentClassAdjustDao musicGroupStudentClassAdjustDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public BaseDAO<Integer, ClassGroup> getDAO() { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2292,6 +2294,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 +2416,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); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2419,17 +2432,36 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             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(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; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //课时长度 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     long classCourseDuration = Duration.between(LocalDateTime.parse(classGroup4MixDto.getStartDate() + " " + courseTimeDto.getStartClassTime() + ":00", formatter), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             LocalDateTime.parse(classGroup4MixDto.getStartDate() + " " + courseTimeDto.getEndClassTime() + ":00", formatter)) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2437,11 +2469,17 @@ 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; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    Date classDate = DateConvertor.toDate(now); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     String startClassTime = DateUtil.getDate(classDate) + " " + courseTimeDto.getStartClassTime() + ":00"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     String endClassTime = DateUtil.getDate(classDate) + " " + courseTimeDto.getEndClassTime() + ":00"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2451,6 +2489,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); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -2495,6 +2536,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); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3483,9 +3528,24 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (CollectionUtils.isEmpty(studentIds)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new BizException("学员列表不可为空"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        SysUser sysUser = sysUserFeignService.queryUserInfo(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         MusicGroup musicGroup = musicGroupDao.findByClassGroupId(classGroupIds.get(0)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //获取欠费学员列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<Integer> noPaymentUserIds = musicGroupPaymentCalenderDetailDao.queryNoPaymentUserIds(musicGroup.getId(), new ArrayList<>(studentIds)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(noPaymentUserIds.size() > 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw new BizException("操作失败:有欠费的学员不允许创建缴费"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //获取缴费状态在审核中或者已拒绝的缴费项目的学员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String studentId = musicGroupPaymentCalenderDao.queryCalenderStudentIds(musicGroup.getId(),null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(StringUtils.isNotEmpty(studentId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (Integer integer : studentIds) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if(studentId.contains(integer.toString())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    throw new BizException("操作失败:所选学员有待审核或已拒绝的缴费项目"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        SysUser sysUser = sysUserFeignService.queryUserInfo(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //生成缴费记录,同一个批次 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         MusicGroupPaymentCalender.PaymentCalenderStatusEnum status = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<MusicGroupPaymentCalenderDto> paymentCalenderDtos = mergeClassSplitClassAffirmDto.getMusicGroupPaymentCalenderDtos(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3870,6 +3930,15 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 studentIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //创建缴费项目 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         MusicGroup musicGroup = musicGroupDao.findByClassGroupId(masterClassGroupId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //获取缴费状态在审核中或者已拒绝的缴费项目的学员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String studentId = musicGroupPaymentCalenderDao.queryCalenderStudentIds(musicGroup.getId(),null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(StringUtils.isNotEmpty(studentId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (Integer integer : studentIds) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if(studentId.contains(integer.toString())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    throw new BizException("操作失败:所选学员有待审核或已拒绝的缴费项目"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         BigDecimal masterTotalPrice = getMasterTotalPrice(masterClassGroupId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //是否有需要审核的缴费项目 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<MusicGroupPaymentCalenderStudentDetail> calenderStudentDetails = paymentCalenderDto.getMusicGroupPaymentCalenderStudentDetails(); 
			 |