校验租户用户数量

This commit is contained in:
dataprince 2024-01-04 11:23:00 +08:00
parent 873d809df5
commit 714c371ee2

View File

@ -58,15 +58,14 @@ import java.util.ArrayList;
public class SysUserController extends BaseController { public class SysUserController extends BaseController {
@Resource @Resource
private ISysUserService userService; private ISysUserService userService;
@Resource @Resource
private ISysRoleService roleService; private ISysRoleService roleService;
@Resource @Resource
private ISysDeptService deptService; private ISysDeptService deptService;
@Resource @Resource
private ISysPostService postService; private ISysPostService postService;
@Resource
private ISysTenantService tenantService;
/** /**
* 获取用户列表 * 获取用户列表
@ -183,6 +182,9 @@ public class SysUserController extends BaseController {
} else if (StringUtils.isNotEmpty(userBo.getEmail()) && !userService.checkEmailUnique(userBo)) { } else if (StringUtils.isNotEmpty(userBo.getEmail()) && !userService.checkEmailUnique(userBo)) {
return R.fail("新增用户'" + userBo.getUserName() + "'失败,邮箱账号已存在"); return R.fail("新增用户'" + userBo.getUserName() + "'失败,邮箱账号已存在");
} }
if (!tenantService.checkAccountBalance(TenantHelper.getTenantId())) {
return R.fail("当前租户下用户名额不足,请您联系管理员增加租户用户数量!");
}
userBo.setPassword(BCrypt.hashpw(userBo.getPassword())); userBo.setPassword(BCrypt.hashpw(userBo.getPassword()));
boolean inserted = userService.insertUser(userBo); boolean inserted = userService.insertUser(userBo);
if (!inserted) { if (!inserted) {