Просмотр исходного кода

feat(cockpit): 显示聚合桶标记状态摘要版本

响应增加 statusVersion/statusSource=SNAPSHOT,明确桶状态摘要绑定快照;WS 推送后调用方需按类别回退或等新版本,服务端不把增量写入已签发快照。
Kazerin 1 неделя назад
Родитель
Сommit
3bd2bc41b6

+ 1 - 0
docs/cockpit/README.md

@@ -69,6 +69,7 @@
 - 服务端完成过滤,并在响应 `mapFilter{industry,district,districtName,districtFilter,deviceType,pointCodes,deviceCodes}` 回显**实际生效范围**(编码为过滤后全量、分页前,升序)。
 - **`snapshotAt` 回显(执行票 62 补齐)**:`monitoring/distribution` 的 `data.snapshotAt` 回显本次响应依据的快照标记,与 `map-snapshot` 同形同义。该端点 `page > 1` 时**必须**带非空 `snapshotAt`(不带即 400 `INVALID_REQUEST`「监测分布分页参数不合法」)——此前响应不回显该值,调用方只能自己找时间戳猜,跨页对齐无从保证;现在第 1 页取回什么、后续页就原样回带什么。`page = 1` 可不带(后端据此开新快照)。
 - `coordinateValidation` 汇总是**当前筛选范围内的全量口径**(再切片分页);逐点/逐设备保留 `renderable=false` 的对象。
+- **显示聚合桶(票 06/07)**:`GET /api/cockpit/v1/map-display-buckets` 与 `/map-display-bucket-members`。响应 `statusVersion` / `statusSource=SNAPSHOT` 说明桶内状态摘要绑定哪份快照;WS 状态推送后调用方必须按受影响类别回退本地或等新 `statusVersion`,不能用同一快照的旧摘要覆盖刚推来的状态。设施无坐标源时该类别如实 `UNAVAILABLE`,不借设备/点位坐标。
 - 逐点 `industry` 由类型推导(口径同 distribution:类型可解析、`objectKind = SMART_DEVICE`、行业属正式行业);不可推导时为 `null`,**默认不排除对象**,仅在请求了 `industry`/`deviceType` 过滤时按推导结果筛选。
 
 ### 片区(district)契约(执行票 12,2026-10-08)

+ 8 - 2
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/display/CockpitMapDisplayResponse.java

@@ -18,20 +18,24 @@ public class CockpitMapDisplayResponse {
     private final boolean readOnly;
     private final boolean partial;
     private final String snapshotAt;
+    private final String statusVersion;
+    private final String statusSource;
     private final int zoomBand;
     private final String bbox;
     private final int cellMeters;
     private final Filters filters;
     private final List<ClassBuckets> classes;
 
-    public CockpitMapDisplayResponse(String requestId, String snapshotAt, int zoomBand, String bbox,
-            int cellMeters, boolean partial, Filters filters, List<ClassBuckets> classes) {
+    public CockpitMapDisplayResponse(String requestId, String snapshotAt, String statusVersion, int zoomBand,
+            String bbox, int cellMeters, boolean partial, Filters filters, List<ClassBuckets> classes) {
         this.requestId = requestId;
         this.apiVersion = "v1";
         this.contract = CONTRACT;
         this.readOnly = true;
         this.partial = partial;
         this.snapshotAt = snapshotAt;
+        this.statusVersion = statusVersion;
+        this.statusSource = "SNAPSHOT";
         this.zoomBand = zoomBand;
         this.bbox = bbox;
         this.cellMeters = cellMeters;
@@ -45,6 +49,8 @@ public class CockpitMapDisplayResponse {
     public boolean isReadOnly() { return readOnly; }
     public boolean isPartial() { return partial; }
     public String getSnapshotAt() { return snapshotAt; }
+    public String getStatusVersion() { return statusVersion; }
+    public String getStatusSource() { return statusSource; }
     public int getZoomBand() { return zoomBand; }
     public String getBbox() { return bbox; }
     public int getCellMeters() { return cellMeters; }

+ 1 - 1
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/display/CockpitMapDisplayService.java

@@ -128,7 +128,7 @@ public class CockpitMapDisplayService {
                 filter == null ? null : filter.getDeviceType(),
                 filter == null ? null : filter.getPointStatus());
         return new CockpitMapDisplayResponse(
-                requestId, rows.snapshotAt, band, bbox.echo(),
+                requestId, rows.snapshotAt, rows.snapshotAt, band, bbox.echo(),
                 (int) cellMeters(band), partial, filters, classes);
     }