|
@@ -116,15 +116,26 @@ public class VppRTeamMemberRoleServiceImpl implements VppRTeamMemberRoleService
|
|
|
VppMember user = vppMemberService.getCurrentUser();
|
|
|
VppMember byAccount = vppMemberService.getByAccount(dto.getMemberEmail());
|
|
|
VppTeam vppTeam = vppTeamService.getById(dto.getTeamId());
|
|
|
- // 如果成员存在
|
|
|
+ // 如果成员存在,校验数据
|
|
|
if (null != byAccount) {
|
|
|
- // 校验数据,查询用户是否已存在在团队中
|
|
|
+ // 判断是否存在于其他公司
|
|
|
+ if (byAccount.getCompanyId().equals(user.getCompanyId())) {
|
|
|
+ throw new BackendRuntimeException(VppMemberConstant.MEMBEU_HAS_JOINED);
|
|
|
+ }
|
|
|
+ // 查询用户是否已存在其他团队中
|
|
|
VppRTeamMemberRoleExample example = new VppRTeamMemberRoleExample();
|
|
|
- example.createCriteria().andMemberIdEqualTo(byAccount.getId()).andRoleIdLike("3");
|
|
|
+ example.createCriteria().andMemberIdEqualTo(byAccount.getId()).andTeamIdNotEqualTo(dto.getTeamId()).andRoleIdLike("3");
|
|
|
List<VppRTeamMemberRole> vppRTeamMemberRoles = vppRTeamMemberRoleMapper.selectByExample(example);
|
|
|
if (!CollectionUtils.isEmpty(vppRTeamMemberRoles)) {
|
|
|
throw new BackendRuntimeException(VppMemberConstant.MEMBEU_HAS_JOINED);
|
|
|
}
|
|
|
+ // 查询是否为本团队管理员
|
|
|
+ VppRTeamMemberRoleExample example1 = new VppRTeamMemberRoleExample();
|
|
|
+ example1.createCriteria().andMemberIdEqualTo(byAccount.getId()).andTeamIdEqualTo(dto.getTeamId()).andRoleIdLike("2");
|
|
|
+ List<VppRTeamMemberRole> vppRTeamMemberRoles1 = vppRTeamMemberRoleMapper.selectByExample(example);
|
|
|
+ if (!CollectionUtils.isEmpty(vppRTeamMemberRoles1)) {
|
|
|
+ throw new BackendRuntimeException(VppMemberConstant.MEMBEU_HAS_ADMIN);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 发送邮件
|