소스 검색

更新第三方接口返回参数

tags/v2.4.1
xiaoying 1 년 전
부모
커밋
12ba142f0d
2개의 변경된 파일23개의 추가작업 그리고 30개의 파일을 삭제
  1. +6
    -9
      tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/TenantServiceImpl.java
  2. +17
    -21
      tuoheng_oidc_admin/src/main/java/com/tuoheng/third/service/impl/ThirdServiceImpl.java

+ 6
- 9
tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/TenantServiceImpl.java 파일 보기

@@ -147,7 +147,7 @@ public class TenantServiceImpl implements TenantService {
}
//拼接
vo.setPlatformName(PlatformName.substring(CommonConstant.ZERO, PlatformName.lastIndexOf(CommonConstant.SIGN)));
log.info("租户客户表添加完毕");
log.info("租户实例表添加完毕");
//1.开始判断租户对应需要的平台并进行匹对
List<ClientRoleDto> clientRoleDtoList = getClientRoleDtos(createClientTenantDto);
List<AuthoritiesPo> authoritiesPos = new ArrayList<>();
@@ -395,14 +395,13 @@ public class TenantServiceImpl implements TenantService {
dto.setTenantCode(tenantPo.getCode());
dto.setTenantName(tenantPo.getName());
UserPo userPo = clientUserMapper.selectByUserId(tenantPo.getUserId());
dto.setUsername(userPo.getUsername());
dto.setUsername(Optional.ofNullable(userPo.getUsername()).orElseThrow(() -> new ServiceException(ServiceExceptionEnum.GET_NO_DATA)));
//Optional.ofNullable(userPo.getUsername()).ifPresent(t -> dto.setUsername(t));
//租户对应的业务平台相关信息
List<ClientRoleDto> list = new ArrayList<>();
List<ClientUserRolePo> clientUserRolePos = clientUserRoleMapper.selectListByUserId(tenantPo.getUserId());
ClientRoleDto clientRoleDto = null;
for (ClientUserRolePo clientUserRolePo : clientUserRolePos) {

clientRoleDto = new ClientRoleDto();
ClientRoleDto clientRoleDto = new ClientRoleDto();
//此处 暂时格式都为 tuoheng-hhz-web 等格式 如后续维护需要变更形式则此处代码需要更改
clientRoleDto.setRoleId(clientUserRolePo.getRoleId());
clientRoleDto.setRoleName(clientUserRolePo.getRoleName());
@@ -410,10 +409,8 @@ public class TenantServiceImpl implements TenantService {
TenantEmploy tenantEmploy = tenantEmployMapper.selectOne(Wrappers.<TenantEmploy>lambdaQuery()
.eq(TenantEmploy::getTenantId, tenantId)
.eq(TenantEmploy::getPlatformCode, clientRoleDto.getClientId()));
if (ObjectUtil.isNotNull(tenantEmploy)) {
clientRoleDto.setServiceId(tenantEmploy.getServiceId());
clientRoleDto.setDescription(tenantEmploy.getDescription());
}
Optional.ofNullable(tenantEmploy).ifPresent(t -> clientRoleDto.setServiceId(t.getServiceId()));
Optional.ofNullable(tenantEmploy).ifPresent(t -> clientRoleDto.setDescription(t.getDescription()));
list.add(clientRoleDto);
}
dto.setClientRoleDtoList(list.stream().distinct().collect(Collectors.toList()));

+ 17
- 21
tuoheng_oidc_admin/src/main/java/com/tuoheng/third/service/impl/ThirdServiceImpl.java 파일 보기

@@ -14,6 +14,7 @@ import com.tuoheng.third.request.ThirdRequest;
import com.tuoheng.third.service.ThirdService;
import com.tuoheng.third.vo.IndustryVo;
import com.tuoheng.third.vo.RoleMenuVo;
import com.tuoheng.third.vo.ServiceExampleVo;
import com.tuoheng.until.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -64,7 +65,19 @@ public class ThirdServiceImpl implements ThirdService {
if (response == null || !response.hasBody() || response.getBody().getCode() != JsonResult.SUCCESS) {
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "dsp获取服务实例异常");
}
return JsonResult.success(response.getBody().getData());

List<IndustryVo> list = response.getBody().getData();
List<ServiceExampleVo> serviceInstListVoList = new ArrayList<>();
for (IndustryVo industryVo : list) {
List<ServiceExampleVo> serviceExampleVos = industryVo.getServiceInstListVoList();
if (ObjectUtil.isNotEmpty(serviceExampleVos)) {
for (ServiceExampleVo serviceExampleVo : serviceExampleVos) {
serviceInstListVoList.add(serviceExampleVo);
}
}
}

return JsonResult.success(serviceInstListVoList);
}

/**
@@ -80,19 +93,7 @@ public class ThirdServiceImpl implements ThirdService {
if (ObjectUtil.isEmpty(clientId)) {
return JsonResult.error("clientId不能为空");
}
List<ClientRoleListDto> clientRoleListDtos = new ArrayList<>();

if (clientId.contains(CommonConstant.COMMA)) {
String[] clientIds = clientId.split(CommonConstant.COMMA);
for (String id : clientIds) {
ClientRoleListDto dto = getRoleListByClinetId(id, loginUser);
clientRoleListDtos.add(dto);
}
} else {
ClientRoleListDto dto = getRoleListByClinetId(clientId, loginUser);
clientRoleListDtos.add(dto);
}
return JsonResult.success(clientRoleListDtos);
return JsonResult.success(getRoleListByClinetId(clientId, loginUser));
}

/**
@@ -178,7 +179,7 @@ public class ThirdServiceImpl implements ThirdService {
* @param loginUser
* @return
*/
private ClientRoleListDto getRoleListByClinetId(String clientId, LoginUser loginUser) {
private List<RoleDto> getRoleListByClinetId(String clientId, LoginUser loginUser) {

Platform platform = platformMapper.selectOne(Wrappers.<Platform>lambdaQuery()
.eq(Platform::getPlatformCode, clientId)
@@ -186,9 +187,6 @@ public class ThirdServiceImpl implements ThirdService {
if (ObjectUtil.isNull(platform)) {
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "该业务平台不存在");
}
ClientRoleListDto clientRoleListDto = new ClientRoleListDto();
clientRoleListDto.setPlatformName(platform.getPlatformName());
clientRoleListDto.setClientId(platform.getPlatformCode());

String url = platform.getPlatformUrl();
//根据不同业务平台进行动态匹配 ->并修改对应标识权限
@@ -235,9 +233,7 @@ public class ThirdServiceImpl implements ThirdService {
}
List<RoleDto> roleDtos = response.getBody().getData();

clientRoleListDto.setRoleDtoList(roleDtos);

return clientRoleListDto;
return roleDtos;

}
}

Loading…
취소
저장