#ifndef TPS_APP_HPP #define TPS_APP_HPP #include #include #include // ============================================================ // 核心数据结构(对应需求文档中的数据库表结构) // ============================================================ /** * 事件数据模型。 * 对应数据库事件表(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