|
|
@@ -22,6 +22,7 @@ import com.tuoheng.model.po.UserPo; |
|
|
|
import com.tuoheng.model.query.TenantQuery; |
|
|
|
import com.tuoheng.model.query.UserQuery; |
|
|
|
import com.tuoheng.model.vo.BusinessSystemVo; |
|
|
|
import com.tuoheng.model.vo.CreateTenantVo; |
|
|
|
import com.tuoheng.model.vo.TenantVo; |
|
|
|
import com.tuoheng.model.vo.UserVo; |
|
|
|
import com.tuoheng.service.TenantEmployService; |
|
|
@@ -84,6 +85,11 @@ public class TenantServiceImpl implements TenantService { |
|
|
|
if (clientUserMapper.judgeCreateByUserName(createClientTenantDto.getUsername()) > 0) { |
|
|
|
return JsonResult.error("该用户名称已存在!"); |
|
|
|
} |
|
|
|
//创建租户创建成功后的返回实体类 |
|
|
|
CreateTenantVo vo = new CreateTenantVo(); |
|
|
|
vo.setPassword(createClientTenantDto.getPassword()); |
|
|
|
vo.setTenantName(createClientTenantDto.getTenantName()); |
|
|
|
vo.setUsername(createClientTenantDto.getUsername()); |
|
|
|
//code复用username |
|
|
|
createClientTenantDto.setTenantCode(createClientTenantDto.getTenantName()); |
|
|
|
//用户表 |
|
|
@@ -111,9 +117,20 @@ public class TenantServiceImpl implements TenantService { |
|
|
|
TenantItem tenantItem = createClientTenantDto.getTenantItem(); |
|
|
|
tenantItem.setTenantId(tenantPo.getId()); |
|
|
|
tenantItemMapper.insert(tenantItem); |
|
|
|
//设置系统有效期 |
|
|
|
vo.setEffectiveDate(DateUtil.formatDate(tenantItem.getBeginTime()) + CommonConstant.TILDE + DateUtil.formatDate(tenantItem.getEndTime())); |
|
|
|
log.info("租户项目表添加完毕"); |
|
|
|
|
|
|
|
for (ClientRoleDto clientRoleDto : createClientTenantDto.getClientRoleDtoList()) { |
|
|
|
//获取clientId查询对应平台获取平台名称 |
|
|
|
Platform platform = platformMapper.selectOne(Wrappers.<Platform>lambdaQuery() |
|
|
|
.eq(Platform::getPlatformCode, clientRoleDto.getClientId()) |
|
|
|
.eq(Platform::getMark, 1)); |
|
|
|
if (ObjectUtil.isNull(platform)) { |
|
|
|
return JsonResult.error("该业务平台不存在"); |
|
|
|
} |
|
|
|
//添加相关对应 |
|
|
|
vo.setPlatformName(platform.getPlatformName() + CommonConstant.SIGN); |
|
|
|
//添加租户对应服务的相关表数据 |
|
|
|
TenantEmploy tenantEmploy = new TenantEmploy(); |
|
|
|
tenantEmploy.setTenantId(tenantPo.getId()); |
|
|
@@ -121,8 +138,9 @@ public class TenantServiceImpl implements TenantService { |
|
|
|
tenantEmploy.setDescription(clientRoleDto.getDescription()); |
|
|
|
tenantEmployMapper.insert(tenantEmploy); |
|
|
|
} |
|
|
|
//拼接 |
|
|
|
vo.setPlatformName(vo.getPlatformName().substring(CommonConstant.ZERO, vo.getPlatformName().lastIndexOf(CommonConstant.SIGN))); |
|
|
|
log.info("租户客户表添加完毕"); |
|
|
|
|
|
|
|
//1.开始判断租户对应需要的平台并进行匹对 |
|
|
|
List<ClientRoleDto> clientRoleDtoList = getClientRoleDtos(createClientTenantDto); |
|
|
|
List<AuthoritiesPo> authoritiesPos = new ArrayList<>(); |
|
|
@@ -164,8 +182,7 @@ public class TenantServiceImpl implements TenantService { |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return JsonResult.success(userPo.getId()); |
|
|
|
return JsonResult.success(vo); |
|
|
|
} |
|
|
|
|
|
|
|
/** |