|
|
|
|
|
|
|
|
String apiPath = TZHLConstant.TIAN_YI_API_FLIGHT_DATA; |
|
|
String apiPath = TZHLConstant.TIAN_YI_API_FLIGHT_DATA; |
|
|
JSONObject jsonObject = this.jsonObjectRequest(inspection); |
|
|
JSONObject jsonObject = this.jsonObjectRequest(inspection); |
|
|
String dataJson = callTianYiPlatformService.callPost(apiPath, jsonObject); |
|
|
String dataJson = callTianYiPlatformService.callPost(apiPath, jsonObject); |
|
|
log.info("获取飞行数据, dataJson:{}", dataJson); |
|
|
|
|
|
|
|
|
|
|
|
List<TZHLAirportFlightDataResponse> flightDataHlList = JSON.parseArray(dataJson, TZHLAirportFlightDataResponse.class); |
|
|
List<TZHLAirportFlightDataResponse> flightDataHlList = JSON.parseArray(dataJson, TZHLAirportFlightDataResponse.class); |
|
|
|
|
|
|
|
|
|
|
|
log.info("获取飞行数据, flightDataHlList size:{}", flightDataHlList.size()); |
|
|
|
|
|
|
|
|
// 查询到的数据入库 |
|
|
// 查询到的数据入库 |
|
|
this.addFlightDataHl(inspection, flightDataHlList); |
|
|
this.addFlightDataHl(inspection, flightDataHlList); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
private void addFlightDataHl(Inspection inspection, List<TZHLAirportFlightDataResponse> flightDataHlList) { |
|
|
private void addFlightDataHl(Inspection inspection, List<TZHLAirportFlightDataResponse> flightDataHlList) { |
|
|
log.info("开始飞行数据保存入库"); |
|
|
|
|
|
|
|
|
log.info("飞行数据保存入库, inspectionId:{}", inspection.getId()); |
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
if (CollectionUtil.isNotEmpty(flightDataHlList) && flightDataHlList.size() != 0) { |
|
|
if (CollectionUtil.isNotEmpty(flightDataHlList) && flightDataHlList.size() != 0) { |
|
|
List<FlightDataHl> flightDataHls = new ArrayList<>(flightDataHlList.size()); |
|
|
List<FlightDataHl> flightDataHls = new ArrayList<>(flightDataHlList.size()); |
|
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
e.printStackTrace(); |
|
|
} |
|
|
} |
|
|
flightDataHl.setCreateUser(inspection.getCreateUser()); |
|
|
flightDataHl.setCreateUser(inspection.getCreateUser()); |
|
|
|
|
|
|
|
|
flightDataHls.add(flightDataHl); |
|
|
flightDataHls.add(flightDataHl); |
|
|
log.info("结束飞行数据保存入库, flightDataHls:{}", flightDataHls); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
CommonUtils.batchOperate((x) -> flightDataHlMapper.addBatch(x),flightDataHls,1000); |
|
|
CommonUtils.batchOperate((x) -> flightDataHlMapper.addBatch(x),flightDataHls,1000); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flightDataHls = flightDataHls.stream().sorted(Comparator.comparing(FlightDataHl::getCreateTime).reversed()).collect(Collectors.toList()); |
|
|
flightDataHls = flightDataHls.stream().sorted(Comparator.comparing(FlightDataHl::getCreateTime).reversed()).collect(Collectors.toList()); |
|
|
//倒序排列的第一个最新数据保存到缓存 |
|
|
//倒序排列的第一个最新数据保存到缓存 |
|
|
redisUtils.set(inspection.getId(), flightDataHls.get(0), 10); |
|
|
redisUtils.set(inspection.getId(), flightDataHls.get(0), 10); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
return; |
|
|
return; |