diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/team/TeamErrorCode.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/team/TeamErrorCode.java index 731a07b4..d1d0ab7a 100644 --- a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/team/TeamErrorCode.java +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/team/TeamErrorCode.java @@ -212,6 +212,12 @@ public enum TeamErrorCode implements IResponseErrorCode { * 拒绝接受. */ REFUSE_ACCEPT(6049, "Refuse accept"), + + /** + * 管理员权限不足 + */ + ADMIN_PERMISSION_INSUFFICIENT(6050, "Administrator permission insufficient"), + ; private final Integer code; diff --git a/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/team/TeamRestController.java b/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/team/TeamRestController.java index 6d078b66..b68ca329 100644 --- a/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/team/TeamRestController.java +++ b/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/team/TeamRestController.java @@ -6,6 +6,7 @@ import com.red.circle.common.business.dto.cmd.app.AppIdLongCmd; import com.red.circle.common.business.dto.cmd.app.AppIdStringCmd; import com.red.circle.common.business.dto.cmd.app.AppRoomIdCmd; import com.red.circle.common.business.dto.cmd.app.AppUserIdCmd; +import com.red.circle.framework.core.asserts.ResponseAssert; import com.red.circle.framework.web.controller.BaseController; import com.red.circle.other.app.dto.clientobject.team.*; import com.red.circle.other.app.dto.cmd.team.DateTypeQryCmd; @@ -15,7 +16,11 @@ import com.red.circle.other.app.dto.cmd.team.TeamMemberWalletWithdrawalCmd; import com.red.circle.other.app.dto.cmd.team.TeamUserApplyCmd; import com.red.circle.other.app.dto.cmd.team.TeamUserApplyRecordQryCmd; import com.red.circle.other.app.service.team.TeamService; +import com.red.circle.other.infra.database.rds.service.sys.AdministratorAuthService; +import com.red.circle.other.inner.asserts.team.TeamErrorCode; +import com.red.circle.other.inner.endpoint.team.target.TeamProfileClient; import com.red.circle.other.inner.enums.team.TeamUserIdentity; +import com.red.circle.other.inner.model.cmd.team.TeamCreateCmd; import com.red.circle.other.inner.model.dto.user.UserProfileDTO; import java.util.List; import lombok.RequiredArgsConstructor; @@ -43,6 +48,8 @@ import org.springframework.web.bind.annotation.RestController; public class TeamRestController extends BaseController { private final TeamService teamService; + private final TeamProfileClient teamProfileClient; + private final AdministratorAuthService administratorAuthService; /** * 成员进入团队. @@ -474,4 +481,16 @@ public class TeamRestController extends BaseController { return teamService.existsMessageTips(cmd); } + /** + * 创建代理 + */ + @PostMapping("/create") + public void createTeam(@Validated TeamCreateCmd cmd) { + // APP管理员权限校验 + List authResources = administratorAuthService.listAuthResources(cmd.getReqUserId()); + ResponseAssert.isTrue(TeamErrorCode.ADMIN_PERMISSION_INSUFFICIENT, authResources.contains("TEAM_CREATE")); + + teamProfileClient.createTeam(cmd); + } + }