# 24: 面板字段与后端契约覆盖调研
Type: research Status: resolved Labels: wayfinder:research Blocked by: None
What to find: 16 个二级面板各自需要的数据字段,现有 /api/cockpit/v1/** 与 /ws/deviceStatus 契约能不能供上;供不上的缺口要逐条列出,并给出补契约建议。
注意:本票是 AFK 调研,不改业务代码。结论写入本票链接的调研资产。
对 ADR 0003 锁定的 16 个 panelId 逐一对照后端契约:
overview:situationSummary、infrastructureSummary、monitoringSummary、alertSettingsinfrastructure:archive、operation、management、emergencymonitoring:monitoringOverview、monitoringDistribution、operationOverview、monitoringPointLedgerwarningResponse:currentEvents、historyAnalysis、responseEfficiency、eventAnalysis每个面板一段,包含:
CONTEXT.md 的语义描述,不要发明业务)map-snapshot、monitoring-points/{code}、equipments/{code}/detail-aggregate、equipments/{code}/archive、equipments/{code}/metrics/{current,history}、equipments/{code}/events/{current,history}、equipments/{code}/work-orders、work-orders/{code}/timeline、foundation、device-boundary、freshnessE:\pipe-ner-server\pipe-network-server 的 com.zksy.web.controller.cockpit 与 com.zksy.cockpit.*),后端演示页 E:\pipe-ner-server\docs\cockpit\*.html 作为样例响应的旁证。.scratch/cockpit-shell-panel-layout/research/panel-field-coverage.md 并从本票链接。已完成。结论写入 .scratch/cockpit-shell-panel-layout/research/panel-field-coverage.md。
16 个面板:5 个字段完全覆盖,11 个存在缺口。 完整字段表与补契约清单见调研资产。
1. 任务书给出的「现有契约」清单漏了 4 个面板级端点。 后端已经为总体概览与基础档案提供了一整层聚合读模型:
GET /api/cockpit/v1/overview/infrastructureGET /api/cockpit/v1/overview/monitoringGET /api/cockpit/v1/overview/warning-settingsGET /api/cockpit/v1/infrastructure/base-archivesGET /api/cockpit/v1/events/{eventSource}/{eventCode}/work-orders因此 infrastructureSummary、monitoringSummary、alertSettings、archive、monitoringOverview 是已有的,不需要补契约。实现票 17-20 的 mock 首期可直接按这 4 个响应的形状建模。
2. 缺口不是「单设备字段缺失」,而是「跨设备/跨设施读模型缺失」。 所有事件端点(current/history)与指标端点都以 deviceCode 为路径参数,没有跨设备视图。
3. 逐面板判定
| 模式 | 完全覆盖 | 存在缺口 |
|---|---|---|
overview |
infrastructureSummary、monitoringSummary、alertSettings |
situationSummary(趋势窗口不可声明,弱缺口) |
infrastructure |
archive |
operation、management、emergency |
monitoring |
monitoringOverview |
monitoringDistribution、operationOverview、monitoringPointLedger |
warningResponse |
无 | 4 个面板全部有缺口 |
4. Top 5 缺失字段
eventCode + 归属设备/监测点/行业 + 分页)— 完全阻塞 currentEventsrange 参数(7/30/90/自定义)— 阻塞 historyAnalysishazardSources / protectionTargets / emergencyResources)— emergency 整版,后端 cockpit 包内该域完全不存在industry + 点位类型 + 设备计数徽标,含 map-snapshot 的 industry 入参 — 阻塞 monitoringPointLedger / monitoringDistributionlongitude/latitude + coordinateValidation)与响应/关闭时长聚合(averageResponseSeconds / averageCloseSeconds)5. 两个影响面超出单面板的发现
overview/monitoring 与 base-archives 支持 industry,但 map-snapshot 既无 industry 入参,CockpitMonitoringPointSummary 也无 industry/类型字段,无法服务端或客户端过滤。CONTEXT.md 定义行业筛选是作用于整个驾驶舱的全局条件。map-snapshot 丢弃了设备编码:内部快照 CockpitMapSnapshot.SourceMonitoringPoint.devices 存在,但 CockpitMapSnapshotService.monitoringPoint() 不写入响应,导致 WS cockpitDeviceStatusDelta(增量只带 deviceCode + status)无法回联到点位状态。6. WS 契约现状:cockpitSubscribe 回帧只有 {scope, serverUpdatedAt},无初始设备状态数组——后端注释明确「REST 仍是初始快照,这里只接收后续状态增量」。另注意线上帧增量状态键是 data.status,而后端 DTO CockpitOverviewMonitoringDeviceStatusDelta 的字段名是 monitoringState。
7. 待业务确认(本票不发明结论):「故障」是否等同 stale;「处置率」当前定义是 state==6 / 全部事件(含已取消),是否即业务所说处置率;「管理单位」与 maintenance(维护单位)是否同一概念。
.scratch/cockpit-shell-panel-layout/research/panel-field-coverage.md 并从本票链接