改造租户创建

This commit is contained in:
gxwebsoft
2024-04-29 12:25:20 +08:00
parent 4997288259
commit 0910e49c6b

View File

@@ -118,7 +118,6 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, Tenant> impleme
// 企业资源配置 // 企业资源配置
company.setTenantId(company.getTid()); company.setTenantId(company.getTid());
company.setShortName(company.getShortName()); company.setShortName(company.getShortName());
company.setCompanyLogo("/logo.svg");
company.setPhone(company.getPhone()); company.setPhone(company.getPhone());
company.setMembers(20); company.setMembers(20);
company.setServerUrl("https://server.gxwebsoft.com"); company.setServerUrl("https://server.gxwebsoft.com");
@@ -128,8 +127,8 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, Tenant> impleme
company.setMerchantUrl("http://".concat(company.getTid().toString()).concat(".m.wsdns.cn")); company.setMerchantUrl("http://".concat(company.getTid().toString()).concat(".m.wsdns.cn"));
company.setWebsiteUrl("http://".concat(company.getTid().toString()).concat(".wsdns.cn")); company.setWebsiteUrl("http://".concat(company.getTid().toString()).concat(".wsdns.cn"));
company.setH5Code("http://".concat(company.getTid().toString()).concat(".h5.wsdns.cn")); company.setH5Code("http://".concat(company.getTid().toString()).concat(".h5.wsdns.cn"));
company.setAndroidUrl("http://".concat(company.getTid().toString()).concat(".android.wsdns.cn")); // company.setAndroidUrl("http://".concat(company.getTid().toString()).concat(".android.wsdns.cn"));
company.setIosUrl("http://".concat(company.getTid().toString()).concat(".ios.wsdns.cn")); // company.setIosUrl("http://".concat(company.getTid().toString()).concat(".ios.wsdns.cn"));
company.setVersion(10); company.setVersion(10);
company.setIndustryParent(""); company.setIndustryParent("");
company.setIndustryChild(""); company.setIndustryChild("");
@@ -166,15 +165,22 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, Tenant> impleme
role.setRoleCode("guest"); role.setRoleCode("guest");
role.setComments("用于未登录时的浏览权限"); role.setComments("用于未登录时的浏览权限");
roleService.save(role); roleService.save(role);
role.setRoleName("商户管理员");
role.setRoleCode("merchant");
role.setComments("商户管理员/店长角色");
roleService.save(role);
role.setRoleName("商户账号");
role.setRoleCode("merchantClerk");
role.setRoleName("管理人员/店员");
Integer guestRoleId = role.getRoleId(); Integer guestRoleId = role.getRoleId();
// 添加游客账号 // 添加游客账号
User www = new User(); // User www = new User();
www.setTenantId(company.getTid()); // www.setTenantId(company.getTid());
www.setUsername("www"); // www.setUsername("www");
www.setNickname("游客"); // www.setNickname("游客");
www.setPassword(userService.encodePassword(CommonUtil.randomUUID16())); // www.setPassword(userService.encodePassword(CommonUtil.randomUUID16()));
userService.save(www); // userService.save(www);
// 添加超管用户角色 // 添加超管用户角色
UserRole userRole = new UserRole(); UserRole userRole = new UserRole();
@@ -184,8 +190,8 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, Tenant> impleme
userRoleService.save(userRole); userRoleService.save(userRole);
// 添加游客用户角色 // 添加游客用户角色
userRole.setUserId(www.getUserId()); // userRole.setUserId(www.getUserId());
userRole.setRoleId(guestRoleId); // userRole.setRoleId(guestRoleId);
boolean resultUserRole = userRoleService.save(userRole); boolean resultUserRole = userRoleService.save(userRole);
// 添加系统菜单 // 添加系统菜单
@@ -584,7 +590,7 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, Tenant> impleme
// 发送邮件通知 // 发送邮件通知
String title = "恭喜!您的账号已注册成功"; String title = "恭喜!您的账号已注册成功";
String content = "租户ID".concat(company.getTid().toString()).concat("\r\n名称" + company.getShortName()).concat("\r\n账号" + company.getPhone()).concat("\r\n密码" + company.getPassword()); String content = "租户ID".concat(company.getTid().toString()).concat("\r\n名称" + company.getShortName()).concat("\r\n账号" + company.getPhone()).concat("\r\n密码" + company.getPassword());
String adminUrl = "\r\n后台管理".concat("https://admin.gxwebsoft.com"); String adminUrl = "\r\n后台管理".concat("http://").concat(company.getTid().toString()).concat(".adm.wsdns.cn");
// 发送邮件通知 // 发送邮件通知
emailRecordService.sendEmail(title, content.concat(adminUrl), company.getEmail()); emailRecordService.sendEmail(title, content.concat(adminUrl), company.getEmail());
return true; return true;