Browse Source

调用机场平台获取机场列表接口调整参数

tags/v1.0.0^2
wanjing 1 year ago
parent
commit
01d2a717f9
1 changed files with 8 additions and 2 deletions
  1. +8
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/airport/AirportServiceImpl.java

+ 8
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/airport/AirportServiceImpl.java View File

import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;


import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Objects; import java.util.Objects;


@Service @Service
if (StringUtils.isEmpty(tenant.getAirportUrl())) { if (StringUtils.isEmpty(tenant.getAirportUrl())) {
return JsonResult.error(AriportCodeEnum.GET_NO_TENANT.getCode(), AriportCodeEnum.GET_NO_TENANT.getMsg()); return JsonResult.error(AriportCodeEnum.GET_NO_TENANT.getCode(), AriportCodeEnum.GET_NO_TENANT.getMsg());
} }

String url = tenant.getAirportUrl() + SystemConstant.API_AIRPORT_LIST; String url = tenant.getAirportUrl() + SystemConstant.API_AIRPORT_LIST;
String param = "page=1&limit=10";
String param;
try {
param = "page=1&limit=1000&tenantName=" + URLEncoder.encode(tenant.getName(), "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
String airPortStr = HttpUtils.sendGet(url, param); String airPortStr = HttpUtils.sendGet(url, param);


JsonResult jsonResult = JacksonUtil.json2pojo(airPortStr, JsonResult.class); JsonResult jsonResult = JacksonUtil.json2pojo(airPortStr, JsonResult.class);

Loading…
Cancel
Save