From 6bebde28921d5e3e4c8bfe48ff93118a9328079a Mon Sep 17 00:00:00 2001 From: vincentlu <t1341870251@gmail.com> Date: 星期四, 13 二月 2025 14:49:52 +0800 Subject: [PATCH] # --- rsf-server/src/main/java/com/vincent/rsf/server/system/controller/AuthController.java | 25 ++++++++++++------------- rsf-server/src/main/java/com/vincent/rsf/server/system/service/impl/TenantServiceImpl.java | 14 +++++++------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/system/controller/AuthController.java b/rsf-server/src/main/java/com/vincent/rsf/server/system/controller/AuthController.java index 7b999b7..5b20e70 100644 --- a/rsf-server/src/main/java/com/vincent/rsf/server/system/controller/AuthController.java +++ b/rsf-server/src/main/java/com/vincent/rsf/server/system/controller/AuthController.java @@ -5,6 +5,7 @@ import com.vincent.rsf.framework.common.BaseRes; import com.vincent.rsf.framework.common.Cools; import com.vincent.rsf.framework.common.R; +import com.vincent.rsf.framework.exception.CoolException; import com.vincent.rsf.server.common.annotation.OperationLog; import com.vincent.rsf.server.common.config.ConfigProperties; import com.vincent.rsf.server.common.security.JwtSubject; @@ -13,6 +14,7 @@ import com.vincent.rsf.server.common.utils.JwtUtil; import com.vincent.rsf.server.system.controller.param.LoginParam; import com.vincent.rsf.server.system.controller.param.RegisterParam; +import com.vincent.rsf.server.system.controller.param.TenantInitParam; import com.vincent.rsf.server.system.controller.param.UpdatePasswordParam; import com.vincent.rsf.server.system.controller.result.LoginResult; import com.vincent.rsf.server.system.controller.result.MenuVo; @@ -113,22 +115,19 @@ if (!cacheCode.equals(param.getCode())) { return R.error("The verification code is incorrect."); } - redisService.delete(EmailType.REGISTER_VERIFY.toString(), param.getEmail()); // register + TenantInitParam initParam = new TenantInitParam(); + initParam.setEmail(param.getEmail()); + initParam.setUsername(param.getUsername()); + initParam.setPassword(param.getPassword()); + initParam.setName(param.getUsername()); + initParam.setFlag(param.getUsername()); + if (!tenantService.initTenant(initParam)) { + throw new CoolException("Failed to register"); + } -// User user = new User(); -// user.setUsername(param.getUsername()); -// user.setNickname(param.getUsername()); -// user.setPassword(userService.encodePassword(param.getPassword())); -// user.setEmail(param.getEmail()); -// user.setEmailVerified(1); -// user.setStatus(StatusType.ENABLE.val); -// user.setCreateTime(new Date()); -// if (!userService.save(user)) { -// throw new CoolException(""); -// } - + redisService.delete(EmailType.REGISTER_VERIFY.toString(), param.getEmail()); return R.ok(); } diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/system/service/impl/TenantServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/system/service/impl/TenantServiceImpl.java index 4f0e082..c1d7292 100644 --- a/rsf-server/src/main/java/com/vincent/rsf/server/system/service/impl/TenantServiceImpl.java +++ b/rsf-server/src/main/java/com/vincent/rsf/server/system/service/impl/TenantServiceImpl.java @@ -44,13 +44,6 @@ return false; } - if (0 < this.count(new LambdaQueryWrapper<Tenant>().eq(Tenant::getName, param.getName()))) { - throw new CoolException("tenant name already exist"); - } - if (0 < this.count(new LambdaQueryWrapper<Tenant>().eq(Tenant::getFlag, param.getFlag()))) { - throw new CoolException("tenant flag already exist"); - } - if (null != userService.getByUsername(param.getUsername(), null)) { throw new CoolException("the username already exist"); } @@ -60,6 +53,13 @@ } } + if (0 < this.count(new LambdaQueryWrapper<Tenant>().eq(Tenant::getName, param.getName()))) { + throw new CoolException("tenant name already exist"); + } + if (0 < this.count(new LambdaQueryWrapper<Tenant>().eq(Tenant::getFlag, param.getFlag()))) { + throw new CoolException("tenant flag already exist"); + } + Date now = new Date(); // save tenant Tenant tenant = new Tenant(); -- Gitblit v1.9.1