feat(发现): 发现列表新增是否所有区域逻辑
This commit is contained in:
parent
d06dcde23c
commit
a418deffea
@ -29,6 +29,11 @@ public class AppExtCommand extends AppCommand {
|
|||||||
|
|
||||||
private String roomSessionId;
|
private String roomSessionId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所有区域
|
||||||
|
*/
|
||||||
|
private boolean isAllRegion = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 转系统枚举.
|
* 转系统枚举.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -54,7 +54,7 @@ public class RoomVoiceDiscoverQryExe {
|
|||||||
private final LiveMicClient liveMicClient;
|
private final LiveMicClient liveMicClient;
|
||||||
|
|
||||||
public List<RoomVoiceProfileCO> execute(AppExtCommand cmd) {
|
public List<RoomVoiceProfileCO> execute(AppExtCommand cmd) {
|
||||||
String region = userRegionGateway.getRegionCode(cmd.requiredReqUserId());
|
String region = cmd.isAllRegion() ? "ALL" : userRegionGateway.getRegionCode(cmd.requiredReqUserId());
|
||||||
|
|
||||||
String key = cmd.requireReqSysOrigin() + region;
|
String key = cmd.requireReqSysOrigin() + region;
|
||||||
String regionsRoom = regionRoomCacheService.getRegionsRoom(key);
|
String regionsRoom = regionRoomCacheService.getRegionsRoom(key);
|
||||||
@ -63,7 +63,7 @@ public class RoomVoiceDiscoverQryExe {
|
|||||||
return roomList;
|
return roomList;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ActiveVoiceRoom> activeVoiceRooms = activeVoiceRoomService.listDiscover(cmd.requireReqSysOrigin(), region, 50);
|
List<ActiveVoiceRoom> activeVoiceRooms = activeVoiceRoomService.listDiscover(cmd.requireReqSysOrigin(), cmd.isAllRegion(), region, 50);
|
||||||
log.info("activeVoiceRooms:{}", JSON.toJSONString(activeVoiceRooms));
|
log.info("activeVoiceRooms:{}", JSON.toJSONString(activeVoiceRooms));
|
||||||
// 处理没有人的房间,有缓存不会大量创建线程
|
// 处理没有人的房间,有缓存不会大量创建线程
|
||||||
// new Thread(() -> formatRoomList(activeVoiceRooms)).start();
|
// new Thread(() -> formatRoomList(activeVoiceRooms)).start();
|
||||||
@ -72,10 +72,8 @@ public class RoomVoiceDiscoverQryExe {
|
|||||||
|
|
||||||
if (CollectionUtils.isEmpty(roomList)) {
|
if (CollectionUtils.isEmpty(roomList)) {
|
||||||
//roomList = getHomeData(cmd,latestMobileDeviceService.getLatestLanguage(cmd.requiredReqUserId()));
|
//roomList = getHomeData(cmd,latestMobileDeviceService.getLatestLanguage(cmd.requiredReqUserId()));
|
||||||
roomList = roomVoiceProfileCommon
|
roomList = roomVoiceProfileCommon.toListRoomVoiceProfileCO(
|
||||||
.toListRoomVoiceProfileCO(activeVoiceRoomService.listDiscover(
|
activeVoiceRoomService.listDiscover(cmd.requireReqSysOrigin(), cmd.isAllRegion(), "ID", 50));
|
||||||
cmd.requireReqSysOrigin(), "ID", 50)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
if (CollectionUtils.isEmpty(roomList)) {
|
if (CollectionUtils.isEmpty(roomList)) {
|
||||||
return CollectionUtils.newArrayList();
|
return CollectionUtils.newArrayList();
|
||||||
|
|||||||
@ -65,7 +65,7 @@ public interface ActiveVoiceRoomService {
|
|||||||
/**
|
/**
|
||||||
* 获取发现页数据.
|
* 获取发现页数据.
|
||||||
*/
|
*/
|
||||||
List<ActiveVoiceRoom> listDiscover(String sysOrigin, String region, Integer limit);
|
List<ActiveVoiceRoom> listDiscover(String sysOrigin, boolean isAllRegion, String region, Integer limit);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取区域房间.
|
* 获取区域房间.
|
||||||
|
|||||||
@ -118,7 +118,7 @@ public class ActiveVoiceRoomServiceImpl implements ActiveVoiceRoomService {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ActiveVoiceRoom> listDiscover(String sysOrigin, String region, Integer limit) {
|
public List<ActiveVoiceRoom> listDiscover(String sysOrigin, boolean isAllRegion, String region, Integer limit) {
|
||||||
|
|
||||||
// 区域隔离
|
// 区域隔离
|
||||||
List<String> regions = getRegions(region);
|
List<String> regions = getRegions(region);
|
||||||
@ -126,10 +126,10 @@ public class ActiveVoiceRoomServiceImpl implements ActiveVoiceRoomService {
|
|||||||
log.info("被隔离区域 regions:{}", JSON.toJSONString(regions));
|
log.info("被隔离区域 regions:{}", JSON.toJSONString(regions));
|
||||||
// 构建聚合管道
|
// 构建聚合管道
|
||||||
Criteria criteria = Criteria.where("sysOrigin").is(sysOrigin);
|
Criteria criteria = Criteria.where("sysOrigin").is(sysOrigin);
|
||||||
if (CollectionUtils.isNotEmpty(specialRegions)) {
|
if (CollectionUtils.isNotEmpty(specialRegions) && !isAllRegion) {
|
||||||
criteria.and("region").in(specialRegions);
|
criteria.and("region").in(specialRegions);
|
||||||
}
|
}
|
||||||
if (CollectionUtils.isEmpty(specialRegions) && CollectionUtils.isNotEmpty(regions)) {
|
if (CollectionUtils.isEmpty(specialRegions) && CollectionUtils.isNotEmpty(regions) && !isAllRegion) {
|
||||||
criteria.and("region").nin(regions);
|
criteria.and("region").nin(regions);
|
||||||
}
|
}
|
||||||
Aggregation aggregation = Aggregation.newAggregation(
|
Aggregation aggregation = Aggregation.newAggregation(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user