|
@@ -33,6 +33,7 @@ import com.ym.mec.biz.dal.enums.*;
|
|
|
import com.ym.mec.biz.dal.enums.live.ELiveViewMode;
|
|
|
import com.ym.mec.biz.dal.page.LiveRoomGoodsOrderQueryInfo;
|
|
|
import com.ym.mec.biz.dal.vo.*;
|
|
|
+import com.ym.mec.biz.dal.wrapper.LiveRoomWrapper;
|
|
|
import com.ym.mec.biz.redisson.RedissonMessageService;
|
|
|
import com.ym.mec.biz.service.*;
|
|
|
import com.ym.mec.biz.service.im.ImGroupCoreService;
|
|
@@ -49,6 +50,7 @@ import com.ym.mec.util.collection.MapUtil;
|
|
|
import com.ym.mec.util.date.DateUtil;
|
|
|
import com.ym.mec.util.excel.POIUtil;
|
|
|
import com.ym.mec.util.http.HttpUtil;
|
|
|
+import com.ym.mec.web.KLXFeignService;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.collections.MapUtils;
|
|
|
import org.apache.commons.lang3.RandomStringUtils;
|
|
@@ -137,6 +139,9 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
|
@Autowired
|
|
|
private ImGroupCoreService imGroupCoreService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private KLXFeignService klxFeignService;
|
|
|
+
|
|
|
|
|
|
//待替换的变量
|
|
|
public static final String USER_ID = "${userId}";
|
|
@@ -1250,7 +1255,7 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
|
|
|
|
//发送消息
|
|
|
try {
|
|
|
- livePluginContext.getPluginService(roomVo.getServiceProvider()).sendChatRoomMessage(message);
|
|
|
+// livePluginContext.getPluginService(roomVo.getServiceProvider()).sendChatRoomMessage(message);
|
|
|
log.info("sendOnlineUserCount>>>> message: {}", JSONObject.toJSONString(message));
|
|
|
} catch (Exception e) {
|
|
|
log.error("sendOnlineUserCount>>>> error {}", e.getMessage());
|
|
@@ -2532,12 +2537,7 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
|
|
|
|
// 不在从缓存中获取观看人数,改为从数据库中获取
|
|
|
|
|
|
- RoomMemberNumDto roomMemberNumDto = liveBroadcastRoomMemberDao.queryMemberNum(roomVo.getRoomUid());
|
|
|
- if (roomMemberNumDto == null) {
|
|
|
- roomMemberNumDto = new RoomMemberNumDto();
|
|
|
- roomMemberNumDto.setTotalNum(0);
|
|
|
- roomMemberNumDto.setOnlineNum(0);
|
|
|
- }
|
|
|
+ RoomMemberNumDto roomMemberNumDto = getRoomMemberNumDto(roomVo.getRoomUid());
|
|
|
roomVo.setTotalLookNum(roomMemberNumDto.getTotalNum() == null? 0 : roomMemberNumDto.getTotalNum());
|
|
|
roomVo.setLookNum(roomMemberNumDto.getOnlineNum() == null? 0 : roomMemberNumDto.getOnlineNum());
|
|
|
|
|
@@ -2550,6 +2550,19 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @NotNull
|
|
|
+ @Override
|
|
|
+ public RoomMemberNumDto getRoomMemberNumDto(String roomUid) {
|
|
|
+ RoomMemberNumDto roomMemberNumDto = liveBroadcastRoomMemberDao.queryMemberNum(roomUid);
|
|
|
+ if (roomMemberNumDto == null) {
|
|
|
+ roomMemberNumDto = new RoomMemberNumDto();
|
|
|
+ roomMemberNumDto.setTotalNum(0);
|
|
|
+ roomMemberNumDto.setOnlineNum(0);
|
|
|
+ }
|
|
|
+ return roomMemberNumDto;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 获取房间缓存中的用户数量/观看人数
|
|
|
*
|
|
@@ -2767,6 +2780,14 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
|
roomConfig.setWhether_mic(whetherMic);
|
|
|
imLiveBroadcastRoom.setRoomConfig(JSONObject.toJSONString(roomConfig));
|
|
|
this.updateById(imLiveBroadcastRoom);
|
|
|
+
|
|
|
+ // 设置酷乐秀状态
|
|
|
+ CompletableFuture.runAsync(()->{
|
|
|
+ com.ym.mec.dto.LiveRoomStatus status = new com.ym.mec.dto.LiveRoomStatus();
|
|
|
+ status.setRoomUid(roomUid);
|
|
|
+ status.setLinkMic(whetherMic == 1 ? 1 : 0);
|
|
|
+ klxFeignService.updateRoomStatus(JSON.parseObject(JSON.toJSONString(status)));
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -2814,7 +2835,12 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- return this.updateById(imLiveBroadcastRoom);
|
|
|
+ this.updateById(imLiveBroadcastRoom);
|
|
|
+
|
|
|
+ CompletableFuture.runAsync(()->{
|
|
|
+ klxFeignService.updateRoomStatus(JSON.parseObject(JSON.toJSONString(liveRoom)));
|
|
|
+ });
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -3153,6 +3179,34 @@ public class ImLiveBroadcastRoomServiceImpl extends ServiceImpl<ImLiveBroadcastR
|
|
|
return list.get(0);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public LiveRoomWrapper.LiveRoomCount queryRoomMemberCount(String roomUid) {
|
|
|
+ LiveRoomWrapper.LiveRoomCount liveRoomCount = new LiveRoomWrapper.LiveRoomCount();
|
|
|
+ liveRoomCount.setLookNum(0);
|
|
|
+ liveRoomCount.setTotalLookNum(0);
|
|
|
+ try {
|
|
|
+
|
|
|
+ List<TencentWrapper.ChatRoomGroupCounter> chatRoomGroupDefinedData = livePluginContext.getPluginService().getChatRoomGroupDefinedData(roomUid);
|
|
|
+ if (CollectionUtils.isNotEmpty(chatRoomGroupDefinedData)) {
|
|
|
+ chatRoomGroupDefinedData.forEach(data -> {
|
|
|
+ switch (data.getKey()) {
|
|
|
+ case "MEMBER_TOTAL":
|
|
|
+ liveRoomCount.setTotalLookNum(Integer.parseInt(data.getValue()));
|
|
|
+ break;
|
|
|
+ case "MEMBER_ONLINE":
|
|
|
+ liveRoomCount.setLookNum(Integer.parseInt(data.getValue()));
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("获取直播群配置失败", e);
|
|
|
+ }
|
|
|
+ return liveRoomCount;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 查询直播间所有用户信息
|