diff --git a/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/h5/MemberActiveController.java b/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/h5/MemberActiveController.java index 1ec4e34c..2414d78c 100644 --- a/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/h5/MemberActiveController.java +++ b/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/h5/MemberActiveController.java @@ -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); + } + } diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/user/user/UserIdentityServiceImpl.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/user/user/UserIdentityServiceImpl.java index a7115151..ebf1cc89 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/user/user/UserIdentityServiceImpl.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/user/user/UserIdentityServiceImpl.java @@ -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 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; + } + } diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/user/user/UserIdentityService.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/user/user/UserIdentityService.java index 8c0dea40..15e8ebd9 100644 --- a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/user/user/UserIdentityService.java +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/user/user/UserIdentityService.java @@ -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); }