房间榜增加隐身
This commit is contained in:
parent
c7878c1341
commit
72b6832b3a
@ -3,11 +3,16 @@ package com.red.circle.other.app.command.activity;
|
||||
import com.red.circle.common.business.dto.cmd.AppExtCommand;
|
||||
import com.red.circle.other.app.dto.clientobject.activity.ActivityLeaderboardCO;
|
||||
import com.red.circle.other.app.dto.clientobject.activity.ActivityLeaderboardCO.LeaderboardUserCO;
|
||||
import com.red.circle.other.domain.enums.VipAbilityType;
|
||||
import com.red.circle.other.domain.gateway.user.UserProfileGateway;
|
||||
import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheService;
|
||||
import com.red.circle.other.infra.database.mongo.entity.activity.RankQueenCount;
|
||||
import com.red.circle.other.infra.database.mongo.entity.activity.RankQueenType;
|
||||
import com.red.circle.other.infra.database.mongo.entity.live.RoomProfile;
|
||||
import com.red.circle.other.infra.database.mongo.service.activity.RankCountService;
|
||||
import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService;
|
||||
import com.red.circle.other.infra.utils.UserIdEncryptUtils;
|
||||
import com.red.circle.other.inner.enums.config.EnumConfigKey;
|
||||
import com.red.circle.tool.core.collection.CollectionUtils;
|
||||
import com.red.circle.tool.core.json.JacksonUtils;
|
||||
import com.red.circle.tool.core.num.NumUtils;
|
||||
@ -33,6 +38,8 @@ public class RoomGiftsLeaderboardQryExe {
|
||||
|
||||
private final RankCountService rankCountService;
|
||||
private final RoomProfileManagerService roomProfileManagerService;
|
||||
private final UserProfileGateway userProfileGateway;
|
||||
private final EnumConfigCacheService enumConfigCacheService;
|
||||
|
||||
public ActivityLeaderboardCO execute(AppExtCommand cmd) {
|
||||
List<RankQueenCount> hours = getListRank(cmd, RankQueenType.ROOM_RANK_HOUR,50);
|
||||
@ -45,12 +52,15 @@ public class RoomGiftsLeaderboardQryExe {
|
||||
return ActivityLeaderboardCO.empty();
|
||||
}
|
||||
Map<Long, RoomProfile> roomProfileMap = roomProfileManagerService.mapProfileByRoomIds(roomIds);
|
||||
Set<Long> ownerIds = roomProfileMap.values().stream()
|
||||
.map(RoomProfile::getUserId).filter(Objects::nonNull).collect(Collectors.toSet());
|
||||
Set<Long> invisibleOwnerIds = userProfileGateway.filterUsersByVipAbility(ownerIds, VipAbilityType.MYSTERIOUS_INVISIBILITY);
|
||||
|
||||
return new ActivityLeaderboardCO()
|
||||
.setHourly(toLeaderboardUserCO(hours, roomProfileMap))
|
||||
.setDaily(toLeaderboardUserCO(days, roomProfileMap))
|
||||
.setWeekly(toLeaderboardUserCO(weeks, roomProfileMap))
|
||||
.setMonthly(toLeaderboardUserCO(months, roomProfileMap));
|
||||
.setHourly(toLeaderboardUserCO(hours, roomProfileMap, invisibleOwnerIds))
|
||||
.setDaily(toLeaderboardUserCO(days, roomProfileMap, invisibleOwnerIds))
|
||||
.setWeekly(toLeaderboardUserCO(weeks, roomProfileMap, invisibleOwnerIds))
|
||||
.setMonthly(toLeaderboardUserCO(months, roomProfileMap, invisibleOwnerIds));
|
||||
}
|
||||
|
||||
public ActivityLeaderboardCO executeApp(AppExtCommand cmd) {
|
||||
@ -64,11 +74,14 @@ public class RoomGiftsLeaderboardQryExe {
|
||||
return ActivityLeaderboardCO.empty();
|
||||
}
|
||||
Map<Long, RoomProfile> roomProfileMap = roomProfileManagerService.mapProfileByRoomIds(roomIds);
|
||||
Set<Long> ownerIds = roomProfileMap.values().stream()
|
||||
.map(RoomProfile::getUserId).filter(Objects::nonNull).collect(Collectors.toSet());
|
||||
Set<Long> invisibleOwnerIds = userProfileGateway.filterUsersByVipAbility(ownerIds, VipAbilityType.MYSTERIOUS_INVISIBILITY);
|
||||
|
||||
return new ActivityLeaderboardCO()
|
||||
.setDaily(toLeaderboardUserCO(null, roomProfileMap))
|
||||
.setWeekly(toLeaderboardUserCO(weeks, roomProfileMap))
|
||||
.setMonthly(toLeaderboardUserCO(null, roomProfileMap));
|
||||
.setDaily(toLeaderboardUserCO(null, roomProfileMap, invisibleOwnerIds))
|
||||
.setWeekly(toLeaderboardUserCO(weeks, roomProfileMap, invisibleOwnerIds))
|
||||
.setMonthly(toLeaderboardUserCO(null, roomProfileMap, invisibleOwnerIds));
|
||||
}
|
||||
|
||||
private Set<Long> getAllUserIds(List<RankQueenCount> days, List<RankQueenCount> weeks,
|
||||
@ -89,7 +102,7 @@ public class RoomGiftsLeaderboardQryExe {
|
||||
}
|
||||
|
||||
private List<LeaderboardUserCO> toLeaderboardUserCO(List<RankQueenCount> list,
|
||||
Map<Long, RoomProfile> roomProfileMap) {
|
||||
Map<Long, RoomProfile> roomProfileMap, Set<Long> invisibleOwnerIds) {
|
||||
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return CollectionUtils.newArrayList();
|
||||
@ -100,12 +113,20 @@ public class RoomGiftsLeaderboardQryExe {
|
||||
log.warn("数据异常,找不到房间记录: {}", JacksonUtils.toJson(count));
|
||||
return null;
|
||||
}
|
||||
return new LeaderboardUserCO()
|
||||
.setId(roomProfile.getId())
|
||||
.setAvatar(roomProfile.getRoomCover())
|
||||
.setNickname(roomProfile.getRoomName())
|
||||
LeaderboardUserCO co = new LeaderboardUserCO()
|
||||
.setQuantity(count.getQuantity())
|
||||
.setQuantityFormat(NumUtils.formatLong(count.getQuantity()));
|
||||
if (Objects.nonNull(roomProfile.getUserId()) && invisibleOwnerIds.contains(roomProfile.getUserId())) {
|
||||
co.setId(null);
|
||||
co.setEncryptedId(UserIdEncryptUtils.encrypt(roomProfile.getId()));
|
||||
co.setNickname("****");
|
||||
co.setAvatar(enumConfigCacheService.getValue(EnumConfigKey.USER_YINSHEN_COVER, roomProfile.getSysOrigin()));
|
||||
} else {
|
||||
co.setId(roomProfile.getId());
|
||||
co.setAvatar(roomProfile.getRoomCover());
|
||||
co.setNickname(roomProfile.getRoomName());
|
||||
}
|
||||
return co;
|
||||
}).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user