task_plan_execute_2/include/app.hpp

133 lines
5.0 KiB
C++
Raw Permalink Normal View History

2026-06-17 04:58:09 +00:00
#ifndef TPS_APP_HPP
#define TPS_APP_HPP
#include <string>
#include <vector>
#include <cstdint>
// ============================================================
// 核心数据结构(对应需求文档中的数据库表结构)
// ============================================================
/**
*
* Event
*/
struct Event {
std::string event_id; ///< 事件ID主键
std::string event_type; ///< 事件类型:"临机" / "规划"
std::string occur_time; ///< 发生时间ISO 8601 格式)
std::string title; ///< 事件标题
std::string description; ///< 事件描述
std::string location; ///< 位置坐标WGS-84
int priority{0}; ///< 优先级,数值越大优先级越高
std::string status; ///< 状态:"未处理" / "已处理" / "拒绝"
std::string create_time; ///< 系统记录时间
};
/**
*
* TaskTemplate
*/
struct TaskTemplate {
std::string template_id; ///< 模板ID主键
std::string name; ///< 模板名称
std::string version; ///< 版本号(如 v1.0.0
std::string content_path; ///< 内容文件路径
std::string scenario; ///< 适用场景(如 "侦察" / "打击"
bool enabled{true}; ///< 是否启用
std::string create_time; ///< 创建时间
};
/**
*
* TemplateVersion
*/
struct TemplateVersion {
uint64_t id{0}; ///< 自增主键
std::string template_id; ///< 关联模板ID
std::string version; ///< 版本标识
std::string release_time; ///< 上线时间
std::string expire_time; ///< 过期时间(可为空)
std::string status; ///< "有效" / "过期" / "草稿"
};
/**
*
* TaskPlan
*/
struct TaskPlan {
std::string plan_id; ///< 计划ID主键
std::string name; ///< 计划名称
std::string event_ids; ///< 关联事件ID列表JSON数组
std::string template_id; ///< 引用模板ID
std::string status; ///< 状态:"草案" / "执行中" / "完成"
std::string create_time; ///< 创建时间
std::string update_time; ///< 最后修改时间
};
/**
*
* PlanNode
*/
struct PlanNode {
std::string node_id; ///< 节点ID主键
std::string plan_id; ///< 关联计划ID
std::string type; ///< 节点类型:"任务" / "决策" / "HITL"
std::string content; ///< 描述或指令
int order_index{0}; ///< 执行顺序
std::string status; ///< 执行状态
bool hitl_required{false}; ///< 是否需人工干预
};
/**
*
* DistributionLog
*/
struct DistributionLog {
uint64_t log_id{0}; ///< 日志ID主键
std::string plan_id; ///< 对应计划ID
std::string asset_type; ///< 目标资产类型
std::string send_time; ///< 发送时刻
std::string status; ///< "成功" / "失败" / "重试"
int retry_count{0}; ///< 重试次数最大3次
std::string ack_code; ///< 响应码ACK/NACK等
};
/**
*
* StatusLog
*/
struct StatusLog {
uint64_t log_id{0}; ///< 日志ID主键
std::string asset_id; ///< 资产ID
std::string status_code; ///< 状态码(如 "OK" / "ERROR_01"
std::string detail_info; ///< 详细信息
std::string timestamp; ///< 数据采集时间
std::string source; ///< 数据来源标识
};
// ============================================================
// 标准化内部事件模型(经过过滤、转换和封装后的标准格式)
// ============================================================
/**
*
* SRS-F-01-002
*/
struct NormalizedEvent {
std::string event_id; ///< 原始事件ID
std::string event_type; ///< 事件类型
std::string normalized_time; ///< 统一转换后的时间戳UTC
std::string title; ///< 标题
std::string description; ///< 描述
double latitude{0.0}; ///< 纬度WGS-84已转换
double longitude{0.0}; ///< 经度WGS-84已转换
int priority{0}; ///< 优先级
std::string status; ///< 状态
std::string receive_time; ///< 系统接收时间
std::string node_id; ///< 处理节点ID
};
#endif // TPS_APP_HPP