From bb229d0324c082a85b14c72ddf7ef1a46622266d Mon Sep 17 00:00:00 2001
From: 杜洪波 <1074825718@qq.com>
Date: 星期五, 17 四月 2026 09:42:28 +0800
Subject: [PATCH] 定时任务-租户扫描
---
src/main/java/com/product/saas/service/TenantApplyService.java | 26 ++++++++++++++++++--------
1 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/src/main/java/com/product/saas/service/TenantApplyService.java b/src/main/java/com/product/saas/service/TenantApplyService.java
index 3fa25e7..d973791 100644
--- a/src/main/java/com/product/saas/service/TenantApplyService.java
+++ b/src/main/java/com/product/saas/service/TenantApplyService.java
@@ -50,6 +50,8 @@
@Autowired
FileManagerService fileManagerService;
+
+
/**
* 绉熸埛淇℃伅璇诲彇鍜岄獙璇�
* @param fse
@@ -71,11 +73,11 @@
}
// 鎯呭喌2锛氬彧瀛樺湪鎵嬫満鍙� -> 鎵嬫満鍙峰凡鐢宠
if (fseTenantByPhone != null && fseTenantByName == null) {
- throw new BaseException(SaasCode.TENANT_APPLY_VALID_UNIT_HAS_APPLY.getValue(), SaasCode.TENANT_APPLY_VALID_UNIT_HAS_APPLY.getText());
+ throw new BaseException(SaasCode.TENANT_APPLY_VALID_PHONE_HAS_APPLY.getValue(), SaasCode.TENANT_APPLY_VALID_PHONE_HAS_APPLY.getText());
}
// 鎯呭喌3锛氬彧瀛樺湪鍗曚綅鍚� -> 鍗曚綅宸茬敵璇�
if (fseTenantByPhone == null && fseTenantByName != null) {
- throw new BaseException(SaasCode.TENANT_APPLY_VALID_PHONE_HAS_APPLY.getValue(), SaasCode.TENANT_APPLY_VALID_PHONE_HAS_APPLY.getText());
+ throw new BaseException(SaasCode.TENANT_APPLY_VALID_UNIT_HAS_APPLY.getValue(), SaasCode.TENANT_APPLY_VALID_UNIT_HAS_APPLY.getText());
}
// 鎯呭喌4锛氶兘瀛樺湪 -> 妫�鏌ユ槸鍚︽槸鍚屼竴鏉¤褰�
if (fseTenantByPhone.getUUID().equals(fseTenantByName.getUUID())) {
@@ -215,7 +217,7 @@
fseClient.setValue("client_address_city_id", fseApply.getString("area_city"));
fseClient.setValue("client_address_county_id", fseApply.getString("area_county"));
fseClient.setValue("client_address_line_one", fseApply.getString("address"));
- fseClient.setValue(CmnConst.CREATED_BY, "1");
+ fseClient.setValue(CmnConst.CREATED_BY, 1);
fseClient.setValue(CmnConst.CREATED_UTC_DATETIME, new Date());
baseDao.add(fseClient);
// 澶嶅埗license鍒皐eb妯″潡
@@ -225,11 +227,13 @@
FieldSetEntity fseOrgUnit = new FieldSetEntity(CmnConst.PRODUCT_SYS_ORG_LEVELS);
fseOrgUnit.setValue("client_uuid", fseClient.getUUID());
fseOrgUnit.setValue("org_level_name", fseApply.getString("unit_name"));
- fseOrgUnit.setValue("org_level_all", fseApply.getString("unit_name"));
- fseOrgUnit.setValue("org_level_code", codeService.createCode("product_sys_org_levels", "org_level_code", null));
+ fseOrgUnit.setValue("org_level_all", "鎴愰兘XXXX杞欢鏈夐檺鍏徃>" + fseApply.getString("unit_name"));
+ fseOrgUnit.setValue("org_level_code", codeService.createCode("product_sys_org_levels", "org_level_code", "001"));
+ fseOrgUnit.setValue("org_level_code_parent", "001");
fseOrgUnit.setValue("org_level_type", 0);
+ fseOrgUnit.setValue("org_level_status", 0);
fseOrgUnit.setValue("sequence", 1);
- fseOrgUnit.setValue(CmnConst.CREATED_BY, "1");
+ fseOrgUnit.setValue(CmnConst.CREATED_BY, 1);
fseOrgUnit.setValue(CmnConst.CREATED_UTC_DATETIME, new Date());
baseDao.add(fseOrgUnit);
// 鍒涘缓绉熸埛绠$悊鍛樼敤鎴蜂俊鎭�
@@ -241,7 +245,7 @@
fseUser.setValue(CmnConst.USER_PWD, userService.createPassWord(fseApply.getString("applicant_phone"), fseApply.getString("applicant_pwd")));
fseUser.setValue(CmnConst.IS_MANAGER, 1);
fseUser.setValue(CmnConst.STATUS, 1);
- fseUser.setValue(CmnConst.CREATED_BY, "1");
+ fseUser.setValue(CmnConst.CREATED_BY, 1);
fseUser.setValue(CmnConst.CREATED_UTC_DATETIME, new Date());
baseDao.add(fseUser);
FieldSetEntity fseUserInfo = baseDao.getFieldSetEntity(CmnConst.PRODUCT_SYS_USERS, fseUser.getUUID(), false);
@@ -253,9 +257,15 @@
fseManager.setValue(CmnConst.ROLE_UUIDS, "eabb00f3-2118-4165-967b-a7d88f472f67-notchange");
fseManager.setValue(CmnConst.IS_USED, 1);
fseManager.setValue(CmnConst.CLIENT_UUID, fseClient.getUUID());
- fseManager.setValue(CmnConst.CREATED_BY, "1");
+ fseManager.setValue(CmnConst.CREATED_BY, 1);
fseManager.setValue(CmnConst.CREATED_UTC_DATETIME, new Date());
baseDao.add(fseManager);
+ baseDao.executeUpdate("UPDATE product_sys_tenant_apply SET client_uuid = ? WHERE uuid = ?", new Object[] {fseClient.getUUID(), fseApply.getUUID()});
+
+ // 鍙戦�佷俊鎭粰绉熸埛绠$悊鍛�
+ FieldSetEntity fse = new FieldSetEntity("temp");
+ fse.setValue("applicant_phone", fseApply.getString("applicant_phone"));
+ loginAuthService.sendMessage(fse, "绉熸埛娉ㄥ唽鎴愬姛", "temp");
}
/**
--
Gitblit v1.9.2