|
|
@@ -7,7 +7,9 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import com.tuoheng.common.CommonConfig; |
|
|
|
import com.tuoheng.common.ServiceException; |
|
|
|
import com.tuoheng.constant.AirportConstant; |
|
|
|
import com.tuoheng.constant.HhzUrlConstant; |
|
|
|
import com.tuoheng.mapper.*; |
|
|
|
import com.tuoheng.model.dto.*; |
|
|
@@ -17,6 +19,7 @@ import com.tuoheng.model.po.ClientUserRolePo; |
|
|
|
import com.tuoheng.model.po.TenantPo; |
|
|
|
import com.tuoheng.model.po.UserPo; |
|
|
|
import com.tuoheng.model.query.TenantQuery; |
|
|
|
import com.tuoheng.model.request.AirportRequest; |
|
|
|
import com.tuoheng.model.vo.BusinessSystemVo; |
|
|
|
import com.tuoheng.model.vo.TenantVo; |
|
|
|
import com.tuoheng.service.ClientUserSevice; |
|
|
@@ -238,10 +241,18 @@ public class ClientUserServiceImpl implements ClientUserSevice { |
|
|
|
if (dto.getClientId().contains(",")) { |
|
|
|
String[] codes = dto.getClientId().split(","); |
|
|
|
for (String code : codes) { |
|
|
|
return getResult(dto, code, loginUser); |
|
|
|
JsonResult result = getResult(dto, code, loginUser); |
|
|
|
if (!"操作成功".equals(result.getMsg())) { |
|
|
|
return result; |
|
|
|
} |
|
|
|
return requestAirport(dto, loginUser); |
|
|
|
} |
|
|
|
} else { |
|
|
|
return getResult(dto, dto.getClientId(), loginUser); |
|
|
|
JsonResult result = getResult(dto, dto.getClientId(), loginUser); |
|
|
|
if (!"操作成功".equals(result.getMsg())) { |
|
|
|
return result; |
|
|
|
} |
|
|
|
return requestAirport(dto, loginUser); |
|
|
|
} |
|
|
|
return JsonResult.success(); |
|
|
|
} |
|
|
@@ -496,4 +507,42 @@ public class ClientUserServiceImpl implements ClientUserSevice { |
|
|
|
} |
|
|
|
return JsonResult.success(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 向机场发送请求 |
|
|
|
* @param dto |
|
|
|
* @param loginUser |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private JsonResult requestAirport(OidcTenantDto dto,LoginUser loginUser) { |
|
|
|
//填充请求类 |
|
|
|
AirportRequest request = new AirportRequest(); |
|
|
|
request.setPassword(dto.getPassword()); |
|
|
|
request.setUsername(dto.getUsername()); |
|
|
|
request.setTenantName(dto.getName()); |
|
|
|
request.setTenantCode(dto.getCode()); |
|
|
|
|
|
|
|
//设置请求头 |
|
|
|
HttpHeaders resultRequestHeader = new HttpHeaders(); |
|
|
|
resultRequestHeader.add("Authorization", "Bearer " + loginUser.getThToken()); |
|
|
|
HttpEntity httpEntity = new HttpEntity(request, resultRequestHeader); |
|
|
|
//设置地址(机场平台->配置文件) |
|
|
|
String url = CommonConfig.airportURL+ AirportConstant.CREATE_TENANT; |
|
|
|
ResponseEntity<JsonResult> response; |
|
|
|
try { |
|
|
|
response = restTemplate.exchange(url, HttpMethod.POST, httpEntity, JsonResult.class); |
|
|
|
} catch (Exception e) { |
|
|
|
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "机场平台创建租户失败"); |
|
|
|
} |
|
|
|
if (null == response || !response.hasBody()) { |
|
|
|
log.error("机场平台创建租户响应失败"); |
|
|
|
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "机场平台创建租户失败"); |
|
|
|
} |
|
|
|
if (response.getBody().getCode() != JsonResult.SUCCESS) { |
|
|
|
log.error("机场平台创建租户响应失败" + response.getBody()); |
|
|
|
return JsonResult.error(response.getBody().getMsg()); |
|
|
|
} |
|
|
|
return JsonResult.success(); |
|
|
|
|
|
|
|
} |
|
|
|
} |