|  | @@ -6,6 +6,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 | 
	
		
			
				|  |  |  import com.google.common.collect.Lists;
 | 
	
		
			
				|  |  |  import com.google.common.collect.Maps;
 | 
	
		
			
				|  |  | +import com.microsvc.toolkit.middleware.live.LivePluginContext;
 | 
	
		
			
				|  |  | +import com.microsvc.toolkit.middleware.live.LivePluginService;
 | 
	
		
			
				|  |  | +import com.microsvc.toolkit.middleware.live.message.LiveRoomMessage;
 | 
	
		
			
				|  |  |  import com.ym.mec.auth.api.entity.SysUser;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.dao.*;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.dto.VipGroupClassGroupMapper;
 | 
	
	
		
			
				|  | @@ -187,6 +190,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private ImLiveBroadcastRoomService imLiveBroadcastRoomService;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private LivePluginContext livePluginContext;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private StudentService studentService;
 | 
	
	
		
			
				|  | @@ -3214,16 +3219,51 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |              studentAttendanceDao.deleteByCourseAndUser(courseScheduleIds,studentId);
 | 
	
		
			
				|  |  |              if(groupType == LIVE){
 | 
	
		
			
				|  |  |                  List<CourseScheduleStudentPayment> studentPayments = courseScheduleStudentPaymentDao.findByCourseScheduleIds(courseScheduleIds);
 | 
	
		
			
				|  |  | -                if(!CollectionUtils.isEmpty(studentPayments)){
 | 
	
		
			
				|  |  | -                    Map<Long, Integer> courseStudentNumMap = studentPayments.stream().filter(e -> e.getJoinCourseType() == JoinCourseType.PURCHASE)
 | 
	
		
			
				|  |  | -                            .collect(Collectors.groupingBy(e -> e.getCourseScheduleId(), Collectors.collectingAndThen(Collectors.toList(), v -> v.size())));
 | 
	
		
			
				|  |  | -                    for (Long courseId : courseStudentNumMap.keySet()) {
 | 
	
		
			
				|  |  | -                        Integer studentNum = courseStudentNumMap.get(courseId);
 | 
	
		
			
				|  |  | -                        if(studentNum != null && studentNum > 0){
 | 
	
		
			
				|  |  | -                            
 | 
	
		
			
				|  |  | -                        }else {
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +                Map<Long, Integer> courseStudentNumMap = studentPayments.stream().filter(e -> e.getJoinCourseType() == JoinCourseType.PURCHASE)
 | 
	
		
			
				|  |  | +                        .collect(Collectors.groupingBy(e -> e.getCourseScheduleId(), Collectors.collectingAndThen(Collectors.toList(), v -> v.size())));
 | 
	
		
			
				|  |  | +                for (CourseSchedule schedule : musicGroupCourseSchedules) {
 | 
	
		
			
				|  |  | +                    if(StringUtils.isEmpty(schedule.getLiveRoomId())){
 | 
	
		
			
				|  |  | +                        continue;
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    ImLiveBroadcastRoom liveRoom = imLiveBroadcastRoomService.getByRoomUid(schedule.getLiveRoomId());
 | 
	
		
			
				|  |  | +                    if (Objects.isNull(liveRoom)) {
 | 
	
		
			
				|  |  | +                        continue;
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    Integer studentNum = courseStudentNumMap.get(schedule.getId());
 | 
	
		
			
				|  |  | +                    //如果还有学生,那么之发送给退学学员
 | 
	
		
			
				|  |  | +                    try {
 | 
	
		
			
				|  |  | +                        LivePluginService pluginService = livePluginContext.getPluginService(liveRoom.getServiceProvider());
 | 
	
		
			
				|  |  | +                        // 发送用户信息
 | 
	
		
			
				|  |  | +                        LiveRoomMessage.MessageUser messageUser = LiveRoomMessage.MessageUser.builder()
 | 
	
		
			
				|  |  | +                                .sendUserId("")
 | 
	
		
			
				|  |  | +                                .sendUserName("")
 | 
	
		
			
				|  |  | +                                .avatarUrl("")
 | 
	
		
			
				|  |  | +                                .build();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                        LiveRoomMessage message = new LiveRoomMessage();
 | 
	
		
			
				|  |  | +                        message.setIsIncludeSender(1);
 | 
	
		
			
				|  |  | +                        message.setFromUserId(studentId.toString());
 | 
	
		
			
				|  |  | +                        message.setToChatRoomId(schedule.getLiveRoomId());
 | 
	
		
			
				|  |  | +                        message.setObjectName(LiveRoomMessage.LIVE_STATUS_CHANGE);
 | 
	
		
			
				|  |  | +                        message.setContent(LiveRoomMessage.MessageContent.builder()
 | 
	
		
			
				|  |  | +                                .reason("您的退学申请已处理,点击退出直播间")
 | 
	
		
			
				|  |  | +                                .targetIds(Lists.newArrayList())
 | 
	
		
			
				|  |  | +                                .sendUserInfo(messageUser).build());
 | 
	
		
			
				|  |  | +                        if(studentNum == null || studentNum == 0){
 | 
	
		
			
				|  |  | +                            LiveRoomMessage message1 = new LiveRoomMessage();
 | 
	
		
			
				|  |  | +                            message1.setIsIncludeSender(1);
 | 
	
		
			
				|  |  | +                            message1.setFromUserId(schedule.getActualTeacherId().toString());
 | 
	
		
			
				|  |  | +                            message1.setToChatRoomId(schedule.getLiveRoomId());
 | 
	
		
			
				|  |  | +                            message1.setObjectName(LiveRoomMessage.LIVE_STATUS_CHANGE);
 | 
	
		
			
				|  |  | +                            message1.setContent(LiveRoomMessage.MessageContent.builder()
 | 
	
		
			
				|  |  | +                                    .reason("课程信息已变更")
 | 
	
		
			
				|  |  | +                                    .targetIds(Lists.newArrayList())
 | 
	
		
			
				|  |  | +                                    .sendUserInfo(messageUser).build());
 | 
	
		
			
				|  |  | +                            pluginService.sendChatRoomMessage(message1);
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  | +                        pluginService.sendChatRoomMessage(message);
 | 
	
		
			
				|  |  | +                    } catch (Exception e) {
 | 
	
		
			
				|  |  | +                        log.error("liveRoom error", e);
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 |