|
|
@@ -48,9 +48,11 @@ public class FlyDataService { |
|
|
|
private TZHLGetAirportListService getAirportListService; |
|
|
|
|
|
|
|
public void getFlyData(Inspection inspection) { |
|
|
|
log.info("执行获取飞行数据操作,inspection:{}",inspection.toString()); |
|
|
|
String apiPath = TZHLConstant.TIAN_YI_API_FLIGHT_DATA; |
|
|
|
JSONObject jsonObject = this.jsonObjectRequest(inspection); |
|
|
|
String dataJson = callTianYiPlatformService.callPost(apiPath, jsonObject); |
|
|
|
log.info("获取飞行数据dataJson:{}",dataJson); |
|
|
|
|
|
|
|
List<TZHLAirportFlightDataResponse> flightDataHlList = JSON.parseArray(dataJson, TZHLAirportFlightDataResponse.class); |
|
|
|
|
|
|
@@ -65,6 +67,7 @@ public class FlyDataService { |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private void addFlightDataHl(Inspection inspection, List<TZHLAirportFlightDataResponse> flightDataHlList) { |
|
|
|
log.info("开始飞行数据保存入库"); |
|
|
|
if(CollectionUtil.isNotEmpty(flightDataHlList) && flightDataHlList.size() != 0){ |
|
|
|
List<FlightDataHl> flightDataHls = new ArrayList<>(flightDataHlList.size()); |
|
|
|
for (TZHLAirportFlightDataResponse responseData : flightDataHlList) { |
|
|
@@ -82,9 +85,11 @@ public class FlyDataService { |
|
|
|
throw new SecurityException("飞行数据插入失败"); |
|
|
|
} |
|
|
|
flightDataHls.add(flightDataHl); |
|
|
|
log.info("结束飞行数据保存入库, flightDataHls:{}",flightDataHls); |
|
|
|
|
|
|
|
} |
|
|
|
//将最新的一条数据存入缓存,并设置过期时间 |
|
|
|
log.info("开始存入最新一条数据于缓存中"); |
|
|
|
if(CollectionUtil.isNotEmpty(flightDataHls) && flightDataHls.size()>0){ |
|
|
|
flightDataHls = flightDataHls.stream().sorted(Comparator.comparing(FlightDataHl::getCreateTime).reversed()).collect(Collectors.toList()); |
|
|
|
//倒序排列的第一个最新数据保存到缓存 |
|
|
@@ -124,7 +129,7 @@ public class FlyDataService { |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private void getCreateTime(Inspection inspection,JSONObject jsonObject) { |
|
|
|
String tenantId = CurrentUserUtil.getTenantId(); |
|
|
|
String tenantId = inspection.getTenantId(); |
|
|
|
|
|
|
|
List<FlightDataHl> flightDataHl = flightDataHlMapper.selectList(new LambdaQueryWrapper<FlightDataHl>() |
|
|
|
.eq(FlightDataHl::getMark, MarkEnum.VALID.getCode()) |