修改获取逻辑
This commit is contained in:
parent
9fba4a59e6
commit
b242852434
|
|
@ -266,6 +266,53 @@ public class TuohengDeviceAttributes {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 飞行限制属性(手动维护)
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 最大飞行高度(米) - Integer
|
||||||
|
public static final AttributeKey<Integer> MAX_ALTITUDE = AttributeKey.of(
|
||||||
|
"maxAltitude",
|
||||||
|
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> MAX_DISTANCE = AttributeKey.of(
|
||||||
|
"maxDistance",
|
||||||
|
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> FLIGHT_DURATION = AttributeKey.of(
|
||||||
|
"flightDuration",
|
||||||
|
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() {
|
||||||
// 工具类,禁止实例化
|
// 工具类,禁止实例化
|
||||||
}
|
}
|
||||||
|
|
@ -297,7 +344,10 @@ public class TuohengDeviceAttributes {
|
||||||
MISSION_COUNT,
|
MISSION_COUNT,
|
||||||
AIR_CONDITIONER_STATUS,
|
AIR_CONDITIONER_STATUS,
|
||||||
ENVIRONMENT_TEMPERATURE,
|
ENVIRONMENT_TEMPERATURE,
|
||||||
ENVIRONMENT_HUMIDITY
|
ENVIRONMENT_HUMIDITY,
|
||||||
|
MAX_ALTITUDE,
|
||||||
|
MAX_DISTANCE,
|
||||||
|
FLIGHT_DURATION
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -114,8 +114,8 @@ public class DockDetailDTO implements Serializable
|
||||||
/** 舱门状态 */
|
/** 舱门状态 */
|
||||||
private String cabinDoorStatus;
|
private String cabinDoorStatus;
|
||||||
|
|
||||||
// /** 机场运行状态 */
|
/** 机场运行状态 */
|
||||||
// private String dockRunStatus;
|
private String dockRunStatus;
|
||||||
|
|
||||||
/** 舱内摄像头 */
|
/** 舱内摄像头 */
|
||||||
private String internalCamera;
|
private String internalCamera;
|
||||||
|
|
|
||||||
|
|
@ -607,9 +607,12 @@ public class TuohengBufferDeviceImpl implements IBufferDeviceService {
|
||||||
|
|
||||||
dto.setAircraftStatus(aircraftStatus);
|
dto.setAircraftStatus(aircraftStatus);
|
||||||
|
|
||||||
// 设置作业架次 - 暂时设置为0
|
// 设置作业架次(从属性中获取,取不到则默认为 0)
|
||||||
dto.setMissionCount(0);
|
log.info("---------- 解析作业架次 ----------");
|
||||||
log.info("设置作业架次: 0");
|
Integer missionCount = attributes.get(TuohengDeviceAttributes.MISSION_COUNT)
|
||||||
|
.orElse(0);
|
||||||
|
log.info("MISSION_COUNT 作业架次: {}", missionCount);
|
||||||
|
dto.setMissionCount(missionCount);
|
||||||
|
|
||||||
// 设置GPS信号
|
// 设置GPS信号
|
||||||
log.info("---------- 解析GPS数据 ----------");
|
log.info("---------- 解析GPS数据 ----------");
|
||||||
|
|
@ -661,13 +664,37 @@ public class TuohengBufferDeviceImpl implements IBufferDeviceService {
|
||||||
dto.setCycleCount(value.getValue());
|
dto.setCycleCount(value.getValue());
|
||||||
});
|
});
|
||||||
|
|
||||||
// 设置飞行时长(秒)
|
// 设置飞行时长(从属性中获取,取不到则默认为 null)
|
||||||
log.info("---------- 解析飞行数据 ----------");
|
log.info("---------- 解析飞行数据 ----------");
|
||||||
telemetry.get(TuohengDeviceTelemetry.FLIGHT_TIME)
|
Integer flightDuration = attributes.get(TuohengDeviceAttributes.FLIGHT_DURATION)
|
||||||
.ifPresent(value -> {
|
.orElse(null);
|
||||||
log.info("FLIGHT_TIME 飞行时长(秒): {}", value.getValue());
|
if (flightDuration != null) {
|
||||||
dto.setFlightDuration(value.getValue());
|
log.info("FLIGHT_DURATION 飞行时长: {} 秒", flightDuration);
|
||||||
});
|
dto.setFlightDuration(flightDuration);
|
||||||
|
} else {
|
||||||
|
log.info("FLIGHT_DURATION 未设置");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置最大飞行高度(从属性中获取,取不到则默认为 null)
|
||||||
|
log.info("---------- 解析飞行限制 ----------");
|
||||||
|
Integer maxAltitude = attributes.get(TuohengDeviceAttributes.MAX_ALTITUDE)
|
||||||
|
.orElse(null);
|
||||||
|
if (maxAltitude != null) {
|
||||||
|
log.info("MAX_ALTITUDE 最大飞行高度: {} 米", maxAltitude);
|
||||||
|
dto.setMaxAltitude(maxAltitude);
|
||||||
|
} else {
|
||||||
|
log.info("MAX_ALTITUDE 未设置");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置最大飞行距离(从属性中获取,取不到则默认为 null)
|
||||||
|
Integer maxDistance = attributes.get(TuohengDeviceAttributes.MAX_DISTANCE)
|
||||||
|
.orElse(null);
|
||||||
|
if (maxDistance != null) {
|
||||||
|
log.info("MAX_DISTANCE 最大飞行距离: {} 米", maxDistance);
|
||||||
|
dto.setMaxDistance(maxDistance);
|
||||||
|
} else {
|
||||||
|
log.info("MAX_DISTANCE 未设置");
|
||||||
|
}
|
||||||
|
|
||||||
log.info("拓恒无人机详情填充完成: iotDeviceId={}, aircraftStatus={}", iotDeviceId, dto.getAircraftStatus());
|
log.info("拓恒无人机详情填充完成: iotDeviceId={}, aircraftStatus={}", iotDeviceId, dto.getAircraftStatus());
|
||||||
log.info("========== 拓恒无人机详情填充结束 ==========");
|
log.info("========== 拓恒无人机详情填充结束 ==========");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue