|
|
@@ -1,6 +1,7 @@ |
|
|
|
package com.tuoheng.service.impl; |
|
|
|
|
|
|
|
import cn.hutool.core.convert.Convert; |
|
|
|
import cn.hutool.core.date.DateUnit; |
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
@@ -121,6 +122,7 @@ public class TenantServiceImpl implements TenantService { |
|
|
|
vo.setEffectiveDate(DateUtil.formatDate(tenantItem.getBeginTime()) + CommonConstant.TILDE + DateUtil.formatDate(tenantItem.getEndTime())); |
|
|
|
log.info("租户项目表添加完毕"); |
|
|
|
|
|
|
|
StringBuilder PlatformName = new StringBuilder(); |
|
|
|
for (ClientRoleDto clientRoleDto : createClientTenantDto.getClientRoleDtoList()) { |
|
|
|
//获取clientId查询对应平台获取平台名称 |
|
|
|
Platform platform = platformMapper.selectOne(Wrappers.<Platform>lambdaQuery() |
|
|
@@ -130,7 +132,8 @@ public class TenantServiceImpl implements TenantService { |
|
|
|
return JsonResult.error("该业务平台不存在"); |
|
|
|
} |
|
|
|
//添加相关对应 |
|
|
|
vo.setPlatformName(platform.getPlatformName() + CommonConstant.SIGN); |
|
|
|
PlatformName.append(platform.getPlatformName()); |
|
|
|
PlatformName.append(CommonConstant.SIGN); |
|
|
|
//添加租户对应服务的相关表数据 |
|
|
|
TenantEmploy tenantEmploy = new TenantEmploy(); |
|
|
|
tenantEmploy.setTenantId(tenantPo.getId()); |
|
|
@@ -139,7 +142,7 @@ public class TenantServiceImpl implements TenantService { |
|
|
|
tenantEmployMapper.insert(tenantEmploy); |
|
|
|
} |
|
|
|
//拼接 |
|
|
|
vo.setPlatformName(vo.getPlatformName().substring(CommonConstant.ZERO, vo.getPlatformName().lastIndexOf(CommonConstant.SIGN))); |
|
|
|
vo.setPlatformName(PlatformName.substring(CommonConstant.ZERO, PlatformName.lastIndexOf(CommonConstant.SIGN))); |
|
|
|
log.info("租户客户表添加完毕"); |
|
|
|
//1.开始判断租户对应需要的平台并进行匹对 |
|
|
|
List<ClientRoleDto> clientRoleDtoList = getClientRoleDtos(createClientTenantDto); |
|
|
@@ -321,7 +324,16 @@ public class TenantServiceImpl implements TenantService { |
|
|
|
List<TenantVo> collect = pageData.getRecords().stream().map(x -> { |
|
|
|
TenantVo vo = new TenantVo(); |
|
|
|
BeanUtils.copyProperties(x, vo); |
|
|
|
//并不是真正意义上的租户id |
|
|
|
vo.setTenantId(x.getUserId()); |
|
|
|
TenantItem tenantItem = tenantItemMapper.selectOne(Wrappers.<TenantItem>lambdaQuery().eq(TenantItem::getTenantId, x.getId())); |
|
|
|
if (ObjectUtil.isNotNull(tenantItem)) { |
|
|
|
//获取有效期等 |
|
|
|
vo.setEffectiveDate(DateUtil.formatDate(tenantItem.getBeginTime()) + CommonConstant.TILDE + DateUtil.formatDate(tenantItem.getEndTime())); |
|
|
|
//获取剩余天数 |
|
|
|
long day = DateUtil.between(tenantItem.getBeginTime(), tenantItem.getEndTime(), DateUnit.DAY); |
|
|
|
vo.setRemainDays(day); |
|
|
|
} |
|
|
|
//此处userId = tenantId 效果一致 |
|
|
|
List<AuthoritiesPo> poList = authoritiesMapper.selectListByUserIdAndClientId(x.getUserId(), query); |
|
|
|
if (ObjectUtil.isEmpty(poList)) { |