Bläddra i källkod

Merge branch 'develop' of gitadmin/tuoheng_telecomumale into release

tags/v1.3.1
wanjing 1 år sedan
förälder
incheckning
f7a9d0cdcc
2 ändrade filer med 30 tillägg och 23 borttagningar
  1. +1
    -1
      tuoheng-common/tuoheng-common-core/src/main/java/com/tuoheng/common/core/config/http/HeadClientHttpRequestInterceptor.java
  2. +29
    -22
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/airportline/query/inspection/QueryAirportLineByAirportService.java

+ 1
- 1
tuoheng-common/tuoheng-common-core/src/main/java/com/tuoheng/common/core/config/http/HeadClientHttpRequestInterceptor.java Visa fil

@@ -18,7 +18,7 @@ public class HeadClientHttpRequestInterceptor implements ClientHttpRequestInterc

@Override
public ClientHttpResponse intercept(HttpRequest httpRequest, byte[] bytes, ClientHttpRequestExecution clientHttpRequestExecution) throws IOException {
LOGGER.info("#####head handle########");
// LOGGER.info("#####head handle########");
HttpHeaders headers = httpRequest.getHeaders();
headers.add("Accept", "application/json");
headers.add("Accept-Encoding", "gzip");

+ 29
- 22
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/airportline/query/inspection/QueryAirportLineByAirportService.java Visa fil

@@ -1,11 +1,15 @@
package com.tuoheng.admin.service.airportline.query.inspection;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.tuoheng.admin.constant.SystemConstant;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.enums.code.AriportCodeEnum;
import com.tuoheng.admin.mapper.InspectionMapper;
import com.tuoheng.admin.tzhl.response.FlyLinePointResult;
import com.tuoheng.admin.tzhl.response.TZHLAirportLineResponse;
import com.tuoheng.admin.tzhl.service.airportline.TZHLGetAirportLineListService;
import com.tuoheng.admin.vo.airport.AirPortLineLocationVo;
import com.tuoheng.admin.vo.airport.AirPortStatusVO;
import com.tuoheng.common.core.config.common.CommonConfig;
@@ -18,6 +22,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
@@ -31,6 +36,9 @@ import java.util.List;
@Service
public class QueryAirportLineByAirportService {

@Autowired
private TZHLGetAirportLineListService tzhlGetAirportLineListService;

/**
* 根据任务ID获取航线,从机场平台获取
*
@@ -44,7 +52,27 @@ public class QueryAirportLineByAirportService {
log.info("根据任务ID获取航线:校验参数失败:{}", result.getMsg());
return result;
}
List<AirPortLineLocationVo> airPortLineLocationVoList = this.getAirPortLocation(inspectionLine);

TZHLAirportLineResponse tzhlAirportLineResponse = tzhlGetAirportLineListService.getAirportLineById(inspection.getInspectionLine());
if (ObjectUtil.isEmpty(tzhlAirportLineResponse)) {
log.info("根据任务ID获取航线:航线不存在:{}", inspection.getInspectionLine());
return JsonResult.error("航线不存在");
}

List<FlyLinePointResult> points = tzhlAirportLineResponse.getPoints();

if (CollectionUtil.isEmpty(points)) {
log.info("根据任务ID获取航线:航线点集合为空");
return JsonResult.error("航线点集合为空");
}
List<AirPortLineLocationVo> airPortLineLocationVoList = new ArrayList<>();
AirPortLineLocationVo airPortLineLocationVo;
for (FlyLinePointResult flyLinePointResult : points) {
airPortLineLocationVo = new AirPortLineLocationVo();
airPortLineLocationVo.setLat(flyLinePointResult.getLatitude());
airPortLineLocationVo.setLon(flyLinePointResult.getLongitude());
airPortLineLocationVoList.add(airPortLineLocationVo);
}
return JsonResult.success(airPortLineLocationVoList);
}

@@ -56,25 +84,4 @@ public class QueryAirportLineByAirportService {
return JsonResult.success();
}

private List<AirPortLineLocationVo> getAirPortLocation(Long inspectionLine) {
String url = CommonConfig.airportURL + SystemConstant.API_AIRPORT_LOCATION;
String param = "id=" + inspectionLine;
String airPortLineLocationStr = HttpUtils.sendGet(url, param);
if (StringUtils.isEmpty(airPortLineLocationStr)) {
log.info("调用机场平台,查询航线:机场接口返回数据为空");
return null;
}
JsonResult jsonResult = JacksonUtil.json2pojo(airPortLineLocationStr, JsonResult.class);
if (0 != jsonResult.getCode()) {
log.info("调用机场平台,查询航线:机场接口返回状态失败");
return null;
}
if (ObjectUtil.isEmpty(jsonResult.getData())) {
log.info("调用机场平台,查询航线:机场接口返回数据为空");
return null;
}
List<AirPortLineLocationVo> airPortLineLocationVoList = JSONObject.parseArray(JSONObject.toJSONString(jsonResult.getData()), AirPortLineLocationVo.class);
return airPortLineLocationVoList;
}

}

Laddar…
Avbryt
Spara