| 
					
				 | 
			
			
				@@ -1480,10 +1480,17 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			throw new BizException("未找到指定的vip课程"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId, null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Integer exitStudentNum = classGroupStudentMapperDao.countClassGroupExitStudentNum(classGroup.getId(), studentIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if(exitStudentNum>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			throw new BizException("选择的学生中存在此课程中已存在的学生"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		List<CourseSchedule> surplusCourses = courseScheduleDao.findByClassGroupAndStatus(classGroup.getId(), CourseStatusEnum.NOT_START.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if(CollectionUtils.isEmpty(surplusCourses)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			throw new BizException("此vip课程没有剩余课程计划"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		BigDecimal surplusCoursesPrice=new BigDecimal(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		surplusCourses.forEach(courseSchedule -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			if(courseSchedule.getTeachMode().equals(TeachModeEnum.OFFLINE)){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1493,6 +1500,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		List<ImGroupMember> imGroupMemberList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		List<ClassGroupStudentMapper> classGroupStudentMappers=new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		//生成学生单课缴费信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		for (Integer studentId:studentIds) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			SysUserCashAccount sysUserCashAccount = sysUserCashAccountService.get(studentId); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1501,11 +1509,25 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			courseScheduleStudentPaymentService.createCourseScheduleStudentPaymentForVipGroup(vipGroupId,studentId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			sysUserCashAccountService.updateCourseBalance(studentId,surplusCoursesPrice.negate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			sysUserCashAccountService.updateCourseBalance(studentId,sysUserCashAccount.getCourseBalance().subtract(surplusCoursesPrice)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			//创建班级学生关联记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			ClassGroupStudentMapper classGroupStudentMapper=new ClassGroupStudentMapper(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			classGroupStudentMapper.setGroupType(classGroup.getGroupType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			classGroupStudentMapper.setMusicGroupId(classGroup.getMusicGroupId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			classGroupStudentMapper.setClassGroupId(classGroup.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			classGroupStudentMapper.setUserId(studentId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			classGroupStudentMappers.add(classGroupStudentMapper); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			imGroupMemberList.add(new ImGroupMember(studentId.toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		classGroupStudentMapperDao.classGroupStudentsInsert(classGroupStudentMappers); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		classGroup.setStudentNum(classGroup.getStudentNum()+classGroupStudentMappers.size()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		classGroupDao.update(classGroup); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			ImGroupMember[] imGroupMembers = imGroupMemberList.toArray(new ImGroupMember[imGroupMemberList.size()]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			// 创建群组 
			 |