家族列表接口 增加房间密码等信息

This commit is contained in:
tianfeng 2025-12-26 18:25:02 +08:00
parent d80f94ecc7
commit 52de5d6577
2 changed files with 36 additions and 14 deletions

View File

@ -12,8 +12,10 @@ import com.red.circle.other.domain.model.user.UserConsumptionLevel;
import com.red.circle.other.domain.model.user.UserProfile;
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.RoomProfileManager;
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.RoomProfileManagerService;
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.FamilyMemberInfo;
@ -28,6 +30,8 @@ import com.red.circle.tool.core.num.NumUtils;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
import com.red.circle.tool.core.text.StringUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@ -47,6 +51,7 @@ public class FamilyHomeListExe {
private final FamilyBaseInfoService familyBaseInfoService;
private final FamilyLevelExpService familyLevelExpService;
private final FamilyMemberInfoService familyMemberInfoService;
private final RoomProfileManagerService roomProfileManagerService;
public PageResult<FamilyHomeListCO> execute(FamilyHomeListCmd cmd) {
List<FamilyBaseInfo> familyList = getFamilyList(cmd);
@ -204,16 +209,24 @@ public class FamilyHomeListExe {
Map<Long, UserProfile> profileMap = userProfileGateway.mapByUserIds(userIds);
Map<Long, RoomProfileManager> roomProfileManagerMap = roomProfileManagerService.mapByRoomIds(
rooms.stream().map(ActiveVoiceRoom::getId).collect(Collectors.toSet()));
return rooms.stream()
.map(room -> {
UserProfile profile = profileMap.get(room.getUserId());
RoomProfileManager roomProfileManager = roomProfileManagerMap.getOrDefault(room.getId(), new RoomProfileManager());
return new FamilyHomeRoomCO()
.setRoomId(room.getId())
.setRoomAccount(room.getRoomAccount())
.setUserId(room.getUserId())
.setUserAvatar(Objects.nonNull(profile) ? profile.getUserAvatar() : "")
.setUserNickname(Objects.nonNull(profile) ? profile.getUserNickname() : "")
.setRoomName(roomProfileManager.getRoomAccount())
.setRoomCover(roomProfileManager.getRoomCover())
.setCountryCode(roomProfileManager.getCountryCode())
.setCountryName(roomProfileManager.getCountryName())
.setRoomDesc(roomProfileManager.getRoomDesc())
.setExistsPassword(StringUtils.isNotBlank(roomProfileManager.getSetting().getPassword()))
.setOnlineQuantity(room.getOnlineQuantity());
})
.collect(Collectors.toList());

View File

@ -22,25 +22,34 @@ public class FamilyHomeRoomCO implements Serializable {
private Long roomId;
/**
* 房间账号
* 封面.
*/
private String roomAccount;
private String roomCover;
/**
* 房主ID
* 名称.
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long userId;
private String roomName;
/**
* 房主头像
* 描述.
*/
private String userAvatar;
private String roomDesc;
/**
* 房主昵称
* 国家code.
*/
private String userNickname;
private String countryCode;
/**
* 国家名称
*/
private String countryName;
/**
* 是否有密码
*/
private Boolean existsPassword;
/**
* 在线人数