diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/RoomGiftsLeaderboardQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/RoomGiftsLeaderboardQryExe.java index 9e2ab46f..72a39047 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/RoomGiftsLeaderboardQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/RoomGiftsLeaderboardQryExe.java @@ -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 hours = getListRank(cmd, RankQueenType.ROOM_RANK_HOUR,50); @@ -45,12 +52,15 @@ public class RoomGiftsLeaderboardQryExe { return ActivityLeaderboardCO.empty(); } Map roomProfileMap = roomProfileManagerService.mapProfileByRoomIds(roomIds); + Set ownerIds = roomProfileMap.values().stream() + .map(RoomProfile::getUserId).filter(Objects::nonNull).collect(Collectors.toSet()); + Set 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 roomProfileMap = roomProfileManagerService.mapProfileByRoomIds(roomIds); + Set ownerIds = roomProfileMap.values().stream() + .map(RoomProfile::getUserId).filter(Objects::nonNull).collect(Collectors.toSet()); + Set 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 getAllUserIds(List days, List weeks, @@ -89,7 +102,7 @@ public class RoomGiftsLeaderboardQryExe { } private List toLeaderboardUserCO(List list, - Map roomProfileMap) { + Map roomProfileMap, Set 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()); }