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 58e205b3..04f7bcb6 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 @@ -242,6 +242,11 @@ public enum TeamErrorCode implements IResponseErrorCode { * 设备指纹已被其他代理使用 */ DEVICE_FINGERPRINT_USED_BY_AGENCY(6054, "This user's current device is no longer able to add any more agency."), + + /** + * 用户是管理员 + */ + USER_IS_A_ADMIN(6055, "This user is a administrator."), ; private final Integer code; diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/BdAgentInviteExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/BdAgentInviteExe.java index 44db814f..79acda3d 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/BdAgentInviteExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/BdAgentInviteExe.java @@ -19,6 +19,7 @@ import com.red.circle.other.infra.database.mongo.service.team.bd.BdInviteAgentMe import com.red.circle.other.infra.database.mongo.service.team.team.TeamApplicationProcessService; import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService; import com.red.circle.other.infra.database.mongo.service.team.team.TeamProfileService; +import com.red.circle.other.infra.database.rds.service.sys.AdministratorService; import com.red.circle.other.infra.database.rds.service.team.BusinessDevelopmentBaseInfoService; import com.red.circle.other.infra.database.rds.service.user.device.LatestMobileDeviceService; import com.red.circle.other.inner.asserts.user.UserErrorCode; @@ -61,9 +62,13 @@ public class BdAgentInviteExe { private final BdInviteAgentMessageService bdInviteAgentMessageService; private final TeamApplicationProcessService teamApplicationProcessService; private final BusinessDevelopmentBaseInfoService businessDevelopmentBaseInfoService; + private final AdministratorService administratorService; public void execute(DbInviteAgentCmd cmd) { + ResponseAssert.isFalse(TeamErrorCode.USER_IS_A_ADMIN, + administratorService.existsAdmin(cmd.getInviteUserId())); + // 权限不足 ResponseAssert.isTrue(CommonErrorCode.INSUFFICIENT_PERMISSION, businessDevelopmentBaseInfoService.checkBD(cmd.requiredReqUserId())); diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/BdLeaderInviteBdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/BdLeaderInviteBdExe.java index 29d1e81f..56933eb9 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/BdLeaderInviteBdExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/BdLeaderInviteBdExe.java @@ -15,6 +15,7 @@ import com.red.circle.other.infra.database.mongo.entity.team.bd.BdInviteAgentMes import com.red.circle.other.infra.database.mongo.entity.team.bd.MessageInviteGroup; import com.red.circle.other.infra.database.mongo.service.team.bd.BdInviteAgentMessageService; import com.red.circle.other.infra.database.rds.entity.team.BusinessDevelopmentBaseInfo; +import com.red.circle.other.infra.database.rds.service.sys.AdministratorService; import com.red.circle.other.infra.database.rds.service.team.BusinessDevelopmentBaseInfoService; import com.red.circle.other.infra.database.rds.service.team.RoomBdLeadService; import com.red.circle.other.inner.asserts.user.UserErrorCode; @@ -49,6 +50,7 @@ public class BdLeaderInviteBdExe { private final UserProfileAppConvertor userProfileAppConvertor; private final BdInviteAgentMessageService bdInviteAgentMessageService; private final BusinessDevelopmentBaseInfoService businessDevelopmentBaseInfoService; + private final AdministratorService administratorService; public void execute(DbLeaderInviteBdCmd cmd) { @@ -63,7 +65,11 @@ public class BdLeaderInviteBdExe { ResponseAssert.isFalse(TeamErrorCode.USER_IS_ALREADY_A_BD, businessDevelopmentBaseInfoService.checkBD(cmd.getInviteUserId())); - // 权限不足 + ResponseAssert.isFalse(TeamErrorCode.USER_IS_A_ADMIN, + administratorService.existsAdmin(cmd.getInviteUserId())); + + + // 权限不足 BusinessDevelopmentBaseInfo bd = getDevelopmentBaseInfoServiceByUserId(cmd); ResponseAssert.isFalse(CommonErrorCode.INSUFFICIENT_PERMISSION, Objects.nonNull(bd) && Objects.nonNull(bd.getBdLeadUserId())); @@ -111,6 +117,9 @@ public class BdLeaderInviteBdExe { ResponseAssert.isFalse(CommonErrorCode.INSUFFICIENT_PERMISSION, roomBdLeadService.checkBdLeader(cmd.getInviteUserId())); + ResponseAssert.isFalse(TeamErrorCode.USER_IS_A_ADMIN, + administratorService.existsAdmin(cmd.getInviteUserId())); + List bdUserIds = businessDevelopmentBaseInfoService.listBdUserIdsByLeaderId(cmd.requiredReqUserId()); ResponseAssert.isFalse(CommonErrorCode.INSUFFICIENT_PERMISSION, bdUserIds.contains(cmd.getInviteUserId()));