|
|
@@ -1,24 +1,23 @@ |
|
|
|
package com.tuoheng.service.impl; |
|
|
|
|
|
|
|
import cn.hutool.core.convert.Convert; |
|
|
|
import cn.hutool.core.date.DateTime; |
|
|
|
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; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.tuoheng.common.CommonConfig; |
|
|
|
import com.tuoheng.common.ServiceException; |
|
|
|
import com.tuoheng.common.ServiceExceptionEnum; |
|
|
|
import com.tuoheng.constant.*; |
|
|
|
import com.tuoheng.enums.MarkTypeEnum; |
|
|
|
import com.tuoheng.mapper.*; |
|
|
|
import com.tuoheng.model.dto.*; |
|
|
|
import com.tuoheng.model.dto.LoginUser; |
|
|
|
import com.tuoheng.model.dto.Platform; |
|
|
|
import com.tuoheng.model.entity.TenantEmploy; |
|
|
|
import com.tuoheng.model.entity.TenantItem; |
|
|
|
import com.tuoheng.model.param.*; |
|
|
|
import com.tuoheng.model.param.ClientRoleDto; |
|
|
|
import com.tuoheng.model.param.CreateClientTenantDto; |
|
|
|
import com.tuoheng.model.param.CreateClientUserDto; |
|
|
|
import com.tuoheng.model.po.AuthoritiesPo; |
|
|
|
import com.tuoheng.model.po.ClientUserRolePo; |
|
|
|
import com.tuoheng.model.po.TenantPo; |
|
|
@@ -29,21 +28,22 @@ 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; |
|
|
|
import com.tuoheng.service.TenantService; |
|
|
|
import com.tuoheng.until.JsonResult; |
|
|
|
import com.tuoheng.until.MapUtils; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.core.ParameterizedTypeReference; |
|
|
|
import org.springframework.http.*; |
|
|
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.web.client.RestTemplate; |
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Optional; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@@ -137,17 +137,11 @@ public class TenantServiceImpl implements TenantService { |
|
|
|
PlatformName.append(platform.getPlatformName()); |
|
|
|
PlatformName.append(CommonConstant.SIGN); |
|
|
|
//添加租户对应服务的相关表数据 |
|
|
|
List<AlgorithmDto> algorithmList = clientRoleDto.getAlgorithmList(); |
|
|
|
if (ObjectUtil.isNotEmpty(algorithmList)) { |
|
|
|
for (AlgorithmDto algorithmDto : algorithmList) { |
|
|
|
TenantEmploy tenantEmploy = new TenantEmploy(); |
|
|
|
tenantEmploy.setTenantId(tenantPo.getId()); |
|
|
|
tenantEmploy.setPlatformCode(platform.getPlatformCode()); |
|
|
|
tenantEmploy.setServiceId(algorithmDto.getServiceId()); |
|
|
|
tenantEmploy.setDescription(algorithmDto.getDescription()); |
|
|
|
tenantEmployMapper.insert(tenantEmploy); |
|
|
|
} |
|
|
|
} |
|
|
|
TenantEmploy tenantEmploy = new TenantEmploy(); |
|
|
|
tenantEmploy.setTenantId(tenantPo.getId()); |
|
|
|
tenantEmploy.setPlatformCode(platform.getPlatformCode()); |
|
|
|
tenantEmploy.setServiceId(clientRoleDto.getServiceId()); |
|
|
|
tenantEmployMapper.insert(tenantEmploy); |
|
|
|
} |
|
|
|
//拼接 |
|
|
|
vo.setPlatformName(PlatformName.substring(CommonConstant.ZERO, PlatformName.lastIndexOf(CommonConstant.SIGN))); |
|
|
@@ -409,21 +403,11 @@ public class TenantServiceImpl implements TenantService { |
|
|
|
//此处 暂时格式都为 tuoheng-hhz-web 等格式 如后续维护需要变更形式则此处代码需要更改 |
|
|
|
clientRoleDto.setRoleId(clientUserRolePo.getRoleId()); |
|
|
|
clientRoleDto.setRoleName(clientUserRolePo.getRoleName()); |
|
|
|
List<AlgorithmDto> algorithmDtos = new ArrayList<>(); |
|
|
|
clientRoleDto.setClientId(clientUserRolePo.getClientId().substring(CommonConstant.ZERO, clientUserRolePo.getClientId().lastIndexOf(CommonConstant.BARS))); |
|
|
|
List<TenantEmploy> tenantEmploys = tenantEmployMapper.selectList(Wrappers.<TenantEmploy>lambdaQuery() |
|
|
|
TenantEmploy tenantEmploy = tenantEmployMapper.selectOne(Wrappers.<TenantEmploy>lambdaQuery() |
|
|
|
.eq(TenantEmploy::getTenantId, tenantId) |
|
|
|
.eq(TenantEmploy::getPlatformCode, clientRoleDto.getClientId())); |
|
|
|
if (ObjectUtil.isNotEmpty(tenantEmploys)) { |
|
|
|
for (TenantEmploy tenantEmploy : tenantEmploys) { |
|
|
|
AlgorithmDto algorithmDto = new AlgorithmDto(); |
|
|
|
algorithmDto.setServiceId(tenantEmploy.getServiceId()); |
|
|
|
algorithmDto.setDescription(tenantEmploy.getDescription()); |
|
|
|
algorithmDtos.add(algorithmDto); |
|
|
|
} |
|
|
|
clientRoleDto.setAlgorithmList(algorithmDtos); |
|
|
|
} |
|
|
|
|
|
|
|
clientRoleDto.setServiceId(tenantEmploy.getServiceId()); |
|
|
|
list.add(clientRoleDto); |
|
|
|
} |
|
|
|
dto.setClientRoleDtoList(list.stream().distinct().collect(Collectors.toList())); |
|
|
@@ -517,6 +501,7 @@ public class TenantServiceImpl implements TenantService { |
|
|
|
List<ClientUserRolePo> clientUserRolePos = clientUserRoleMapper.selectListByUserId(tenant.getUserId()); |
|
|
|
CreateClientTenantDto clientTenantDto = new CreateClientTenantDto(); |
|
|
|
BeanUtils.copyProperties(dto, clientTenantDto); |
|
|
|
log.info(clientTenantDto.toString()); |
|
|
|
for (ClientUserRolePo clientUserRolePo : clientUserRolePos) { |
|
|
|
ClientRoleDto clientRoleDto = new ClientRoleDto(); |
|
|
|
//此处 暂时格式都为 tuoheng-hhz-web 等格式 如后续维护需要变更形式则此处代码需要更改 |
|
|
@@ -556,17 +541,11 @@ public class TenantServiceImpl implements TenantService { |
|
|
|
} |
|
|
|
PlatformName.append(platform.getPlatformName()); |
|
|
|
PlatformName.append(CommonConstant.SIGN); |
|
|
|
List<AlgorithmDto> algorithmList = clientRoleDto.getAlgorithmList(); |
|
|
|
if (ObjectUtil.isNotEmpty(algorithmList)) { |
|
|
|
for (AlgorithmDto algorithmDto : algorithmList) { |
|
|
|
TenantEmploy tenantEmploy = new TenantEmploy(); |
|
|
|
tenantEmploy.setTenantId(dto.getId()); |
|
|
|
tenantEmploy.setPlatformCode(clientRoleDto.getClientId()); |
|
|
|
tenantEmploy.setServiceId(algorithmDto.getServiceId()); |
|
|
|
tenantEmploy.setDescription(algorithmDto.getDescription()); |
|
|
|
tenantEmployMapper.insert(tenantEmploy); |
|
|
|
} |
|
|
|
} |
|
|
|
TenantEmploy tenantEmploy = new TenantEmploy(); |
|
|
|
tenantEmploy.setTenantId(dto.getId()); |
|
|
|
tenantEmploy.setPlatformCode(clientRoleDto.getClientId()); |
|
|
|
tenantEmploy.setServiceId(clientRoleDto.getServiceId()); |
|
|
|
tenantEmployMapper.insert(tenantEmploy); |
|
|
|
} |
|
|
|
//拼接 |
|
|
|
vo.setPlatformName(PlatformName.substring(CommonConstant.ZERO, PlatformName.lastIndexOf(CommonConstant.SIGN))); |