|  | @@ -30,6 +30,26 @@ import java.util.function.Consumer;
 | 
	
		
			
				|  |  |  import java.util.function.Function;
 | 
	
		
			
				|  |  |  import java.util.stream.Collectors;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  | +import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
	
		
			
				|  |  | +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 | 
	
		
			
				|  |  | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 | 
	
		
			
				|  |  | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.auth.api.entity.SysUser;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.biz.dal.dao.LiveRoomDao;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.biz.dal.entity.*;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.biz.dal.enums.*;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.biz.dal.service.*;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.biz.dal.support.IMHelper;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.biz.dal.support.WrapperUtil;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.biz.dal.vo.UserOrderVo;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.common.enums.YesOrNoEnum;
 | 
	
		
			
				|  |  | +import com.yonge.toolset.base.exception.BizException;
 | 
	
		
			
				|  |  | +import com.yonge.toolset.base.page.PageInfo;
 | 
	
		
			
				|  |  | +import com.yonge.toolset.mybatis.support.PageUtil;
 | 
	
		
			
				|  |  | +import com.yonge.toolset.thirdparty.message.MessageSenderPluginContext;
 | 
	
		
			
				|  |  | +import com.yonge.toolset.utils.date.DateUtil;
 | 
	
		
			
				|  |  |  import org.apache.commons.collections.CollectionUtils;
 | 
	
		
			
				|  |  |  import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  |  import org.redisson.api.RBucket;
 | 
	
	
		
			
				|  | @@ -121,6 +141,8 @@ public class LiveRoomServiceImpl extends ServiceImpl<LiveRoomDao, LiveRoom> impl
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private SysMessageService sysMessageService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private LiveBroadcastRoomMemberService liveBroadcastRoomMemberService;
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 生成房间UID
 | 
	
		
			
				|  |  |       *
 | 
	
	
		
			
				|  | @@ -497,6 +519,7 @@ public class LiveRoomServiceImpl extends ServiceImpl<LiveRoomDao, LiveRoom> impl
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          //修改房间状态
 | 
	
		
			
				|  |  |          room.setLiveState(2);
 | 
	
		
			
				|  |  | +        // room.setRoomState(1);
 | 
	
		
			
				|  |  |          this.updateById(room);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          String speakerIdStr = room.getSpeakerId().toString();
 | 
	
	
		
			
				|  | @@ -643,6 +666,7 @@ public class LiveRoomServiceImpl extends ServiceImpl<LiveRoomDao, LiveRoom> impl
 | 
	
		
			
				|  |  |              if (!onlineUserInfo.isExists()) {
 | 
	
		
			
				|  |  |                  return;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            liveBroadcastRoomMemberService.saveRecord(roomUid,userId, InOrOutEnum.OUT, YesOrNoEnum.NO);
 | 
	
		
			
				|  |  |              //从在线人员列表删除该人员
 | 
	
		
			
				|  |  |              onlineUserInfo.fastRemove(userId);
 | 
	
		
			
				|  |  |              //学员退出 写学生考勤表
 | 
	
	
		
			
				|  | @@ -771,6 +795,7 @@ public class LiveRoomServiceImpl extends ServiceImpl<LiveRoomDao, LiveRoom> impl
 | 
	
		
			
				|  |  |          Date now = new Date();
 | 
	
		
			
				|  |  |          roomInfo.setSpeakerState(0);
 | 
	
		
			
				|  |  |          roomInfo.setJoinRoomTime(now);
 | 
	
		
			
				|  |  | +        liveBroadcastRoomMemberService.saveRecord(roomUid, roomInfo.getSpeakerId(), InOrOutEnum.IN, YesOrNoEnum.NO);
 | 
	
		
			
				|  |  |          //查询老师是否有进入过,没有则写老师考勤表的进入时间
 | 
	
		
			
				|  |  |          this.setTeacherAttendance(roomInfo.getSpeakerId(), roomInfo.getCourseGroupId(), roomInfo.getCourseId());
 | 
	
		
			
				|  |  |          //记录当前用户对应的房间uid
 | 
	
	
		
			
				|  | @@ -796,6 +821,7 @@ public class LiveRoomServiceImpl extends ServiceImpl<LiveRoomDao, LiveRoom> impl
 | 
	
		
			
				|  |  |          RMap<Long, String> roomTotalUser = this.getTotalUserCache(roomUid);
 | 
	
		
			
				|  |  |          //判断是否第一次进房间
 | 
	
		
			
				|  |  |          RoomUserInfoCache userInfo;
 | 
	
		
			
				|  |  | +        liveBroadcastRoomMemberService.saveRecord(roomUid,userId, InOrOutEnum.IN, YesOrNoEnum.YES);
 | 
	
		
			
				|  |  |          if (roomTotalUser.containsKey(userId)) {
 | 
	
		
			
				|  |  |              //多次进入更新动态进入时间
 | 
	
		
			
				|  |  |              userInfo = JSONObject.toJavaObject(JSONObject.parseObject(roomTotalUser.get(userId)), RoomUserInfoCache.class);
 | 
	
	
		
			
				|  | @@ -831,7 +857,7 @@ public class LiveRoomServiceImpl extends ServiceImpl<LiveRoomDao, LiveRoom> impl
 | 
	
		
			
				|  |  |          //校验房间是否存在
 | 
	
		
			
				|  |  |          RBucket<RoomInfoCache> roomInfoCache = this.getLiveRoomInfo(roomUid);
 | 
	
		
			
				|  |  |          if (!roomInfoCache.isExists()) {
 | 
	
		
			
				|  |  | -            throw new BizException("直播还未开始!");
 | 
	
		
			
				|  |  | +            throw new BizException("直播还未开始或已结束!");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          RoomInfoCache roomInfo = roomInfoCache.get();
 | 
	
		
			
				|  |  |          //校验观看者是否买过课,如果是非临时直播间,则校验是否已经买过课
 | 
	
	
		
			
				|  | @@ -1119,5 +1145,17 @@ public class LiveRoomServiceImpl extends ServiceImpl<LiveRoomDao, LiveRoom> impl
 | 
	
		
			
				|  |  |  	public List<TeacherLivingInfoVo> queryTeacherLivingList() {
 | 
	
		
			
				|  |  |  		return baseMapper.queryTeacherLivingList();
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public void whetherMic(String roomUid, Integer whetherMic) {
 | 
	
		
			
				|  |  | +        //校验房间是否存在
 | 
	
		
			
				|  |  | +        RBucket<RoomInfoCache> roomInfoCache = getLiveRoomInfo(roomUid);
 | 
	
		
			
				|  |  | +        if (!roomInfoCache.isExists()) {
 | 
	
		
			
				|  |  | +            log.error("teacherCheckRoomInfo>>>live not start  roomUid: {} ", roomUid);
 | 
	
		
			
				|  |  | +            throw new BizException("直播还未开始!");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        RoomInfoCache roomInfo = roomInfoCache.get();
 | 
	
		
			
				|  |  | +        roomInfo.setWhether_mic(whetherMic);
 | 
	
		
			
				|  |  | +        roomInfoCache.set(roomInfo);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 |