|
|
@@ -3,6 +3,7 @@ package com.tuoheng.admin.service.inspection.query; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.tuoheng.admin.entity.FlightData; |
|
|
|
import com.tuoheng.admin.entity.FlightDataHl; |
|
|
|
import com.tuoheng.admin.entity.Inspection; |
|
|
|
import com.tuoheng.admin.enums.InspectionStatusEnum; |
|
|
|
import com.tuoheng.admin.enums.code.inspection.QueryInspectionInfoByIdCodeEnum; |
|
|
@@ -57,44 +58,20 @@ public class QueryAirportMsgByIdService { |
|
|
|
} |
|
|
|
//获取遥测信号最新的一条数据 |
|
|
|
Object obj = redisUtils.get(inspectionId); |
|
|
|
FlightData flightData = null; |
|
|
|
FlightDataHl flightDataHl = null; |
|
|
|
if (ObjectUtil.isNull(obj)) { |
|
|
|
return JsonResult.success(); |
|
|
|
} else { |
|
|
|
flightData = (FlightData) obj; |
|
|
|
flightDataHl = (FlightDataHl) obj; |
|
|
|
} |
|
|
|
AirportMsgVo vo = new AirportMsgVo(); |
|
|
|
BeanUtils.copyProperties(flightData,vo); |
|
|
|
//高度 |
|
|
|
Double.parseDouble(flightData.getAlt()); |
|
|
|
double round = CommonNumberTypeUtils.round(Double.parseDouble(flightData.getAlt()), 2); |
|
|
|
vo.setAlt(round + "m"); |
|
|
|
//gps |
|
|
|
vo.setGpssingal(flightData.getGpssingal() + "%"); |
|
|
|
//电量 |
|
|
|
Double Umax = 26.1; |
|
|
|
Double Umin = 22.2; |
|
|
|
if(StringUtils.isNotEmpty(flightData.getVoltage())){ |
|
|
|
double temp = Double.parseDouble(flightData.getVoltage()); |
|
|
|
if(temp>=Umin){ |
|
|
|
//实时电压值大于现在电压最小值 |
|
|
|
double vol = (temp - Umin) / (Umax - Umin); |
|
|
|
String percent = CommonNumberTypeUtils.getPercentFormat(vol, Integer.MAX_VALUE, 2); |
|
|
|
vo.setVoltage(percent); |
|
|
|
}else { |
|
|
|
vo.setVoltage(0 + "%"); |
|
|
|
} |
|
|
|
} |
|
|
|
//速度 |
|
|
|
double hSpeed = CommonNumberTypeUtils.round(Double.parseDouble(flightData.getHspeed()), 2); |
|
|
|
vo.setHspeed(hSpeed+ "m/s"); |
|
|
|
//里程 |
|
|
|
double mileageTemp = Double.parseDouble(flightData.getMileage()) / 1000; |
|
|
|
double mileage = CommonNumberTypeUtils.round(mileageTemp, 2); |
|
|
|
vo.setMileage(mileage+ "km"); |
|
|
|
//机场距离 |
|
|
|
double distToHome = CommonNumberTypeUtils.round(Double.parseDouble(flightData.getDistToHome()), 2); |
|
|
|
vo.setDistToHome(distToHome + "m"); |
|
|
|
|
|
|
|
vo.setHt(flightDataHl.getHt()); |
|
|
|
vo.setDuration(flightDataHl.getDuration()); |
|
|
|
vo.setAbsp(flightDataHl.getAbsp()); |
|
|
|
vo.setRemainingFlightTime(flightDataHl.getRemainingFlightTime()); |
|
|
|
vo.setSatellite(flightDataHl.getSatellite()); |
|
|
|
vo.setGps(flightDataHl.getGps()); |
|
|
|
return JsonResult.success(vo); |
|
|
|
} |
|
|
|
} |