fix closed room visibility in lists
This commit is contained in:
parent
d15ea98dc6
commit
258e56ea45
@ -14,17 +14,18 @@ import com.red.circle.other.infra.common.family.FamilyCommon;
|
|||||||
import com.red.circle.other.infra.database.mongo.entity.live.ActiveVoiceRoom;
|
import com.red.circle.other.infra.database.mongo.entity.live.ActiveVoiceRoom;
|
||||||
import com.red.circle.other.infra.database.mongo.entity.live.RoomProfileManager;
|
import com.red.circle.other.infra.database.mongo.entity.live.RoomProfileManager;
|
||||||
import com.red.circle.other.infra.database.mongo.entity.user.status.OnlineUser;
|
import com.red.circle.other.infra.database.mongo.entity.user.status.OnlineUser;
|
||||||
import com.red.circle.other.infra.database.mongo.service.live.ActiveVoiceRoomService;
|
import com.red.circle.other.infra.database.mongo.service.live.ActiveVoiceRoomService;
|
||||||
import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService;
|
import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService;
|
||||||
import com.red.circle.other.infra.database.mongo.service.user.status.OnlineUserService;
|
import com.red.circle.other.infra.database.mongo.service.user.status.OnlineUserService;
|
||||||
import com.red.circle.other.infra.database.rds.entity.family.FamilyBaseInfo;
|
import com.red.circle.other.infra.database.rds.entity.family.FamilyBaseInfo;
|
||||||
import com.red.circle.other.infra.database.rds.entity.family.FamilyMemberInfo;
|
import com.red.circle.other.infra.database.rds.entity.family.FamilyMemberInfo;
|
||||||
import com.red.circle.other.infra.database.rds.service.family.FamilyBaseInfoService;
|
import com.red.circle.other.infra.database.rds.service.family.FamilyBaseInfoService;
|
||||||
import com.red.circle.other.infra.database.rds.service.family.FamilyLevelExpService;
|
import com.red.circle.other.infra.database.rds.service.family.FamilyLevelExpService;
|
||||||
import com.red.circle.other.infra.database.rds.service.family.FamilyMemberInfoService;
|
import com.red.circle.other.infra.database.rds.service.family.FamilyMemberInfoService;
|
||||||
import com.red.circle.other.infra.enums.family.FamilyRoleEnum;
|
import com.red.circle.other.infra.enums.family.FamilyRoleEnum;
|
||||||
import com.red.circle.other.infra.enums.family.FamilyStatusEnum;
|
import com.red.circle.other.infra.enums.family.FamilyStatusEnum;
|
||||||
import com.red.circle.other.inner.model.dto.famliy.FamilyDetailsDTO;
|
import com.red.circle.other.inner.enums.room.RoomEventEnum;
|
||||||
|
import com.red.circle.other.inner.model.dto.famliy.FamilyDetailsDTO;
|
||||||
import com.red.circle.tool.core.collection.CollectionUtils;
|
import com.red.circle.tool.core.collection.CollectionUtils;
|
||||||
import com.red.circle.tool.core.num.NumUtils;
|
import com.red.circle.tool.core.num.NumUtils;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@ -217,22 +218,33 @@ public class FamilyHomeListExe {
|
|||||||
rooms.stream().map(ActiveVoiceRoom::getId).collect(Collectors.toSet()));
|
rooms.stream().map(ActiveVoiceRoom::getId).collect(Collectors.toSet()));
|
||||||
|
|
||||||
|
|
||||||
return rooms.stream()
|
return rooms.stream()
|
||||||
.map(room -> {
|
.map(room -> {
|
||||||
UserProfile profile = profileMap.get(room.getUserId());
|
UserProfile profile = profileMap.get(room.getUserId());
|
||||||
RoomProfileManager roomProfileManager = roomProfileManagerMap.getOrDefault(room.getId(), new RoomProfileManager());
|
RoomProfileManager roomProfileManager = roomProfileManagerMap.get(room.getId());
|
||||||
|
if (!isAvailableRoom(roomProfileManager)) {
|
||||||
return new FamilyHomeRoomCO()
|
return null;
|
||||||
.setRoomId(room.getId())
|
}
|
||||||
.setRoomName(roomProfileManager.getRoomAccount())
|
|
||||||
.setRoomCover(roomProfileManager.getRoomCover())
|
return new FamilyHomeRoomCO()
|
||||||
|
.setRoomId(room.getId())
|
||||||
|
.setRoomName(roomProfileManager.getRoomAccount())
|
||||||
|
.setRoomCover(roomProfileManager.getRoomCover())
|
||||||
.setCountryCode(roomProfileManager.getCountryCode())
|
.setCountryCode(roomProfileManager.getCountryCode())
|
||||||
.setCountryName(roomProfileManager.getCountryName())
|
.setCountryName(roomProfileManager.getCountryName())
|
||||||
.setRoomDesc(roomProfileManager.getRoomDesc())
|
.setRoomDesc(roomProfileManager.getRoomDesc())
|
||||||
.setExistsPassword(StringUtils.isNotBlank(roomProfileManager.getSetting().getPassword()))
|
.setExistsPassword(StringUtils.isNotBlank(roomProfileManager.getSetting().getPassword()))
|
||||||
.setOnlineQuantity(room.getOnlineQuantity());
|
.setOnlineQuantity(room.getOnlineQuantity());
|
||||||
})
|
})
|
||||||
.collect(Collectors.toList());
|
.filter(Objects::nonNull)
|
||||||
}
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
}
|
|
||||||
|
private boolean isAvailableRoom(RoomProfileManager roomProfileManager) {
|
||||||
|
return Objects.nonNull(roomProfileManager)
|
||||||
|
&& !Objects.equals(roomProfileManager.getDel(), Boolean.TRUE)
|
||||||
|
&& !Objects.equals(roomProfileManager.getEvent(), RoomEventEnum.CLOSE.name())
|
||||||
|
&& Objects.nonNull(roomProfileManager.getSetting());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
package com.red.circle.other.app.command.party3rd.callback.trtc;
|
package com.red.circle.other.app.command.party3rd.callback.trtc;
|
||||||
|
|
||||||
import com.red.circle.external.inner.model.callback.trtc.TrtcCallbackEvent;
|
import com.red.circle.external.inner.model.callback.trtc.TrtcCallbackEvent;
|
||||||
import com.red.circle.other.infra.database.cache.service.other.RoomManagerCacheService;
|
import com.red.circle.other.infra.database.cache.service.other.RoomManagerCacheService;
|
||||||
import com.red.circle.other.infra.database.mongo.service.live.ActiveVoiceRoomService;
|
import com.red.circle.other.infra.database.mongo.service.live.ActiveVoiceRoomService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import com.red.circle.tool.core.text.StringUtils;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -20,11 +21,14 @@ public class DisbandRoomCallbackStrategy implements TrtcCallbackStrategy {
|
|||||||
private final ActiveVoiceRoomService activeVoiceRoomService;
|
private final ActiveVoiceRoomService activeVoiceRoomService;
|
||||||
private final RoomManagerCacheService roomManagerCacheService;
|
private final RoomManagerCacheService roomManagerCacheService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doOperation(TrtcCallbackEvent event) {
|
public void doOperation(TrtcCallbackEvent event) {
|
||||||
// log.warn("解散房间:{}", event);
|
log.warn("解散房间:{}", event);
|
||||||
// activeVoiceRoomService.removeByRoomAccount(event.getRoomIdLongValve());
|
if (StringUtils.isBlank(event.getRoomId())) {
|
||||||
// roomManagerCacheService.removeNumberPeople(event.getRoomIdLongValve());
|
return;
|
||||||
}
|
}
|
||||||
|
activeVoiceRoomService.removeByRoomAccount(event.getRoomId());
|
||||||
}
|
roomManagerCacheService.removeNumberPeople(event.getRoomId());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@ -76,12 +76,20 @@ public class RoomVoiceDiscoverQryExe {
|
|||||||
String region = cmd.isAllRegion() ? "ALL" : userRegionGateway.getRegionCode(cmd.requiredReqUserId());
|
String region = cmd.isAllRegion() ? "ALL" : userRegionGateway.getRegionCode(cmd.requiredReqUserId());
|
||||||
UserProfile userProfile = userProfileGateway.getByUserId(cmd.requiredReqUserId());
|
UserProfile userProfile = userProfileGateway.getByUserId(cmd.requiredReqUserId());
|
||||||
|
|
||||||
String key = cmd.requireReqSysOrigin() + region;
|
String key = cmd.requireReqSysOrigin() + region;
|
||||||
String regionsRoom = regionRoomCacheService.getRegionsRoom(key);
|
String regionsRoom = regionRoomCacheService.getRegionsRoom(key);
|
||||||
if (Objects.nonNull(regionsRoom)) {
|
if (Objects.nonNull(regionsRoom)) {
|
||||||
List<RoomVoiceProfileCO> roomList = JSON.parseArray(regionsRoom, RoomVoiceProfileCO.class);
|
List<RoomVoiceProfileCO> roomList = JSON.parseArray(regionsRoom, RoomVoiceProfileCO.class);
|
||||||
return roomList;
|
if (CollectionUtils.isEmpty(roomList)) {
|
||||||
}
|
return CollectionUtils.newArrayList();
|
||||||
|
}
|
||||||
|
List<RoomVoiceProfileCO> availableRooms = roomVoiceProfileCommon
|
||||||
|
.filterAvailableRoomProfiles(roomList);
|
||||||
|
if (availableRooms.size() != roomList.size()) {
|
||||||
|
regionRoomCacheService.remove(key);
|
||||||
|
}
|
||||||
|
return availableRooms;
|
||||||
|
}
|
||||||
|
|
||||||
String userCountryCode = userProfile != null ? userProfile.getCountryCode() : null;
|
String userCountryCode = userProfile != null ? userProfile.getCountryCode() : null;
|
||||||
List<ActiveVoiceRoom> activeVoiceRooms = activeVoiceRoomService.listDiscover(cmd.requireReqSysOrigin(), cmd.isAllRegion(), region, userCountryCode, 50);
|
List<ActiveVoiceRoom> activeVoiceRooms = activeVoiceRoomService.listDiscover(cmd.requireReqSysOrigin(), cmd.isAllRegion(), region, userCountryCode, 50);
|
||||||
|
|||||||
@ -3,14 +3,15 @@ package com.red.circle.other.app.command.room.query;
|
|||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.red.circle.common.business.dto.cmd.app.AppFlowCmd;
|
import com.red.circle.common.business.dto.cmd.app.AppFlowCmd;
|
||||||
import com.red.circle.other.app.common.room.RoomVoiceProfileCommon;
|
import com.red.circle.other.app.common.room.RoomVoiceProfileCommon;
|
||||||
import com.red.circle.other.app.dto.clientobject.room.RoomBrowseRecordsV2CO;
|
import com.red.circle.other.app.dto.clientobject.room.RoomBrowseRecordsV2CO;
|
||||||
import com.red.circle.other.app.dto.clientobject.room.RoomVoiceProfileCO;
|
import com.red.circle.other.app.dto.clientobject.room.RoomVoiceProfileCO;
|
||||||
import com.red.circle.other.infra.database.rds.entity.live.RoomMember;
|
import com.red.circle.other.infra.database.rds.entity.live.RoomMember;
|
||||||
import com.red.circle.other.infra.database.rds.service.live.RoomMemberService;
|
import com.red.circle.other.infra.database.rds.service.live.RoomMemberService;
|
||||||
import com.red.circle.tool.core.collection.CollectionUtils;
|
import com.red.circle.tool.core.collection.CollectionUtils;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@ -32,11 +33,12 @@ public class UserJoinedRoomsQryExe {
|
|||||||
if (CollectionUtils.isEmpty(roomMembers)) {
|
if (CollectionUtils.isEmpty(roomMembers)) {
|
||||||
return Lists.newArrayList();
|
return Lists.newArrayList();
|
||||||
}
|
}
|
||||||
Map<Long, RoomVoiceProfileCO> roomProfileMap = roomVoiceProfileCommon.mapRoomVoiceProfile(
|
Map<Long, RoomVoiceProfileCO> roomProfileMap = roomVoiceProfileCommon.mapRoomVoiceProfile(
|
||||||
roomMembers.stream().map(RoomMember::getRoomId).collect(Collectors.toSet()));
|
roomMembers.stream().map(RoomMember::getRoomId).collect(Collectors.toSet()));
|
||||||
return roomMembers.stream().map(roomMember -> new RoomBrowseRecordsV2CO()
|
return roomMembers.stream().map(roomMember -> new RoomBrowseRecordsV2CO()
|
||||||
.setId(roomMember.getId())
|
.setId(roomMember.getId())
|
||||||
.setRoomProfile(roomProfileMap.get(roomMember.getRoomId())))
|
.setRoomProfile(roomProfileMap.get(roomMember.getRoomId())))
|
||||||
.collect(Collectors.toList());
|
.filter(record -> Objects.nonNull(record.getRoomProfile()))
|
||||||
}
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -45,18 +45,19 @@ public class UserTraceRoomsQryExe {
|
|||||||
|
|
||||||
Map<Long, RoomVoiceProfileCO> roomProfileMap = roomVoiceProfileCommon.mapRoomVoiceProfile(
|
Map<Long, RoomVoiceProfileCO> roomProfileMap = roomVoiceProfileCommon.mapRoomVoiceProfile(
|
||||||
roomTourists.stream().map(RoomTourist::getRoomId).collect(Collectors.toSet()));
|
roomTourists.stream().map(RoomTourist::getRoomId).collect(Collectors.toSet()));
|
||||||
return roomTourists.stream().filter(Objects::nonNull)
|
return roomTourists.stream().filter(Objects::nonNull)
|
||||||
.map(roomTourist -> {
|
.map(roomTourist -> {
|
||||||
RoomVoiceProfileCO profileCO = roomProfileMap.get(roomTourist.getRoomId());
|
RoomVoiceProfileCO profileCO = roomProfileMap.get(roomTourist.getRoomId());
|
||||||
if (profileCO != null) {
|
if (profileCO != null) {
|
||||||
profileCO.setRoomGameIcon(coverMap.get(roomTourist.getRoomId()));
|
profileCO.setRoomGameIcon(coverMap.get(roomTourist.getRoomId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new RoomBrowseRecordsV2CO()
|
return new RoomBrowseRecordsV2CO()
|
||||||
.setId(roomTourist.getTimeId())
|
.setId(roomTourist.getTimeId())
|
||||||
.setRoomProfile(profileCO);
|
.setRoomProfile(profileCO);
|
||||||
}
|
}
|
||||||
).collect(Collectors.toList());
|
).filter(record -> Objects.nonNull(record.getRoomProfile()))
|
||||||
}
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
|
|||||||
@ -8,11 +8,12 @@ import com.red.circle.other.app.convertor.live.RoomProfileAppConvertor;
|
|||||||
import com.red.circle.other.app.convertor.user.UserProfileAppConvertor;
|
import com.red.circle.other.app.convertor.user.UserProfileAppConvertor;
|
||||||
import com.red.circle.other.app.dto.clientobject.room.RoomVoiceProfileCO;
|
import com.red.circle.other.app.dto.clientobject.room.RoomVoiceProfileCO;
|
||||||
import com.red.circle.other.domain.gateway.user.UserProfileGateway;
|
import com.red.circle.other.domain.gateway.user.UserProfileGateway;
|
||||||
import com.red.circle.other.infra.database.mongo.entity.live.ActiveVoiceRoom;
|
import com.red.circle.other.infra.database.mongo.entity.live.ActiveVoiceRoom;
|
||||||
import com.red.circle.other.infra.database.mongo.entity.live.RoomProfileManager;
|
import com.red.circle.other.infra.database.mongo.entity.live.RoomProfileManager;
|
||||||
import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService;
|
import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService;
|
||||||
import com.red.circle.other.inner.model.dto.material.UseBadgeDTO;
|
import com.red.circle.other.inner.enums.room.RoomEventEnum;
|
||||||
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
|
import com.red.circle.other.inner.model.dto.material.UseBadgeDTO;
|
||||||
|
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
|
||||||
import com.red.circle.tool.core.collection.CollectionUtils;
|
import com.red.circle.tool.core.collection.CollectionUtils;
|
||||||
import com.red.circle.tool.core.text.StringUtils;
|
import com.red.circle.tool.core.text.StringUtils;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -43,22 +44,31 @@ public class RoomVoiceProfileCommon {
|
|||||||
return listRoomVoiceProfilesV2(roomProfileManagerService.listByRoomIds(roomIds));
|
return listRoomVoiceProfilesV2(roomProfileManagerService.listByRoomIds(roomIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<RoomVoiceProfileCO> listRoomVoiceProfilesV2(
|
public List<RoomVoiceProfileCO> listRoomVoiceProfilesV2(
|
||||||
List<RoomProfileManager> roomProfileManagers) {
|
List<RoomProfileManager> roomProfileManagers) {
|
||||||
if (CollectionUtils.isEmpty(roomProfileManagers)) {
|
if (CollectionUtils.isEmpty(roomProfileManagers)) {
|
||||||
return Lists.newArrayList();
|
return Lists.newArrayList();
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<Long, UserProfileDTO> userProfileMap = userProfileAppConvertor.toMapUserProfileDTO(
|
List<RoomProfileManager> availableRooms = roomProfileManagers.stream()
|
||||||
userProfileGateway.mapByUserIds(
|
.filter(this::isRoomAvailable)
|
||||||
roomProfileManagers.stream().map(RoomProfileManager::getUserId)
|
.toList();
|
||||||
.collect(Collectors.toSet())));
|
|
||||||
|
if (CollectionUtils.isEmpty(availableRooms)) {
|
||||||
return roomProfileManagers.stream()
|
return Lists.newArrayList();
|
||||||
.map(roomManager -> mergeRoomVoiceProfile(userProfileMap.get(roomManager.getUserId()),
|
}
|
||||||
roomManager))
|
|
||||||
.toList();
|
Map<Long, UserProfileDTO> userProfileMap = userProfileAppConvertor.toMapUserProfileDTO(
|
||||||
}
|
userProfileGateway.mapByUserIds(
|
||||||
|
availableRooms.stream().map(RoomProfileManager::getUserId)
|
||||||
|
.collect(Collectors.toSet())));
|
||||||
|
|
||||||
|
return availableRooms.stream()
|
||||||
|
.map(roomManager -> mergeRoomVoiceProfile(userProfileMap.get(roomManager.getUserId()),
|
||||||
|
roomManager))
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
public Map<Long, RoomVoiceProfileCO> mapRoomVoiceProfile(Set<Long> roomIds) {
|
public Map<Long, RoomVoiceProfileCO> mapRoomVoiceProfile(Set<Long> roomIds) {
|
||||||
if (CollectionUtils.isEmpty(roomIds)) {
|
if (CollectionUtils.isEmpty(roomIds)) {
|
||||||
@ -70,25 +80,36 @@ public class RoomVoiceProfileCommon {
|
|||||||
.orElse(Maps.newHashMap());
|
.orElse(Maps.newHashMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
public RoomVoiceProfileCO getAvailableByRoomAccount(SysOriginPlatformEnum sysOrigin,
|
public RoomVoiceProfileCO getAvailableByRoomAccount(SysOriginPlatformEnum sysOrigin,
|
||||||
String roomAccount) {
|
String roomAccount) {
|
||||||
return Optional.ofNullable(
|
return Optional.ofNullable(
|
||||||
userProfileAppConvertor.toUserProfileDTO(
|
userProfileAppConvertor.toUserProfileDTO(
|
||||||
userProfileGateway.getByAccount(sysOrigin.name(), roomAccount)
|
userProfileGateway.getByAccount(sysOrigin.name(), roomAccount)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.map(userProfile -> {
|
.map(userProfile -> {
|
||||||
RoomProfileManager manager = roomProfileManagerService.getByUserId(userProfile.getId());
|
RoomProfileManager manager = roomProfileManagerService.getByUserId(userProfile.getId());
|
||||||
if (Objects.nonNull(manager)) {
|
if (isRoomAvailable(manager)) {
|
||||||
if (Objects.equals(manager.getDel(), Boolean.TRUE)) {
|
return mergeRoomVoiceProfile(userProfile, manager);
|
||||||
return null;
|
}
|
||||||
}
|
|
||||||
return mergeRoomVoiceProfile(userProfile, manager);
|
return null;
|
||||||
}
|
}).orElse(null);
|
||||||
|
}
|
||||||
return null;
|
|
||||||
}).orElse(null);
|
public List<RoomVoiceProfileCO> filterAvailableRoomProfiles(
|
||||||
}
|
List<RoomVoiceProfileCO> roomVoiceProfiles) {
|
||||||
|
if (CollectionUtils.isEmpty(roomVoiceProfiles)) {
|
||||||
|
return Lists.newArrayList();
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<Long, RoomProfileManager> roomProfileManagerMap = roomProfileManagerService.mapByRoomIds(
|
||||||
|
roomVoiceProfiles.stream().map(RoomVoiceProfileCO::getId).collect(Collectors.toSet()));
|
||||||
|
|
||||||
|
return roomVoiceProfiles.stream()
|
||||||
|
.filter(room -> isRoomAvailable(roomProfileManagerMap.get(room.getId())))
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
public List<RoomVoiceProfileCO> toListRoomVoiceProfileCO(List<ActiveVoiceRoom> activeVoiceRooms) {
|
public List<RoomVoiceProfileCO> toListRoomVoiceProfileCO(List<ActiveVoiceRoom> activeVoiceRooms) {
|
||||||
if (CollectionUtils.isEmpty(activeVoiceRooms)) {
|
if (CollectionUtils.isEmpty(activeVoiceRooms)) {
|
||||||
@ -136,12 +157,12 @@ public class RoomVoiceProfileCommon {
|
|||||||
return roomVoiceProfile;
|
return roomVoiceProfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
private RoomVoiceProfileCO mergeRoomVoiceProfile(UserProfileDTO userProfile,
|
private RoomVoiceProfileCO mergeRoomVoiceProfile(UserProfileDTO userProfile,
|
||||||
RoomProfileManager manager) {
|
RoomProfileManager manager) {
|
||||||
|
|
||||||
if (Objects.isNull(manager)) {
|
if (!isRoomAvailable(manager)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
RoomVoiceProfileCO roomVoiceProfile = roomProfileAppConvertor.toRoomVoiceProfileCO(manager);
|
RoomVoiceProfileCO roomVoiceProfile = roomProfileAppConvertor.toRoomVoiceProfileCO(manager);
|
||||||
roomVoiceProfile.setUserProfile(userProfile);
|
roomVoiceProfile.setUserProfile(userProfile);
|
||||||
@ -155,8 +176,14 @@ public class RoomVoiceProfileCommon {
|
|||||||
);
|
);
|
||||||
// 兼容Android进入自己房间错误
|
// 兼容Android进入自己房间错误
|
||||||
roomVoiceProfile.setLayoutKey("");
|
roomVoiceProfile.setLayoutKey("");
|
||||||
return roomVoiceProfile;
|
return roomVoiceProfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isRoomAvailable(RoomProfileManager manager) {
|
||||||
}
|
return Objects.nonNull(manager)
|
||||||
|
&& !Objects.equals(manager.getDel(), Boolean.TRUE)
|
||||||
|
&& !Objects.equals(manager.getEvent(), RoomEventEnum.CLOSE.name());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@ -5,14 +5,17 @@ import com.google.common.collect.Lists;
|
|||||||
import com.mongodb.BasicDBObject;
|
import com.mongodb.BasicDBObject;
|
||||||
import com.red.circle.common.business.core.ReplaceString;
|
import com.red.circle.common.business.core.ReplaceString;
|
||||||
import com.red.circle.common.business.core.SensitiveWordFilter;
|
import com.red.circle.common.business.core.SensitiveWordFilter;
|
||||||
import com.red.circle.framework.core.asserts.ResponseAssert;
|
import com.red.circle.framework.core.asserts.ResponseAssert;
|
||||||
import com.red.circle.other.infra.database.mongo.entity.live.RoomCounter;
|
import com.red.circle.other.infra.database.cache.service.other.RoomManagerCacheService;
|
||||||
import com.red.circle.other.infra.database.mongo.entity.live.RoomProfile;
|
import com.red.circle.other.infra.database.mongo.entity.live.RoomCounter;
|
||||||
import com.red.circle.other.infra.database.mongo.entity.live.RoomProfileManager;
|
import com.red.circle.other.infra.database.mongo.entity.live.RoomProfile;
|
||||||
import com.red.circle.other.infra.database.mongo.entity.live.RoomSetting;
|
import com.red.circle.other.infra.database.mongo.entity.live.RoomProfileManager;
|
||||||
import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService;
|
import com.red.circle.other.infra.database.mongo.entity.live.RoomSetting;
|
||||||
import com.red.circle.other.inner.asserts.DynamicErrorCode;
|
import com.red.circle.other.infra.database.mongo.service.live.ActiveVoiceRoomService;
|
||||||
import com.red.circle.other.inner.model.cmd.room.RoomProfileOpsQryCmd;
|
import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService;
|
||||||
|
import com.red.circle.other.inner.asserts.DynamicErrorCode;
|
||||||
|
import com.red.circle.other.inner.enums.room.RoomEventEnum;
|
||||||
|
import com.red.circle.other.inner.model.cmd.room.RoomProfileOpsQryCmd;
|
||||||
import com.red.circle.other.inner.model.dto.material.UseBadgeDTO;
|
import com.red.circle.other.inner.model.dto.material.UseBadgeDTO;
|
||||||
import com.red.circle.other.inner.model.dto.material.UsePropsDTO;
|
import com.red.circle.other.inner.model.dto.material.UsePropsDTO;
|
||||||
import com.red.circle.tool.core.collection.CollectionUtils;
|
import com.red.circle.tool.core.collection.CollectionUtils;
|
||||||
@ -48,10 +51,12 @@ import org.springframework.stereotype.Service;
|
|||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class RoomProfileManagerServiceImpl implements RoomProfileManagerService {
|
public class RoomProfileManagerServiceImpl implements RoomProfileManagerService {
|
||||||
|
|
||||||
private final MongoTemplate mongoTemplate;
|
private final MongoTemplate mongoTemplate;
|
||||||
private final RedisTemplate<String, String> redisTemplate;
|
private final RedisTemplate<String, String> redisTemplate;
|
||||||
|
private final ActiveVoiceRoomService activeVoiceRoomService;
|
||||||
|
private final RoomManagerCacheService roomManagerCacheService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Redis缓存Key前缀
|
* Redis缓存Key前缀
|
||||||
@ -439,16 +444,23 @@ public class RoomProfileManagerServiceImpl implements RoomProfileManagerService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean updateSelectiveProfile(RoomProfile roomProfile) {
|
public Boolean updateSelectiveProfile(RoomProfile roomProfile) {
|
||||||
RoomProfileManager profile = getById(roomProfile.getId());
|
RoomProfileManager profile = getById(roomProfile.getId());
|
||||||
if (Objects.isNull(profile)) {
|
if (Objects.isNull(profile)) {
|
||||||
return Boolean.FALSE;
|
return Boolean.FALSE;
|
||||||
}
|
}
|
||||||
mongoTemplate.updateFirst(Query.query(Criteria.where("id").is(roomProfile.getId())),
|
mongoTemplate.updateFirst(Query.query(Criteria.where("id").is(roomProfile.getId())),
|
||||||
getUpdateSelectiveProfile(roomProfile),
|
getUpdateSelectiveProfile(roomProfile),
|
||||||
RoomProfileManager.class);
|
RoomProfileManager.class);
|
||||||
return Boolean.TRUE;
|
if (Objects.equals(roomProfile.getEvent(), RoomEventEnum.CLOSE.name())
|
||||||
}
|
|| Objects.equals(roomProfile.getDel(), Boolean.TRUE)) {
|
||||||
|
if (StringUtils.isNotBlank(profile.getRoomAccount())) {
|
||||||
|
activeVoiceRoomService.removeByRoomAccount(profile.getRoomAccount());
|
||||||
|
roomManagerCacheService.removeNumberPeople(profile.getRoomAccount());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSelectiveSetting(Long roomId, RoomSetting roomSetting) {
|
public void updateSelectiveSetting(Long roomId, RoomSetting roomSetting) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user