feat(drone-dock): 完善真实联调、状态轮询与准备页反馈

开放 Release 真实操作并保留 Debug 拦截;恢复前台 shooting 串行轮询;统一打印机巢请求与完整原值响应;优化长点位名称、未拍摄文案、报备失败及已结束任务提示,移除成功回执 UI。补充相关测试、离线策略检查和联调说明。
This commit is contained in:
2026-11-02 16:26:50 +08:00
parent b21a3b6cb6
commit 2d86ec8cd7
37 changed files with 1298 additions and 411 deletions
@@ -0,0 +1,43 @@
import Foundation
/// 准备页的业务失败提示;区分创建与召唤,不把通用业务错误码当作未报备。
struct DroneDockPreparationFailure: Equatable, Sendable {
/// 失败发生的提交步骤。
enum Stage: Sendable { case creation, summon }
/// 面向工作人员的标题。
let title: String
/// 原因及下一步操作,不包含接口 JSON。
let message: String
/// 后端文字明确指出报备问题时,额外弹出提醒。
let requiresFiling: Bool
/// 未获得专用错误码前,仅匹配明确报备/备案失败的文字,其他原因保持后端原意。
init(message: String, stage: Stage, outcomeUnknown: Bool) {
requiresFiling = !outcomeUnknown && Self.isFilingFailure(message)
if outcomeUnknown {
title = stage == .creation ? "任务创建结果待核对" : "召唤结果待核对"
self.message = message
} else if requiresFiling {
title = "请先完成飞行报备"
self.message = message + "\n请联系相关负责人核实并完成飞行报备,确认生效后再重试。"
} else if stage == .summon && Self.requiresTaskReview(message) {
title = "任务已结束"
self.message = "当前任务已结束,无法直接召唤。请先查看拍摄任务状态;如需重新召唤,在任务页确认后操作。"
} else {
title = stage == .creation ? "任务创建失败" : "召唤失败"
self.message = message
}
}
/// 仅识别实际返回的明确终止提示;不会据此自动发送 restart=true。
static func requiresTaskReview(_ message: String) -> Bool {
message.contains("任务已结束") && message.contains("无法召唤")
}
private static func isFilingFailure(_ message: String) -> Bool {
["未报备", "未完成报备", "报备未", "报备失败", "报备过期", "报备已过期",
"报备失效", "报备已失效", "无有效报备", "没有报备", "无报备", "请先报备", "需要报备",
"未备案", "未完成备案", "备案未", "备案失败", "备案已过期", "请先备案"]
.contains(where: message.contains)
}
}
@@ -92,7 +92,7 @@ struct DroneDockShootingPlaneStatus: Decodable, Equatable, Sendable {
let scenicID: Int?
/// 后端景区连接状态。
let connected: Bool?
/// 保留后端建议间隔;当前任务页不据此安排定时请求。
/// 后端建议轮询间隔,任务页校验并限制频率后使用。
let pollHintMS: Int?
/// 设备快照字段映射,其余字段仍保留在完整 dataJSON 中。