You've already forked VptPassiveAdapter
feat(core): 添加视频连续性检查功能
- 实现了连续性检查循环,每5分钟执行一次检查 - 添加了跨天跨小时的文件列表获取功能 - 实现了单个设备和所有设备的连续性检查逻辑 - 添加了连续性检查结果上报API接口 - 实现了检查结果的数据结构定义和转换功能 - 配置了9点到18点的工作时间检查范围 - 添加了详细的日志记录和OpenTelemetry追踪支持
This commit is contained in:
57
dto/continuity.go
Normal file
57
dto/continuity.go
Normal file
@@ -0,0 +1,57 @@
|
||||
package dto
|
||||
|
||||
import "time"
|
||||
|
||||
// ContinuityCheckResult 连续性检查结果(内部使用)
|
||||
type ContinuityCheckResult struct {
|
||||
DeviceNo string `json:"deviceNo"` // 设备编号
|
||||
DeviceName string `json:"deviceName"` // 设备名称
|
||||
CheckTime time.Time `json:"checkTime"` // 检查执行时间
|
||||
RangeStart time.Time `json:"rangeStart"` // 检查范围起始
|
||||
RangeEnd time.Time `json:"rangeEnd"` // 检查范围结束
|
||||
IsContinuous bool `json:"isContinuous"` // 是否连续
|
||||
Gaps []GapInfo `json:"gaps,omitempty"` // 间隔详情
|
||||
CoverageStart *time.Time `json:"coverageStart,omitempty"` // 实际覆盖起始时间
|
||||
CoverageEnd *time.Time `json:"coverageEnd,omitempty"` // 实际覆盖结束时间
|
||||
FileCount int `json:"fileCount"` // 文件数量
|
||||
TotalDurationMs int64 `json:"totalDurationMs"` // 总时长(毫秒)
|
||||
ErrorMessage string `json:"errorMessage,omitempty"` // 错误信息
|
||||
}
|
||||
|
||||
// GapInfo 间隔信息(内部使用)
|
||||
type GapInfo struct {
|
||||
PreviousFileName string `json:"previousFileName"` // 前一个文件名
|
||||
PreviousEndTime time.Time `json:"previousEndTime"` // 前一个文件结束时间
|
||||
NextFileName string `json:"nextFileName"` // 后一个文件名
|
||||
NextStartTime time.Time `json:"nextStartTime"` // 后一个文件开始时间
|
||||
GapSeconds float64 `json:"gapSeconds"` // 间隔秒数
|
||||
}
|
||||
|
||||
// ContinuityReportRequest 连续性检查上报请求
|
||||
type ContinuityReportRequest struct {
|
||||
DeviceNo string `json:"deviceNo"` // 设备编号
|
||||
StartTime string `json:"startTime"` // 检查开始时间 (ISO 8601)
|
||||
EndTime string `json:"endTime"` // 检查结束时间 (ISO 8601)
|
||||
Support bool `json:"support"` // 是否支持连续性检查
|
||||
Continuous bool `json:"continuous"` // 视频是否连续
|
||||
TotalVideos int `json:"totalVideos"` // 视频总数
|
||||
TotalDurationMs int64 `json:"totalDurationMs"` // 总时长(毫秒)
|
||||
MaxAllowedGapMs int64 `json:"maxAllowedGapMs,omitempty"` // 允许的最大间隙(毫秒)
|
||||
Gaps []ContinuityReportGap `json:"gaps,omitempty"` // 间隙列表
|
||||
}
|
||||
|
||||
// ContinuityReportGap 连续性检查上报间隙信息
|
||||
type ContinuityReportGap struct {
|
||||
BeforeFileName string `json:"beforeFileName"` // 前一个文件名
|
||||
AfterFileName string `json:"afterFileName"` // 后一个文件名
|
||||
GapMs int64 `json:"gapMs"` // 间隙时长(毫秒)
|
||||
GapStartTime string `json:"gapStartTime"` // 间隙开始时间 (ISO 8601)
|
||||
GapEndTime string `json:"gapEndTime"` // 间隙结束时间 (ISO 8601)
|
||||
}
|
||||
|
||||
// ContinuityReportResponse 连续性检查上报响应
|
||||
type ContinuityReportResponse struct {
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data any `json:"data"`
|
||||
}
|
||||
Reference in New Issue
Block a user