From c9b4f3b80be9c63227dbdb1d256cf41d62629952 Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Tue, 16 Sep 2025 14:23:56 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E5=8F=AA=E5=8F=AF?= =?UTF-8?q?=E8=B5=A0=E9=80=811=202=203=E7=BA=A7VIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/user/ManagerAuthServiceImpl.java | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/user/ManagerAuthServiceImpl.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/user/ManagerAuthServiceImpl.java index a6816d85..cefe8012 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/user/ManagerAuthServiceImpl.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/user/ManagerAuthServiceImpl.java @@ -1,5 +1,6 @@ package com.red.circle.other.app.service.user; +import cn.hutool.core.map.MapUtil; import com.alibaba.fastjson.JSON; import com.red.circle.common.business.enums.SendPropsOrigin; import com.red.circle.component.redis.service.RedisService; @@ -42,12 +43,14 @@ import com.red.circle.other.infra.database.rds.service.team.BusinessDevelopmentB import com.red.circle.other.infra.database.rds.service.team.BusinessDevelopmentTeamService; import com.red.circle.other.inner.asserts.user.UserErrorCode; import com.red.circle.other.inner.endpoint.material.props.PropsBackpackClient; +import com.red.circle.other.inner.endpoint.material.props.PropsNobleVipClient; import com.red.circle.other.inner.enums.material.ConsolePropsTypeEnum; import com.red.circle.other.inner.enums.material.PropsCommodityType; import com.red.circle.other.inner.enums.team.TeamMemberRole; import com.red.circle.other.inner.model.cmd.material.GivePropsBackpackCmd; import com.red.circle.other.inner.model.cmd.team.TeamMemberBackQryCmd; import com.red.circle.other.inner.model.dto.material.PropsResourcesDTO; +import com.red.circle.other.inner.model.dto.material.props.NobleVipAbility; import com.red.circle.other.inner.model.dto.material.props.PropsNobleVipAbilityDTO; import com.red.circle.tool.core.collection.CollectionUtils; import com.red.circle.tool.core.date.TimestampUtils; @@ -61,6 +64,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.Set; import java.util.stream.Collectors; /** @@ -91,6 +95,7 @@ public class ManagerAuthServiceImpl implements ManagerAuthService { private final BusinessDevelopmentTeamService businessDevelopmentTeamService; private final OfficialNoticeClient officialNoticeClient; private final AdministratorAuthService administratorAuthService; + private final PropsNobleVipClient propsNobleVipClient; @Override public RoomManagerAuthsCO managerAuths(RoomManageCommonCmd roomManageCommonCmd) { @@ -127,12 +132,23 @@ public class ManagerAuthServiceImpl implements ManagerAuthService { dto.setCount(50); return dto; }).toList(); -// Map collect = resultDto.stream().collect(Collectors.toMap(dto -> String.valueOf(dto.getId()), JSON::toJSONString)); -// redisService.redisTemplate().opsForHash().putAll(redisKey, collect); - return resultDto.stream().filter(filter -> filter.getType().equals(cmd.getPropsType().name())).toList(); -// } -// return redisResult.stream().map(action -> JSON.parseObject(action, PropsResourcesDTO.class)).filter(filter -> filter.getType().equals(cmd.getPropsType().name())).toList(); + Set sourceIds = resultDto.stream().filter(filter -> filter.getType().equals(cmd.getPropsType().name())) + .map(PropsResourcesDTO::getId).collect(Collectors.toSet()); + + // 贵族携带资源信息只有vip1 2 3 + Map abilityMap = + Objects.equals(cmd.getPropsType().name(), ConsolePropsTypeEnum.NOBLE_VIP.name()) + ? ResponseAssert.requiredSuccess(propsNobleVipClient.mapAbilityByIds(sourceIds)) + : CollectionUtils.newHashMap(); + if (MapUtil.isNotEmpty(abilityMap)) { + Set collect = abilityMap.entrySet().stream() + .filter(entry -> entry.getValue().getVipLevel() <= 3) + .map(Map.Entry::getKey).collect(Collectors.toSet()); + return resultDto.stream().filter(e -> collect.contains(e.getId())).toList(); + } + + return resultDto.stream().filter(e -> sourceIds.contains(e.getId())).toList(); } private boolean isIsHaveAuth(PropsStoreTypeQryCmd cmd) {