diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/query/WeekKingQueenRankingQueryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/query/WeekKingQueenRankingQueryExe.java index 121d7bc7..740f59b6 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/query/WeekKingQueenRankingQueryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/query/WeekKingQueenRankingQueryExe.java @@ -5,9 +5,13 @@ import com.red.circle.framework.dto.PageResult; 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.cmd.activity.WeekKingQueenRankingQueryCmd; +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.WeekKingQueenCount; import com.red.circle.other.infra.database.mongo.service.activity.WeekKingQueenCountService; +import com.red.circle.other.infra.utils.UserIdEncryptUtils; +import com.red.circle.other.inner.enums.config.EnumConfigKey; import com.red.circle.other.inner.enums.activity.KingQueenType; import com.red.circle.other.inner.model.dto.user.UserProfileDTO; import com.red.circle.tool.core.collection.CollectionUtils; @@ -39,6 +43,7 @@ public class WeekKingQueenRankingQueryExe { private final UserProfileGateway userProfileGateway; private final UserProfileAppConvertor userProfileAppConvertor; private final WeekKingQueenCountService weekKingQueenCountService; + private final EnumConfigCacheService enumConfigCacheService; public PageResult execute(WeekKingQueenRankingQueryCmd cmd) { Page kingQueenCountPage = pageWeekTop(cmd.getReqSysOrigin().getOrigin(), @@ -51,13 +56,29 @@ public class WeekKingQueenRankingQueryExe { if (CollectionUtils.isEmpty(weekKingQueens)) { return null; } + Set userIds = getUserIds(weekKingQueens); Map userProfileMap = userProfileAppConvertor.toMapUserProfileDTO( - userProfileGateway - .mapByUserIds(getUserIds(weekKingQueens))); + userProfileGateway.mapByUserIds(userIds)); + Set invisibleUserIds = userProfileGateway.filterUsersByVipAbility(userIds, VipAbilityType.MYSTERIOUS_INVISIBILITY); List userRankList = weekKingQueens.stream() .map(item -> { UserProfileDTO userProfile = userProfileMap.get(item.getUserId()); + 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())) + .setUserNickname("****") + .setQuantity(NumUtils.formatLong(item.getQuantity())) + .setRank(item.getRank()) + .setCountryName(null) + .setCountryCode(null); + } return new UserRankCO() .setUserId(userProfile.getId()) .setAccount(userProfile.getAccount()) @@ -67,7 +88,7 @@ public class WeekKingQueenRankingQueryExe { .setRank(item.getRank()) .setCountryName(userProfile.getCountryName()) .setCountryCode(userProfile.getCountryCode()); - }).toList(); + }).filter(Objects::nonNull).toList(); diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/activity/UserRankCO.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/activity/UserRankCO.java index 4ea02343..c1fc0527 100644 --- a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/activity/UserRankCO.java +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/activity/UserRankCO.java @@ -25,6 +25,11 @@ public class UserRankCO extends ClientObject { @JsonSerialize(using = ToStringSerializer.class) private Long userId; + /** + * 加密后的用户ID(隐身用户使用). + */ + private String encryptedId; + /** * 账号 */