diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/room/query/UserFollowRoomsQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/room/query/UserFollowRoomsQryExe.java index c7fc533b..4b0dea62 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/room/query/UserFollowRoomsQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/room/query/UserFollowRoomsQryExe.java @@ -5,6 +5,7 @@ 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.dto.clientobject.room.RoomBrowseRecordsV2CO; import com.red.circle.other.app.dto.clientobject.room.RoomVoiceProfileCO; +import com.red.circle.other.app.service.game.GameLudoService; import com.red.circle.other.infra.database.rds.entity.live.RoomSubscription; import com.red.circle.other.infra.database.rds.service.live.RoomSubscriptionService; import com.red.circle.tool.core.collection.CollectionUtils; @@ -26,6 +27,7 @@ public class UserFollowRoomsQryExe { private final RoomVoiceProfileCommon roomVoiceProfileCommon; private final RoomSubscriptionService roomSubscriptionService; + private final GameLudoService gameLudoService; public List execute(AppFlowCmd cmd) { List roomSubscriptions = roomSubscriptionService @@ -40,9 +42,20 @@ public class UserFollowRoomsQryExe { List roomSubscriptions) { Map roomProfileMap = roomVoiceProfileCommon.mapRoomVoiceProfile( roomSubscriptions.stream().map(RoomSubscription::getRoomId).collect(Collectors.toSet())); - return roomSubscriptions.stream().map(roomMember -> new RoomBrowseRecordsV2CO() - .setId(roomMember.getId()) - .setRoomProfile(roomProfileMap.get(roomMember.getRoomId()))) + + // 填充游戏图标 + List list = roomSubscriptions.stream().map(RoomSubscription::getRoomId).toList(); + Map coverMap = gameLudoService.listGameCoverByRoomIds(list); + + return roomSubscriptions.stream().map(roomMember -> { + RoomVoiceProfileCO profileCO = roomProfileMap.get(roomMember.getRoomId()); + if (profileCO != null) { + profileCO.setRoomGameIcon(coverMap.get(roomMember.getRoomId())); + } + return new RoomBrowseRecordsV2CO() + .setId(roomMember.getId()) + .setRoomProfile(profileCO); + }) .filter(sub -> Objects.nonNull(sub.getRoomProfile())).collect(Collectors.toList()); } diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/room/query/UserTraceRoomsQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/room/query/UserTraceRoomsQryExe.java index 88944dc1..a77897ae 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/room/query/UserTraceRoomsQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/room/query/UserTraceRoomsQryExe.java @@ -5,8 +5,10 @@ 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.dto.clientobject.room.RoomBrowseRecordsV2CO; import com.red.circle.other.app.dto.clientobject.room.RoomVoiceProfileCO; +import com.red.circle.other.app.service.game.GameLudoService; import com.red.circle.other.infra.database.mongo.entity.live.RoomTourist; import com.red.circle.other.infra.database.mongo.service.live.RoomTouristService; +import com.red.circle.other.infra.database.rds.entity.live.RoomSubscription; import com.red.circle.tool.core.collection.CollectionUtils; import java.util.List; import java.util.Map; @@ -28,6 +30,7 @@ public class UserTraceRoomsQryExe { private final RoomTouristService roomTouristService; private final RoomVoiceProfileCommon roomVoiceProfileCommon; + private final GameLudoService gameLudoService; public List execute(AppFlowCmd cmd) { List roomTourists = roomTouristService @@ -35,12 +38,24 @@ public class UserTraceRoomsQryExe { if (CollectionUtils.isEmpty(roomTourists)) { return Lists.newArrayList(); } + + // 填充游戏图标 + List list = roomTourists.stream().map(RoomTourist::getRoomId).toList(); + Map coverMap = gameLudoService.listGameCoverByRoomIds(list); + Map roomProfileMap = roomVoiceProfileCommon.mapRoomVoiceProfile( roomTourists.stream().map(RoomTourist::getRoomId).collect(Collectors.toSet())); return roomTourists.stream().filter(Objects::nonNull) - .map(roomTourist -> new RoomBrowseRecordsV2CO() - .setId(roomTourist.getTimeId()) - .setRoomProfile(roomProfileMap.get(roomTourist.getRoomId())) + .map(roomTourist -> { + RoomVoiceProfileCO profileCO = roomProfileMap.get(roomTourist.getRoomId()); + if (profileCO != null) { + profileCO.setRoomGameIcon(coverMap.get(roomTourist.getRoomId())); + } + + return new RoomBrowseRecordsV2CO() + .setId(roomTourist.getTimeId()) + .setRoomProfile(profileCO); + } ).collect(Collectors.toList()); }