From cc22708e70ca31b6116dd180a8c4a1e3f5c6abcb Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Thu, 19 Mar 2026 14:18:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E6=A6=9C=E5=92=8C=E5=91=A8=E6=98=9F?= =?UTF-8?q?=E6=8E=92=E8=A1=8C=E6=A6=9C=E9=9A=90=E8=BA=AB=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activity/query/RankingListQryExe.java | 18 +++++++++------ .../query/WeekStarGiftRankingQueryExe.java | 22 +++++++++++++++++-- .../activity/RankingActivityRecordCO.java | 5 +++++ 3 files changed, 36 insertions(+), 9 deletions(-) diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/query/RankingListQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/query/RankingListQryExe.java index f3a161e9..2184a641 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/query/RankingListQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/query/RankingListQryExe.java @@ -11,6 +11,7 @@ import com.red.circle.other.domain.enums.VipAbilityType; import com.red.circle.other.domain.gateway.user.UserProfileGateway; import com.red.circle.other.domain.model.user.UserProfile; import com.red.circle.other.domain.ranking.RankingActivityType; +import com.red.circle.other.infra.utils.UserIdEncryptUtils; import com.red.circle.other.domain.ranking.RankingCycleType; import com.red.circle.other.domain.ranking.RankingDimension; import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheService; @@ -72,23 +73,23 @@ public class RankingListQryExe { cmd.getTopN() ); + Set userIds = getUserIds(records); Map userProfileMap = userProfileAppConvertor.toMapUserProfileDTO( - userProfileGateway - .mapByUserIds(getUserIds(records))); + userProfileGateway.mapByUserIds(userIds)); + Set invisibleUserIds = userProfileGateway.filterUsersByVipAbility(userIds, VipAbilityType.MYSTERIOUS_INVISIBILITY); // 转换为CO并设置排名 List rankingList = IntStream.range(0, records.size()) .mapToObj(i -> { RankingActivityRecord record = records.get(i); RankingActivityRecordCO co = convertor.toRecordCO(record); - co.setRank(i + 1); // 排名从1开始 + co.setRank(i + 1); UserProfileDTO userProfileDTO = userProfileMap.get(record.getUserId()); if (userProfileDTO != null) { - boolean invisible = userProfileGateway.getUserVipAbility( - record.getUserId(), VipAbilityType.MYSTERIOUS_INVISIBILITY); - if (invisible) { + if (invisibleUserIds.contains(record.getUserId())) { co.setUserId(null); + co.setEncryptedId(UserIdEncryptUtils.encrypt(userProfileDTO.getId())); co.setAccount(null); co.setNickname("****"); co.setAvatar(enumConfigCacheService.getValue(EnumConfigKey.USER_YINSHEN_COVER, userProfileDTO.getSysOriginChild())); @@ -153,7 +154,10 @@ public class RankingListQryExe { // 从排行榜列表中查找当前用户 Optional userInList = rankingList.stream() - .filter(record -> cmd.getReqUserId().equals(record.getUserId())) + .filter(record -> cmd.getReqUserId().equals(record.getUserId()) + || (record.getUserId() == null + && record.getEncryptedId() != null + && cmd.getReqUserId().equals(UserIdEncryptUtils.decrypt(record.getEncryptedId())))) .findFirst(); if (userInList.isPresent()) { diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/query/WeekStarGiftRankingQueryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/query/WeekStarGiftRankingQueryExe.java index a27c4cf2..72de08ae 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/query/WeekStarGiftRankingQueryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/query/WeekStarGiftRankingQueryExe.java @@ -7,9 +7,13 @@ import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; import com.red.circle.other.app.dto.clientobject.activity.UserRankCO; import com.red.circle.other.app.dto.clientobject.activity.WeekStarGiftUserRankCO; import com.red.circle.other.app.dto.cmd.activity.WeekStarRankingQueryCmd; +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.WeekStarGiftCount; import com.red.circle.other.infra.database.mongo.service.activity.WeekStarGiftCountService; +import com.red.circle.other.infra.utils.UserIdEncryptUtils; +import com.red.circle.other.inner.enums.config.EnumConfigKey; import com.red.circle.other.inner.model.dto.user.UserProfileDTO; import com.red.circle.tool.core.collection.CollectionUtils; import com.red.circle.tool.core.num.NumUtils; @@ -33,6 +37,7 @@ public class WeekStarGiftRankingQueryExe { private final UserProfileGateway userProfileGateway; private final UserProfileAppConvertor userProfileAppConvertor; private final WeekStarGiftCountService weekStarGiftCountService; + private final EnumConfigCacheService enumConfigCacheService; public WeekStarGiftUserRankCO execute(WeekStarRankingQueryCmd cmd) { WeekStarGiftUserRankCO result = new WeekStarGiftUserRankCO() @@ -80,10 +85,11 @@ public class WeekStarGiftRankingQueryExe { List weekStarGiftCounts = (List) pageResult.getRecords(); + Set userIds = getUserIds(weekStarGiftCounts); Map userProfileMap = userProfileAppConvertor.toMapUserProfileDTO( - userProfileGateway - .mapByUserIds(getUserIds(weekStarGiftCounts)) + userProfileGateway.mapByUserIds(userIds) ); + Set invisibleUserIds = userProfileGateway.filterUsersByVipAbility(userIds, VipAbilityType.MYSTERIOUS_INVISIBILITY); List list = weekStarGiftCounts.stream() .map(item -> { @@ -91,6 +97,18 @@ public class WeekStarGiftRankingQueryExe { if (Objects.isNull(userProfile)) { return null; } + if (invisibleUserIds.contains(item.getUserId())) { + return new UserRankCO() + .setUserId(null) + .setEncryptedId(UserIdEncryptUtils.encrypt(userProfile.getId())) + .setAccount(null) + .setUserAvatar(enumConfigCacheService.getValue(EnumConfigKey.USER_YINSHEN_COVER, userProfile.getSysOriginChild())) + .setRank(item.getRank()) + .setUserNickname("****") + .setQuantity(NumUtils.formatLong(item.getQuantity())) + .setCountryCode(null) + .setCountryName(null); + } return new UserRankCO() .setUserId(userProfile.getId()) .setAccount(userProfile.getAccount()) diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/activity/RankingActivityRecordCO.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/activity/RankingActivityRecordCO.java index c08fdf27..b11a1459 100644 --- a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/activity/RankingActivityRecordCO.java +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/activity/RankingActivityRecordCO.java @@ -20,6 +20,11 @@ public class RankingActivityRecordCO implements Serializable { @JsonSerialize(using = ToStringSerializer.class) private Long userId; + /** + * 加密后的用户ID(隐身用户使用,用于myRank匹配). + */ + private String encryptedId; + private String account; /**