我的足迹和我的关注新增 正在游玩的游戏字段
This commit is contained in:
parent
426d57a830
commit
1253a404b2
@ -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<RoomBrowseRecordsV2CO> execute(AppFlowCmd cmd) {
|
||||
List<RoomSubscription> roomSubscriptions = roomSubscriptionService
|
||||
@ -40,9 +42,20 @@ public class UserFollowRoomsQryExe {
|
||||
List<RoomSubscription> roomSubscriptions) {
|
||||
Map<Long, RoomVoiceProfileCO> 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<Long> list = roomSubscriptions.stream().map(RoomSubscription::getRoomId).toList();
|
||||
Map<Long, String> 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());
|
||||
}
|
||||
|
||||
|
||||
@ -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<RoomBrowseRecordsV2CO> execute(AppFlowCmd cmd) {
|
||||
List<RoomTourist> roomTourists = roomTouristService
|
||||
@ -35,12 +38,24 @@ public class UserTraceRoomsQryExe {
|
||||
if (CollectionUtils.isEmpty(roomTourists)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
|
||||
// 填充游戏图标
|
||||
List<Long> list = roomTourists.stream().map(RoomTourist::getRoomId).toList();
|
||||
Map<Long, String> coverMap = gameLudoService.listGameCoverByRoomIds(list);
|
||||
|
||||
Map<Long, RoomVoiceProfileCO> 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());
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user