From 6883e31331af4633d1b7d74ea7deb5f972afa05d Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期五, 23 五月 2025 20:02:19 +0800
Subject: [PATCH] 新增移库功能

---
 rsf-server/src/main/java/com/vincent/rsf/server/system/service/impl/TenantServiceImpl.java |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 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 c1d7292..c5c6ff7 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,9 @@
 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.domain.BusinessRes;
+import com.vincent.rsf.server.common.exception.BusinessException;
+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,22 +35,27 @@
     private UserRoleService userRoleService;
     @Autowired
     private RoleMenuService roleMenuService;
+    @Autowired
+    private EmailService emailService;
 
     @Override
     @Transactional
-    public Boolean initTenant(TenantInitParam param) {
+    public Long initTenant(TenantInitParam param) {
         // valid ----------------------------
         if (null == param) {
-            return false;
+            return null;
         }
         if (Cools.isEmpty(param.getName(), param.getFlag(), param.getUsername(), param.getPassword())) {
-            return false;
+            return null;
         }
 
         if (null != userService.getByUsername(param.getUsername(), null)) {
-            throw new CoolException("the username already exist");
+            throw new BusinessException(BusinessRes.USERNAME_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");
             }
@@ -125,7 +133,7 @@
             }
         }
 
-        return true;
+        return tenant.getId();
     }
 
 }

--
Gitblit v1.9.1