Browse Source

添加获取机场航线列表接口

tags/v1.3.1
chengwang 1 year ago
parent
commit
ac5d31fcfa
1 changed files with 9 additions and 6 deletions
  1. +9
    -6
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/service/airport/TZHLGetAirportListService.java

+ 9
- 6
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/service/airport/TZHLGetAirportListService.java View File

package com.tuoheng.admin.tzhl.service.airport; package com.tuoheng.admin.tzhl.service.airport;


import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.tuoheng.admin.constant.SystemConstant; import com.tuoheng.admin.constant.SystemConstant;
import com.tuoheng.admin.dto.GetAirportListDto; import com.tuoheng.admin.dto.GetAirportListDto;
import org.springframework.web.client.RestClientException; import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;


import java.util.List;

/** /**
* 获取机场列表 * 获取机场列表
* @Author ChengWang * @Author ChengWang
log.error("请求获取机场列表" + response.getBody()); log.error("请求获取机场列表" + response.getBody());
return JsonResult.error(response.getBody().getMsg()); return JsonResult.error(response.getBody().getMsg());
} }
if(response.getBody().getData() == null){
return JsonResult.error("查询机场列表数据为空");
}
log.info("查询机场列表数据成功,response={}", response);
String body = JSONObject.toJSONString(response.getBody().getData());


GetAirportListDto getAirportListDto = JSONObject.parseObject(response.getBody().getData().toString(), GetAirportListDto.class);
if(ObjectUtil.isNull(getAirportListDto)){
List<GetAirportListDto> getAirportListDtoLists = JSON.parseArray(JSON.parse(body).toString(), GetAirportListDto.class);
if(ObjectUtil.isNull(getAirportListDtoLists)){
return JsonResult.error("查询机场列表数据为空"); return JsonResult.error("查询机场列表数据为空");
} }
return JsonResult.success(getAirportListDto);
return JsonResult.success(getAirportListDtoLists);
} }


private JsonResult check(String token) { private JsonResult check(String token) {

Loading…
Cancel
Save