Compare commits
No commits in common. "aa328169e36dbd438c7627b288cda1944a9cf8e5" and "85f39feac18aa4903114f847cb3c8165a567abb2" have entirely different histories.
aa328169e3
...
85f39feac1
|
|
@ -1,37 +0,0 @@
|
||||||
package com.ruoyi.device.controller;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.R;
|
|
||||||
import com.ruoyi.common.core.web.controller.BaseController;
|
|
||||||
import com.ruoyi.common.security.annotation.InnerAuth;
|
|
||||||
import com.ruoyi.device.api.domain.AircraftDetailVO;
|
|
||||||
import com.ruoyi.device.service.api.IAircraftService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 无人机Controller
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
* @date 2026-01-20
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/aircraft")
|
|
||||||
public class AircraftController extends BaseController
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private IAircraftService aircraftService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查看无人机详情
|
|
||||||
*
|
|
||||||
* @param aircraftId 无人机ID
|
|
||||||
* @return 无人机详情
|
|
||||||
*/
|
|
||||||
@InnerAuth
|
|
||||||
@GetMapping("/detail/{aircraftId}")
|
|
||||||
public R<AircraftDetailVO> getAircraftDetail(@PathVariable("aircraftId") Long aircraftId)
|
|
||||||
{
|
|
||||||
AircraftDetailVO aircraftDetail = aircraftService.getAircraftDetail(aircraftId);
|
|
||||||
return R.ok(aircraftDetail);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,55 +0,0 @@
|
||||||
package com.ruoyi.device.controller;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.R;
|
|
||||||
import com.ruoyi.common.core.web.controller.BaseController;
|
|
||||||
import com.ruoyi.common.security.annotation.InnerAuth;
|
|
||||||
import com.ruoyi.device.api.domain.DockDetailVO;
|
|
||||||
import com.ruoyi.device.api.domain.DockVO;
|
|
||||||
import com.ruoyi.device.service.api.IDockService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 机场Controller
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
* @date 2026-01-20
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/dock")
|
|
||||||
public class DockController extends BaseController
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private IDockService dockService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 搜索机场
|
|
||||||
*
|
|
||||||
* @param dockStatus 机场状态
|
|
||||||
* @param dockId 机场ID
|
|
||||||
* @return 机场列表
|
|
||||||
*/
|
|
||||||
@InnerAuth
|
|
||||||
@GetMapping("/search")
|
|
||||||
public R<List<DockVO>> searchDocks(@RequestParam(required = false) String dockStatus, @RequestParam(required = false) Long dockId)
|
|
||||||
{
|
|
||||||
List<DockVO> dockList = dockService.searchDocks(dockStatus, dockId);
|
|
||||||
return R.ok(dockList);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查看机场详情
|
|
||||||
*
|
|
||||||
* @param dockId 机场ID
|
|
||||||
* @return 机场详情
|
|
||||||
*/
|
|
||||||
@InnerAuth
|
|
||||||
@GetMapping("/detail/{dockId}")
|
|
||||||
public R<DockDetailVO> getDockDetail(@PathVariable("dockId") Long dockId)
|
|
||||||
{
|
|
||||||
DockDetailVO dockDetail = dockService.getDockDetail(dockId);
|
|
||||||
return R.ok(dockDetail);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,99 +0,0 @@
|
||||||
package com.ruoyi.device.controller;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.R;
|
|
||||||
import com.ruoyi.common.core.web.controller.BaseController;
|
|
||||||
import com.ruoyi.common.security.annotation.InnerAuth;
|
|
||||||
import com.ruoyi.device.api.domain.DockVO;
|
|
||||||
import com.ruoyi.device.api.domain.GroupVO;
|
|
||||||
import com.ruoyi.device.service.api.IGroupService;
|
|
||||||
import com.ruoyi.device.service.dto.GroupDTO;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分组Controller
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
* @date 2026-01-20
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/group")
|
|
||||||
public class GroupController extends BaseController
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private IGroupService groupService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建分组
|
|
||||||
*
|
|
||||||
* @param groupVO 分组信息
|
|
||||||
* @return 分组ID
|
|
||||||
*/
|
|
||||||
@InnerAuth
|
|
||||||
@PostMapping("/create")
|
|
||||||
public R<Long> createGroup(@RequestBody GroupVO groupVO)
|
|
||||||
{
|
|
||||||
GroupDTO dto = new GroupDTO();
|
|
||||||
dto.setGroupName(groupVO.getGroupName());
|
|
||||||
Long groupId = groupService.createGroup(dto);
|
|
||||||
return R.ok(groupId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除分组
|
|
||||||
*
|
|
||||||
* @param groupId 分组ID
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@InnerAuth
|
|
||||||
@DeleteMapping("/delete/{groupId}")
|
|
||||||
public R<Void> deleteGroup(@PathVariable("groupId") Long groupId)
|
|
||||||
{
|
|
||||||
groupService.deleteGroup(groupId);
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 切换机场所在的分组
|
|
||||||
*
|
|
||||||
* @param dockId 机场ID
|
|
||||||
* @param groupId 分组ID
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@InnerAuth
|
|
||||||
@PutMapping("/switch/{dockId}/{groupId}")
|
|
||||||
public R<Void> switchDockGroup(@PathVariable("dockId") Long dockId, @PathVariable("groupId") Long groupId)
|
|
||||||
{
|
|
||||||
groupService.switchDockGroup(dockId, groupId);
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查看分组下的机场
|
|
||||||
*
|
|
||||||
* @param groupId 分组ID
|
|
||||||
* @return 机场列表
|
|
||||||
*/
|
|
||||||
@InnerAuth
|
|
||||||
@GetMapping("/docks/{groupId}")
|
|
||||||
public R<List<DockVO>> getDocksByGroupId(@PathVariable("groupId") Long groupId)
|
|
||||||
{
|
|
||||||
List<DockVO> dockList = groupService.getDocksByGroupId(groupId);
|
|
||||||
return R.ok(dockList);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查看所有分组
|
|
||||||
*
|
|
||||||
* @return 分组ID列表
|
|
||||||
*/
|
|
||||||
@InnerAuth
|
|
||||||
@GetMapping("/list")
|
|
||||||
public R<List<Long>> getAllGroupIds()
|
|
||||||
{
|
|
||||||
List<Long> groupIds = groupService.getAllGroupIds();
|
|
||||||
return R.ok(groupIds);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
package com.ruoyi.device.controller.convert;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 无人机Controller转换器
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
* @date 2026-01-20
|
|
||||||
*/
|
|
||||||
public class AircraftControllerConvert
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
package com.ruoyi.device.controller.convert;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 机场Controller转换器
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
* @date 2026-01-20
|
|
||||||
*/
|
|
||||||
public class DockControllerConvert
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
package com.ruoyi.device.controller.convert;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分组Controller转换器
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
* @date 2026-01-20
|
|
||||||
*/
|
|
||||||
public class GroupControllerConvert
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
@ -100,34 +100,18 @@ public class AttributeKey<T> {
|
||||||
if (v instanceof Boolean) return (Boolean) v;
|
if (v instanceof Boolean) return (Boolean) v;
|
||||||
return Boolean.parseBoolean(v.toString());
|
return Boolean.parseBoolean(v.toString());
|
||||||
});
|
});
|
||||||
} else if (value instanceof Integer) {
|
} else if (value instanceof Long || value instanceof Integer) {
|
||||||
// Integer 类型优先处理
|
|
||||||
return (AttributeKey<T>) new AttributeKey<>(name, Integer.class, v -> {
|
|
||||||
if (v == null) return null;
|
|
||||||
if (v instanceof Number) return ((Number) v).intValue();
|
|
||||||
return Integer.parseInt(v.toString());
|
|
||||||
});
|
|
||||||
} else if (value instanceof Long) {
|
|
||||||
// Long 类型
|
|
||||||
return (AttributeKey<T>) new AttributeKey<>(name, Long.class, v -> {
|
return (AttributeKey<T>) new AttributeKey<>(name, Long.class, v -> {
|
||||||
if (v == null) return null;
|
if (v == null) return null;
|
||||||
if (v instanceof Number) return ((Number) v).longValue();
|
if (v instanceof Number) return ((Number) v).longValue();
|
||||||
return Long.parseLong(v.toString());
|
return Long.parseLong(v.toString());
|
||||||
});
|
});
|
||||||
} else if (value instanceof Double) {
|
} else if (value instanceof Double || value instanceof Float) {
|
||||||
// Double 类型优先处理
|
|
||||||
return (AttributeKey<T>) new AttributeKey<>(name, Double.class, v -> {
|
return (AttributeKey<T>) new AttributeKey<>(name, Double.class, v -> {
|
||||||
if (v == null) return null;
|
if (v == null) return null;
|
||||||
if (v instanceof Number) return ((Number) v).doubleValue();
|
if (v instanceof Number) return ((Number) v).doubleValue();
|
||||||
return Double.parseDouble(v.toString());
|
return Double.parseDouble(v.toString());
|
||||||
});
|
});
|
||||||
} else if (value instanceof Float) {
|
|
||||||
// Float 类型
|
|
||||||
return (AttributeKey<T>) new AttributeKey<>(name, Float.class, v -> {
|
|
||||||
if (v == null) return null;
|
|
||||||
if (v instanceof Number) return ((Number) v).floatValue();
|
|
||||||
return Float.parseFloat(v.toString());
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
// 默认为 String 类型
|
// 默认为 String 类型
|
||||||
return (AttributeKey<T>) new AttributeKey<>(name, String.class, v -> v != null ? v.toString() : null);
|
return (AttributeKey<T>) new AttributeKey<>(name, String.class, v -> v != null ? v.toString() : null);
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ package com.ruoyi.device.domain.model.thingsboard;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.ruoyi.device.domain.model.thingsboard.attributes.psdk.PsdkDevice;
|
import com.ruoyi.device.domain.model.thingsboard.attributes.psdk.PsdkDevice;
|
||||||
import com.ruoyi.device.domain.model.thingsboard.attributes.battery.BatteryData;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -104,11 +103,6 @@ public class TelemetryKey<T> {
|
||||||
return (TelemetryKey<T>) createPsdkWidgetValuesKeyWithoutRegistering();
|
return (TelemetryKey<T>) createPsdkWidgetValuesKeyWithoutRegistering();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 特殊处理:battery 字段
|
|
||||||
if ("battery".equals(name)) {
|
|
||||||
return (TelemetryKey<T>) createBatteryKeyWithoutRegistering();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 根据值的实际类型推断
|
// 根据值的实际类型推断
|
||||||
if (value instanceof Boolean) {
|
if (value instanceof Boolean) {
|
||||||
return (TelemetryKey<T>) new TelemetryKey<>(name, Boolean.class, v -> {
|
return (TelemetryKey<T>) new TelemetryKey<>(name, Boolean.class, v -> {
|
||||||
|
|
@ -116,34 +110,18 @@ public class TelemetryKey<T> {
|
||||||
if (v instanceof Boolean) return (Boolean) v;
|
if (v instanceof Boolean) return (Boolean) v;
|
||||||
return Boolean.parseBoolean(v.toString());
|
return Boolean.parseBoolean(v.toString());
|
||||||
});
|
});
|
||||||
} else if (value instanceof Integer) {
|
} else if (value instanceof Long || value instanceof Integer) {
|
||||||
// Integer 类型优先处理
|
|
||||||
return (TelemetryKey<T>) new TelemetryKey<>(name, Integer.class, v -> {
|
|
||||||
if (v == null) return null;
|
|
||||||
if (v instanceof Number) return ((Number) v).intValue();
|
|
||||||
return Integer.parseInt(v.toString());
|
|
||||||
});
|
|
||||||
} else if (value instanceof Long) {
|
|
||||||
// Long 类型
|
|
||||||
return (TelemetryKey<T>) new TelemetryKey<>(name, Long.class, v -> {
|
return (TelemetryKey<T>) new TelemetryKey<>(name, Long.class, v -> {
|
||||||
if (v == null) return null;
|
if (v == null) return null;
|
||||||
if (v instanceof Number) return ((Number) v).longValue();
|
if (v instanceof Number) return ((Number) v).longValue();
|
||||||
return Long.parseLong(v.toString());
|
return Long.parseLong(v.toString());
|
||||||
});
|
});
|
||||||
} else if (value instanceof Double) {
|
} else if (value instanceof Double || value instanceof Float) {
|
||||||
// Double 类型优先处理
|
|
||||||
return (TelemetryKey<T>) new TelemetryKey<>(name, Double.class, v -> {
|
return (TelemetryKey<T>) new TelemetryKey<>(name, Double.class, v -> {
|
||||||
if (v == null) return null;
|
if (v == null) return null;
|
||||||
if (v instanceof Number) return ((Number) v).doubleValue();
|
if (v instanceof Number) return ((Number) v).doubleValue();
|
||||||
return Double.parseDouble(v.toString());
|
return Double.parseDouble(v.toString());
|
||||||
});
|
});
|
||||||
} else if (value instanceof Float) {
|
|
||||||
// Float 类型
|
|
||||||
return (TelemetryKey<T>) new TelemetryKey<>(name, Float.class, v -> {
|
|
||||||
if (v == null) return null;
|
|
||||||
if (v instanceof Number) return ((Number) v).floatValue();
|
|
||||||
return Float.parseFloat(v.toString());
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
// 默认为 String 类型
|
// 默认为 String 类型
|
||||||
return (TelemetryKey<T>) new TelemetryKey<>(name, String.class, v -> v != null ? v.toString() : null);
|
return (TelemetryKey<T>) new TelemetryKey<>(name, String.class, v -> v != null ? v.toString() : null);
|
||||||
|
|
@ -205,55 +183,6 @@ public class TelemetryKey<T> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建 battery 的遥测键(不注册到 REGISTRY)
|
|
||||||
* 用于解析 Python 风格的字典字符串为 BatteryData
|
|
||||||
* 注意:不能调用 of() 方法,避免递归更新
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private static TelemetryKey<BatteryData> createBatteryKeyWithoutRegistering() {
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
|
||||||
// 配置 ObjectMapper 忽略未知字段
|
|
||||||
objectMapper.configure(com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
|
||||||
|
|
||||||
return new TelemetryKey<>(
|
|
||||||
"battery",
|
|
||||||
BatteryData.class,
|
|
||||||
value -> {
|
|
||||||
if (value == null) return null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
// 如果已经是 BatteryData 类型,直接返回
|
|
||||||
if (value instanceof BatteryData) {
|
|
||||||
return (BatteryData) value;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果是字符串,需要处理 Python 风格的字典格式
|
|
||||||
if (value instanceof String) {
|
|
||||||
String jsonStr = (String) value;
|
|
||||||
|
|
||||||
// 将 Python 风格的字典转换为标准 JSON 格式
|
|
||||||
// 1. 将单引号替换为双引号
|
|
||||||
jsonStr = jsonStr.replace("'", "\"");
|
|
||||||
|
|
||||||
// 2. 处理 True/False/None (如果有的话)
|
|
||||||
jsonStr = jsonStr.replace(": True", ": true")
|
|
||||||
.replace(": False", ": false")
|
|
||||||
.replace(": None", ": null");
|
|
||||||
|
|
||||||
return objectMapper.readValue(jsonStr, BatteryData.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果是其他对象(如 JsonNode),转换为 JSON 再解析
|
|
||||||
String json = objectMapper.writeValueAsString(value);
|
|
||||||
return objectMapper.readValue(json, BatteryData.class);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException("Failed to parse battery: " + e.getMessage(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 值解析器接口
|
* 值解析器接口
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,83 +0,0 @@
|
||||||
package com.ruoyi.device.domain.model.thingsboard.attributes.battery;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 电池数据
|
|
||||||
* 包含电池列表和相关状态信息
|
|
||||||
*/
|
|
||||||
public class BatteryData {
|
|
||||||
|
|
||||||
@JsonProperty("batteries")
|
|
||||||
private List<BatteryInfo> batteries;
|
|
||||||
|
|
||||||
@JsonProperty("capacity_percent")
|
|
||||||
private Integer capacityPercent;
|
|
||||||
|
|
||||||
@JsonProperty("landing_power")
|
|
||||||
private Integer landingPower;
|
|
||||||
|
|
||||||
@JsonProperty("remain_flight_time")
|
|
||||||
private Integer remainFlightTime;
|
|
||||||
|
|
||||||
@JsonProperty("return_home_power")
|
|
||||||
private Integer returnHomePower;
|
|
||||||
|
|
||||||
// 构造方法
|
|
||||||
public BatteryData() {
|
|
||||||
}
|
|
||||||
|
|
||||||
// Getter和Setter方法
|
|
||||||
public List<BatteryInfo> getBatteries() {
|
|
||||||
return batteries;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBatteries(List<BatteryInfo> batteries) {
|
|
||||||
this.batteries = batteries;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getCapacityPercent() {
|
|
||||||
return capacityPercent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCapacityPercent(Integer capacityPercent) {
|
|
||||||
this.capacityPercent = capacityPercent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getLandingPower() {
|
|
||||||
return landingPower;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLandingPower(Integer landingPower) {
|
|
||||||
this.landingPower = landingPower;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getRemainFlightTime() {
|
|
||||||
return remainFlightTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRemainFlightTime(Integer remainFlightTime) {
|
|
||||||
this.remainFlightTime = remainFlightTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getReturnHomePower() {
|
|
||||||
return returnHomePower;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setReturnHomePower(Integer returnHomePower) {
|
|
||||||
this.returnHomePower = returnHomePower;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "BatteryData{" +
|
|
||||||
"batteries=" + batteries +
|
|
||||||
", capacityPercent=" + capacityPercent +
|
|
||||||
", landingPower=" + landingPower +
|
|
||||||
", remainFlightTime=" + remainFlightTime +
|
|
||||||
", returnHomePower=" + returnHomePower +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,140 +0,0 @@
|
||||||
package com.ruoyi.device.domain.model.thingsboard.attributes.battery;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 单个电池信息
|
|
||||||
*/
|
|
||||||
public class BatteryInfo {
|
|
||||||
|
|
||||||
@JsonProperty("capacity_percent")
|
|
||||||
private Integer capacityPercent;
|
|
||||||
|
|
||||||
@JsonProperty("firmware_version")
|
|
||||||
private String firmwareVersion;
|
|
||||||
|
|
||||||
@JsonProperty("high_voltage_storage_days")
|
|
||||||
private Integer highVoltageStorageDays;
|
|
||||||
|
|
||||||
@JsonProperty("index")
|
|
||||||
private Integer index;
|
|
||||||
|
|
||||||
@JsonProperty("loop_times")
|
|
||||||
private Integer loopTimes;
|
|
||||||
|
|
||||||
@JsonProperty("sn")
|
|
||||||
private String sn;
|
|
||||||
|
|
||||||
@JsonProperty("sub_type")
|
|
||||||
private Integer subType;
|
|
||||||
|
|
||||||
@JsonProperty("temperature")
|
|
||||||
private Double temperature;
|
|
||||||
|
|
||||||
@JsonProperty("type")
|
|
||||||
private Integer type;
|
|
||||||
|
|
||||||
@JsonProperty("voltage")
|
|
||||||
private Integer voltage;
|
|
||||||
|
|
||||||
// 构造方法
|
|
||||||
public BatteryInfo() {
|
|
||||||
}
|
|
||||||
|
|
||||||
// Getter和Setter方法
|
|
||||||
public Integer getCapacityPercent() {
|
|
||||||
return capacityPercent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCapacityPercent(Integer capacityPercent) {
|
|
||||||
this.capacityPercent = capacityPercent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFirmwareVersion() {
|
|
||||||
return firmwareVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFirmwareVersion(String firmwareVersion) {
|
|
||||||
this.firmwareVersion = firmwareVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getHighVoltageStorageDays() {
|
|
||||||
return highVoltageStorageDays;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHighVoltageStorageDays(Integer highVoltageStorageDays) {
|
|
||||||
this.highVoltageStorageDays = highVoltageStorageDays;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getIndex() {
|
|
||||||
return index;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIndex(Integer index) {
|
|
||||||
this.index = index;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getLoopTimes() {
|
|
||||||
return loopTimes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLoopTimes(Integer loopTimes) {
|
|
||||||
this.loopTimes = loopTimes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSn() {
|
|
||||||
return sn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSn(String sn) {
|
|
||||||
this.sn = sn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getSubType() {
|
|
||||||
return subType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubType(Integer subType) {
|
|
||||||
this.subType = subType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getTemperature() {
|
|
||||||
return temperature;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTemperature(Double temperature) {
|
|
||||||
this.temperature = temperature;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType(Integer type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getVoltage() {
|
|
||||||
return voltage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVoltage(Integer voltage) {
|
|
||||||
this.voltage = voltage;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "BatteryInfo{" +
|
|
||||||
"capacityPercent=" + capacityPercent +
|
|
||||||
", firmwareVersion='" + firmwareVersion + '\'' +
|
|
||||||
", highVoltageStorageDays=" + highVoltageStorageDays +
|
|
||||||
", index=" + index +
|
|
||||||
", loopTimes=" + loopTimes +
|
|
||||||
", sn='" + sn + '\'' +
|
|
||||||
", subType=" + subType +
|
|
||||||
", temperature=" + temperature +
|
|
||||||
", type=" + type +
|
|
||||||
", voltage=" + voltage +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package com.ruoyi.device.domain.model.thingsboard.constants;
|
package com.ruoyi.device.domain.model.thingsboard.constants;
|
||||||
|
|
||||||
import com.ruoyi.device.domain.model.thingsboard.AttributeKey;
|
import com.ruoyi.device.domain.model.thingsboard.AttributeKey;
|
||||||
import com.ruoyi.device.domain.model.thingsboard.TelemetryKey;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -12,9 +11,26 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public class DeviceAttributes {
|
public class DeviceAttributes {
|
||||||
|
|
||||||
/**
|
// 连接器类型 - String
|
||||||
* 公用服务端属性
|
public static final AttributeKey<String> CONNECTOR_TYPE = AttributeKey.of(
|
||||||
*/
|
"connectorType",
|
||||||
|
String.class,
|
||||||
|
value -> value != null ? value.toString() : null
|
||||||
|
);
|
||||||
|
|
||||||
|
// 连接器名称 - String
|
||||||
|
public static final AttributeKey<String> CONNECTOR_NAME = AttributeKey.of(
|
||||||
|
"connectorName",
|
||||||
|
String.class,
|
||||||
|
value -> value != null ? value.toString() : null
|
||||||
|
);
|
||||||
|
|
||||||
|
// 网关 - String
|
||||||
|
public static final AttributeKey<String> GATEWAY = AttributeKey.of(
|
||||||
|
"gateway",
|
||||||
|
String.class,
|
||||||
|
value -> value != null ? value.toString() : null
|
||||||
|
);
|
||||||
|
|
||||||
// 最后连接时间 - Long
|
// 最后连接时间 - Long
|
||||||
public static final AttributeKey<Long> LAST_CONNECT_TIME = AttributeKey.of(
|
public static final AttributeKey<Long> LAST_CONNECT_TIME = AttributeKey.of(
|
||||||
|
|
@ -68,27 +84,6 @@ public class DeviceAttributes {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
* 公用客户端属性 (无需配置)
|
|
||||||
*/
|
|
||||||
// 连接器类型 - String
|
|
||||||
public static final AttributeKey<String> CONNECTOR_TYPE = AttributeKey.of(
|
|
||||||
"connectorType",
|
|
||||||
String.class,
|
|
||||||
value -> value != null ? value.toString() : null
|
|
||||||
);
|
|
||||||
|
|
||||||
// 连接器名称 - String
|
|
||||||
public static final AttributeKey<String> CONNECTOR_NAME = AttributeKey.of(
|
|
||||||
"connectorName",
|
|
||||||
String.class,
|
|
||||||
value -> value != null ? value.toString() : null
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 公用客户端属性 (需要配置)
|
|
||||||
*/
|
|
||||||
|
|
||||||
// 机场SN号 - String
|
// 机场SN号 - String
|
||||||
public static final AttributeKey<String> DOCK_SN = AttributeKey.of(
|
public static final AttributeKey<String> DOCK_SN = AttributeKey.of(
|
||||||
"dock_sn",
|
"dock_sn",
|
||||||
|
|
@ -96,71 +91,13 @@ public class DeviceAttributes {
|
||||||
value -> value != null ? value.toString() : null
|
value -> value != null ? value.toString() : null
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
// 子设备SN号 - String
|
||||||
* 固件版本 (需要配置)
|
|
||||||
*/
|
|
||||||
public static final AttributeKey<String> Firmware_Version = AttributeKey.of(
|
|
||||||
"firmware_version",
|
|
||||||
String.class,
|
|
||||||
value -> value != null ? value.toString() : null
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 机场 {"0":"空闲中","1":"现场调试","2":"远程调试","3":"固件升级中","4":"作业中","5":"待标定"}
|
|
||||||
* 无人机 {"0":"待机","1":"起飞准备","2":"起飞准备完毕","3":"手动飞行","4":"自动起飞","5":"航线飞行","6":"全景拍照","7":"智能跟随","8":"ADS-B 躲避","9":"自动返航","10":"自动降落","11":"强制降落","12":"三桨叶降落","13":"升级中","14":"未连接","15":"APAS","16":"虚拟摇杆状态","17":"指令飞行","18":"空中 RTK 收敛模式","19":"机场选址中","20":"POI环绕"}
|
|
||||||
*/
|
|
||||||
public static final AttributeKey<Integer> MODE_CODE = AttributeKey.of(
|
|
||||||
"mode_code",
|
|
||||||
Integer.class,
|
|
||||||
value -> {
|
|
||||||
if (value == null) return null;
|
|
||||||
if (value instanceof Number) {
|
|
||||||
return ((Number) value).intValue();
|
|
||||||
}
|
|
||||||
return Integer.parseInt(value.toString());
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 机场特有属性
|
|
||||||
*/
|
|
||||||
// 无人机SN号 - String
|
|
||||||
public static final AttributeKey<String> SUB_DEVICE_SN = AttributeKey.of(
|
public static final AttributeKey<String> SUB_DEVICE_SN = AttributeKey.of(
|
||||||
"sub_device.device_sn",
|
"sub_device.device_sn",
|
||||||
String.class,
|
String.class,
|
||||||
value -> value != null ? value.toString() : null
|
value -> value != null ? value.toString() : null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// // 空调状态 - Integer
|
|
||||||
// public static final TelemetryKey<Integer> AIR_CONDITIONER_STATE = TelemetryKey.of(
|
|
||||||
// "air_conditioner.air_conditioner_state",
|
|
||||||
// Integer.class,
|
|
||||||
// value -> {
|
|
||||||
// if (value == null) return null;
|
|
||||||
// if (value instanceof Number) {
|
|
||||||
// return ((Number) value).intValue();
|
|
||||||
// }
|
|
||||||
// return Integer.parseInt(value.toString());
|
|
||||||
// }
|
|
||||||
// );
|
|
||||||
|
|
||||||
//
|
|
||||||
// // 网关 - String
|
|
||||||
// public static final AttributeKey<String> GATEWAY = AttributeKey.of(
|
|
||||||
// "gateway",
|
|
||||||
// String.class,
|
|
||||||
// value -> value != null ? value.toString() : null
|
|
||||||
// );
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private DeviceAttributes() {
|
private DeviceAttributes() {
|
||||||
// 工具类,禁止实例化
|
// 工具类,禁止实例化
|
||||||
}
|
}
|
||||||
|
|
@ -174,15 +111,13 @@ public class DeviceAttributes {
|
||||||
return Arrays.asList(
|
return Arrays.asList(
|
||||||
CONNECTOR_TYPE,
|
CONNECTOR_TYPE,
|
||||||
CONNECTOR_NAME,
|
CONNECTOR_NAME,
|
||||||
// GATEWAY,
|
GATEWAY,
|
||||||
LAST_CONNECT_TIME,
|
LAST_CONNECT_TIME,
|
||||||
ACTIVE,
|
ACTIVE,
|
||||||
LAST_ACTIVITY_TIME,
|
LAST_ACTIVITY_TIME,
|
||||||
LAST_DISCONNECT_TIME,
|
LAST_DISCONNECT_TIME,
|
||||||
DOCK_SN,
|
DOCK_SN,
|
||||||
SUB_DEVICE_SN,
|
SUB_DEVICE_SN
|
||||||
MODE_CODE,
|
|
||||||
Firmware_Version
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,8 @@ package com.ruoyi.device.domain.model.thingsboard.constants;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.ruoyi.device.domain.model.thingsboard.AttributeKey;
|
|
||||||
import com.ruoyi.device.domain.model.thingsboard.TelemetryKey;
|
import com.ruoyi.device.domain.model.thingsboard.TelemetryKey;
|
||||||
import com.ruoyi.device.domain.model.thingsboard.attributes.psdk.PsdkDevice;
|
import com.ruoyi.device.domain.model.thingsboard.attributes.psdk.PsdkDevice;
|
||||||
import com.ruoyi.device.domain.model.thingsboard.attributes.battery.BatteryData;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
@ -21,17 +19,9 @@ public class DeviceTelemetry {
|
||||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||||
|
|
||||||
|
|
||||||
/**
|
// 空调状态 - Integer
|
||||||
* 机场独有状态
|
public static final TelemetryKey<Integer> AIR_CONDITIONER_STATE = TelemetryKey.of(
|
||||||
*/
|
"air_conditioner.air_conditioner_state",
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 网络类型 {"1":"4G","2":"以太网"}
|
|
||||||
*/
|
|
||||||
|
|
||||||
public static final TelemetryKey<Integer> Network_State_Type = TelemetryKey.of(
|
|
||||||
"network_state.type",
|
|
||||||
Integer.class,
|
Integer.class,
|
||||||
value -> {
|
value -> {
|
||||||
if (value == null) return null;
|
if (value == null) return null;
|
||||||
|
|
@ -42,26 +32,6 @@ public class DeviceTelemetry {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
* 运行时长 {"unit_name":"秒 / s"}
|
|
||||||
*/
|
|
||||||
public static final TelemetryKey<Integer> Acc_Time = TelemetryKey.of(
|
|
||||||
"acc_time",
|
|
||||||
Integer.class,
|
|
||||||
value -> {
|
|
||||||
if (value == null) return null;
|
|
||||||
if (value instanceof Number) {
|
|
||||||
return ((Number) value).intValue();
|
|
||||||
}
|
|
||||||
return Integer.parseInt(value.toString());
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 舱内温度 temperature
|
|
||||||
*/
|
|
||||||
// 温度 - Double
|
// 温度 - Double
|
||||||
public static final TelemetryKey<Double> TEMPERATURE = TelemetryKey.of(
|
public static final TelemetryKey<Double> TEMPERATURE = TelemetryKey.of(
|
||||||
"temperature",
|
"temperature",
|
||||||
|
|
@ -75,10 +45,7 @@ public class DeviceTelemetry {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// 湿度 - Double
|
||||||
/**
|
|
||||||
* 舱内湿度 humidity
|
|
||||||
*/
|
|
||||||
public static final TelemetryKey<Double> HUMIDITY = TelemetryKey.of(
|
public static final TelemetryKey<Double> HUMIDITY = TelemetryKey.of(
|
||||||
"humidity",
|
"humidity",
|
||||||
Double.class,
|
Double.class,
|
||||||
|
|
@ -91,144 +58,7 @@ public class DeviceTelemetry {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// PSDK Widget Values - List<PsdkDevice>
|
||||||
/**
|
|
||||||
* 任务作业状态
|
|
||||||
* {"0":"作业准备中","1":"飞行作业中","2":"作业后状态恢复","3":"自定义飞行区更新中","4":"地形障碍物更新中","5":"任务空闲","255":"飞行器异常","256":"未知状态"}
|
|
||||||
*/
|
|
||||||
public static final TelemetryKey<Integer> FlightTask_Step_Code = TelemetryKey.of(
|
|
||||||
"flighttask_step_code",
|
|
||||||
Integer.class,
|
|
||||||
value -> {
|
|
||||||
if (value == null) return null;
|
|
||||||
if (value instanceof Number) {
|
|
||||||
return ((Number) value).intValue();
|
|
||||||
}
|
|
||||||
return Integer.parseInt(value.toString());
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 无人机是否在舱
|
|
||||||
* {"0":"舱外","1":"舱内"}
|
|
||||||
*/
|
|
||||||
public static final TelemetryKey<Integer> Drone_In_Dock = TelemetryKey.of(
|
|
||||||
"drone_in_dock",
|
|
||||||
Integer.class,
|
|
||||||
value -> {
|
|
||||||
if (value == null) return null;
|
|
||||||
if (value instanceof Number) {
|
|
||||||
return ((Number) value).intValue();
|
|
||||||
}
|
|
||||||
return Integer.parseInt(value.toString());
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 无人机是否开机状态
|
|
||||||
* {"0":"关机","1":"开机"}
|
|
||||||
*/
|
|
||||||
public static final TelemetryKey<Integer> Sub_Device_Online_Status = TelemetryKey.of(
|
|
||||||
"sub_device.device_online_status",
|
|
||||||
Integer.class,
|
|
||||||
value -> {
|
|
||||||
if (value == null) return null;
|
|
||||||
if (value instanceof Number) {
|
|
||||||
return ((Number) value).intValue();
|
|
||||||
}
|
|
||||||
return Integer.parseInt(value.toString());
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 无人机充电状态
|
|
||||||
* {"0":"空闲","1":"充电中"}
|
|
||||||
*/
|
|
||||||
public static final TelemetryKey<Integer> Drone_Charge_State_State = TelemetryKey.of(
|
|
||||||
"drone_charge_state.state",
|
|
||||||
Integer.class,
|
|
||||||
value -> {
|
|
||||||
if (value == null) return null;
|
|
||||||
if (value instanceof Number) {
|
|
||||||
return ((Number) value).intValue();
|
|
||||||
}
|
|
||||||
return Integer.parseInt(value.toString());
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* {"0":"空闲模式(无制冷、制热、除湿等)","1":"制冷模式","2":"制热模式","3":"除湿模式","4":"制冷退出模式","5":"制热退出模式","6":"除湿退出模式","7":"制冷准备模式","8":"制热准备模式","9":"除湿准备模式"10":"风冷准备中"11":"风冷中"12":"风冷退出中"13":"除雾准备中"14":"除雾中"15":"除雾退出中"}
|
|
||||||
*/
|
|
||||||
public static final TelemetryKey<Integer> AIR_CONDITIONER_STATE = TelemetryKey.of(
|
|
||||||
"air_conditioner.air_conditioner_state",
|
|
||||||
Integer.class,
|
|
||||||
value -> {
|
|
||||||
if (value == null) return null;
|
|
||||||
if (value instanceof Number) {
|
|
||||||
return ((Number) value).intValue();
|
|
||||||
}
|
|
||||||
return Integer.parseInt(value.toString());
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 无人机 position_state.rtk_number RTK 搜星数量
|
|
||||||
*/
|
|
||||||
|
|
||||||
public static final TelemetryKey<Integer> Position_State_Rtk_Number = TelemetryKey.of(
|
|
||||||
"position_state.rtk_number",
|
|
||||||
Integer.class,
|
|
||||||
value -> {
|
|
||||||
if (value == null) return null;
|
|
||||||
if (value instanceof Number) {
|
|
||||||
return ((Number) value).intValue();
|
|
||||||
}
|
|
||||||
return Integer.parseInt(value.toString());
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 风速
|
|
||||||
*/
|
|
||||||
//wind_speed{"unit_name":"米每秒 / m/s"} float
|
|
||||||
public static final TelemetryKey<Double> Wind_Speed = TelemetryKey.of(
|
|
||||||
"wind_speed",
|
|
||||||
Double.class,
|
|
||||||
value -> {
|
|
||||||
if (value == null) return null;
|
|
||||||
if (value instanceof Number) {
|
|
||||||
return ((Number) value).doubleValue();
|
|
||||||
}
|
|
||||||
return Double.parseDouble(value.toString());
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 降雨量
|
|
||||||
*/
|
|
||||||
//rainfall {"0":"无雨","1":"小雨","2":"中雨","3":"大雨"} enum_int
|
|
||||||
public static final TelemetryKey<Integer> Rainfall = TelemetryKey.of(
|
|
||||||
"rainfall",
|
|
||||||
Integer.class,
|
|
||||||
value -> {
|
|
||||||
if (value == null) return null;
|
|
||||||
if (value instanceof Number) {
|
|
||||||
return ((Number) value).intValue();
|
|
||||||
}
|
|
||||||
return Integer.parseInt(value.toString());
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 无人机特有
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 无人机挂载信息
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static final TelemetryKey<List<PsdkDevice>> PSDK_WIDGET_VALUES = TelemetryKey.of(
|
public static final TelemetryKey<List<PsdkDevice>> PSDK_WIDGET_VALUES = TelemetryKey.of(
|
||||||
"psdk_widget_values",
|
"psdk_widget_values",
|
||||||
|
|
@ -273,102 +103,6 @@ public class DeviceTelemetry {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
* 电池信息
|
|
||||||
* 包含电池列表、电量百分比、降落电量、剩余飞行时间、返航电量等信息
|
|
||||||
*/
|
|
||||||
public static final TelemetryKey<BatteryData> BATTERY = TelemetryKey.of(
|
|
||||||
"battery",
|
|
||||||
BatteryData.class,
|
|
||||||
value -> {
|
|
||||||
if (value == null) return null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
// 如果已经是 BatteryData 类型,直接返回
|
|
||||||
if (value instanceof BatteryData) {
|
|
||||||
return (BatteryData) value;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果是字符串,需要处理 Python 风格的字典格式
|
|
||||||
if (value instanceof String) {
|
|
||||||
String jsonStr = (String) value;
|
|
||||||
|
|
||||||
// 将 Python 风格的字典转换为标准 JSON 格式
|
|
||||||
// 1. 将单引号替换为双引号
|
|
||||||
jsonStr = jsonStr.replace("'", "\"");
|
|
||||||
|
|
||||||
// 2. 处理 True/False/None (如果有的话)
|
|
||||||
jsonStr = jsonStr.replace(": True", ": true")
|
|
||||||
.replace(": False", ": false")
|
|
||||||
.replace(": None", ": null");
|
|
||||||
|
|
||||||
return OBJECT_MAPPER.readValue(jsonStr, BatteryData.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果是其他对象(如 JsonNode),转换为 JSON 再解析
|
|
||||||
String json = OBJECT_MAPPER.writeValueAsString(value);
|
|
||||||
return OBJECT_MAPPER.readValue(json, BatteryData.class);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException("Failed to parse battery: " + e.getMessage(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 限高
|
|
||||||
*/
|
|
||||||
public static final TelemetryKey<Integer> Height_Limit = TelemetryKey.of(
|
|
||||||
"height_limit",
|
|
||||||
Integer.class,
|
|
||||||
value -> {
|
|
||||||
if (value == null) return null;
|
|
||||||
if (value instanceof Number) {
|
|
||||||
return ((Number) value).intValue();
|
|
||||||
}
|
|
||||||
return Integer.parseInt(value.toString());
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 飞行器限远
|
|
||||||
* {"max":"8000","min":"15","step":"1","unit_name":"米 / m"}
|
|
||||||
*/
|
|
||||||
|
|
||||||
public static final TelemetryKey<Integer> Distance_Limit_Status_Distance_Limit = TelemetryKey.of(
|
|
||||||
"distance_limit_status.distance_limit",
|
|
||||||
Integer.class,
|
|
||||||
value -> {
|
|
||||||
if (value == null) return null;
|
|
||||||
if (value instanceof Number) {
|
|
||||||
return ((Number) value).intValue();
|
|
||||||
}
|
|
||||||
return Integer.parseInt(value.toString());
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 飞行次数 作业架次
|
|
||||||
*/
|
|
||||||
public static final TelemetryKey<Integer> Total_Flight_Sorties = TelemetryKey.of(
|
|
||||||
"total_flight_sorties",
|
|
||||||
Integer.class,
|
|
||||||
value -> {
|
|
||||||
if (value == null) return null;
|
|
||||||
if (value instanceof Number) {
|
|
||||||
return ((Number) value).intValue();
|
|
||||||
}
|
|
||||||
return Integer.parseInt(value.toString());
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 以下尚未划分
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private DeviceTelemetry() {
|
private DeviceTelemetry() {
|
||||||
// 工具类,禁止实例化
|
// 工具类,禁止实例化
|
||||||
}
|
}
|
||||||
|
|
@ -383,26 +117,10 @@ public class DeviceTelemetry {
|
||||||
AIR_CONDITIONER_STATE,
|
AIR_CONDITIONER_STATE,
|
||||||
TEMPERATURE,
|
TEMPERATURE,
|
||||||
HUMIDITY,
|
HUMIDITY,
|
||||||
PSDK_WIDGET_VALUES,
|
PSDK_WIDGET_VALUES
|
||||||
BATTERY,
|
|
||||||
FlightTask_Step_Code,
|
|
||||||
Sub_Device_Online_Status,
|
|
||||||
Total_Flight_Sorties,
|
|
||||||
Drone_Charge_State_State,
|
|
||||||
Drone_In_Dock,
|
|
||||||
Acc_Time,
|
|
||||||
Network_State_Type,
|
|
||||||
Wind_Speed,
|
|
||||||
Rainfall,
|
|
||||||
Position_State_Rtk_Number,
|
|
||||||
Height_Limit,
|
|
||||||
Distance_Limit_Status_Distance_Limit
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化所有遥测键
|
* 初始化所有遥测键
|
||||||
* 确保所有静态字段被加载和注册
|
* 确保所有静态字段被加载和注册
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.ruoyi.device.service.api;
|
package com.ruoyi.device.service.api;
|
||||||
|
|
||||||
import com.ruoyi.device.api.domain.AircraftDetailVO;
|
|
||||||
import com.ruoyi.device.service.dto.AircraftDTO;
|
import com.ruoyi.device.service.dto.AircraftDTO;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -27,12 +26,4 @@ public interface IAircraftService
|
||||||
* @return 无人机
|
* @return 无人机
|
||||||
*/
|
*/
|
||||||
AircraftDTO selectAircraftByAircraftId(Long aircraftId);
|
AircraftDTO selectAircraftByAircraftId(Long aircraftId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 查看无人机详情
|
|
||||||
*
|
|
||||||
* @param aircraftId 无人机ID
|
|
||||||
* @return 无人机详情
|
|
||||||
*/
|
|
||||||
AircraftDetailVO getAircraftDetail(Long aircraftId);
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
package com.ruoyi.device.service.api;
|
package com.ruoyi.device.service.api;
|
||||||
|
|
||||||
import com.ruoyi.device.api.domain.DockDetailVO;
|
|
||||||
import com.ruoyi.device.api.domain.DockVO;
|
|
||||||
import com.ruoyi.device.service.dto.DockDTO;
|
import com.ruoyi.device.service.dto.DockDTO;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -28,21 +26,4 @@ public interface IDockService
|
||||||
* @return 机场
|
* @return 机场
|
||||||
*/
|
*/
|
||||||
DockDTO selectDockByDockId(Long dockId);
|
DockDTO selectDockByDockId(Long dockId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 搜索机场
|
|
||||||
*
|
|
||||||
* @param dockStatus 机场状态
|
|
||||||
* @param dockId 机场ID
|
|
||||||
* @return 机场列表
|
|
||||||
*/
|
|
||||||
List<DockVO> searchDocks(String dockStatus, Long dockId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查看机场详情
|
|
||||||
*
|
|
||||||
* @param dockId 机场ID
|
|
||||||
* @return 机场详情
|
|
||||||
*/
|
|
||||||
DockDetailVO getDockDetail(Long dockId);
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
package com.ruoyi.device.service.api;
|
package com.ruoyi.device.service.api;
|
||||||
|
|
||||||
import com.ruoyi.device.api.domain.DockVO;
|
|
||||||
import com.ruoyi.device.api.domain.GroupVO;
|
|
||||||
import com.ruoyi.device.service.dto.GroupDTO;
|
import com.ruoyi.device.service.dto.GroupDTO;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -60,42 +58,4 @@ public interface IGroupService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int deleteGroupByGroupIds(Long[] groupIds);
|
int deleteGroupByGroupIds(Long[] groupIds);
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建分组
|
|
||||||
*
|
|
||||||
* @param groupDTO 分组信息
|
|
||||||
* @return 分组ID
|
|
||||||
*/
|
|
||||||
Long createGroup(GroupDTO groupDTO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除分组
|
|
||||||
*
|
|
||||||
* @param groupId 分组ID
|
|
||||||
*/
|
|
||||||
void deleteGroup(Long groupId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 切换机场所在的分组
|
|
||||||
*
|
|
||||||
* @param dockId 机场ID
|
|
||||||
* @param groupId 分组ID
|
|
||||||
*/
|
|
||||||
void switchDockGroup(Long dockId, Long groupId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查看分组下的机场
|
|
||||||
*
|
|
||||||
* @param groupId 分组ID
|
|
||||||
* @return 机场列表
|
|
||||||
*/
|
|
||||||
List<DockVO> getDocksByGroupId(Long groupId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查看所有分组
|
|
||||||
*
|
|
||||||
* @return 分组ID列表
|
|
||||||
*/
|
|
||||||
List<Long> getAllGroupIds();
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.ruoyi.device.service.impl;
|
package com.ruoyi.device.service.impl;
|
||||||
|
|
||||||
import com.ruoyi.device.api.domain.AircraftDetailVO;
|
|
||||||
import com.ruoyi.device.domain.api.IAircraftDomain;
|
import com.ruoyi.device.domain.api.IAircraftDomain;
|
||||||
import com.ruoyi.device.domain.model.Aircraft;
|
import com.ruoyi.device.domain.model.Aircraft;
|
||||||
import com.ruoyi.device.service.api.IAircraftService;
|
import com.ruoyi.device.service.api.IAircraftService;
|
||||||
|
|
@ -37,10 +36,4 @@ public class AircraftServiceImpl implements IAircraftService
|
||||||
Aircraft model = aircraftDomain.selectAircraftByAircraftId(aircraftId);
|
Aircraft model = aircraftDomain.selectAircraftByAircraftId(aircraftId);
|
||||||
return AircraftServiceConvert.toDTO(model);
|
return AircraftServiceConvert.toDTO(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public AircraftDetailVO getAircraftDetail(Long aircraftId)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
package com.ruoyi.device.service.impl;
|
package com.ruoyi.device.service.impl;
|
||||||
|
|
||||||
import com.ruoyi.device.api.domain.DockDetailVO;
|
|
||||||
import com.ruoyi.device.api.domain.DockVO;
|
|
||||||
import com.ruoyi.device.domain.api.IDockDomain;
|
import com.ruoyi.device.domain.api.IDockDomain;
|
||||||
import com.ruoyi.device.domain.model.Dock;
|
import com.ruoyi.device.domain.model.Dock;
|
||||||
import com.ruoyi.device.service.api.IDockService;
|
import com.ruoyi.device.service.api.IDockService;
|
||||||
|
|
@ -38,16 +36,4 @@ public class DockServiceImpl implements IDockService
|
||||||
Dock model = dockDomain.selectDockByDockId(dockId);
|
Dock model = dockDomain.selectDockByDockId(dockId);
|
||||||
return DockServiceConvert.toDTO(model);
|
return DockServiceConvert.toDTO(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<DockVO> searchDocks(String dockStatus, Long dockId)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DockDetailVO getDockDetail(Long dockId)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.ruoyi.device.service.impl;
|
package com.ruoyi.device.service.impl;
|
||||||
|
|
||||||
import com.ruoyi.device.api.domain.DockVO;
|
|
||||||
import com.ruoyi.device.domain.api.IGroupDomain;
|
import com.ruoyi.device.domain.api.IGroupDomain;
|
||||||
import com.ruoyi.device.domain.model.Group;
|
import com.ruoyi.device.domain.model.Group;
|
||||||
import com.ruoyi.device.service.api.IGroupService;
|
import com.ruoyi.device.service.api.IGroupService;
|
||||||
|
|
@ -63,32 +62,4 @@ public class GroupServiceImpl implements IGroupService
|
||||||
{
|
{
|
||||||
return groupDomain.deleteGroupByGroupIds(groupIds);
|
return groupDomain.deleteGroupByGroupIds(groupIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Long createGroup(GroupDTO groupDTO)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deleteGroup(Long groupId)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void switchDockGroup(Long dockId, Long groupId)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<DockVO> getDocksByGroupId(Long groupId)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Long> getAllGroupIds()
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue