diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/UserProfileGatewayImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/UserProfileGatewayImpl.java index 5467b3ce..32f44076 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/UserProfileGatewayImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/UserProfileGatewayImpl.java @@ -637,33 +637,25 @@ public class UserProfileGatewayImpl implements UserProfileGateway { @Override public List getUserNobleAbility(Long userId) { - return userCacheService.getUserNobleAbility(userId, this::getNobleAbility); - } - - private List getNobleAbility(Long userId) { UserProfile userProfile = getByUserId(userId); - if (Objects.isNull(userProfile)) { + if (Objects.isNull(userProfile) || CollectionUtils.isEmpty(userProfile.getUseProps())) { return null; } - Set userVipPropsIds = getUserVipPropsIds(userProfile.getUseProps()); - if (CollectionUtils.isEmpty(userVipPropsIds)) { - return null; - } - - List vipAbilities = propsNobleVipAbilityService.listByIds(userVipPropsIds); - - if (CollectionUtils.isEmpty(vipAbilities)) { - return null; - } - - return vipAbilities.stream().map(e -> { - NobleAbilityCO result = new NobleAbilityCO(); - result.setVipType(e.getVipType()); - result.setVipLevel(e.getVipLevel()); - result.setRoomMaxMember(e.getRoomMaxMember()); - return result; - }).toList(); + return userProfile.getUseProps().stream() + .filter(props -> Objects.nonNull(props.getPropsResources()) + && PropsCommodityType.NOBLE_VIP.name().equals(props.getPropsResources().getType()) + && props.getExpireTime() != null + && props.getExpireTime() > System.currentTimeMillis()) + .map(props -> { + String vipName = props.getPropsResources().getName(); + NobleVipEnum vipEnum = NobleVipEnum.valueOf(vipName); + NobleAbilityCO co = new NobleAbilityCO(); + co.setVipType(vipName); + co.setVipLevel(vipEnum.ordinal() + 1); + return co; + }) + .toList(); } /**