|
|
@@ -52,10 +52,10 @@ public class FlyDataService { |
|
|
|
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); |
|
|
|
|
|
|
|
log.info("获取飞行数据, flightDataHlList size:{}", flightDataHlList.size()); |
|
|
|
|
|
|
|
// 查询到的数据入库 |
|
|
|
this.addFlightDataHl(inspection, flightDataHlList); |
|
|
|
} |
|
|
@@ -68,7 +68,7 @@ public class FlyDataService { |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
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"); |
|
|
|
if (CollectionUtil.isNotEmpty(flightDataHlList) && flightDataHlList.size() != 0) { |
|
|
|
List<FlightDataHl> flightDataHls = new ArrayList<>(flightDataHlList.size()); |
|
|
@@ -83,10 +83,7 @@ public class FlyDataService { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
flightDataHl.setCreateUser(inspection.getCreateUser()); |
|
|
|
|
|
|
|
flightDataHls.add(flightDataHl); |
|
|
|
log.info("结束飞行数据保存入库, flightDataHls:{}", flightDataHls); |
|
|
|
|
|
|
|
} |
|
|
|
CommonUtils.batchOperate((x) -> flightDataHlMapper.addBatch(x),flightDataHls,1000); |
|
|
|
|
|
|
@@ -96,7 +93,6 @@ public class FlyDataService { |
|
|
|
flightDataHls = flightDataHls.stream().sorted(Comparator.comparing(FlightDataHl::getCreateTime).reversed()).collect(Collectors.toList()); |
|
|
|
//倒序排列的第一个最新数据保存到缓存 |
|
|
|
redisUtils.set(inspection.getId(), flightDataHls.get(0), 10); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return; |