|
@@ -43,8 +43,7 @@ import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import static org.dromara.common.core.constant.Constants.THR;
|
|
|
-import static org.dromara.common.core.constant.TenantConstants.SUPER_ADMIN_ROLE_KEY;
|
|
|
-import static org.dromara.common.core.constant.TenantConstants.TENANT_ADMIN_ROLE_KEY;
|
|
|
+import static org.dromara.common.core.constant.TenantConstants.*;
|
|
|
import static org.dromara.common.core.enums.UserType.APP_STAFF;
|
|
|
import static org.dromara.common.core.enums.UserType.PC_USER;
|
|
|
|
|
@@ -134,6 +133,9 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean insertByBo(SysTenantBo bo) {
|
|
|
SysTenant add = MapstructUtils.convert(bo, SysTenant.class);
|
|
|
+ if (add != null) {
|
|
|
+ add.setPackageId(1L);
|
|
|
+ }
|
|
|
|
|
|
// 获取所有租户编号
|
|
|
List<String> tenantIds = baseMapper.selectObjs(
|
|
@@ -209,7 +211,7 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
|
|
sysUserTenant.setTenantId(tenantId);
|
|
|
sysUserTenantMapper.insert(sysUserTenant);
|
|
|
|
|
|
- String defaultTenantId = TenantConstants.DEFAULT_TENANT_ID;
|
|
|
+ String defaultTenantId = DEFAULT_TENANT_ID;
|
|
|
List<SysDictType> dictTypeList = dictTypeMapper.selectList(
|
|
|
new LambdaQueryWrapper<SysDictType>().eq(SysDictType::getTenantId, defaultTenantId));
|
|
|
List<SysDictData> dictDataList = dictDataMapper.selectList(
|
|
@@ -282,16 +284,18 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
|
|
*/
|
|
|
private List<SysRole> createTenantRole(String tenantId, Long packageId) {
|
|
|
// 获取租户套餐
|
|
|
- SysTenantPackage tenantPackage = tenantPackageMapper.selectById(packageId);
|
|
|
+ /*SysTenantPackage tenantPackage = tenantPackageMapper.selectById(packageId);
|
|
|
if (ObjectUtil.isNull(tenantPackage)) {
|
|
|
throw new ServiceException("套餐不存在");
|
|
|
- }
|
|
|
+ }*/
|
|
|
// 获取套餐菜单id
|
|
|
//List<Long> menuIds = StringUtils.splitTo(tenantPackage.getMenuIds(), Convert::toLong);
|
|
|
|
|
|
// 创建角色
|
|
|
//查询000000的角色
|
|
|
- List<SysRoleVo> roleVos = sysRoleService.selectRoleAll();
|
|
|
+ SysRole ro = new SysRole();
|
|
|
+ ro.setTenantId(DEFAULT_TENANT_ID);
|
|
|
+ List<SysRoleVo> roleVos = sysRoleService.selectListNoPage(ro);
|
|
|
List<SysRole> roles = new ArrayList<>();
|
|
|
for (SysRoleVo roleVo : roleVos) {
|
|
|
if(!SUPER_ADMIN_ROLE_KEY.equals(roleVo.getRoleKey())){
|
|
@@ -359,7 +363,7 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
|
|
*/
|
|
|
@Override
|
|
|
public void checkTenantAllowed(String tenantId) {
|
|
|
- if (ObjectUtil.isNotNull(tenantId) && TenantConstants.DEFAULT_TENANT_ID.equals(tenantId)) {
|
|
|
+ if (ObjectUtil.isNotNull(tenantId) && DEFAULT_TENANT_ID.equals(tenantId)) {
|
|
|
throw new ServiceException("不允许操作管理租户");
|
|
|
}
|
|
|
}
|
|
@@ -469,8 +473,8 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
|
|
Map<String, Map<String, List<SysDictData>>> typeDataMap = StreamUtils.groupBy2Key(
|
|
|
dictDataList, TenantEntity::getTenantId, SysDictData::getDictType);
|
|
|
// 管理租户字典数据
|
|
|
- List<SysDictType> defaultTypeMap = typeMap.get(TenantConstants.DEFAULT_TENANT_ID);
|
|
|
- Map<String, List<SysDictData>> defaultTypeDataMap = typeDataMap.get(TenantConstants.DEFAULT_TENANT_ID);
|
|
|
+ List<SysDictType> defaultTypeMap = typeMap.get(DEFAULT_TENANT_ID);
|
|
|
+ Map<String, List<SysDictData>> defaultTypeDataMap = typeDataMap.get(DEFAULT_TENANT_ID);
|
|
|
|
|
|
// 获取所有租户编号
|
|
|
List<String> tenantIds = baseMapper.selectObjs(
|
|
@@ -482,7 +486,7 @@ public class SysTenantServiceImpl implements ISysTenantService {
|
|
|
List<SysDictData> saveDataList = new ArrayList<>();
|
|
|
Set<String> set = new HashSet<>();
|
|
|
for (String tenantId : tenantIds) {
|
|
|
- if (TenantConstants.DEFAULT_TENANT_ID.equals(tenantId)) {
|
|
|
+ if (DEFAULT_TENANT_ID.equals(tenantId)) {
|
|
|
continue;
|
|
|
}
|
|
|
for (SysDictType dictType : defaultTypeMap) {
|