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

feat(video): 驾驶舱回放返回控制集并与 playbackControl 同源

票11:回放控制接通。

- playback() 返回 controls{pause,resume,speed,seek},与 VideoDeviceService.controlSession
  实际实现的四个动作一致,不多报;
- capabilities.playbackControl 由恒 false 改为与 records 同源,消除同一接口对同一能力
  给出两个相反答案的矛盾;注释明确它是接缝能力而非设备确证(设备是否生效以画面为准);
- 设备详情测试改为断言公开的业务字段(businessCode/sourceType/gbDeviceId/gbChannelId),
  内部主键 equipmentId/videoId 仍不暴露;
- playback 用例补 controls 四项断言,防止契约无测试守护。

离线验证 reactor 165 项通过(含 67 项驾驶舱控制器测试)。
Kazerin 2 недель назад
Родитель
Сommit
f4aeb2ac5a

+ 12 - 3
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitVideoControllerTest.java

@@ -228,6 +228,11 @@ class CockpitVideoControllerTest {
                 .andExpect(jsonPath("$.data.startTime").value("2026-11-10 01:00:00"))
                 .andExpect(jsonPath("$.data.startTime").value("2026-11-10 01:00:00"))
                 .andExpect(jsonPath("$.data.sessionToken").isNotEmpty())
                 .andExpect(jsonPath("$.data.sessionToken").isNotEmpty())
                 .andExpect(jsonPath("$.data.media.webrtc").exists())
                 .andExpect(jsonPath("$.data.media.webrtc").exists())
+                // The panel enables exactly the actions the playback seam implements; nothing more.
+                .andExpect(jsonPath("$.data.controls.pause").value(true))
+                .andExpect(jsonPath("$.data.controls.resume").value(true))
+                .andExpect(jsonPath("$.data.controls.speed").value(true))
+                .andExpect(jsonPath("$.data.controls.seek").value(true))
                 .andExpect(content().string(org.hamcrest.Matchers.not(org.hamcrest.Matchers.containsString("internal-key"))));
                 .andExpect(content().string(org.hamcrest.Matchers.not(org.hamcrest.Matchers.containsString("internal-key"))));
     }
     }
 
 
@@ -254,17 +259,21 @@ class CockpitVideoControllerTest {
                 .andExpect(jsonPath("$.data.typeCode").value("20"))
                 .andExpect(jsonPath("$.data.typeCode").value("20"))
                 .andExpect(jsonPath("$.data.bound").value(true))
                 .andExpect(jsonPath("$.data.bound").value(true))
                 .andExpect(jsonPath("$.data.capabilities.live").value(true))
                 .andExpect(jsonPath("$.data.capabilities.live").value(true))
-                // Records and playback follow the GB28181 binding; control stays grey until a real device confirms it.
+                // Records, playback and the playback control seam follow the GB28181 binding together.
                 .andExpect(jsonPath("$.data.capabilities.records").value(true))
                 .andExpect(jsonPath("$.data.capabilities.records").value(true))
                 .andExpect(jsonPath("$.data.capabilities.playback").value(true))
                 .andExpect(jsonPath("$.data.capabilities.playback").value(true))
-                .andExpect(jsonPath("$.data.capabilities.playbackControl").value(false))
+                .andExpect(jsonPath("$.data.capabilities.playbackControl").value(true))
                 .andExpect(jsonPath("$.data.capabilities.ptz").value(false))
                 .andExpect(jsonPath("$.data.capabilities.ptz").value(false))
                 .andExpect(jsonPath("$.data.capabilities.ptzStopGuaranteed").value(false))
                 .andExpect(jsonPath("$.data.capabilities.ptzStopGuaranteed").value(false))
                 .andExpect(jsonPath("$.data.requestId").value("video-lookup-1"))
                 .andExpect(jsonPath("$.data.requestId").value("video-lookup-1"))
                 .andExpect(jsonPath("$.data.serverTime").value("2026-11-10T16:00:00+08:00"))
                 .andExpect(jsonPath("$.data.serverTime").value("2026-11-10T16:00:00+08:00"))
                 .andExpect(jsonPath("$.data.equipmentId").doesNotExist())
                 .andExpect(jsonPath("$.data.equipmentId").doesNotExist())
                 .andExpect(jsonPath("$.data.videoId").doesNotExist())
                 .andExpect(jsonPath("$.data.videoId").doesNotExist())
-                .andExpect(jsonPath("$.data.gbChannelId").doesNotExist());
+                // The monitor panel shows these six fields; GB identifiers are business data, not internal keys.
+                .andExpect(jsonPath("$.data.businessCode").value(CODE))
+                .andExpect(jsonPath("$.data.sourceType").value("GB28181"))
+                .andExpect(jsonPath("$.data.gbDeviceId").value("34020000002000000001"))
+                .andExpect(jsonPath("$.data.gbChannelId").value("34020000001320000001"));
         verifyNoInteractions(collector, sessions);
         verifyNoInteractions(collector, sessions);
     }
     }
 
 

+ 7 - 2
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/video/CockpitVideoService.java

@@ -48,9 +48,11 @@ public class CockpitVideoService {
         data.put("gbChannelId", binding == null ? null : binding.getGbChannelId());
         data.put("gbChannelId", binding == null ? null : binding.getGbChannelId());
         data.put("manufacturer", device.getManufacturer());
         data.put("manufacturer", device.getManufacturer());
         data.put("location", device.getEquipmentLocation());
         data.put("location", device.getEquipmentLocation());
-        // playbackControl stays false until a real device confirms pause/speed/seek support.
+        // playbackControl mirrors what the playback seam actually implements (see playback(): the same
+        // four actions). It is a seam capability, not a device confirmation: whether a camera honours
+        // pause/speed/seek is only observable in the picture.
         data.put("capabilities", Map.of("live", live, "records", records, "playback", records,
         data.put("capabilities", Map.of("live", live, "records", records, "playback", records,
-                "playbackControl", false, "ptz", false, "ptzStopGuaranteed", false));
+                "playbackControl", records, "ptz", false, "ptzStopGuaranteed", false));
         data.put("unavailableReason", live ? null : "设备未绑定或实时视频能力未确认");
         data.put("unavailableReason", live ? null : "设备未绑定或实时视频能力未确认");
         return data;
         return data;
     }
     }
@@ -118,6 +120,9 @@ public class CockpitVideoService {
         data.put("startTime", range.getStartTime());
         data.put("startTime", range.getStartTime());
         data.put("endTime", range.getEndTime());
         data.put("endTime", range.getEndTime());
         data.put("media", media);
         data.put("media", media);
+        // The reused playback seam implements these four actions for a GB28181 session; the panel
+        // enables exactly this set and bounds seek by the chosen recording span on the client.
+        data.put("controls", Map.of("pause", true, "resume", true, "speed", true, "seek", true));
         return data;
         return data;
     }
     }