|
|
@@ -426,7 +426,9 @@ public class TenantServiceImpl implements TenantService { |
|
|
|
TenantEmploy tenantEmploy = tenantEmployMapper.selectOne(Wrappers.<TenantEmploy>lambdaQuery() |
|
|
|
.eq(TenantEmploy::getTenantId, tenantId) |
|
|
|
.eq(TenantEmploy::getPlatformCode, clientRoleDto.getClientId())); |
|
|
|
clientRoleDto.setServiceId(tenantEmploy.getServiceId()); |
|
|
|
if (ObjectUtil.isNotNull(tenantEmploy)) { |
|
|
|
clientRoleDto.setServiceId(tenantEmploy.getServiceId()); |
|
|
|
} |
|
|
|
list.add(clientRoleDto); |
|
|
|
} |
|
|
|
dto.setClientRoleDtoList(list.stream().distinct().collect(Collectors.toList())); |
|
|
@@ -595,18 +597,15 @@ public class TenantServiceImpl implements TenantService { |
|
|
|
vo.setPlatformName(PlatformName.substring(CommonConstant.ZERO, PlatformName.lastIndexOf(CommonConstant.SIGN))); |
|
|
|
log.info("租户更新的业务服务实例表更新完毕"); |
|
|
|
//更新租户原有数据基本 |
|
|
|
TenantPo tenantPo = new TenantPo(); |
|
|
|
BeanUtils.copyProperties(dto, tenantPo); |
|
|
|
tenantPo.setName(dto.getTenantName()) |
|
|
|
tenant.setName(dto.getTenantName()) |
|
|
|
.setCode(dto.getTenantCode()) |
|
|
|
.setId(dto.getId()); |
|
|
|
tenantMapper.updateById(tenantPo); |
|
|
|
tenantMapper.updateById(tenant); |
|
|
|
log.info("租户基本信息更新完毕"); |
|
|
|
TenantItem tenantItem = dto.getTenantItem(); |
|
|
|
tenantItemMapper.updateById(tenantItem); |
|
|
|
vo.setEffectiveDate(DateUtil.formatDate(tenantItem.getBeginTime()) + CommonConstant.TILDE + DateUtil.formatDate(tenantItem.getEndTime())); |
|
|
|
log.info("租户项目相关信息更新完毕"); |
|
|
|
|
|
|
|
//todo:调用业务系统完成租户创建 |
|
|
|
for (ClientRoleDto clientRoleDto : list) { |
|
|
|
try { |
|
|
@@ -622,6 +621,35 @@ public class TenantServiceImpl implements TenantService { |
|
|
|
log.info("异常信息:{}", e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
log.info("业务系统新增租户成功"); |
|
|
|
//原有集合 |
|
|
|
List<ClientRoleDto> finalClientRoleDtoList = clientRoleDtoList; |
|
|
|
list= list.stream().filter(t -> !finalClientRoleDtoList.contains(t)).collect(Collectors.toList()); |
|
|
|
|
|
|
|
List<AuthoritiesPo> authoritiesPos = new ArrayList<>(); |
|
|
|
List<ClientUserRolePo> clientUserRolePoArrayList = new ArrayList<>(); |
|
|
|
|
|
|
|
for (ClientRoleDto clientRoleDto : list) { |
|
|
|
//添加角色权限相关 |
|
|
|
AuthoritiesPo authoritiesPo = new AuthoritiesPo() |
|
|
|
.setUserId(tenant.getUserId()) |
|
|
|
.setUsername(dto.getUsername()) |
|
|
|
.setAuthority(clientRoleDto.getClientId()); |
|
|
|
authoritiesPo.setCreateUser(loginUser.getUserId()); |
|
|
|
authoritiesPos.add(authoritiesPo); |
|
|
|
|
|
|
|
ClientUserRolePo clientUserRolePo = new ClientUserRolePo() |
|
|
|
.setUserId(tenant.getUserId()) |
|
|
|
.setClientId(clientRoleDto.getClientId()) |
|
|
|
.setRoleId(clientRoleDto.getRoleId()) |
|
|
|
.setRoleName(clientRoleDto.getRoleName()); |
|
|
|
clientUserRolePo.setCreateUser(loginUser.getUserId()); |
|
|
|
clientUserRolePoArrayList.add(clientUserRolePo); |
|
|
|
} |
|
|
|
authoritiesMapper.batchInsert(authoritiesPos); |
|
|
|
clientUserRoleMapper.batchInsert(clientUserRolePoArrayList); |
|
|
|
log.info("对应业务系统的权限相关创建成功"); |
|
|
|
|
|
|
|
return JsonResult.success(vo); |
|
|
|
} |
|
|
|
|