wanjing pirms 1 gada
vecāks
revīzija
88d13348fd
2 mainītis faili ar 7 papildinājumiem un 2 dzēšanām
  1. +6
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/service/fly/data/FlyDataService.java
  2. +1
    -1
      tuoheng-service/tuoheng-admin/src/test/java/com/tuoheng/admin/tzhl/TZHLFlyLogServiceTest.java

+ 6
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/tzhl/service/fly/data/FlyDataService.java Parādīt failu

@@ -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())

+ 1
- 1
tuoheng-service/tuoheng-admin/src/test/java/com/tuoheng/admin/tzhl/TZHLFlyLogServiceTest.java Parādīt failu

@@ -25,7 +25,7 @@ public class TZHLFlyLogServiceTest {

@Test
public void testFlyLog() {
String id = "da5da2c67dc152de5e43c7e7a104bfcf";
String id = "d51d654e4b8aae6533cbdd997af100d9";
Inspection inspection = inspectionMapper.selectById(id);
flyLogService.getFlyLog(inspection);
}

Notiek ielāde…
Atcelt
Saglabāt