架次和运行时长
This commit is contained in:
parent
18832acf17
commit
fca4eff00d
|
|
@ -195,6 +195,36 @@ public class TuohengDeviceAttributes {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机场运行数据属性(手动维护)
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 运行时长(小时) - Integer
|
||||||
|
public static final AttributeKey<Integer> RUNNING_DURATION = AttributeKey.of(
|
||||||
|
"runningDuration",
|
||||||
|
Integer.class,
|
||||||
|
value -> {
|
||||||
|
if (value == null) return null;
|
||||||
|
if (value instanceof Number) {
|
||||||
|
return ((Number) value).intValue();
|
||||||
|
}
|
||||||
|
return Integer.parseInt(value.toString());
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// 作业架次 - Integer
|
||||||
|
public static final AttributeKey<Integer> MISSION_COUNT = AttributeKey.of(
|
||||||
|
"missionCount",
|
||||||
|
Integer.class,
|
||||||
|
value -> {
|
||||||
|
if (value == null) return null;
|
||||||
|
if (value instanceof Number) {
|
||||||
|
return ((Number) value).intValue();
|
||||||
|
}
|
||||||
|
return Integer.parseInt(value.toString());
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
private TuohengDeviceAttributes() {
|
private TuohengDeviceAttributes() {
|
||||||
// 工具类,禁止实例化
|
// 工具类,禁止实例化
|
||||||
}
|
}
|
||||||
|
|
@ -221,7 +251,9 @@ public class TuohengDeviceAttributes {
|
||||||
HOME_LONGITUDE,
|
HOME_LONGITUDE,
|
||||||
HOME_LATITUDE,
|
HOME_LATITUDE,
|
||||||
BACKUP_LONGITUDE,
|
BACKUP_LONGITUDE,
|
||||||
BACKUP_LATITUDE
|
BACKUP_LATITUDE,
|
||||||
|
RUNNING_DURATION,
|
||||||
|
MISSION_COUNT
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -266,6 +266,18 @@ public class TuohengBufferDeviceImpl implements IBufferDeviceService {
|
||||||
dto.setBackupLatitude(DEFAULT_LATITUDE);
|
dto.setBackupLatitude(DEFAULT_LATITUDE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 设置运行数据(从属性中获取 runningDuration 和 missionCount,取不到则默认为 0)
|
||||||
|
log.info("---------- 解析运行数据 ----------");
|
||||||
|
Integer runningDuration = attributes.get(TuohengDeviceAttributes.RUNNING_DURATION)
|
||||||
|
.orElse(0);
|
||||||
|
log.info("RUNNING_DURATION 运行时长: {} 小时", runningDuration);
|
||||||
|
dto.setRunningDuration(runningDuration);
|
||||||
|
|
||||||
|
Integer missionCount = attributes.get(TuohengDeviceAttributes.MISSION_COUNT)
|
||||||
|
.orElse(0);
|
||||||
|
log.info("MISSION_COUNT 作业架次: {}", missionCount);
|
||||||
|
dto.setMissionCount(missionCount);
|
||||||
|
|
||||||
// 设置在线状态 - 基于心跳时间戳判断离线,基于无人机mode判断工作状态
|
// 设置在线状态 - 基于心跳时间戳判断离线,基于无人机mode判断工作状态
|
||||||
telemetry.get(TuohengDeviceTelemetry.STATUS).ifPresentOrElse(statusValue -> {
|
telemetry.get(TuohengDeviceTelemetry.STATUS).ifPresentOrElse(statusValue -> {
|
||||||
long lastHeartbeatTime = statusValue.getTimestamp();
|
long lastHeartbeatTime = statusValue.getTimestamp();
|
||||||
|
|
@ -476,10 +488,6 @@ public class TuohengBufferDeviceImpl implements IBufferDeviceService {
|
||||||
|
|
||||||
dto.setAircraftStatus(aircraftStatus);
|
dto.setAircraftStatus(aircraftStatus);
|
||||||
|
|
||||||
// 设置作业架次 - 暂时设置为0,拓恒设备可能没有这个数据
|
|
||||||
dto.setMissionCount(0);
|
|
||||||
log.info("设置作业架次: 0 (拓恒设备暂无此数据)");
|
|
||||||
|
|
||||||
log.info("拓恒无人机状态填充完成: aircraftIotDeviceId={}, aircraftStatus={}",
|
log.info("拓恒无人机状态填充完成: aircraftIotDeviceId={}, aircraftStatus={}",
|
||||||
aircraftIotDeviceId, dto.getAircraftStatus());
|
aircraftIotDeviceId, dto.getAircraftStatus());
|
||||||
log.info("========== 拓恒无人机状态填充结束 ==========");
|
log.info("========== 拓恒无人机状态填充结束 ==========");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue