feat(device): 添加设备在线状态查询功能- 在DeviceV2Controller中新增getDeviceOnlineStatus接口,用于根据设备ID查询设备在线状态
All checks were successful
ZhenTu-BE/pipeline/head This commit looks good

- 引入DeviceStatusDTO和DeviceStatusIntegrationService以支持设备状态查询- 修改DeviceStatusDTO中的时间字段类型为Date,并调整JSON序列化格式- 在DeviceRepository中增加convertToEntityWithStatus方法,用于合并设备信息与状态信息
- 优化DeviceRepository中的getOnlineStatus方法,增加异常处理和降级机制- 完善设备在线状态查询的日志记录和错误处理逻辑
This commit is contained in:
2025-09-25 15:32:09 +08:00
parent 47c6b2ca67
commit 3c700a42f9
3 changed files with 83 additions and 8 deletions

View File

@@ -6,6 +6,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
import java.util.Date;
/**
* 设备状态信息
@@ -28,8 +29,8 @@ public class DeviceStatusDTO {
/**
* 最后活动时间
*/
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss'Z'")
private LocalDateTime lastActiveTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date lastActiveTime;
/**
* 最后动作(register/keepalive/unregister)
@@ -44,6 +45,6 @@ public class DeviceStatusDTO {
/**
* 状态更新时间
*/
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss'Z'")
private LocalDateTime updateTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
}