管理员只可赠送1 2 3级VIP
This commit is contained in:
parent
e5a35a4475
commit
c9b4f3b80b
@ -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<String, String> 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<Long> sourceIds = resultDto.stream().filter(filter -> filter.getType().equals(cmd.getPropsType().name()))
|
||||
.map(PropsResourcesDTO::getId).collect(Collectors.toSet());
|
||||
|
||||
// 贵族携带资源信息只有vip1 2 3
|
||||
Map<Long, NobleVipAbility> abilityMap =
|
||||
Objects.equals(cmd.getPropsType().name(), ConsolePropsTypeEnum.NOBLE_VIP.name())
|
||||
? ResponseAssert.requiredSuccess(propsNobleVipClient.mapAbilityByIds(sourceIds))
|
||||
: CollectionUtils.newHashMap();
|
||||
if (MapUtil.isNotEmpty(abilityMap)) {
|
||||
Set<Long> 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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user