diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/family/FamilyHomeListExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/family/FamilyHomeListExe.java index 089d4aa5..6b7ce8ac 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/family/FamilyHomeListExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/family/FamilyHomeListExe.java @@ -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 execute(FamilyHomeListCmd cmd) { List familyList = getFamilyList(cmd); @@ -204,16 +209,24 @@ public class FamilyHomeListExe { Map profileMap = userProfileGateway.mapByUserIds(userIds); + + Map 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()); diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/family/FamilyHomeRoomCO.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/family/FamilyHomeRoomCO.java index 246d98fa..ebad1ed3 100644 --- a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/family/FamilyHomeRoomCO.java +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/family/FamilyHomeRoomCO.java @@ -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; /** * 在线人数