Browse Source

更新相关结构

tags/v2.4.1
xiaoying 1 year ago
parent
commit
30a62ceabc
4 changed files with 24 additions and 76 deletions
  1. +0
    -22
      tuoheng_oidc_admin/src/main/java/com/tuoheng/model/dto/AlgorithmDto.java
  2. +0
    -6
      tuoheng_oidc_admin/src/main/java/com/tuoheng/model/entity/TenantEmploy.java
  3. +2
    -5
      tuoheng_oidc_admin/src/main/java/com/tuoheng/model/param/ClientRoleDto.java
  4. +22
    -43
      tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/TenantServiceImpl.java

+ 0
- 22
tuoheng_oidc_admin/src/main/java/com/tuoheng/model/dto/AlgorithmDto.java View File

@@ -1,22 +0,0 @@
package com.tuoheng.model.dto;

import lombok.Data;

/**
* 算法实例dto
* @Author xiaoying
* @Date 2023/3/15 16:13
*/
@Data
public class AlgorithmDto {
/**
* 该平台对应服务实例id
*/
private String serviceId;
/**
* 识别详情
*/
private String description;


}

+ 0
- 6
tuoheng_oidc_admin/src/main/java/com/tuoheng/model/entity/TenantEmploy.java View File

@@ -50,12 +50,6 @@ public class TenantEmploy implements Serializable {
* 服务实例id
*/
private String serviceId;

/**
* 识别详情
*/
private String description;

/**
* 业务平台对应标识
*/

+ 2
- 5
tuoheng_oidc_admin/src/main/java/com/tuoheng/model/param/ClientRoleDto.java View File

@@ -1,10 +1,7 @@
package com.tuoheng.model.param;

import com.tuoheng.model.dto.AlgorithmDto;
import lombok.Data;

import java.util.List;

/**
* @author chenjiandong
* @description: TODO
@@ -17,9 +14,9 @@ public class ClientRoleDto {
*/
private String clientId;
/**
* 算法实例对象集合
* 该平台对应服务实例id(多个逗号隔开)
*/
private List<AlgorithmDto> algorithmList;
private String serviceId;;

/**
* 该平台对应角色id

+ 22
- 43
tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/TenantServiceImpl.java View File

@@ -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)));

Loading…
Cancel
Save