From e6be6598d70f1fc4e6d4bf33d6e43dc6492187ad Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@gmail.com>
Date: 星期四, 13 二月 2025 22:49:04 +0800
Subject: [PATCH] #
---
rsf-server/src/main/java/com/vincent/rsf/server/system/service/impl/TenantServiceImpl.java | 24 +++++++++++++++---------
1 files changed, 15 insertions(+), 9 deletions(-)
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..546f5a3 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
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.vincent.rsf.framework.common.Cools;
import com.vincent.rsf.framework.exception.CoolException;
+import com.vincent.rsf.server.common.service.EmailService;
import com.vincent.rsf.server.system.controller.param.TenantInitParam;
import com.vincent.rsf.server.system.entity.*;
import com.vincent.rsf.server.system.enums.StatusType;
@@ -32,6 +33,8 @@
private UserRoleService userRoleService;
@Autowired
private RoleMenuService roleMenuService;
+ @Autowired
+ private EmailService emailService;
@Override
@Transactional
@@ -44,20 +47,23 @@
return false;
}
+ if (null != userService.getByUsername(param.getUsername(), null)) {
+ throw new CoolException("the username already exist");
+ }
+ if (!Cools.isEmpty(param.getEmail())) {
+ if (!emailService.isValid(param.getEmail())) {
+ throw new CoolException("Please enter a valid email address");
+ }
+ if (null != userService.getByEmail(param.getEmail(), null)) {
+ throw new CoolException("the email already exist");
+ }
+ }
+
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");
- }
- if (!Cools.isEmpty(param.getEmail())) {
- if (null != userService.getByEmail(param.getEmail(), null)) {
- throw new CoolException("the email already exist");
- }
}
Date now = new Date();
--
Gitblit v1.9.1