新增查询管理员是否有赠送VIP权限的接口

This commit is contained in:
tianfeng 2025-09-16 16:25:56 +08:00
parent c9b4f3b80b
commit 602e384cd5
3 changed files with 34 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import com.red.circle.order.inner.endpoint.UserFreightRechargeRecordClient;
import com.red.circle.order.inner.endpoint.UserMonthlyRechargeClient;
import com.red.circle.order.inner.endpoint.api.UserMonthlyRechargeClientApi;
import com.red.circle.order.inner.model.dto.MonthlyRechargeSummaryVO;
import com.red.circle.other.app.dto.cmd.material.PropsStoreTypeQryCmd;
import com.red.circle.other.app.dto.h5.MemberActiveDTO;
import com.red.circle.other.app.dto.h5.RechargePageVO;
import com.red.circle.other.app.dto.h5.UserIdentityVO;
@ -73,4 +74,12 @@ public class MemberActiveController extends BaseController {
return rechargeUserService.getRechargeSummary(cmd);
}
/**
* 是否有指定道具类型的权限
*/
@GetMapping("/own-permission")
public Boolean permission(PropsStoreTypeQryCmd cmd) {
return userIdentityService.hasPermission(cmd);
}
}

View File

@ -2,16 +2,20 @@ package com.red.circle.other.app.service.user.user;
import com.red.circle.framework.core.asserts.ResponseAssert;
import com.red.circle.other.app.dto.cmd.material.PropsStoreTypeQryCmd;
import com.red.circle.other.app.dto.h5.UserIdentityVO;
import com.red.circle.other.infra.database.rds.service.sys.AdministratorAuthService;
import com.red.circle.other.infra.database.rds.service.sys.AdministratorService;
import com.red.circle.other.inner.endpoint.team.bd.BdTeamInfoClient;
import com.red.circle.other.inner.endpoint.team.target.TeamProfileClient;
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.dto.agency.agency.TeamMemberDTO;
import com.red.circle.wallet.inner.endpoint.freight.FreightGoldClient;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Objects;
@Service
@ -22,6 +26,7 @@ public class UserIdentityServiceImpl implements UserIdentityService {
private final FreightGoldClient freightGoldClient;
private final BdTeamInfoClient bdTeamInfoClient;
private final AdministratorService administratorService;
private final AdministratorAuthService administratorAuthService;
@Override
public UserIdentityVO getUserIdentity(Long userId) {
@ -35,4 +40,17 @@ public class UserIdentityServiceImpl implements UserIdentityService {
.setAdmin(administratorService.existsAdmin(userId));
}
@Override
public Boolean hasPermission(PropsStoreTypeQryCmd cmd) {
List<String> authResources = administratorAuthService.listAuthResources(cmd.requiredReqUserId());
boolean isHaveAuth = false;
if (PropsCommodityType.RIDE.equals(cmd.getPropsType())) {
isHaveAuth = authResources.contains("ALL_VEHICLE");
}
if (PropsCommodityType.NOBLE_VIP.equals(cmd.getPropsType())) {
isHaveAuth = authResources.contains("ALL_VIP");
}
return isHaveAuth;
}
}

View File

@ -1,5 +1,6 @@
package com.red.circle.other.app.service.user.user;
import com.red.circle.other.app.dto.cmd.material.PropsStoreTypeQryCmd;
import com.red.circle.other.app.dto.h5.UserIdentityVO;
public interface UserIdentityService {
@ -9,4 +10,10 @@ public interface UserIdentityService {
*/
UserIdentityVO getUserIdentity(Long userId);
/**
* 用户是否有指定道具类型的权限
* @param cmd
* @return
*/
Boolean hasPermission(PropsStoreTypeQryCmd cmd);
}