|  | @@ -1809,8 +1809,48 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  		List<CourseSchedule> surplusCourses = courseScheduleDao.findByClassGroupAndStatus(classGroup.getId(), CourseStatusEnum.NOT_START.getCode());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		List<ImGroupMember> imGroupMemberList = new ArrayList<>();
 | 
	
		
			
				|  |  | +		List<ClassGroupStudentMapper> classGroupStudentMappers=new ArrayList<>();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		List<ClassGroupStudentMapper> classGroupStudentsList = classGroupStudentMapperDao.findByClassGroupAndStudent(classGroup.getId(), studentIds);
 | 
	
		
			
				|  |  | +		Map<Integer, List<ClassGroupStudentMapper>> classGroupStudentsMap = classGroupStudentsList.stream()
 | 
	
		
			
				|  |  | +				.collect(Collectors.groupingBy(ClassGroupStudentMapper::getUserId));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  		if(CollectionUtils.isEmpty(surplusCourses)){
 | 
	
		
			
				|  |  | -			throw new BizException("此vip课程没有剩余课程计划");
 | 
	
		
			
				|  |  | +			for (Integer studentId:studentIds) {
 | 
	
		
			
				|  |  | +				//创建班级学生关联记录
 | 
	
		
			
				|  |  | +				ClassGroupStudentMapper classGroupStudentMapper;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +				List<ClassGroupStudentMapper> classGroupStudents = classGroupStudentsMap.get(studentId);
 | 
	
		
			
				|  |  | +				if(!CollectionUtils.isEmpty(classGroupStudents)){
 | 
	
		
			
				|  |  | +					classGroupStudentMapper = classGroupStudents.get(0);
 | 
	
		
			
				|  |  | +					classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
 | 
	
		
			
				|  |  | +					classGroupStudentMapperDao.update(classGroupStudentMapper);
 | 
	
		
			
				|  |  | +				}else{
 | 
	
		
			
				|  |  | +					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()));
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +			if(!CollectionUtils.isEmpty(classGroupStudentMappers)){
 | 
	
		
			
				|  |  | +				classGroupStudentMapperDao.classGroupStudentsInsert(classGroupStudentMappers);
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +			try {
 | 
	
		
			
				|  |  | +				ImGroupMember[] imGroupMembers = imGroupMemberList.toArray(new ImGroupMember[imGroupMemberList.size()]);
 | 
	
		
			
				|  |  | +				// 创建群组
 | 
	
		
			
				|  |  | +				imFeignService.groupCreate(new ImGroupModel(classGroup.getId().toString(), imGroupMembers, classGroup.getName()));
 | 
	
		
			
				|  |  | +			} catch (Exception e) {
 | 
	
		
			
				|  |  | +				e.printStackTrace();
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +			return;
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  		BigDecimal surplusCourseNum = new BigDecimal(surplusCourses.size());
 | 
	
	
		
			
				|  | @@ -1825,13 +1865,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  		BigDecimal avgCourseFee = surplusCoursesPrice.divide(surplusCourseNum,CommonConstants.DECIMAL_FINAL_PLACE,BigDecimal.ROUND_HALF_UP);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -		List<ImGroupMember> imGroupMemberList = new ArrayList<>();
 | 
	
		
			
				|  |  | -		List<ClassGroupStudentMapper> classGroupStudentMappers=new ArrayList<>();
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -		List<ClassGroupStudentMapper> classGroupStudentsList = classGroupStudentMapperDao.findByClassGroupAndStudent(classGroup.getId(), studentIds);
 | 
	
		
			
				|  |  | -		Map<Integer, List<ClassGroupStudentMapper>> classGroupStudentsMap = classGroupStudentsList.stream()
 | 
	
		
			
				|  |  | -				.collect(Collectors.groupingBy(ClassGroupStudentMapper::getUserId));
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |  		//生成学生单课缴费信息
 | 
	
		
			
				|  |  |  		for (Integer studentId:studentIds) {
 | 
	
		
			
				|  |  |  			SysUserCashAccount sysUserCashAccount = sysUserCashAccountService.get(studentId);
 |