|
|
@@ -557,6 +557,10 @@ public class TenantServiceImpl implements TenantService { |
|
|
|
if (ObjectUtil.isNull(tenant)) { |
|
|
|
return JsonResult.error(ServiceExceptionEnum.GET_NO_DATA.getMessage()); |
|
|
|
} |
|
|
|
//现有list |
|
|
|
List<ClientRoleDto> list = dto.getClientRoleDtoList(); |
|
|
|
//现有集合 |
|
|
|
List<ClientRoleDto> clientRoleDtos = getClientRoleDtos(list); |
|
|
|
//租户对应的业务平台相关信息 |
|
|
|
//删除这个租户原本存在的所有业务平台下的信息 |
|
|
|
List<ClientRoleDto> clientRoleDtoList = new ArrayList<>(); |
|
|
@@ -572,8 +576,16 @@ public class TenantServiceImpl implements TenantService { |
|
|
|
clientRoleDto.setClientId(clientUserRolePo.getClientId().substring(CommonConstant.ZERO, clientUserRolePo.getClientId().lastIndexOf(CommonConstant.BARS))); |
|
|
|
clientRoleDtoList.add(clientRoleDto); |
|
|
|
} |
|
|
|
//原有集合 |
|
|
|
clientRoleDtoList = clientRoleDtoList.stream().distinct().collect(Collectors.toList()); |
|
|
|
clientTenantDto.setClientRoleDtoList(clientRoleDtoList); |
|
|
|
List<ClientRoleDto> deleteList = clientRoleDtoList; |
|
|
|
//现有对比 拿出不需要的数据进行删除 |
|
|
|
List<ClientRoleDto> deleteClientRoleDtoList; |
|
|
|
List<ClientRoleDto> insertClientRoleDtoList; |
|
|
|
deleteClientRoleDtoList = list.stream().filter(t -> !deleteList.contains(t)).collect(Collectors.toList()); |
|
|
|
//新增 |
|
|
|
insertClientRoleDtoList = clientRoleDtoList.stream().filter(t -> !list.contains(t)).collect(Collectors.toList()); |
|
|
|
clientTenantDto.setClientRoleDtoList(deleteClientRoleDtoList); |
|
|
|
//符合先删后增逻辑 则直接将原有租户已经对应的关联业务数据清除 |
|
|
|
JsonResult jsonResult = deleteTenant(clientTenantDto, loginUser); |
|
|
|
if (jsonResult.getCode() != JsonResult.SUCCESS) { |
|
|
@@ -589,12 +601,8 @@ public class TenantServiceImpl implements TenantService { |
|
|
|
List<TenantEmploy> tenantEmploys = tenantEmployMapper.selectList(Wrappers.<TenantEmploy>lambdaQuery() |
|
|
|
.eq(TenantEmploy::getTenantId, dto.getId())); |
|
|
|
tenantEmploys.forEach(t -> tenantEmployMapper.deleteById(t)); |
|
|
|
//现有list |
|
|
|
List<ClientRoleDto> list = dto.getClientRoleDtoList(); |
|
|
|
//现有集合 |
|
|
|
List<ClientRoleDto> clientRoleDtos = getClientRoleDtos(list); |
|
|
|
//原有集合 |
|
|
|
List<ClientRoleDto> finalClientRoleDtoList = getClientRoleDtos(clientRoleDtoList); |
|
|
|
List<ClientRoleDto> finalClientRoleDtoList = getClientRoleDtos(deleteClientRoleDtoList); |
|
|
|
//筛选出一样的则不做相关操作 |
|
|
|
//删除租户所有原始权限 |
|
|
|
for (ClientRoleDto clientRoleDto : finalClientRoleDtoList) { |
|
|
@@ -638,7 +646,7 @@ public class TenantServiceImpl implements TenantService { |
|
|
|
vo.setEffectiveDate(DateUtil.formatDate(tenantItem.getBeginTime()) + CommonConstant.TILDE + DateUtil.formatDate(tenantItem.getEndTime())); |
|
|
|
log.info("租户项目相关信息更新完毕"); |
|
|
|
//todo:调用业务系统完成租户创建 |
|
|
|
for (ClientRoleDto clientRoleDto : list) { |
|
|
|
for (ClientRoleDto clientRoleDto : insertClientRoleDtoList) { |
|
|
|
try { |
|
|
|
log.info("参数:{}", clientRoleDto.toString()); |
|
|
|
JsonResult result = getResult(dto, clientRoleDto.getClientId(), loginUser); |
|
|
@@ -657,8 +665,8 @@ public class TenantServiceImpl implements TenantService { |
|
|
|
//创建新的租户对应权限相关数据 |
|
|
|
List<AuthoritiesPo> authoritiesPos = new ArrayList<>(); |
|
|
|
List<ClientUserRolePo> clientUserRolePoArrayList = new ArrayList<>(); |
|
|
|
|
|
|
|
for (ClientRoleDto clientRoleDto : clientRoleDtos) { |
|
|
|
insertClientRoleDtoList = getClientRoleDtos(insertClientRoleDtoList); |
|
|
|
for (ClientRoleDto clientRoleDto : insertClientRoleDtoList) { |
|
|
|
//添加角色权限相关 |
|
|
|
AuthoritiesPo authoritiesPo = new AuthoritiesPo() |
|
|
|
.setUserId(tenant.getUserId()) |