|
|
@@ -84,7 +84,6 @@ public class TenantServiceImpl implements TenantService { |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public JsonResult createClientTenant(CreateClientTenantDto createClientTenantDto, LoginUser loginUser) { |
|
|
|
|
|
|
|
if (clientUserMapper.judgeCreateByUserName(createClientTenantDto.getUsername()) > 0) { |
|
|
|
return JsonResult.error("该用户名称已存在!"); |
|
|
|
} |
|
|
@@ -105,7 +104,7 @@ public class TenantServiceImpl implements TenantService { |
|
|
|
clientUserMapper.insertClientUser(userPo); |
|
|
|
log.info("用户表添加完毕"); |
|
|
|
//调用高德将地址转换经纬度 |
|
|
|
Map lonAndLat = MapUtils.getLonAndLat(createClientTenantDto.getAdress(), CommonConfig.gaodeKey); |
|
|
|
Map<String, String> lonAndLat = MapUtils.getLonAndLat(createClientTenantDto.getAdress(), CommonConfig.gaodeKey); |
|
|
|
//租户表 |
|
|
|
TenantPo tenantPo = new TenantPo(); |
|
|
|
BeanUtils.copyProperties(createClientTenantDto, tenantPo); |
|
|
@@ -138,12 +137,17 @@ public class TenantServiceImpl implements TenantService { |
|
|
|
PlatformName.append(platform.getPlatformName()); |
|
|
|
PlatformName.append(CommonConstant.SIGN); |
|
|
|
//添加租户对应服务的相关表数据 |
|
|
|
TenantEmploy tenantEmploy = new TenantEmploy(); |
|
|
|
tenantEmploy.setTenantId(tenantPo.getId()); |
|
|
|
tenantEmploy.setServiceId(clientRoleDto.getServiceId()); |
|
|
|
tenantEmploy.setDescription(clientRoleDto.getDescription()); |
|
|
|
tenantEmploy.setPlatformCode(platform.getPlatformCode()); |
|
|
|
tenantEmployMapper.insert(tenantEmploy); |
|
|
|
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); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
//拼接 |
|
|
|
vo.setPlatformName(PlatformName.substring(CommonConstant.ZERO, PlatformName.lastIndexOf(CommonConstant.SIGN))); |
|
|
@@ -405,12 +409,21 @@ 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))); |
|
|
|
TenantEmploy tenantEmploy = tenantEmployMapper.selectOne(Wrappers.<TenantEmploy>lambdaQuery() |
|
|
|
List<TenantEmploy> tenantEmploys = tenantEmployMapper.selectList(Wrappers.<TenantEmploy>lambdaQuery() |
|
|
|
.eq(TenantEmploy::getTenantId, tenantId) |
|
|
|
.eq(TenantEmploy::getPlatformCode, clientRoleDto.getClientId())); |
|
|
|
Optional.ofNullable(tenantEmploy).ifPresent(t -> clientRoleDto.setServiceId(t.getServiceId())); |
|
|
|
Optional.ofNullable(tenantEmploy).ifPresent(t -> clientRoleDto.setDescription(t.getDescription())); |
|
|
|
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); |
|
|
|
} |
|
|
|
|
|
|
|
list.add(clientRoleDto); |
|
|
|
} |
|
|
|
dto.setClientRoleDtoList(list.stream().distinct().collect(Collectors.toList())); |
|
|
@@ -510,12 +523,17 @@ public class TenantServiceImpl implements TenantService { |
|
|
|
List<ClientRoleDto> list = dto.getClientRoleDtoList(); |
|
|
|
//新增租户关联业务服务实例相关 |
|
|
|
for (ClientRoleDto clientRoleDto : list) { |
|
|
|
TenantEmploy tenantEmploy = new TenantEmploy(); |
|
|
|
tenantEmploy.setDescription(clientRoleDto.getDescription()); |
|
|
|
tenantEmploy.setTenantId(dto.getId()); |
|
|
|
tenantEmploy.setServiceId(clientRoleDto.getServiceId()); |
|
|
|
tenantEmploy.setPlatformCode(clientRoleDto.getClientId()); |
|
|
|
tenantEmployMapper.insert(tenantEmploy); |
|
|
|
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); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
log.info("租户更新的业务服务实例表更新完毕"); |
|
|
|
//更新租户原有数据基本 |