|  | @@ -5,6 +5,9 @@ import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  |  import com.google.common.collect.Lists;
 | 
	
		
			
				|  |  |  import com.google.common.collect.Maps;
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
	
		
			
				|  |  | +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.*;
 | 
	
	
		
			
				|  | @@ -195,7 +198,8 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 | 
	
		
			
				|  |  |      private LessonExaminationService lessonExaminationService;
 | 
	
		
			
				|  |  |  	@Autowired
 | 
	
		
			
				|  |  |  	private ImLiveBroadcastRoomService imLiveBroadcastRoomService;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +	@Autowired
 | 
	
		
			
				|  |  | +	private LivePluginContext livePluginContext;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private ImLiveRoomVideoService imLiveRoomVideoService;
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -3032,6 +3036,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  		Map<Long, CourseSchedule> oldCourseScheduleMap = oldCourseScheduleList.stream().collect(Collectors.toMap(CourseSchedule::getId, c -> c));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +		List<CourseSchedule> liveCourseSchedules = Lists.newArrayList();
 | 
	
		
			
				|  |  |          for(CourseSchedule newCourseSchedule : newCourseSchedules){
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          	//获取数据库中的记录
 | 
	
	
		
			
				|  | @@ -3087,6 +3092,11 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 | 
	
		
			
				|  |  |  				}
 | 
	
		
			
				|  |  |  			}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +			// 直播课发送推送消息
 | 
	
		
			
				|  |  | +			if (LIVE.equals(oldCourseSchedule.getGroupType()) && StringUtils.isNotBlank(oldCourseSchedule.getLiveRoomId())) {
 | 
	
		
			
				|  |  | +				liveCourseSchedules.add(oldCourseSchedule);
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              if(!CollectionUtils.isEmpty(newCourseSchedule.getTeachingTeacherIdList())){
 | 
	
		
			
				|  |  |                  if (newCourseSchedule.getTeachingTeacherIdList().contains(newCourseSchedule.getActualTeacherId())){
 | 
	
		
			
				|  |  |                      throw new BizException("主教和助教不可重复");
 | 
	
	
		
			
				|  | @@ -3529,6 +3539,45 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 | 
	
		
			
				|  |  |  		} catch (Exception e) {
 | 
	
		
			
				|  |  |  			e.printStackTrace();
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		// 直播课消息推送
 | 
	
		
			
				|  |  | +		if (CollectionUtils.isNotEmpty(liveCourseSchedules)) {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +			liveCourseSchedules.parallelStream().forEach(item -> {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +				ImLiveBroadcastRoom liveRoom = imLiveBroadcastRoomService.getByRoomUid(item.getLiveRoomId());
 | 
	
		
			
				|  |  | +				if (Objects.isNull(liveRoom)) {
 | 
	
		
			
				|  |  | +					log.warn("liveRoom is null, liveRoomId:{}", item.getLiveRoomId());
 | 
	
		
			
				|  |  | +					return;
 | 
	
		
			
				|  |  | +				}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +				try {
 | 
	
		
			
				|  |  | +					LivePluginService pluginService = livePluginContext.getPluginService(liveRoom.getServiceProvider());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +					LiveRoomMessage message = new LiveRoomMessage();
 | 
	
		
			
				|  |  | +					message.setIsIncludeSender(1);
 | 
	
		
			
				|  |  | +					message.setFromUserId(item.getActualTeacherId().toString());
 | 
	
		
			
				|  |  | +					message.setToChatRoomId(item.getLiveRoomId());
 | 
	
		
			
				|  |  | +					message.setObjectName(LiveRoomMessage.LIVE_STATUS_CHANGE);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +					// 发送用户信息
 | 
	
		
			
				|  |  | +					LiveRoomMessage.MessageUser messageUser = LiveRoomMessage.MessageUser.builder()
 | 
	
		
			
				|  |  | +							.sendUserId("")
 | 
	
		
			
				|  |  | +							.sendUserName("")
 | 
	
		
			
				|  |  | +							.avatarUrl("")
 | 
	
		
			
				|  |  | +							.build();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +					message.setContent(LiveRoomMessage.MessageContent.builder()
 | 
	
		
			
				|  |  | +							.reason("课程信息已变更")
 | 
	
		
			
				|  |  | +							.sendUserInfo(messageUser).build());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +					pluginService.sendChatRoomMessage(message);
 | 
	
		
			
				|  |  | +				} catch (Exception e) {
 | 
	
		
			
				|  |  | +					log.error("liveRoom error", e);
 | 
	
		
			
				|  |  | +				}
 | 
	
		
			
				|  |  | +			});
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  |  		return BaseController.succeed();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 |