添加经纬度

This commit is contained in:
孙小云 2026-01-22 17:44:06 +08:00
parent 2ea81a491c
commit 9bee1836dd
3 changed files with 43 additions and 1 deletions

View File

@ -135,7 +135,29 @@ public class DeviceAttributes {
);
public static final AttributeKey<Double> Latitude = AttributeKey.of(
"latitude",
Double.class,
value -> {
if (value == null) return null;
if (value instanceof Number) {
return ((Number) value).doubleValue();
}
return Double.parseDouble(value.toString());
}
);
public static final AttributeKey<Double> Longitude = AttributeKey.of(
"longitude",
Double.class,
value -> {
if (value == null) return null;
if (value instanceof Number) {
return ((Number) value).doubleValue();
}
return Double.parseDouble(value.toString());
}
);
//
// // 空调状态 - Integer
@ -182,7 +204,9 @@ public class DeviceAttributes {
DOCK_SN,
SUB_DEVICE_SN,
MODE_CODE,
Firmware_Version
Firmware_Version,
Latitude,
Longitude
);
}

View File

@ -140,5 +140,14 @@ public class DockDetailDTO implements Serializable
/** Y轴夹状态 */
private String yAxisClampStatus;
/**
*纬度
*/
private String latitude;
/**
* 经度
*/
private String longitude;
}

View File

@ -307,6 +307,15 @@ public class BufferDeviceImpl implements IBufferDeviceService
telemetryMap.get(DeviceTelemetry.HUMIDITY)
.ifPresent(telemetryValue -> dto.setCabinHumidity(telemetryValue.getValue()));
// 赋予经纬度
// 纬度
attributeMap.get(DeviceAttributes.Latitude)
.ifPresent(latitude -> dto.setLatitude(latitude.toString()));
// 经度
attributeMap.get(DeviceAttributes.Longitude)
.ifPresent(longitude -> dto.setLongitude(longitude.toString()));
return dto;
}