财富魅力棒新增隐身效果

This commit is contained in:
tianfeng 2026-03-19 12:04:51 +08:00
parent 5c3fdc4108
commit 9c257eba1b
8 changed files with 101 additions and 33 deletions

View File

@ -27,6 +27,11 @@ public enum EnumConfigKey {
*/ */
DEFAULT_ROOM_COVER, DEFAULT_ROOM_COVER,
/**
* 用户隐身图
*/
USER_YINSHEN_COVER,
/** /**
* h5基础域名. * h5基础域名.
*/ */

View File

@ -4,10 +4,13 @@ import com.red.circle.common.business.dto.cmd.AppExtCommand;
import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; import com.red.circle.other.app.convertor.user.UserProfileAppConvertor;
import com.red.circle.other.app.dto.clientobject.activity.ActivityLeaderboardCO; 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.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.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.RankQueenCount;
import com.red.circle.other.infra.database.mongo.entity.activity.RankQueenType; import com.red.circle.other.infra.database.mongo.entity.activity.RankQueenType;
import com.red.circle.other.infra.database.mongo.service.activity.RankCountService; import com.red.circle.other.infra.database.mongo.service.activity.RankCountService;
import com.red.circle.other.inner.enums.config.EnumConfigKey;
import com.red.circle.other.inner.model.dto.user.UserProfileDTO; import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
import com.red.circle.tool.core.collection.CollectionUtils; import com.red.circle.tool.core.collection.CollectionUtils;
import com.red.circle.tool.core.json.JacksonUtils; import com.red.circle.tool.core.json.JacksonUtils;
@ -32,6 +35,7 @@ public class GiftsReceivedLeaderboardQryExe {
private final RankCountService rankCountService; private final RankCountService rankCountService;
private final UserProfileGateway userProfileGateway; private final UserProfileGateway userProfileGateway;
private final UserProfileAppConvertor userProfileAppConvertor; private final UserProfileAppConvertor userProfileAppConvertor;
private final EnumConfigCacheService enumConfigCacheService;
public ActivityLeaderboardCO execute(AppExtCommand cmd) { public ActivityLeaderboardCO execute(AppExtCommand cmd) {
List<RankQueenCount> hours = getListRank(cmd, RankQueenType.CHARM_RANK_HOUR,50); List<RankQueenCount> hours = getListRank(cmd, RankQueenType.CHARM_RANK_HOUR,50);
@ -49,12 +53,13 @@ public class GiftsReceivedLeaderboardQryExe {
Map<Long, UserProfileDTO> userProfileMap = userProfileAppConvertor.toMapUserProfileDTO( Map<Long, UserProfileDTO> userProfileMap = userProfileAppConvertor.toMapUserProfileDTO(
userProfileGateway.mapByUserIds(userIds) userProfileGateway.mapByUserIds(userIds)
); );
Set<Long> invisibleUserIds = userProfileGateway.filterUsersByVipAbility(userIds, VipAbilityType.MYSTERIOUS_INVISIBILITY);
return new ActivityLeaderboardCO() return new ActivityLeaderboardCO()
.setHourly(toLeaderboardUserCO(hours, userProfileMap)) .setHourly(toLeaderboardUserCO(hours, userProfileMap, invisibleUserIds))
.setDaily(toLeaderboardUserCO(days, userProfileMap)) .setDaily(toLeaderboardUserCO(days, userProfileMap, invisibleUserIds))
.setWeekly(toLeaderboardUserCO(weeks, userProfileMap)) .setWeekly(toLeaderboardUserCO(weeks, userProfileMap, invisibleUserIds))
.setMonthly(toLeaderboardUserCO(months, userProfileMap)) .setMonthly(toLeaderboardUserCO(months, userProfileMap, invisibleUserIds))
; ;
} }
@ -74,31 +79,39 @@ public class GiftsReceivedLeaderboardQryExe {
Map<Long, UserProfileDTO> userProfileMap = userProfileAppConvertor.toMapUserProfileDTO( Map<Long, UserProfileDTO> userProfileMap = userProfileAppConvertor.toMapUserProfileDTO(
userProfileGateway.mapByUserIds(userIds) userProfileGateway.mapByUserIds(userIds)
); );
Set<Long> invisibleUserIds = userProfileGateway.filterUsersByVipAbility(userIds, VipAbilityType.MYSTERIOUS_INVISIBILITY);
List<RankQueenCount> emptyList = Collections.emptyList(); List<RankQueenCount> emptyList = Collections.emptyList();
return new ActivityLeaderboardCO() return new ActivityLeaderboardCO()
.setHourly(toLeaderboardUserCO(emptyList, userProfileMap)) .setHourly(toLeaderboardUserCO(emptyList, userProfileMap, invisibleUserIds))
.setDaily(toLeaderboardUserCO(emptyList, userProfileMap)) .setDaily(toLeaderboardUserCO(emptyList, userProfileMap, invisibleUserIds))
.setWeekly(toLeaderboardUserCO(weeks, userProfileMap)) .setWeekly(toLeaderboardUserCO(weeks, userProfileMap, invisibleUserIds))
.setMonthly(toLeaderboardUserCO(emptyList, userProfileMap)) .setMonthly(toLeaderboardUserCO(emptyList, userProfileMap, invisibleUserIds))
; ;
} }
private List<LeaderboardUserCO> toLeaderboardUserCO(List<RankQueenCount> list, private List<LeaderboardUserCO> toLeaderboardUserCO(List<RankQueenCount> list,
Map<Long, UserProfileDTO> userProfileMap) { Map<Long, UserProfileDTO> userProfileMap, Set<Long> invisibleUserIds) {
return list.stream().map(count -> { return list.stream().map(count -> {
UserProfileDTO userProfile = userProfileMap.get(count.getBusinessId()); UserProfileDTO userProfile = userProfileMap.get(count.getBusinessId());
if (Objects.isNull(userProfile)) { if (Objects.isNull(userProfile)) {
log.warn("数据错误,没有找到用户记录: {}", JacksonUtils.toJson(count)); log.warn("数据错误,没有找到用户记录: {}", JacksonUtils.toJson(count));
return null; return null;
} }
return new LeaderboardUserCO() LeaderboardUserCO co = new LeaderboardUserCO()
.setId(userProfile.getId())
.setAvatar(userProfile.getUserAvatar())
.setNickname(userProfile.getUserNickname())
.setQuantity(count.getQuantity()) .setQuantity(count.getQuantity())
.setQuantityFormat(NumUtils.formatLong(count.getQuantity())); .setQuantityFormat(NumUtils.formatLong(count.getQuantity()));
if (invisibleUserIds.contains(count.getBusinessId())) {
co.setId(null);
co.setNickname("****");
co.setAvatar(enumConfigCacheService.getValue(EnumConfigKey.USER_YINSHEN_COVER, userProfile.getSysOriginChild()));
} else {
co.setId(userProfile.getId());
co.setAvatar(userProfile.getUserAvatar());
co.setNickname(userProfile.getUserNickname());
}
return co;
}).filter(Objects::nonNull).collect(Collectors.toList()); }).filter(Objects::nonNull).collect(Collectors.toList());
} }

View File

@ -4,10 +4,13 @@ import com.red.circle.common.business.dto.cmd.AppExtCommand;
import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; import com.red.circle.other.app.convertor.user.UserProfileAppConvertor;
import com.red.circle.other.app.dto.clientobject.activity.ActivityLeaderboardCO; 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.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.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.RankQueenCount;
import com.red.circle.other.infra.database.mongo.entity.activity.RankQueenType; import com.red.circle.other.infra.database.mongo.entity.activity.RankQueenType;
import com.red.circle.other.infra.database.mongo.service.activity.RankCountService; import com.red.circle.other.infra.database.mongo.service.activity.RankCountService;
import com.red.circle.other.inner.enums.config.EnumConfigKey;
import com.red.circle.other.inner.model.dto.user.UserProfileDTO; import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
import com.red.circle.tool.core.collection.CollectionUtils; import com.red.circle.tool.core.collection.CollectionUtils;
import com.red.circle.tool.core.json.JacksonUtils; import com.red.circle.tool.core.json.JacksonUtils;
@ -35,6 +38,7 @@ public class GiftsSendLeaderboardQryExe {
private final RankCountService rankCountService; private final RankCountService rankCountService;
private final UserProfileGateway userProfileGateway; private final UserProfileGateway userProfileGateway;
private final UserProfileAppConvertor userProfileAppConvertor; private final UserProfileAppConvertor userProfileAppConvertor;
private final EnumConfigCacheService enumConfigCacheService;
public ActivityLeaderboardCO execute(AppExtCommand cmd) { public ActivityLeaderboardCO execute(AppExtCommand cmd) {
List<RankQueenCount> hours = getListRank(cmd, RankQueenType.WEALTH_RANK_HOUR,50); List<RankQueenCount> hours = getListRank(cmd, RankQueenType.WEALTH_RANK_HOUR,50);
@ -49,12 +53,13 @@ public class GiftsSendLeaderboardQryExe {
Map<Long, UserProfileDTO> userProfileMap = userProfileAppConvertor.toMapUserProfileDTO( Map<Long, UserProfileDTO> userProfileMap = userProfileAppConvertor.toMapUserProfileDTO(
userProfileGateway.mapByUserIds(userIds) userProfileGateway.mapByUserIds(userIds)
); );
Set<Long> invisibleUserIds = userProfileGateway.filterUsersByVipAbility(userIds, VipAbilityType.MYSTERIOUS_INVISIBILITY);
return new ActivityLeaderboardCO() return new ActivityLeaderboardCO()
.setHourly(toLeaderboardUserCO(hours, userProfileMap)) .setHourly(toLeaderboardUserCO(hours, userProfileMap, invisibleUserIds))
.setDaily(toLeaderboardUserCO(days, userProfileMap)) .setDaily(toLeaderboardUserCO(days, userProfileMap, invisibleUserIds))
.setWeekly(toLeaderboardUserCO(weeks, userProfileMap)) .setWeekly(toLeaderboardUserCO(weeks, userProfileMap, invisibleUserIds))
.setMonthly(toLeaderboardUserCO(months, userProfileMap)); .setMonthly(toLeaderboardUserCO(months, userProfileMap, invisibleUserIds));
} }
public ActivityLeaderboardCO executeApp(AppExtCommand cmd) { public ActivityLeaderboardCO executeApp(AppExtCommand cmd) {
@ -70,11 +75,12 @@ public class GiftsSendLeaderboardQryExe {
Map<Long, UserProfileDTO> userProfileMap = userProfileAppConvertor.toMapUserProfileDTO( Map<Long, UserProfileDTO> userProfileMap = userProfileAppConvertor.toMapUserProfileDTO(
userProfileGateway.mapByUserIds(userIds) userProfileGateway.mapByUserIds(userIds)
); );
Set<Long> invisibleUserIds = userProfileGateway.filterUsersByVipAbility(userIds, VipAbilityType.MYSTERIOUS_INVISIBILITY);
return new ActivityLeaderboardCO() return new ActivityLeaderboardCO()
.setDaily(toLeaderboardUserCO(null, userProfileMap)) .setDaily(toLeaderboardUserCO(null, userProfileMap, invisibleUserIds))
.setWeekly(toLeaderboardUserCO(weeks, userProfileMap)) .setWeekly(toLeaderboardUserCO(weeks, userProfileMap, invisibleUserIds))
.setMonthly(toLeaderboardUserCO(null, userProfileMap)); .setMonthly(toLeaderboardUserCO(null, userProfileMap, invisibleUserIds));
} }
private Set<Long> getAllUserIds(List<RankQueenCount> days, List<RankQueenCount> weeks, private Set<Long> getAllUserIds(List<RankQueenCount> days, List<RankQueenCount> weeks,
@ -95,7 +101,7 @@ public class GiftsSendLeaderboardQryExe {
} }
private List<LeaderboardUserCO> toLeaderboardUserCO(List<RankQueenCount> list, private List<LeaderboardUserCO> toLeaderboardUserCO(List<RankQueenCount> list,
Map<Long, UserProfileDTO> userProfileMap) { Map<Long, UserProfileDTO> userProfileMap, Set<Long> invisibleUserIds) {
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
return CollectionUtils.newArrayList(); return CollectionUtils.newArrayList();
} }
@ -105,12 +111,19 @@ public class GiftsSendLeaderboardQryExe {
log.warn("数据异常,找不到用户记录: {}", JacksonUtils.toJson(count)); log.warn("数据异常,找不到用户记录: {}", JacksonUtils.toJson(count));
return null; return null;
} }
return new LeaderboardUserCO() LeaderboardUserCO co = new LeaderboardUserCO()
.setId(userProfile.getId())
.setAvatar(userProfile.getUserAvatar())
.setNickname(userProfile.getUserNickname())
.setQuantity(count.getQuantity()) .setQuantity(count.getQuantity())
.setQuantityFormat(NumUtils.formatLong(count.getQuantity())); .setQuantityFormat(NumUtils.formatLong(count.getQuantity()));
if (invisibleUserIds.contains(count.getBusinessId())) {
co.setId(null);
co.setNickname("****");
co.setAvatar(enumConfigCacheService.getValue(EnumConfigKey.USER_YINSHEN_COVER, userProfile.getSysOriginChild()));
} else {
co.setId(userProfile.getId());
co.setAvatar(userProfile.getUserAvatar());
co.setNickname(userProfile.getUserNickname());
}
return co;
}).filter(Objects::nonNull).toList(); }).filter(Objects::nonNull).toList();
} }

View File

@ -13,10 +13,12 @@ import com.red.circle.other.domain.model.user.UserProfile;
import com.red.circle.other.domain.ranking.RankingActivityType; import com.red.circle.other.domain.ranking.RankingActivityType;
import com.red.circle.other.domain.ranking.RankingCycleType; import com.red.circle.other.domain.ranking.RankingCycleType;
import com.red.circle.other.domain.ranking.RankingDimension; import com.red.circle.other.domain.ranking.RankingDimension;
import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheService;
import com.red.circle.other.infra.database.mongo.entity.activity.RankingActivityRecord; import com.red.circle.other.infra.database.mongo.entity.activity.RankingActivityRecord;
import com.red.circle.other.infra.database.mongo.entity.activity.WeekKingQueenCount; import com.red.circle.other.infra.database.mongo.entity.activity.WeekKingQueenCount;
import com.red.circle.other.infra.gateway.RankingActivityGateway; import com.red.circle.other.infra.gateway.RankingActivityGateway;
import com.red.circle.other.inner.endpoint.sys.SysActivityConfigClient; import com.red.circle.other.inner.endpoint.sys.SysActivityConfigClient;
import com.red.circle.other.inner.enums.config.EnumConfigKey;
import com.red.circle.other.inner.model.dto.sys.ActivityConfigDTO; import com.red.circle.other.inner.model.dto.sys.ActivityConfigDTO;
import com.red.circle.other.inner.model.dto.user.UserProfileDTO; import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
import com.red.circle.tool.core.date.ZonedDateTimeAsiaRiyadhUtils; import com.red.circle.tool.core.date.ZonedDateTimeAsiaRiyadhUtils;
@ -42,13 +44,12 @@ import java.util.stream.IntStream;
@RequiredArgsConstructor @RequiredArgsConstructor
public class RankingListQryExe { public class RankingListQryExe {
private static final String INVISIBLE_AVATAR = "https://tkm-likei.oss-ap-southeast-1.aliyuncs.com/default_avatar/yinshen.png";
private final RankingActivityGateway rankingActivityGateway; private final RankingActivityGateway rankingActivityGateway;
private final RankingActivityConvertor convertor; private final RankingActivityConvertor convertor;
private final UserProfileGateway userProfileGateway; private final UserProfileGateway userProfileGateway;
private final UserProfileAppConvertor userProfileAppConvertor; private final UserProfileAppConvertor userProfileAppConvertor;
private final SysActivityConfigClient sysActivityConfigClient; private final SysActivityConfigClient sysActivityConfigClient;
private final EnumConfigCacheService enumConfigCacheService;
public RankingListCO execute(RankingListQueryCmd cmd) { public RankingListCO execute(RankingListQueryCmd cmd) {
// 获取枚举 // 获取枚举
@ -89,8 +90,8 @@ public class RankingListQryExe {
if (invisible) { if (invisible) {
co.setUserId(null); co.setUserId(null);
co.setAccount(null); co.setAccount(null);
co.setNickname(maskNickname(userProfileDTO.getUserNickname())); co.setNickname("****");
co.setAvatar(INVISIBLE_AVATAR); co.setAvatar(enumConfigCacheService.getValue(EnumConfigKey.USER_YINSHEN_COVER, userProfileDTO.getSysOriginChild()));
} else { } else {
co.setAccount(userProfileDTO.getAccount()); co.setAccount(userProfileDTO.getAccount());
co.setNickname(userProfileDTO.getUserNickname()); co.setNickname(userProfileDTO.getUserNickname());

View File

@ -9,10 +9,13 @@ import com.red.circle.other.app.command.activity.RechargeLeaderboardQryExe;
import com.red.circle.other.app.command.activity.RoomGiftsLeaderboardQryExe; import com.red.circle.other.app.command.activity.RoomGiftsLeaderboardQryExe;
import com.red.circle.other.app.dto.clientobject.activity.ActivityLeaderboardCO; import com.red.circle.other.app.dto.clientobject.activity.ActivityLeaderboardCO;
import com.red.circle.other.app.dto.clientobject.activity.ActivityLeaderboardListCO; import com.red.circle.other.app.dto.clientobject.activity.ActivityLeaderboardListCO;
import com.red.circle.other.domain.enums.VipAbilityType;
import com.red.circle.other.domain.gateway.user.UserProfileGateway; import com.red.circle.other.domain.gateway.user.UserProfileGateway;
import com.red.circle.other.domain.model.user.UserProfile; import com.red.circle.other.domain.model.user.UserProfile;
import com.red.circle.other.infra.database.cache.key.RankKey; import com.red.circle.other.infra.database.cache.key.RankKey;
import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheService;
import com.red.circle.other.infra.database.cache.service.user.RankCacheService; import com.red.circle.other.infra.database.cache.service.user.RankCacheService;
import com.red.circle.other.inner.enums.config.EnumConfigKey;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -36,6 +39,7 @@ public class ActivityLeaderboardServiceImpl implements ActivityLeaderboardServic
private final GiftsReceivedLeaderboardQryExe giftsReceivedLeaderboardQryExe; private final GiftsReceivedLeaderboardQryExe giftsReceivedLeaderboardQryExe;
private final RankCacheService rankCacheService; private final RankCacheService rankCacheService;
private final UserProfileGateway userProfileGateway; private final UserProfileGateway userProfileGateway;
private final EnumConfigCacheService enumConfigCacheService;
@Override @Override
public ActivityLeaderboardCO roomGiftsLeaderboard(AppExtCommand cmd) { public ActivityLeaderboardCO roomGiftsLeaderboard(AppExtCommand cmd) {
@ -73,11 +77,9 @@ public class ActivityLeaderboardServiceImpl implements ActivityLeaderboardServic
ActivityLeaderboardCO co = giftsSendLeaderboardQryExe.execute(cmd); ActivityLeaderboardCO co = giftsSendLeaderboardQryExe.execute(cmd);
Gson gson = new Gson(); Gson gson = new Gson();
String jsonString = gson.toJson(co); String jsonString = gson.toJson(co);
//log.warn("礼物赠送排行榜:{}", jsonString);
rankCacheService.add(jsonString, cmd.requireReqSysOrigin(), RankKey.GIFTS_SEND.name()); rankCacheService.add(jsonString, cmd.requireReqSysOrigin(), RankKey.GIFTS_SEND.name());
return co; return co;
} else { } else {
//log.warn("礼物赠送排行榜,{}", rank);
Gson gson = new Gson(); Gson gson = new Gson();
Type listType = new TypeToken<ActivityLeaderboardCO>(){}.getType(); Type listType = new TypeToken<ActivityLeaderboardCO>(){}.getType();
ActivityLeaderboardCO activityLeaderboardCO = gson.fromJson(rank, listType); ActivityLeaderboardCO activityLeaderboardCO = gson.fromJson(rank, listType);
@ -245,6 +247,16 @@ public class ActivityLeaderboardServiceImpl implements ActivityLeaderboardServic
private ActivityLeaderboardCO.LeaderboardUserCO defaultRankInfo(Long userId) { private ActivityLeaderboardCO.LeaderboardUserCO defaultRankInfo(Long userId) {
UserProfile userProfile = userProfileGateway.getByUserId(userId); UserProfile userProfile = userProfileGateway.getByUserId(userId);
boolean vipAbility = userProfileGateway.getUserVipAbility(userId, VipAbilityType.MYSTERIOUS_INVISIBILITY);
if (vipAbility) {
return new ActivityLeaderboardCO.LeaderboardUserCO()
.setId(null)
.setAvatar(enumConfigCacheService.getValue(EnumConfigKey.USER_YINSHEN_COVER, userProfile.getSysOriginChild()))
.setNickname("****")
.setQuantity(0L)
.setQuantityFormat("0");
}
return new ActivityLeaderboardCO.LeaderboardUserCO() return new ActivityLeaderboardCO.LeaderboardUserCO()
.setId(userProfile.getId()) .setId(userProfile.getId())
.setAvatar(userProfile.getUserAvatar()) .setAvatar(userProfile.getUserAvatar())

View File

@ -203,6 +203,11 @@ public interface UserProfileGateway {
*/ */
boolean getUserVipAbility(Long userId, VipAbilityType abilityType); boolean getUserVipAbility(Long userId, VipAbilityType abilityType);
/**
* 批量返回具有指定VIP权限的用户ID集合.
*/
Set<Long> filterUsersByVipAbility(Set<Long> userIds, VipAbilityType abilityType);
/** /**
* 根据 userId 查询用户当前 VIP 等级 * 根据 userId 查询用户当前 VIP 等级
* *

View File

@ -23,7 +23,7 @@ import java.util.concurrent.TimeUnit;
public class RankCacheServiceImpl implements RankCacheService { public class RankCacheServiceImpl implements RankCacheService {
private final RedisService redisService; private final RedisService redisService;
private static final long CACHE_TIME = 1; private static final long CACHE_TIME = 5;
@Override @Override
public void remove(String sysOrigin, String type) { public void remove(String sysOrigin, String type) {

View File

@ -512,6 +512,22 @@ public class UserProfileGatewayImpl implements UserProfileGateway {
return hasVipLevel && switchOn; return hasVipLevel && switchOn;
} }
@Override
public Set<Long> filterUsersByVipAbility(Set<Long> userIds, VipAbilityType abilityType) {
if (CollectionUtils.isEmpty(userIds)) {
return Collections.emptySet();
}
Map<Long, UserProfile> profileMap = mapByUserIds(userIds);
return profileMap.entrySet().stream()
.filter(entry -> {
String vipName = resolveVipNameFromProfile(entry.getValue());
return abilityType.hasAbility(vipName)
&& userVipAbilitySettingService.isEnabled(entry.getKey(), abilityType);
})
.map(Map.Entry::getKey)
.collect(Collectors.toSet());
}
private boolean inWhiteList(Long userId) { private boolean inWhiteList(Long userId) {
EnumConfigDTO configDTO = enumConfigCacheService.getByCode("LOGIN_WHITE_CONFIG", "LIKEI"); EnumConfigDTO configDTO = enumConfigCacheService.getByCode("LOGIN_WHITE_CONFIG", "LIKEI");
String whiteConfig = Optional.ofNullable(configDTO).map(EnumConfigDTO::getVal).orElse(null); String whiteConfig = Optional.ofNullable(configDTO).map(EnumConfigDTO::getVal).orElse(null);
@ -535,7 +551,10 @@ public class UserProfileGatewayImpl implements UserProfileGateway {
} }
private String resolveUserVipName(Long userId) { private String resolveUserVipName(Long userId) {
UserProfile userProfile = getByUserId(userId); return resolveVipNameFromProfile(getByUserId(userId));
}
private String resolveVipNameFromProfile(UserProfile userProfile) {
if (Objects.isNull(userProfile) || CollectionUtils.isEmpty(userProfile.getUseProps())) { if (Objects.isNull(userProfile) || CollectionUtils.isEmpty(userProfile.getUseProps())) {
return null; return null;
} }