|
@@ -34,6 +34,7 @@ import com.ym.mec.biz.dal.entity.ImLiveBroadcastRoomData;
|
|
import com.ym.mec.biz.dal.entity.ImLiveBroadcastRoomMember;
|
|
import com.ym.mec.biz.dal.entity.ImLiveBroadcastRoomMember;
|
|
import com.ym.mec.biz.dal.entity.ImLiveRoomBlack;
|
|
import com.ym.mec.biz.dal.entity.ImLiveRoomBlack;
|
|
import com.ym.mec.biz.dal.entity.ImLiveRoomVideo;
|
|
import com.ym.mec.biz.dal.entity.ImLiveRoomVideo;
|
|
|
|
+import com.ym.mec.biz.dal.enums.EGroupDefinedDataType;
|
|
import com.ym.mec.biz.dal.enums.MessageTypeEnum;
|
|
import com.ym.mec.biz.dal.enums.MessageTypeEnum;
|
|
import com.ym.mec.biz.dal.page.LiveRoomGoodsOrderQueryInfo;
|
|
import com.ym.mec.biz.dal.page.LiveRoomGoodsOrderQueryInfo;
|
|
import com.ym.mec.biz.dal.vo.*;
|
|
import com.ym.mec.biz.dal.vo.*;
|
|
@@ -251,6 +252,7 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
// 直播房间统计信息
|
|
// 直播房间统计信息
|
|
getRoomData(room);
|
|
getRoomData(room);
|
|
|
|
|
|
|
|
+
|
|
// 直播间配置信息
|
|
// 直播间配置信息
|
|
return room.userSig(userSig).liveRoomConfig(pluginService.getLiveRoomConfig());
|
|
return room.userSig(userSig).liveRoomConfig(pluginService.getLiveRoomConfig());
|
|
}
|
|
}
|
|
@@ -287,9 +289,12 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
@Override
|
|
@Override
|
|
public PageInfo<ImLiveBroadcastRoomVo> queryPage(Map<String, Object> param) {
|
|
public PageInfo<ImLiveBroadcastRoomVo> queryPage(Map<String, Object> param) {
|
|
String os = WrapperUtil.toStr(param, "os");
|
|
String os = WrapperUtil.toStr(param, "os");
|
|
- if (StringUtils.isNotBlank(os) && os.equals("teacher")) {
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(os) && os.toUpperCase(Locale.ROOT).equals("TEACHER")) {
|
|
param.put("speakerId", getSysUser().getId());
|
|
param.put("speakerId", getSysUser().getId());
|
|
param.put("clientType", SysUserType.TEACHER.getCode());
|
|
param.put("clientType", SysUserType.TEACHER.getCode());
|
|
|
|
+ } else if (StringUtils.isNotBlank(os) && os.toUpperCase(Locale.ROOT).equals("EDUCATION")) {
|
|
|
|
+ param.put("clientType", SysUserType.EDUCATION.getCode());
|
|
|
|
+ param.put("speakerId", getSysUser().getId());
|
|
}
|
|
}
|
|
Page<ImLiveBroadcastRoomVo> pageInfo = PageUtil.concatTimePage(param, "startTime", "endTime");
|
|
Page<ImLiveBroadcastRoomVo> pageInfo = PageUtil.concatTimePage(param, "startTime", "endTime");
|
|
// pageInfo.setDesc("a.created_time_");
|
|
// pageInfo.setDesc("a.created_time_");
|
|
@@ -315,6 +320,16 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
record.setRoomReservationNum(imLiveBroadcastRoomVos.get(0).getRoomReservationNum());
|
|
record.setRoomReservationNum(imLiveBroadcastRoomVos.get(0).getRoomReservationNum());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 查询直播间视频数
|
|
|
|
+ Map<String, Integer> uidCountMap = imLiveRoomVideoService.queryRoomUidCountMap(roomIdList);
|
|
|
|
+ for (ImLiveBroadcastRoomVo record : records) {
|
|
|
|
+ Integer count = uidCountMap.get(record.getRoomUid());
|
|
|
|
+ if (count == null) {
|
|
|
|
+ record.setVideoNum(0);
|
|
|
|
+ }
|
|
|
|
+ record.setVideoNum(count);
|
|
|
|
+ }
|
|
|
|
+
|
|
return PageUtil.pageInfo(page);
|
|
return PageUtil.pageInfo(page);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -401,6 +416,10 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
roomConfig.setWhether_chat(whetherChat);
|
|
roomConfig.setWhether_chat(whetherChat);
|
|
obj.setRoomConfig(JSONObject.toJSONString(roomConfig));
|
|
obj.setRoomConfig(JSONObject.toJSONString(roomConfig));
|
|
this.updateById(obj);
|
|
this.updateById(obj);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ ImLiveBroadcastRoomVo roomVo = getImLiveBroadcastRoomVo(obj.getRoomUid());
|
|
|
|
+ setGroupDefinedData(roomVo,EGroupDefinedDataType.GLOBAL_BAN,whetherChat.toString());
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1153,7 +1172,7 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
.update(room);
|
|
.update(room);
|
|
|
|
|
|
// 设置直播群组自定义数据
|
|
// 设置直播群组自定义数据
|
|
- setGroupDefinedData(roomVo,false);
|
|
|
|
|
|
+ setGroupDefinedData(roomVo,EGroupDefinedDataType.ANCHOR_STATUS,"OFFLINE");
|
|
|
|
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
@@ -1200,16 +1219,16 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
.update();
|
|
.update();
|
|
|
|
|
|
// 设置直播群组自定义数据
|
|
// 设置直播群组自定义数据
|
|
- setGroupDefinedData(roomVo,true);
|
|
|
|
|
|
+ setGroupDefinedData(roomVo,EGroupDefinedDataType.ANCHOR_STATUS,"ONLINE");
|
|
|
|
|
|
return roomVo;
|
|
return roomVo;
|
|
}
|
|
}
|
|
|
|
|
|
- private void setGroupDefinedData( ImLiveBroadcastRoomVo roomVo,Boolean onlineStatus) {
|
|
|
|
|
|
+ private void setGroupDefinedData(ImLiveBroadcastRoomVo roomVo, EGroupDefinedDataType type, String value) {
|
|
List<TencentRequest.ChatRoomGroupDefinedData> appDefinedData = new ArrayList<>();
|
|
List<TencentRequest.ChatRoomGroupDefinedData> appDefinedData = new ArrayList<>();
|
|
appDefinedData.add(TencentRequest.ChatRoomGroupDefinedData.builder()
|
|
appDefinedData.add(TencentRequest.ChatRoomGroupDefinedData.builder()
|
|
- .key("ANCHOR_STATUS")
|
|
|
|
- .value(onlineStatus?"ONLINE":"OFFLINE")
|
|
|
|
|
|
+ .key(type.getCode())
|
|
|
|
+ .value(value)
|
|
.build());
|
|
.build());
|
|
try {
|
|
try {
|
|
livePluginContext.getPluginService(roomVo.getServiceProvider())
|
|
livePluginContext.getPluginService(roomVo.getServiceProvider())
|
|
@@ -1235,6 +1254,18 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
log.info("opsRoom>>>> joinRoom error roomUid: {}", roomUid);
|
|
log.info("opsRoom>>>> joinRoom error roomUid: {}", roomUid);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ // 判断用户机构是否有权限进入该直播间
|
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserById(userId);
|
|
|
|
+ if (Objects.isNull(sysUser)) {
|
|
|
|
+ log.info("opsRoom>>>> joinRoom user null error userId: {}", userId);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (!sysUser.getTenantId().equals(imLiveBroadcastRoomVo.getTenantId())) {
|
|
|
|
+ log.info("opsRoom>>>> joinRoom error tenant diff userId: {}, tenantId: {}", userId, sysUser.getTenantId());
|
|
|
|
+ throw new BizException("当前用户所在机构没有加入直播间的权限");
|
|
|
|
+ }
|
|
|
|
+
|
|
//记录用户当前房间uid
|
|
//记录用户当前房间uid
|
|
redissonClient.getBucket(LIVE_USER_ROOM.replace(USER_ID, userId.toString())).set(roomUid, 12L, TimeUnit.HOURS);
|
|
redissonClient.getBucket(LIVE_USER_ROOM.replace(USER_ID, userId.toString())).set(roomUid, 12L, TimeUnit.HOURS);
|
|
//房间累计用户信息-指只要进入到该房间的用户都要记录
|
|
//房间累计用户信息-指只要进入到该房间的用户都要记录
|
|
@@ -1572,6 +1603,18 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
//推送直播开始消息
|
|
//推送直播开始消息
|
|
this.sendRoomLiveState(sysUser, room, MessageTypeEnum.JIGUANG_LIVE_STARTED);
|
|
this.sendRoomLiveState(sysUser, room, MessageTypeEnum.JIGUANG_LIVE_STARTED);
|
|
|
|
|
|
|
|
+ // 查询黑名单人员
|
|
|
|
+ List<ImLiveRoomBlack> blackList = imLiveRoomBlackService.lambdaQuery()
|
|
|
|
+ .eq(ImLiveRoomBlack::getRoomUid, room.getRoomUid())
|
|
|
|
+ .list();
|
|
|
|
+
|
|
|
|
+ ImLiveBroadcastRoomVo roomVo = getImLiveBroadcastRoomVo(room.getRoomUid());
|
|
|
|
+ if (CollectionUtils.isNotEmpty(blackList)) {
|
|
|
|
+ // 将黑名单人员踢出房间
|
|
|
|
+ for (ImLiveRoomBlack black : blackList) {
|
|
|
|
+ imLiveRoomBlackService.setBlack(black.getUserId(),roomVo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
log.error(">>>>>>>>>> createLiveRoom error roomUid:{} msg:{}", room.getRoomUid(), e.getMessage());
|
|
log.error(">>>>>>>>>> createLiveRoom error roomUid:{} msg:{}", room.getRoomUid(), e.getMessage());
|
|
}
|
|
}
|
|
@@ -1686,6 +1729,15 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
roomVo.setTotalLookNum(getNum.apply(this::getTotalUserCache, roomVo.getRoomUid()));
|
|
roomVo.setTotalLookNum(getNum.apply(this::getTotalUserCache, roomVo.getRoomUid()));
|
|
//在房间观看用户数量
|
|
//在房间观看用户数量
|
|
roomVo.setLookNum(getNum.apply(this::getOnlineUserCache, roomVo.getRoomUid()));
|
|
roomVo.setLookNum(getNum.apply(this::getOnlineUserCache, roomVo.getRoomUid()));
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 直播视频数
|
|
|
|
+ List<ImLiveRoomVideoVo> imLiveRoomVideoVos = imLiveRoomVideoService.queryList(roomVo.getRoomUid());
|
|
|
|
+ if (CollectionUtils.isNotEmpty(imLiveRoomVideoVos)) {
|
|
|
|
+ roomVo.setVideoNum(imLiveRoomVideoVos.size());
|
|
|
|
+ } else {
|
|
|
|
+ roomVo.setVideoNum(0);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1924,6 +1976,7 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
imLiveBroadcastRoom.setSpeakerStatus(liveRoom.getSpeakerStatus());
|
|
imLiveBroadcastRoom.setSpeakerStatus(liveRoom.getSpeakerStatus());
|
|
imLiveBroadcastRoom.setPushStatus(liveRoom.getPushStatus());
|
|
imLiveBroadcastRoom.setPushStatus(liveRoom.getPushStatus());
|
|
imLiveBroadcastRoom.setBanStatus(liveRoom.getBanStatus());
|
|
imLiveBroadcastRoom.setBanStatus(liveRoom.getBanStatus());
|
|
|
|
+ whetherChat(room.getId(), liveRoom.getBanStatus());
|
|
// 不用前端传时间
|
|
// 不用前端传时间
|
|
// imLiveBroadcastRoom.setLiveTotalTime(liveRoom.getLiveTotalTime());
|
|
// imLiveBroadcastRoom.setLiveTotalTime(liveRoom.getLiveTotalTime());
|
|
|
|
|