From 91467b25769e238bd71055f1c23c43af842d17cc Mon Sep 17 00:00:00 2001 From: smallchill Date: Sun, 3 May 2020 20:39:15 +0800 Subject: [PATCH] =?UTF-8?q?:zap:=20=E4=BC=98=E5=8C=96=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E6=B3=A8=E5=86=8C=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/user/service/impl/UserServiceImpl.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/blade-service/blade-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java b/blade-service/blade-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java index abef1551..6037e428 100644 --- a/blade-service/blade-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java +++ b/blade-service/blade-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java @@ -78,7 +78,7 @@ public class UserServiceImpl extends BaseServiceImpl implement if (Func.isNotEmpty(tenant)) { Integer accountNumber = tenant.getAccountNumber(); Integer tenantCount = baseMapper.selectCount(Wrappers.query().lambda().eq(User::getTenantId, tenantId)); - if (accountNumber != null && accountNumber > 0 && accountNumber < tenantCount) { + if (accountNumber != null && accountNumber > 0 && accountNumber <= tenantCount) { throw new ServiceException("当前租户已到最大账号额度!"); } } @@ -259,25 +259,20 @@ public class UserServiceImpl extends BaseServiceImpl implement @Override @Transactional(rollbackFor = Exception.class) public boolean registerGuest(User user, Long oauthId) { - R tenant = sysClient.getTenant(user.getTenantId()); - if (!tenant.isSuccess() || tenant.getData().getId() == null) { + Tenant tenant = SysCache.getTenant(user.getTenantId()); + if (tenant == null || tenant.getId() == null) { throw new ApiException("租户信息错误!"); } - int userCnt = this.count(Wrappers.query().lambda().eq(User::getTenantId, Func.toStr(user.getTenantId(), BladeConstant.ADMIN_TENANT_ID)).eq(User::getAccount, user.getAccount())); - if (userCnt > 0) { - throw new ApiException("当前系统用户名已存在!"); - } UserOauth userOauth = userOauthService.getById(oauthId); if (userOauth == null || userOauth.getId() == null) { throw new ApiException("第三方登陆信息错误!"); } user.setRealName(user.getName()); user.setAvatar(userOauth.getAvatar()); - user.setPassword(DigestUtil.encrypt(user.getPassword())); user.setRoleId(StringPool.MINUS_ONE); user.setDeptId(StringPool.MINUS_ONE); user.setPostId(StringPool.MINUS_ONE); - boolean userTemp = this.save(user); + boolean userTemp = this.submit(user); userOauth.setUserId(user.getId()); userOauth.setTenantId(user.getTenantId()); boolean oauthTemp = userOauthService.updateById(userOauth);