Преглед изворни кода

cockpit接口按规范定义,并提炼公共类

zengy пре 1 недеља
родитељ
комит
d9b5431ecf
71 измењених фајлова са 1025 додато и 2304 уклоњено
  1. 2 2
      docs/cockpit/README.md
  2. 2 2
      docs/cockpit/foundation-demo.html
  3. 1 1
      docs/cockpit/map-snapshot-demo.html
  4. 1 1
      docs/cockpit/websocket-scope-delta-demo.html
  5. 45 0
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/BaseCockpitController.java
  6. 0 56
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitCollectionRecordsController.java
  7. 0 78
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitCurrentEventsController.java
  8. 0 47
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitDeviceFacilityRelationController.java
  9. 1 1
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitDictController.java
  10. 0 52
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitEntityDetailController.java
  11. 0 87
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitEquipmentArchiveController.java
  12. 72 0
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitEquipmentController.java
  13. 0 66
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitEquipmentDetailAggregateController.java
  14. 66 0
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitEventController.java
  15. 0 60
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitEventDetailController.java
  16. 115 0
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitExceptionAdvice.java
  17. 0 51
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitFacilityGeometryController.java
  18. 0 45
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitFoundationController.java
  19. 0 100
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitFreshnessController.java
  20. 0 83
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitHandlingEfficiencyController.java
  21. 0 80
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitHistoryAnalysisController.java
  22. 0 72
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitInfrastructureBaseArchivesController.java
  23. 70 0
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitInfrastructureController.java
  24. 0 69
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitInfrastructureEmergencySupportController.java
  25. 0 66
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitInfrastructureManagementInformationController.java
  26. 0 75
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitInfrastructureOperatingInformationController.java
  27. 46 0
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitMapController.java
  28. 0 81
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitMapSnapshotController.java
  29. 48 0
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitMonitoringController.java
  30. 0 86
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitMonitoringDistributionController.java
  31. 0 66
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitMonitoringOverviewController.java
  32. 0 98
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitMonitoringPointDetailController.java
  33. 0 79
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitMonitoringSituationController.java
  34. 0 83
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitMultidimensionalAnalysisController.java
  35. 41 0
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitOverviewController.java
  36. 0 101
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitOverviewModulesController.java
  37. 0 79
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitTypeMetricsController.java
  38. 28 50
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitVideoController.java
  39. 41 0
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitWorkOrderController.java
  40. 0 63
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitWorkOrderDetailController.java
  41. 0 107
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitWorkOrderReadController.java
  42. 1 1
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitAuthenticationEntryPointTest.java
  43. 7 19
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitContractDictionaryTest.java
  44. 37 33
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitContractIntegrationTest.java
  45. 16 13
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitCurrentEventsControllerTest.java
  46. 18 7
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitDeviceFacilityRelationContractTest.java
  47. 1 1
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitDictControllerTest.java
  48. 46 24
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitDistrictFilterContractTest.java
  49. 19 2
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitEntityDetailControllerTest.java
  50. 13 8
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitEquipmentArchiveControllerTest.java
  51. 24 8
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitFacilityGeometryControllerTest.java
  52. 14 12
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitFoundationControllerTest.java
  53. 16 7
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitFreshnessSemanticsControllerTest.java
  54. 15 13
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitHandlingEfficiencyControllerTest.java
  55. 16 17
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitHistoryAnalysisControllerTest.java
  56. 18 13
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitInfrastructureBaseArchivesControllerTest.java
  57. 11 6
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitInfrastructureEmergencySupportControllerTest.java
  58. 13 8
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitInfrastructureManagementInformationControllerTest.java
  59. 21 9
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitInfrastructureOperatingInformationControllerTest.java
  60. 37 35
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitMapSnapshotControllerTest.java
  61. 14 14
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitMonitoringDistributionControllerTest.java
  62. 10 8
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitMonitoringOverviewControllerTest.java
  63. 15 12
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitMonitoringPointDetailControllerTest.java
  64. 11 11
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitMonitoringSituationControllerTest.java
  65. 16 13
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitMultidimensionalAnalysisControllerTest.java
  66. 8 8
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitOverviewModulesControllerTest.java
  67. 11 4
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitPointStatusContractTest.java
  68. 9 4
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitTypeMetricsControllerTest.java
  69. 2 1
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitVideoControllerTest.java
  70. 3 3
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitWorkOrderListContractTest.java
  71. 4 3
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitWorkOrderReadControllerTest.java

+ 2 - 2
docs/cockpit/README.md

@@ -49,7 +49,7 @@
 
 | 用途 | 端点 |
 | --- | --- |
-| 地图分页快照(**地图取数路径**) | `GET /api/cockpit/v1/map-snapshot?page&pageSize&snapshotAt&industry&district&deviceType` |
+| 地图分页快照(**地图取数路径**) | `GET /api/cockpit/v1/map/snapshot?page&pageSize&snapshotAt&industry&district&deviceType` |
 | 监测点详情 | `GET /api/cockpit/v1/monitoring-points/{monitoringPointCode}?snapshotAt` |
 | 设备档案(含最新图片) | `GET /api/cockpit/v1/equipments/{deviceCode}/archive` |
 | 类型指标 | `GET /api/cockpit/v1/equipments/{deviceCode}/metrics/current`、`.../metrics/history` |
@@ -58,7 +58,7 @@
 | 工单时间线 | `GET /api/cockpit/v1/work-orders/{workOrderCode}/timeline` |
 | 设备详情聚合 | `GET /api/cockpit/v1/equipments/{deviceCode}/detail-aggregate` |
 | 新鲜度 | `GET /api/cockpit/v1/equipments/{deviceCode}/freshness` |
-| 契约自检 | `GET /api/cockpit/v1/foundation`、`GET /api/cockpit/v1/device-boundary` |
+| 契约自检 | `GET /api/cockpit/v1/map/foundation`、`GET /api/cockpit/v1/device-boundary` |
 
 ### 地图筛选路径(冻结结论)
 

+ 2 - 2
docs/cockpit/foundation-demo.html

@@ -111,7 +111,7 @@
 <body>
 <main>
   <h1>城市生命线驾驶舱基础契约演示</h1>
-  <p class="endpoint">GET /api/cockpit/v1/foundation</p>
+  <p class="endpoint">GET /api/cockpit/v1/map/foundation</p>
 
   <div class="toolbar">
     <button type="button" data-mode="success">成功空地图</button>
@@ -211,7 +211,7 @@
   }
 
   function loadLive() {
-    fetch('/api/cockpit/v1/foundation', { headers: { 'X-Request-Id': 'demo-foundation-live' } })
+    fetch('/api/cockpit/v1/map/foundation', { headers: { 'X-Request-Id': 'demo-foundation-live' } })
       .then(function (response) {
         return response.json().then(function (payload) {
           render('success', payload,

+ 1 - 1
docs/cockpit/map-snapshot-demo.html

@@ -28,7 +28,7 @@
 <main>
   <header>
     <h1>驾驶舱地图快照分页演示</h1>
-    <p class="endpoint">GET /api/cockpit/v1/map-snapshot?page=1&amp;pageSize=2</p>
+    <p class="endpoint">GET /api/cockpit/v1/map/snapshot?page=1&amp;pageSize=2</p>
   </header>
   <div class="layout">
     <section>

+ 1 - 1
docs/cockpit/websocket-scope-delta-demo.html

@@ -54,7 +54,7 @@
     </div>
   </main>
   <script>
-    const REST_URL = "http://localhost:8300/api/cockpit/v1/map-snapshot";
+    const REST_URL = "http://localhost:8300/api/cockpit/v1/map/snapshot";
     const WS_URL = "ws://localhost:8300/ws/deviceStatus";
     let snapshotLoaded = false;
     const latest = new Map();

+ 45 - 0
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/BaseCockpitController.java

@@ -0,0 +1,45 @@
+package com.zksy.web.controller.cockpit;
+
+import com.zksy.cockpit.foundation.CockpitInvalidCodeException;
+import com.zksy.common.utils.StringUtils;
+import com.zksy.common.utils.uuid.IdUtils;
+import org.springframework.web.util.UriUtils;
+
+import javax.servlet.http.HttpServletRequest;
+import java.nio.charset.StandardCharsets;
+import java.time.Clock;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * 驾驶舱控制器公共工具基类:只提供入参/元数据工具,不承载异常处理或错误响应拼装。
+ */
+public abstract class BaseCockpitController {
+    protected static final String REQUEST_ID_HEADER = "X-Request-Id";
+
+    protected String resolveRequestId(String requestId) {
+        return StringUtils.isNotEmpty(requestId) ? requestId : IdUtils.fastSimpleUUID();
+    }
+
+    protected final String serverTime(Clock clock) {
+        return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(
+                clock.instant().atZone(ZoneId.of("Asia/Shanghai")));
+    }
+
+    protected final Map<String, Object> cockpitMetadata(HttpServletRequest request, Clock clock) {
+        Map<String, Object> metadata = new LinkedHashMap<>();
+        metadata.put("requestId", resolveRequestId(request.getHeader(REQUEST_ID_HEADER)));
+        metadata.put("serverTime", serverTime(clock));
+        return metadata;
+    }
+
+    protected final String decodePathSegment(String value) {
+        try {
+            return UriUtils.decode(value, StandardCharsets.UTF_8);
+        } catch (IllegalArgumentException exception) {
+            throw new CockpitInvalidCodeException("invalid path segment encoding");
+        }
+    }
+}

+ 0 - 56
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitCollectionRecordsController.java

@@ -1,56 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.collectionRecords.CockpitCollectionRecordsResponse;
-import com.zksy.cockpit.collectionRecords.CockpitCollectionRecordsService;
-import com.zksy.cockpit.foundation.CockpitDeviceNotFoundException;
-import com.zksy.cockpit.foundation.CockpitInvalidRequestException;
-import com.zksy.common.core.domain.AjaxResult;
-import com.zksy.common.utils.uuid.IdUtils;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.util.UriUtils;
-
-import java.nio.charset.StandardCharsets;
-
-/** 驾驶舱公开只读入口,不改变管理端档案接口的授权。 */
-@RestController
-@RequestMapping("/api/cockpit/v1")
-public class CockpitCollectionRecordsController {
-    private final CockpitCollectionRecordsService service;
-
-    public CockpitCollectionRecordsController(CockpitCollectionRecordsService service) {
-        this.service = service;
-    }
-
-    @GetMapping("/equipments/{deviceCode}/collection-records")
-    public ResponseEntity<AjaxResult> collectionRecords(
-            @PathVariable("deviceCode") String deviceCode,
-            @RequestHeader(value = "X-Request-Id", required = false) String requestId) {
-        String traceId = requestId == null || requestId.trim().isEmpty() ? IdUtils.fastSimpleUUID() : requestId;
-        try {
-            String decoded;
-            try {
-                decoded = UriUtils.decode(deviceCode, StandardCharsets.UTF_8);
-            } catch (IllegalArgumentException exception) {
-                throw new CockpitInvalidRequestException("设备编码不合法");
-            }
-            return ResponseEntity.ok(AjaxResult.success(service.load(traceId, decoded)));
-        } catch (CockpitInvalidRequestException exception) {
-            return failure(400, traceId, deviceCode, exception.getMessage());
-        } catch (CockpitDeviceNotFoundException exception) {
-            return failure(404, traceId, deviceCode, "设备不存在");
-        } catch (RuntimeException exception) {
-            return failure(500, traceId, deviceCode, "驾驶舱采集记录读取失败,暂不可用");
-        }
-    }
-
-    private ResponseEntity<AjaxResult> failure(int status, String requestId, String deviceCode, String message) {
-        CockpitCollectionRecordsResponse response = new CockpitCollectionRecordsResponse(
-                requestId, deviceCode, "FAILED", message, CockpitCollectionRecordsResponse.emptyView());
-        return ResponseEntity.status(status).body(new AjaxResult(status, message, response));
-    }
-}

+ 0 - 78
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitCurrentEventsController.java

@@ -1,78 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.event.CockpitCurrentEventsService;
-import com.zksy.cockpit.foundation.CockpitErrorPayload;
-import com.zksy.cockpit.foundation.CockpitInvalidRequestException;
-import com.zksy.cockpit.foundation.CockpitReadException;
-import com.zksy.common.core.domain.AjaxResult;
-import com.zksy.common.utils.StringUtils;
-import com.zksy.common.utils.uuid.IdUtils;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-
-@RestController
-@RequestMapping("/api/cockpit/v1")
-public class CockpitCurrentEventsController {
-    private static final String REQUEST_ID_HEADER = "X-Request-Id";
-
-    private final CockpitCurrentEventsService currentEventsService;
-
-    public CockpitCurrentEventsController(CockpitCurrentEventsService currentEventsService) {
-        this.currentEventsService = currentEventsService;
-    }
-
-    @GetMapping("/events/current")
-    public ResponseEntity<AjaxResult> currentEvents(
-            @RequestParam(value = "mode", required = false) String mode,
-            @RequestParam(value = "level", required = false) String level,
-            @RequestParam(value = "industry", required = false) String industry,
-            @RequestParam(value = "status", required = false) String status,
-            // 范围维度=片区(票 77):0/1/2 按片区筛、UNASSIGNED 只看未分区、不传=不筛。
-            @RequestParam(value = "district", required = false) String district,
-            @RequestParam(value = "page", defaultValue = "1") Integer page,
-            @RequestParam(value = "pageSize", defaultValue = "100") Integer pageSize,
-            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
-        return ResponseEntity.ok(AjaxResult.success(
-                currentEventsService.load(
-                        resolveRequestId(requestId),
-                        mode,
-                        level,
-                        industry,
-                        status,
-                        district,
-                        page,
-                        pageSize)));
-    }
-
-    @ExceptionHandler(CockpitInvalidRequestException.class)
-    public ResponseEntity<AjaxResult> handleInvalidRequest(
-            HttpServletRequest request,
-            CockpitInvalidRequestException exception) {
-        return error(HttpStatus.BAD_REQUEST, currentEventsService.invalidRequest(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER)),
-                exception.getMessage()));
-    }
-
-    @ExceptionHandler(CockpitReadException.class)
-    public ResponseEntity<AjaxResult> handleReadFailure(HttpServletRequest request) {
-        return error(HttpStatus.INTERNAL_SERVER_ERROR, currentEventsService.serverError(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER))));
-    }
-
-    private ResponseEntity<AjaxResult> error(HttpStatus status, CockpitErrorPayload payload) {
-        return ResponseEntity.status(status)
-                .body(new AjaxResult(status.value(), payload.getMessage(), payload));
-    }
-
-    private String resolveRequestId(String requestId) {
-        return StringUtils.isNotEmpty(requestId) ? requestId : IdUtils.fastSimpleUUID();
-    }
-}

+ 0 - 47
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitDeviceFacilityRelationController.java

@@ -1,47 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.foundation.CockpitReadException;
-import com.zksy.cockpit.relation.CockpitDeviceFacilityRelationService;
-import com.zksy.common.core.domain.AjaxResult;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * 设备 → 设施真实关联(免鉴权只读,`/api/cockpit/v1/**` GET 已由 SecurityConfig 放行)。
- *
- * <p>存在意义:前端「地下管线详情视图」此前拿不到真实设施关系,只能把设备按同业邻近摆成「示意安装」。
- * 本端点把 {@code manhole_device_rel} 的真实主键关系如实吐出,
- * 让前端按主键把设备挂到管段上;查不到就是空数组,前端继续降级,绝不在这里补关系。
- *
- * <p>只读:纯查询,无写库、无事务注解。
- */
-@RestController
-@RequestMapping("/api/cockpit/v1")
-public class CockpitDeviceFacilityRelationController {
-    private static final Logger LOG = LoggerFactory.getLogger(CockpitDeviceFacilityRelationController.class);
-
-    private final CockpitDeviceFacilityRelationService service;
-
-    public CockpitDeviceFacilityRelationController(CockpitDeviceFacilityRelationService service) {
-        this.service = service;
-    }
-
-    @GetMapping("/device-facility-relations")
-    public ResponseEntity<AjaxResult> relations() {
-        return ResponseEntity.ok(AjaxResult.success(service.load()));
-    }
-
-    @ExceptionHandler(CockpitReadException.class)
-    public ResponseEntity<AjaxResult> handleReadFailure(CockpitReadException exception) {
-        // 失败返回错误信封而不是空数组:空数组对前端意味着「确实没有真实关联」。
-        LOG.error("Device facility relation read failed", exception);
-        return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
-                .body(AjaxResult.error(HttpStatus.INTERNAL_SERVER_ERROR.value(), exception.getMessage()));
-    }
-}

+ 1 - 1
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitDictController.java

@@ -20,7 +20,7 @@ import java.util.stream.Collectors;
  */
 @RestController
 @RequestMapping("/api/cockpit/v1")
-public class CockpitDictController {
+public class CockpitDictController extends BaseCockpitController {
     /** 只透传驾驶舱契约需要的字典,避免把后台任意字典暴露到公开端点。 */
     private static final List<String> ALLOWED = Collections.singletonList("pump_station_type");
 

+ 0 - 52
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitEntityDetailController.java

@@ -1,52 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.entity.CockpitEntityDetailResponse;
-import com.zksy.cockpit.entity.CockpitEntityDetailService;
-import com.zksy.cockpit.entity.CockpitEntityNotFoundException;
-import com.zksy.cockpit.foundation.CockpitErrorPayload;
-import com.zksy.cockpit.foundation.CockpitInvalidRequestException;
-import com.zksy.common.core.domain.AjaxResult;
-import com.zksy.common.utils.StringUtils;
-import com.zksy.common.utils.uuid.IdUtils;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.util.UriUtils;
-
-import javax.servlet.http.HttpServletRequest;
-import java.nio.charset.StandardCharsets;
-
-@RestController
-@RequestMapping("/api/cockpit/v1")
-public class CockpitEntityDetailController {
-    private static final String REQUEST_ID_HEADER = "X-Request-Id";
-    private final CockpitEntityDetailService service;
-
-    public CockpitEntityDetailController(CockpitEntityDetailService service) { this.service = service; }
-
-    @GetMapping("/entities/{entityId}/detail")
-    public ResponseEntity<AjaxResult> detail(@PathVariable("entityId") String entityId,
-            @RequestParam("category") String category,
-            @RequestHeader(value=REQUEST_ID_HEADER,required=false) String requestId) {
-        CockpitEntityDetailResponse response=service.load(resolveRequestId(requestId),category,decode(entityId));
-        return ResponseEntity.ok(AjaxResult.success(response));
-    }
-
-    @ExceptionHandler(CockpitInvalidRequestException.class)
-    public ResponseEntity<AjaxResult> invalid(HttpServletRequest request) {
-        return error(HttpStatus.BAD_REQUEST,service.invalidRequest(resolveRequestId(request.getHeader(REQUEST_ID_HEADER))));
-    }
-    @ExceptionHandler(CockpitEntityNotFoundException.class)
-    public ResponseEntity<AjaxResult> notFound(HttpServletRequest request) {
-        return error(HttpStatus.NOT_FOUND,service.notFound(resolveRequestId(request.getHeader(REQUEST_ID_HEADER))));
-    }
-    private ResponseEntity<AjaxResult> error(HttpStatus status,CockpitErrorPayload payload){return ResponseEntity.status(status).body(new AjaxResult(status.value(),payload.getMessage(),payload));}
-    private String resolveRequestId(String id){return StringUtils.isNotEmpty(id)?id:IdUtils.fastSimpleUUID();}
-    private String decode(String value){try{return UriUtils.decode(value,StandardCharsets.UTF_8);}catch(IllegalArgumentException e){throw new CockpitInvalidRequestException("invalid entity id encoding");}}
-}

+ 0 - 87
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitEquipmentArchiveController.java

@@ -1,87 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.equipment.CockpitEquipmentArchiveResponse;
-import com.zksy.cockpit.equipment.CockpitEquipmentArchiveService;
-import com.zksy.cockpit.foundation.CockpitDeviceNotFoundException;
-import com.zksy.cockpit.foundation.CockpitErrorPayload;
-import com.zksy.cockpit.foundation.CockpitInvalidCodeException;
-import com.zksy.cockpit.foundation.CockpitInvalidRequestException;
-import com.zksy.cockpit.foundation.CockpitReadException;
-import com.zksy.common.core.domain.AjaxResult;
-import com.zksy.common.utils.StringUtils;
-import com.zksy.common.utils.uuid.IdUtils;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.util.UriUtils;
-
-import java.nio.charset.StandardCharsets;
-
-import javax.servlet.http.HttpServletRequest;
-
-@RestController
-@RequestMapping("/api/cockpit/v1")
-public class CockpitEquipmentArchiveController {
-    private static final String REQUEST_ID_HEADER = "X-Request-Id";
-
-    private final CockpitEquipmentArchiveService archiveService;
-
-    public CockpitEquipmentArchiveController(CockpitEquipmentArchiveService archiveService) {
-        this.archiveService = archiveService;
-    }
-
-    @GetMapping("/equipments/{deviceCode}/archive")
-    public ResponseEntity<AjaxResult> equipmentArchive(
-            @PathVariable("deviceCode") String deviceCode,
-            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
-        CockpitEquipmentArchiveResponse response = archiveService.load(
-                resolveRequestId(requestId), decodePathSegment(deviceCode));
-        return ResponseEntity.ok(AjaxResult.success(response));
-    }
-
-    @ExceptionHandler(CockpitInvalidRequestException.class)
-    public ResponseEntity<AjaxResult> handleInvalidRequest(HttpServletRequest request) {
-        return error(HttpStatus.BAD_REQUEST, archiveService.invalidRequest(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER))));
-    }
-
-    @ExceptionHandler(CockpitInvalidCodeException.class)
-    public ResponseEntity<AjaxResult> handleInvalidCode(HttpServletRequest request) {
-        return error(HttpStatus.BAD_REQUEST, archiveService.invalidCode(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER))));
-    }
-
-    @ExceptionHandler(CockpitDeviceNotFoundException.class)
-    public ResponseEntity<AjaxResult> handleNotFound(HttpServletRequest request) {
-        return error(HttpStatus.NOT_FOUND, archiveService.notFound(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER))));
-    }
-
-    @ExceptionHandler(CockpitReadException.class)
-    public ResponseEntity<AjaxResult> handleReadFailure(HttpServletRequest request) {
-        return error(HttpStatus.INTERNAL_SERVER_ERROR, archiveService.serverError(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER))));
-    }
-
-    private ResponseEntity<AjaxResult> error(HttpStatus status, CockpitErrorPayload payload) {
-        return ResponseEntity.status(status)
-                .body(new AjaxResult(status.value(), payload.getMessage(), payload));
-    }
-
-    private String resolveRequestId(String requestId) {
-        return StringUtils.isNotEmpty(requestId) ? requestId : IdUtils.fastSimpleUUID();
-    }
-
-    private String decodePathSegment(String value) {
-        try {
-            return UriUtils.decode(value, StandardCharsets.UTF_8);
-        } catch (IllegalArgumentException exception) {
-            throw new CockpitInvalidCodeException("invalid device code encoding");
-        }
-    }
-}

+ 72 - 0
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitEquipmentController.java

@@ -0,0 +1,72 @@
+package com.zksy.web.controller.cockpit;
+
+import com.zksy.cockpit.collectionRecords.CockpitCollectionRecordsService;
+import com.zksy.cockpit.detail.CockpitEquipmentDetailAggregateResponse;
+import com.zksy.cockpit.detail.CockpitEquipmentDetailAggregateService;
+import com.zksy.cockpit.equipment.CockpitEquipmentArchiveResponse;
+import com.zksy.cockpit.equipment.CockpitEquipmentArchiveService;
+import com.zksy.cockpit.foundation.CockpitFreshnessResponse;
+import com.zksy.cockpit.foundation.CockpitFreshnessService;
+import com.zksy.cockpit.relation.CockpitDeviceFacilityRelationService;
+import com.zksy.cockpit.type.CockpitTypeMetricsResponse;
+import com.zksy.cockpit.type.CockpitTypeMetricsService;
+import com.zksy.common.core.domain.AjaxResult;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 设备类只读端点:档案、详情聚合、采集记录、新鲜度、当前指标。
+ */
+@RestController
+@RequestMapping("/api/cockpit/v1")
+public class CockpitEquipmentController extends BaseCockpitController {
+    private final CockpitEquipmentArchiveService archiveService;
+    private final CockpitEquipmentDetailAggregateService aggregateService;
+    private final CockpitCollectionRecordsService collectionRecordsService;
+    private final CockpitFreshnessService freshnessService;
+    private final CockpitTypeMetricsService metricsService;
+    private final CockpitDeviceFacilityRelationService relationService;
+
+    public CockpitEquipmentController(CockpitEquipmentArchiveService archiveService, CockpitEquipmentDetailAggregateService aggregateService, CockpitCollectionRecordsService collectionRecordsService, CockpitFreshnessService freshnessService, CockpitTypeMetricsService metricsService, CockpitDeviceFacilityRelationService relationService) {
+        this.archiveService = archiveService;
+        this.aggregateService = aggregateService;
+        this.collectionRecordsService = collectionRecordsService;
+        this.freshnessService = freshnessService;
+        this.metricsService = metricsService;
+        this.relationService = relationService;
+    }
+
+    @GetMapping("/equipments/facility-relations")
+    public ResponseEntity<AjaxResult> facilityRelations() {
+        return ResponseEntity.ok(AjaxResult.success(relationService.load()));
+    }
+
+    @GetMapping("/equipments/{deviceCode}/archive")
+    public ResponseEntity<AjaxResult> equipmentArchive(@PathVariable("deviceCode") String deviceCode, @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
+        CockpitEquipmentArchiveResponse response = archiveService.load(resolveRequestId(requestId), decodePathSegment(deviceCode));
+        return ResponseEntity.ok(AjaxResult.success(response));
+    }
+
+    @GetMapping("/equipments/{deviceCode}/detail-aggregate")
+    public ResponseEntity<AjaxResult> equipmentDetailAggregate(@PathVariable("deviceCode") String deviceCode, @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
+        CockpitEquipmentDetailAggregateResponse response = aggregateService.loadAggregate(resolveRequestId(requestId), decodePathSegment(deviceCode));
+        return ResponseEntity.ok(AjaxResult.success(response));
+    }
+
+    @GetMapping("/equipments/{deviceCode}/collection-records")
+    public ResponseEntity<AjaxResult> collectionRecords(@PathVariable("deviceCode") String deviceCode, @RequestHeader(value = "X-Request-Id", required = false) String requestId) {
+        return ResponseEntity.ok(AjaxResult.success(collectionRecordsService.load(resolveRequestId(requestId), decodePathSegment(deviceCode))));
+    }
+
+    @GetMapping("/equipments/{deviceCode}/freshness")
+    public ResponseEntity<AjaxResult> freshness(@PathVariable("deviceCode") String deviceCode, @RequestParam(value = "calibrationPeriodSeconds", required = false) Integer calibrationPeriodSeconds, @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
+        CockpitFreshnessResponse response = freshnessService.load(resolveRequestId(requestId), decodePathSegment(deviceCode), calibrationPeriodSeconds);
+        return ResponseEntity.ok(AjaxResult.success(response));
+    }
+
+    @GetMapping("/equipments/{deviceCode}/metrics/current")
+    public ResponseEntity<AjaxResult> currentMetrics(@PathVariable("deviceCode") String deviceCode, @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
+        CockpitTypeMetricsResponse response = metricsService.loadCurrent(resolveRequestId(requestId), decodePathSegment(deviceCode));
+        return ResponseEntity.ok(AjaxResult.success(response));
+    }
+}

+ 0 - 66
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitEquipmentDetailAggregateController.java

@@ -1,66 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.detail.CockpitEquipmentDetailAggregateResponse;
-import com.zksy.cockpit.detail.CockpitEquipmentDetailAggregateService;
-import com.zksy.cockpit.foundation.CockpitErrorCategory;
-import com.zksy.cockpit.foundation.CockpitErrorPayload;
-import com.zksy.cockpit.foundation.CockpitInvalidRequestException;
-import com.zksy.common.core.domain.AjaxResult;
-import com.zksy.common.utils.StringUtils;
-import com.zksy.common.utils.uuid.IdUtils;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.util.UriUtils;
-
-import javax.servlet.http.HttpServletRequest;
-import java.nio.charset.StandardCharsets;
-
-@RestController
-@RequestMapping("/api/cockpit/v1")
-public class CockpitEquipmentDetailAggregateController {
-    private static final String REQUEST_ID_HEADER = "X-Request-Id";
-
-    private final CockpitEquipmentDetailAggregateService aggregateService;
-
-    public CockpitEquipmentDetailAggregateController(CockpitEquipmentDetailAggregateService aggregateService) {
-        this.aggregateService = aggregateService;
-    }
-
-    @GetMapping("/equipments/{deviceCode}/detail-aggregate")
-    public ResponseEntity<AjaxResult> equipmentDetailAggregate(
-            @PathVariable("deviceCode") String deviceCode,
-            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
-        CockpitEquipmentDetailAggregateResponse response = aggregateService.loadAggregate(
-                resolveRequestId(requestId), decodePathSegment(deviceCode));
-        return ResponseEntity.ok(AjaxResult.success(response));
-    }
-
-    @ExceptionHandler(CockpitInvalidRequestException.class)
-    public ResponseEntity<AjaxResult> handleInvalidRequest(HttpServletRequest request) {
-        CockpitErrorPayload payload = new CockpitErrorPayload(
-                CockpitErrorCategory.INVALID_REQUEST,
-                "设备详情查询参数不合法",
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER)),
-                null);
-        return ResponseEntity.status(HttpStatus.BAD_REQUEST)
-                .body(new AjaxResult(HttpStatus.BAD_REQUEST.value(), payload.getMessage(), payload));
-    }
-
-    private String resolveRequestId(String requestId) {
-        return StringUtils.isNotEmpty(requestId) ? requestId : IdUtils.fastSimpleUUID();
-    }
-
-    private String decodePathSegment(String value) {
-        try {
-            return UriUtils.decode(value, StandardCharsets.UTF_8);
-        } catch (IllegalArgumentException exception) {
-            throw new CockpitInvalidRequestException("invalid device code encoding");
-        }
-    }
-}

+ 66 - 0
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitEventController.java

@@ -0,0 +1,66 @@
+package com.zksy.web.controller.cockpit;
+
+import com.zksy.cockpit.entity.CockpitEntityNotFoundException;
+import com.zksy.cockpit.event.*;
+import com.zksy.cockpit.foundation.CockpitInvalidRequestException;
+import com.zksy.common.core.domain.AjaxResult;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 事件类只读端点:当前事件、处置效率、历史分析、多维分析、事件详情。
+ */
+@RestController
+@RequestMapping("/api/cockpit/v1")
+public class CockpitEventController extends BaseCockpitController {
+    private final CockpitCurrentEventsService currentEventsService;
+    private final CockpitHandlingEfficiencyService handlingEfficiencyService;
+    private final CockpitHistoryAnalysisService historyAnalysisService;
+    private final CockpitMultidimensionalAnalysisService analysisService;
+    private final CockpitEventDetailService eventDetailService;
+
+    public CockpitEventController(CockpitCurrentEventsService currentEventsService, CockpitHandlingEfficiencyService handlingEfficiencyService, CockpitHistoryAnalysisService historyAnalysisService, CockpitMultidimensionalAnalysisService analysisService, CockpitEventDetailService eventDetailService) {
+        this.currentEventsService = currentEventsService;
+        this.handlingEfficiencyService = handlingEfficiencyService;
+        this.historyAnalysisService = historyAnalysisService;
+        this.analysisService = analysisService;
+        this.eventDetailService = eventDetailService;
+    }
+
+    @GetMapping("/events/current")
+    public ResponseEntity<AjaxResult> currentEvents(@RequestParam(value = "mode", required = false) String mode, @RequestParam(value = "level", required = false) String level, @RequestParam(value = "industry", required = false) String industry, @RequestParam(value = "status", required = false) String status, @RequestParam(value = "district", required = false) String district, @RequestParam(value = "page", defaultValue = "1") Integer page, @RequestParam(value = "pageSize", defaultValue = "100") Integer pageSize, @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
+        return ResponseEntity.ok(AjaxResult.success(currentEventsService.load(resolveRequestId(requestId), mode, level, industry, status, district, page, pageSize)));
+    }
+
+    @GetMapping("/events/handling-efficiency")
+    public ResponseEntity<AjaxResult> handlingEfficiency(@RequestParam(value = "eventFamily", required = false) String eventFamily, @RequestParam(value = "industry", required = false) String industry, @RequestParam(value = "level", required = false) String level, @RequestParam(value = "workOrderState", required = false) String workOrderState, @RequestParam(value = "district", required = false) String district, @RequestParam(value = "startTime", required = false) String startTime, @RequestParam(value = "endTime", required = false) String endTime, @RequestParam(value = "page", defaultValue = "1") Integer page, @RequestParam(value = "pageSize", defaultValue = "100") Integer pageSize, @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
+        return ResponseEntity.ok(AjaxResult.success(handlingEfficiencyService.load(resolveRequestId(requestId), eventFamily, industry, level, workOrderState, district, startTime, endTime, page, pageSize)));
+    }
+
+    @GetMapping("/events/history-analysis")
+    public ResponseEntity<AjaxResult> historyAnalysis(@RequestParam(value = "eventFamily", required = false) String eventFamily, @RequestParam(value = "level", required = false) String level, @RequestParam(value = "industry", required = false) String industry, @RequestParam(value = "district", required = false) String district, @RequestParam(value = "startTime", required = false) String startTime, @RequestParam(value = "endTime", required = false) String endTime, @RequestParam(value = "page", defaultValue = "1") Integer page, @RequestParam(value = "pageSize", defaultValue = "100") Integer pageSize, @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
+        return ResponseEntity.ok(AjaxResult.success(historyAnalysisService.load(resolveRequestId(requestId), eventFamily, level, industry, district, startTime, endTime, page, pageSize)));
+    }
+
+    @GetMapping("/events/multidimensional-analysis")
+    public ResponseEntity<AjaxResult> multidimensionalAnalysis(@RequestParam(value = "eventFamily", required = false) String eventFamily, @RequestParam(value = "industry", required = false) String industry, @RequestParam(value = "level", required = false) String level, @RequestParam(value = "eventType", required = false) String eventType, @RequestParam(value = "cause", required = false) String cause, @RequestParam(value = "deviceType", required = false) String deviceType, @RequestParam(value = "district", required = false) String district, @RequestParam(value = "startTime", required = false) String startTime, @RequestParam(value = "endTime", required = false) String endTime, @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
+        return ResponseEntity.ok(AjaxResult.success(analysisService.load(resolveRequestId(requestId), eventFamily, industry, level, eventType, cause, deviceType, district, startTime, endTime)));
+    }
+
+    @GetMapping("/events/{eventId}/detail")
+    public ResponseEntity<AjaxResult> event(@PathVariable String eventId, @RequestParam(required = false) String family) {
+        String kind = family == null ? "" : family.trim().toUpperCase();
+        if ("WARNING".equals(kind)) {
+            Object detail = eventDetailService.warningDetail(eventId);
+            if (detail == null) throw new CockpitEntityNotFoundException("预警不存在");
+            return ResponseEntity.ok(AjaxResult.success(detail));
+        }
+        if ("ALARM".equals(kind)) {
+            Object detail = eventDetailService.alarmDetail(eventId);
+            if (detail == null) throw new CockpitEntityNotFoundException("报警不存在");
+            return ResponseEntity.ok(AjaxResult.success(detail));
+        }
+        throw new CockpitInvalidRequestException("family 只取 WARNING 或 ALARM");
+    }
+
+}

+ 0 - 60
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitEventDetailController.java

@@ -1,60 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.base.alarm.dto.AlarmVO;
-import com.zksy.cockpit.event.CockpitEventDetailService;
-import com.zksy.cockpit.foundation.CockpitErrorCategory;
-import com.zksy.cockpit.foundation.CockpitErrorPayload;
-import com.zksy.common.core.domain.AjaxResult;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.*;
-
-import java.time.OffsetDateTime;
-import java.time.ZoneId;
-import java.util.Map;
-
-/**
- * 驾驶舱只读事件/工单详情门面(维护者 2026-10-29)。
- *
- * <p>路径固定在免鉴权的 {@code /api/cockpit/v1/**} 下:前端不直接打 mobile 域
- * (那套接口按登录用户做范围裁剪,驾驶舱没有登录态)。只读、无写入口。
- */
-@RestController
-@RequestMapping("/api/cockpit/v1")
-public class CockpitEventDetailController {
-
-    private final CockpitEventDetailService events;
-
-    public CockpitEventDetailController(CockpitEventDetailService events) {
-        this.events = events;
-    }
-
-    /** 预警/报警详情;family 只认 WARNING / ALARM(认不出 400,不猜)。 */
-    @GetMapping("/events/{eventId}/detail")
-    public ResponseEntity<AjaxResult> event(@PathVariable String eventId,
-                                            @RequestParam(required = false) String family) {
-        String kind = family == null ? "" : family.trim().toUpperCase();
-        if ("WARNING".equals(kind)) {
-            Map<String, Object> detail = events.warningDetail(eventId);
-            if (detail == null) return notFound("预警");
-            return ResponseEntity.ok(AjaxResult.success(detail));
-        }
-        if ("ALARM".equals(kind)) {
-            AlarmVO detail = events.alarmDetail(eventId);
-            if (detail == null) return notFound("报警");
-            return ResponseEntity.ok(AjaxResult.success(detail));
-        }
-        return error(HttpStatus.BAD_REQUEST, CockpitErrorCategory.INVALID_REQUEST, "family 只取 WARNING 或 ALARM");
-    }
-
-    private ResponseEntity<AjaxResult> notFound(String label) {
-        return error(HttpStatus.NOT_FOUND, CockpitErrorCategory.NOT_FOUND, label + "不存在");
-    }
-
-    private ResponseEntity<AjaxResult> error(HttpStatus status, CockpitErrorCategory category, String message) {
-        CockpitErrorPayload payload = new CockpitErrorPayload(category, message,
-                java.util.UUID.randomUUID().toString().replace("-", ""),
-                OffsetDateTime.now(ZoneId.of("Asia/Shanghai")).toString());
-        return ResponseEntity.status(status).body(new AjaxResult(status.value(), message, payload));
-    }
-}

+ 115 - 0
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitExceptionAdvice.java

@@ -0,0 +1,115 @@
+package com.zksy.web.controller.cockpit;
+
+import com.zksy.cockpit.entity.CockpitEntityNotFoundException;
+import com.zksy.cockpit.foundation.CockpitDeviceNotFoundException;
+import com.zksy.cockpit.foundation.CockpitErrorCategory;
+import com.zksy.cockpit.foundation.CockpitErrorPayload;
+import com.zksy.cockpit.foundation.CockpitInvalidCodeException;
+import com.zksy.cockpit.foundation.CockpitInvalidRequestException;
+import com.zksy.cockpit.foundation.CockpitReadException;
+import com.zksy.cockpit.foundation.CockpitSnapshotExpiredException;
+import com.zksy.cockpit.foundation.CockpitMonitoringPointNotFoundException;
+import com.zksy.cockpit.video.CockpitVideoException;
+import com.zksy.common.core.domain.AjaxResult;
+import com.zksy.common.utils.StringUtils;
+import com.zksy.common.utils.uuid.IdUtils;
+import org.springframework.core.Ordered;
+import org.springframework.core.annotation.Order;
+import org.springframework.http.CacheControl;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.http.converter.HttpMessageNotReadableException;
+import org.springframework.web.bind.MissingServletRequestParameterException;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.RestControllerAdvice;
+import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
+
+import javax.servlet.http.HttpServletRequest;
+import java.time.Clock;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * 驾驶舱统一异常出口:Controller 只负责路由,错误响应在这里统一构造。
+ */
+@RestControllerAdvice(basePackages = "com.zksy.web.controller.cockpit")
+@Order(Ordered.HIGHEST_PRECEDENCE)
+public class CockpitExceptionAdvice {
+    private static final String REQUEST_ID_HEADER = "X-Request-Id";
+
+    private final Clock clock;
+
+    public CockpitExceptionAdvice() {
+        this(Clock.system(ZoneId.of("Asia/Shanghai")));
+    }
+
+    public CockpitExceptionAdvice(Clock clock) {
+        this.clock = clock;
+    }
+
+    @ExceptionHandler(CockpitInvalidRequestException.class)
+    public ResponseEntity<AjaxResult> invalidRequest(CockpitInvalidRequestException exception, HttpServletRequest request) {
+        return error(HttpStatus.BAD_REQUEST, CockpitErrorCategory.INVALID_REQUEST, exception.getMessage(), request);
+    }
+
+    @ExceptionHandler(CockpitInvalidCodeException.class)
+    public ResponseEntity<AjaxResult> invalidCode(CockpitInvalidCodeException exception, HttpServletRequest request) {
+        return error(HttpStatus.BAD_REQUEST, CockpitErrorCategory.INVALID_REQUEST, exception.getMessage(), request);
+    }
+
+    @ExceptionHandler(CockpitSnapshotExpiredException.class)
+    public ResponseEntity<AjaxResult> snapshotExpired(CockpitSnapshotExpiredException exception, HttpServletRequest request) {
+        return error(HttpStatus.BAD_REQUEST, CockpitErrorCategory.SNAPSHOT_EXPIRED, exception.getMessage(), request);
+    }
+
+    @ExceptionHandler({CockpitDeviceNotFoundException.class, CockpitEntityNotFoundException.class, CockpitMonitoringPointNotFoundException.class})
+    public ResponseEntity<AjaxResult> notFound(RuntimeException exception, HttpServletRequest request) {
+        return error(HttpStatus.NOT_FOUND, CockpitErrorCategory.NOT_FOUND, exception.getMessage(), request);
+    }
+
+    @ExceptionHandler(CockpitReadException.class)
+    public ResponseEntity<AjaxResult> readFailure(CockpitReadException exception, HttpServletRequest request) {
+        return error(HttpStatus.INTERNAL_SERVER_ERROR, CockpitErrorCategory.SERVER_ERROR, exception.getMessage(), request);
+    }
+
+    @ExceptionHandler(RuntimeException.class)
+    public ResponseEntity<AjaxResult> unexpectedFailure(RuntimeException exception, HttpServletRequest request) {
+        return error(HttpStatus.INTERNAL_SERVER_ERROR, CockpitErrorCategory.SERVER_ERROR, "服务暂时不可用", request);
+    }
+
+    @ExceptionHandler({HttpMessageNotReadableException.class, MissingServletRequestParameterException.class, MethodArgumentTypeMismatchException.class})
+    public ResponseEntity<AjaxResult> bindingFailure(Exception exception, HttpServletRequest request) {
+        return error(HttpStatus.BAD_REQUEST, CockpitErrorCategory.INVALID_REQUEST, "请求参数无效", request);
+    }
+
+    @ExceptionHandler(CockpitVideoException.class)
+    public ResponseEntity<AjaxResult> videoFailure(CockpitVideoException exception, HttpServletRequest request) {
+        Map<String, Object> data = metadata(request);
+        data.put("category", exception.getCategory());
+        data.put("message", exception.getMessage());
+        return ResponseEntity.status(exception.getStatus()).cacheControl(CacheControl.noStore()).body(new AjaxResult(exception.getStatus(), exception.getMessage(), data));
+    }
+
+    private ResponseEntity<AjaxResult> error(HttpStatus status, CockpitErrorCategory category, String message, HttpServletRequest request) {
+        CockpitErrorPayload payload = new CockpitErrorPayload(category, message, requestId(request), serverTime());
+        return ResponseEntity.status(status).body(new AjaxResult(status.value(), message, payload));
+    }
+
+    private String requestId(HttpServletRequest request) {
+        String value = request.getHeader(REQUEST_ID_HEADER);
+        return StringUtils.isNotEmpty(value) ? value : IdUtils.fastSimpleUUID();
+    }
+
+    private Map<String, Object> metadata(HttpServletRequest request) {
+        Map<String, Object> data = new LinkedHashMap<>();
+        data.put("requestId", requestId(request));
+        data.put("serverTime", serverTime());
+        return data;
+    }
+
+    private String serverTime() {
+        return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(clock.instant().atZone(ZoneId.of("Asia/Shanghai")));
+    }
+}

+ 0 - 51
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitFacilityGeometryController.java

@@ -1,51 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.foundation.CockpitErrorCategory;
-import com.zksy.cockpit.foundation.CockpitErrorPayload;
-import com.zksy.cockpit.geometry.CockpitFacilityGeometryService;
-import com.zksy.common.core.domain.AjaxResult;
-import com.zksy.common.utils.uuid.IdUtils;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-import java.time.Clock;
-import java.time.ZoneId;
-import java.time.format.DateTimeFormatter;
-
-@RestController
-@RequestMapping("/api/cockpit/v1")
-public class CockpitFacilityGeometryController {
-    private final CockpitFacilityGeometryService service;
-    private final Clock clock;
-
-    public CockpitFacilityGeometryController(CockpitFacilityGeometryService service, Clock clock) {
-        this.service = service;
-        this.clock = clock;
-    }
-
-    @GetMapping("/infrastructure/geometry")
-    public ResponseEntity<AjaxResult> geometry() {
-        return ResponseEntity.ok(AjaxResult.success(service.load()));
-    }
-
-    @ExceptionHandler(RuntimeException.class)
-    public ResponseEntity<AjaxResult> handleReadFailure(HttpServletRequest request, RuntimeException exception) {
-        // Includes transaction begin/commit failures thrown outside service.load()'s body.
-        org.slf4j.LoggerFactory.getLogger(CockpitFacilityGeometryController.class)
-                .error("Facility geometry read failed", exception);
-        String requestId = request.getHeader("X-Request-Id");
-        if (requestId == null || requestId.trim().isEmpty()) {
-            requestId = IdUtils.fastSimpleUUID();
-        }
-        CockpitErrorPayload payload = new CockpitErrorPayload(CockpitErrorCategory.SERVER_ERROR,
-                "facility geometry source unavailable", requestId,
-                DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(clock.instant().atZone(ZoneId.of("Asia/Shanghai"))));
-        return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
-                .body(new AjaxResult(500, payload.getMessage(), payload));
-    }
-}

+ 0 - 45
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitFoundationController.java

@@ -1,45 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.foundation.CockpitErrorPayload;
-import com.zksy.cockpit.foundation.CockpitFoundationService;
-import com.zksy.cockpit.foundation.CockpitReadException;
-import com.zksy.common.core.domain.AjaxResult;
-import com.zksy.common.utils.StringUtils;
-import com.zksy.common.utils.uuid.IdUtils;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-
-@RestController
-@RequestMapping("/api/cockpit/v1")
-public class CockpitFoundationController {
-    private static final String REQUEST_ID_HEADER = "X-Request-Id";
-
-    private final CockpitFoundationService foundationService;
-
-    public CockpitFoundationController(CockpitFoundationService foundationService) {
-        this.foundationService = foundationService;
-    }
-
-    @GetMapping("/foundation")
-    public ResponseEntity<AjaxResult> foundation(@RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
-        return ResponseEntity.ok(AjaxResult.success(foundationService.load(resolveRequestId(requestId))));
-    }
-
-    @ExceptionHandler(CockpitReadException.class)
-    public ResponseEntity<AjaxResult> handleReadFailure(HttpServletRequest request) {
-        CockpitErrorPayload payload = foundationService.serverError(resolveRequestId(request.getHeader(REQUEST_ID_HEADER)));
-        return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
-                .body(AjaxResult.error(payload.getMessage(), payload));
-    }
-
-    private String resolveRequestId(String requestId) {
-        return StringUtils.isNotEmpty(requestId) ? requestId : IdUtils.fastSimpleUUID();
-    }
-}

+ 0 - 100
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitFreshnessController.java

@@ -1,100 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.foundation.CockpitDeviceNotFoundException;
-import com.zksy.cockpit.foundation.CockpitErrorCategory;
-import com.zksy.cockpit.foundation.CockpitErrorPayload;
-import com.zksy.cockpit.foundation.CockpitFreshnessResponse;
-import com.zksy.cockpit.foundation.CockpitFreshnessService;
-import com.zksy.cockpit.foundation.CockpitInvalidRequestException;
-import com.zksy.cockpit.foundation.CockpitReadException;
-import com.zksy.common.core.domain.AjaxResult;
-import com.zksy.common.utils.StringUtils;
-import com.zksy.common.utils.uuid.IdUtils;
-import java.time.Clock;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.util.UriUtils;
-import java.time.ZoneId;
-import java.time.format.DateTimeFormatter;
-
-import javax.servlet.http.HttpServletRequest;
-import java.nio.charset.StandardCharsets;
-
-@RestController
-@RequestMapping("/api/cockpit/v1")
-public class CockpitFreshnessController {
-    private static final String REQUEST_ID_HEADER = "X-Request-Id";
-
-    private static final DateTimeFormatter BUSINESS_TIME = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
-    private static final ZoneId BUSINESS_ZONE = ZoneId.of("Asia/Shanghai");
-
-    private final CockpitFreshnessService freshnessService;
-    private final Clock clock;
-
-    public CockpitFreshnessController(CockpitFreshnessService freshnessService, Clock clock) {
-        this.freshnessService = freshnessService;
-        this.clock = clock;
-    }
-
-    @GetMapping("/equipments/{deviceCode}/freshness")
-    public ResponseEntity<AjaxResult> freshness(
-            @PathVariable("deviceCode") String deviceCode,
-            @RequestParam(value = "calibrationPeriodSeconds", required = false) Integer calibrationPeriodSeconds,
-            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
-        CockpitFreshnessResponse response = freshnessService.load(
-                resolveRequestId(requestId), decodePathSegment(deviceCode), calibrationPeriodSeconds);
-        return ResponseEntity.ok(AjaxResult.success(response));
-    }
-
-    @ExceptionHandler(CockpitInvalidRequestException.class)
-    public ResponseEntity<AjaxResult> handleInvalidRequest(HttpServletRequest request) {
-        return badRequest(CockpitErrorCategory.INVALID_REQUEST, "驾驶舱新鲜度查询参数不合法", request);
-    }
-
-    @ExceptionHandler(CockpitDeviceNotFoundException.class)
-    public ResponseEntity<AjaxResult> handleNotFound(HttpServletRequest request) {
-        return error(HttpStatus.NOT_FOUND, CockpitErrorCategory.NOT_FOUND, "驾驶舱新鲜度数据不存在", request);
-    }
-
-    @ExceptionHandler(CockpitReadException.class)
-    public ResponseEntity<AjaxResult> handleReadFailure(HttpServletRequest request) {
-        return error(HttpStatus.INTERNAL_SERVER_ERROR, CockpitErrorCategory.SERVER_ERROR, "驾驶舱新鲜度数据暂不可用", request);
-    }
-
-    private ResponseEntity<AjaxResult> badRequest(CockpitErrorCategory category, String message, HttpServletRequest request) {
-        return error(HttpStatus.BAD_REQUEST, category, message, request);
-    }
-
-    private ResponseEntity<AjaxResult> error(
-            HttpStatus status,
-            CockpitErrorCategory category,
-            String message,
-            HttpServletRequest request) {
-        CockpitErrorPayload payload = new CockpitErrorPayload(
-                category,
-                message,
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER)),
-                BUSINESS_TIME.format(clock.instant().atZone(BUSINESS_ZONE)));
-        return ResponseEntity.status(status)
-                .body(new AjaxResult(status.value(), payload.getMessage(), payload));
-    }
-
-    private String resolveRequestId(String requestId) {
-        return StringUtils.isNotEmpty(requestId) ? requestId : IdUtils.fastSimpleUUID();
-    }
-
-    private String decodePathSegment(String value) {
-        try {
-            return UriUtils.decode(value, StandardCharsets.UTF_8);
-        } catch (IllegalArgumentException exception) {
-            throw new CockpitInvalidRequestException("invalid device code encoding");
-        }
-    }
-}

+ 0 - 83
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitHandlingEfficiencyController.java

@@ -1,83 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.event.CockpitHandlingEfficiencyService;
-import com.zksy.cockpit.foundation.CockpitErrorPayload;
-import com.zksy.cockpit.foundation.CockpitInvalidRequestException;
-import com.zksy.cockpit.foundation.CockpitReadException;
-import com.zksy.common.core.domain.AjaxResult;
-import com.zksy.common.utils.StringUtils;
-import com.zksy.common.utils.uuid.IdUtils;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-
-@RestController
-@RequestMapping("/api/cockpit/v1")
-public class CockpitHandlingEfficiencyController {
-    private static final String REQUEST_ID_HEADER = "X-Request-Id";
-
-    private final CockpitHandlingEfficiencyService handlingEfficiencyService;
-
-    public CockpitHandlingEfficiencyController(
-            CockpitHandlingEfficiencyService handlingEfficiencyService) {
-        this.handlingEfficiencyService = handlingEfficiencyService;
-    }
-
-    @GetMapping("/events/handling-efficiency")
-    public ResponseEntity<AjaxResult> handlingEfficiency(
-            @RequestParam(value = "eventFamily", required = false) String eventFamily,
-            @RequestParam(value = "industry", required = false) String industry,
-            @RequestParam(value = "level", required = false) String level,
-            @RequestParam(value = "workOrderState", required = false) String workOrderState,
-            // 范围维度=片区(票 77):语义与事件族其它端点同套(0/1/2/UNASSIGNED,非法 400)。
-            @RequestParam(value = "district", required = false) String district,
-            @RequestParam(value = "startTime", required = false) String startTime,
-            @RequestParam(value = "endTime", required = false) String endTime,
-            @RequestParam(value = "page", defaultValue = "1") Integer page,
-            @RequestParam(value = "pageSize", defaultValue = "100") Integer pageSize,
-            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
-        return ResponseEntity.ok(AjaxResult.success(
-                handlingEfficiencyService.load(
-                        resolveRequestId(requestId),
-                        eventFamily,
-                        industry,
-                        level,
-                        workOrderState,
-                        district,
-                        startTime,
-                        endTime,
-                        page,
-                        pageSize)));
-    }
-
-    @ExceptionHandler(CockpitInvalidRequestException.class)
-    public ResponseEntity<AjaxResult> handleInvalidRequest(
-            HttpServletRequest request,
-            CockpitInvalidRequestException exception) {
-        return error(HttpStatus.BAD_REQUEST, handlingEfficiencyService.invalidRequest(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER)),
-                exception.getMessage()));
-    }
-
-    @ExceptionHandler(CockpitReadException.class)
-    public ResponseEntity<AjaxResult> handleReadFailure(HttpServletRequest request) {
-        return error(HttpStatus.INTERNAL_SERVER_ERROR, handlingEfficiencyService.serverError(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER))));
-    }
-
-    private ResponseEntity<AjaxResult> error(HttpStatus status, CockpitErrorPayload payload) {
-        return ResponseEntity.status(status)
-                .body(new AjaxResult(status.value(), payload.getMessage(), payload));
-    }
-
-    private String resolveRequestId(String requestId) {
-        return StringUtils.isNotEmpty(requestId) ? requestId : IdUtils.fastSimpleUUID();
-    }
-}

+ 0 - 80
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitHistoryAnalysisController.java

@@ -1,80 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.event.CockpitHistoryAnalysisService;
-import com.zksy.cockpit.foundation.CockpitErrorPayload;
-import com.zksy.cockpit.foundation.CockpitInvalidRequestException;
-import com.zksy.cockpit.foundation.CockpitReadException;
-import com.zksy.common.core.domain.AjaxResult;
-import com.zksy.common.utils.StringUtils;
-import com.zksy.common.utils.uuid.IdUtils;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-
-@RestController
-@RequestMapping("/api/cockpit/v1")
-public class CockpitHistoryAnalysisController {
-    private static final String REQUEST_ID_HEADER = "X-Request-Id";
-
-    private final CockpitHistoryAnalysisService historyAnalysisService;
-
-    public CockpitHistoryAnalysisController(CockpitHistoryAnalysisService historyAnalysisService) {
-        this.historyAnalysisService = historyAnalysisService;
-    }
-
-    @GetMapping("/events/history-analysis")
-    public ResponseEntity<AjaxResult> historyAnalysis(
-            @RequestParam(value = "eventFamily", required = false) String eventFamily,
-            @RequestParam(value = "level", required = false) String level,
-            @RequestParam(value = "industry", required = false) String industry,
-            // 范围维度=片区(票 77):语义与事件族其它端点同套(0/1/2/UNASSIGNED,非法 400)。
-            @RequestParam(value = "district", required = false) String district,
-            @RequestParam(value = "startTime", required = false) String startTime,
-            @RequestParam(value = "endTime", required = false) String endTime,
-            @RequestParam(value = "page", defaultValue = "1") Integer page,
-            @RequestParam(value = "pageSize", defaultValue = "100") Integer pageSize,
-            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
-        return ResponseEntity.ok(AjaxResult.success(
-                historyAnalysisService.load(
-                        resolveRequestId(requestId),
-                        eventFamily,
-                        level,
-                        industry,
-                        district,
-                        startTime,
-                        endTime,
-                        page,
-                        pageSize)));
-    }
-
-    @ExceptionHandler(CockpitInvalidRequestException.class)
-    public ResponseEntity<AjaxResult> handleInvalidRequest(
-            HttpServletRequest request,
-            CockpitInvalidRequestException exception) {
-        return error(HttpStatus.BAD_REQUEST, historyAnalysisService.invalidRequest(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER)),
-                exception.getMessage()));
-    }
-
-    @ExceptionHandler(CockpitReadException.class)
-    public ResponseEntity<AjaxResult> handleReadFailure(HttpServletRequest request) {
-        return error(HttpStatus.INTERNAL_SERVER_ERROR, historyAnalysisService.serverError(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER))));
-    }
-
-    private ResponseEntity<AjaxResult> error(HttpStatus status, CockpitErrorPayload payload) {
-        return ResponseEntity.status(status)
-                .body(new AjaxResult(status.value(), payload.getMessage(), payload));
-    }
-
-    private String resolveRequestId(String requestId) {
-        return StringUtils.isNotEmpty(requestId) ? requestId : IdUtils.fastSimpleUUID();
-    }
-}

+ 0 - 72
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitInfrastructureBaseArchivesController.java

@@ -1,72 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.foundation.CockpitErrorPayload;
-import com.zksy.cockpit.foundation.CockpitInvalidRequestException;
-import com.zksy.cockpit.foundation.CockpitReadException;
-import com.zksy.cockpit.infrastructure.CockpitInfrastructureBaseArchivesService;
-import com.zksy.common.core.domain.AjaxResult;
-import com.zksy.common.utils.StringUtils;
-import com.zksy.common.utils.uuid.IdUtils;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-
-@RestController
-@RequestMapping("/api/cockpit/v1")
-public class CockpitInfrastructureBaseArchivesController {
-    private static final String REQUEST_ID_HEADER = "X-Request-Id";
-
-    private final CockpitInfrastructureBaseArchivesService baseArchivesService;
-
-    public CockpitInfrastructureBaseArchivesController(
-            CockpitInfrastructureBaseArchivesService baseArchivesService) {
-        this.baseArchivesService = baseArchivesService;
-    }
-
-    @GetMapping("/infrastructure/base-archives")
-    public ResponseEntity<AjaxResult> baseArchives(
-            @RequestParam(value = "industry", required = false) String industry,
-            @RequestParam(value = "facilityType", required = false) String facilityType,
-            @RequestParam(value = "ageBucket", required = false) String ageBucket,
-            @RequestParam(value = "district", required = false) String district,
-            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
-        return ResponseEntity.ok(AjaxResult.success(
-                baseArchivesService.load(
-                        resolveRequestId(requestId),
-                        industry,
-                        facilityType,
-                        ageBucket,
-                        district)));
-    }
-
-    @ExceptionHandler(CockpitInvalidRequestException.class)
-    public ResponseEntity<AjaxResult> handleInvalidRequest(
-            HttpServletRequest request,
-            CockpitInvalidRequestException exception) {
-        return error(HttpStatus.BAD_REQUEST, baseArchivesService.invalidRequest(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER)),
-                exception.getMessage()));
-    }
-
-    @ExceptionHandler(CockpitReadException.class)
-    public ResponseEntity<AjaxResult> handleReadFailure(HttpServletRequest request) {
-        return error(HttpStatus.INTERNAL_SERVER_ERROR, baseArchivesService.serverError(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER))));
-    }
-
-    private ResponseEntity<AjaxResult> error(HttpStatus status, CockpitErrorPayload payload) {
-        return ResponseEntity.status(status)
-                .body(new AjaxResult(status.value(), payload.getMessage(), payload));
-    }
-
-    private String resolveRequestId(String requestId) {
-        return StringUtils.isNotEmpty(requestId) ? requestId : IdUtils.fastSimpleUUID();
-    }
-}

+ 70 - 0
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitInfrastructureController.java

@@ -0,0 +1,70 @@
+package com.zksy.web.controller.cockpit;
+
+import com.zksy.cockpit.entity.CockpitEntityDetailService;
+import com.zksy.cockpit.geometry.CockpitFacilityGeometryService;
+import com.zksy.cockpit.infrastructure.CockpitInfrastructureBaseArchivesService;
+import com.zksy.cockpit.infrastructure.CockpitInfrastructureEmergencySupportService;
+import com.zksy.cockpit.infrastructure.CockpitInfrastructureManagementInformationService;
+import com.zksy.cockpit.infrastructure.CockpitInfrastructureOperatingInformationService;
+import com.zksy.common.core.domain.AjaxResult;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+import java.time.Clock;
+
+/**
+ * 基础设施类只读端点:基础档案、应急保障、管理信息、运行信息。
+ *
+ */
+@RestController
+@RequestMapping("/api/cockpit/v1")
+public class CockpitInfrastructureController extends BaseCockpitController {
+    private final CockpitInfrastructureBaseArchivesService baseArchivesService;
+    private final CockpitInfrastructureEmergencySupportService emergencySupportService;
+    private final CockpitInfrastructureManagementInformationService managementInformationService;
+    private final CockpitInfrastructureOperatingInformationService operatingInformationService;
+    private final CockpitFacilityGeometryService geometryService;
+    private final CockpitEntityDetailService entityDetailService;
+    private final Clock clock;
+
+    public CockpitInfrastructureController(CockpitInfrastructureBaseArchivesService baseArchivesService, CockpitInfrastructureEmergencySupportService emergencySupportService, CockpitInfrastructureManagementInformationService managementInformationService, CockpitInfrastructureOperatingInformationService operatingInformationService, CockpitFacilityGeometryService geometryService, CockpitEntityDetailService entityDetailService, Clock clock) {
+        this.baseArchivesService = baseArchivesService;
+        this.emergencySupportService = emergencySupportService;
+        this.managementInformationService = managementInformationService;
+        this.operatingInformationService = operatingInformationService;
+        this.geometryService = geometryService;
+        this.entityDetailService = entityDetailService;
+        this.clock = clock;
+    }
+
+    @GetMapping("/infrastructure/entities/{entityId}/detail")
+    public ResponseEntity<AjaxResult> entityDetail(@PathVariable("entityId") String entityId, @RequestParam("category") String category, @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
+        return ResponseEntity.ok(AjaxResult.success(entityDetailService.load(resolveRequestId(requestId), category, decodePathSegment(entityId))));
+    }
+
+    @GetMapping("/infrastructure/base-archives")
+    public ResponseEntity<AjaxResult> baseArchives(@RequestParam(value = "industry", required = false) String industry, @RequestParam(value = "facilityType", required = false) String facilityType, @RequestParam(value = "ageBucket", required = false) String ageBucket, @RequestParam(value = "district", required = false) String district, @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
+        return ResponseEntity.ok(AjaxResult.success(baseArchivesService.load(resolveRequestId(requestId), industry, facilityType, ageBucket, district)));
+    }
+
+    @GetMapping("/infrastructure/emergency-support")
+    public ResponseEntity<AjaxResult> emergencySupport(@RequestParam(value = "category", required = false) String category, @RequestParam(value = "industry", required = false) String industry, @RequestParam(value = "district", required = false) String district, @RequestParam(value = "area", required = false) String area, @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
+        return ResponseEntity.ok(AjaxResult.success(emergencySupportService.load(resolveRequestId(requestId), category, industry, area, district)));
+    }
+
+    @GetMapping("/infrastructure/management-information")
+    public ResponseEntity<AjaxResult> managementInformation(@RequestParam(value = "industry", required = false) String industry, @RequestParam(value = "district", required = false) String district, @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
+        return ResponseEntity.ok(AjaxResult.success(managementInformationService.load(resolveRequestId(requestId), industry, district)));
+    }
+
+    @GetMapping("/infrastructure/operating-information")
+    public ResponseEntity<AjaxResult> operatingInformation(@RequestParam(value = "industry", required = false) String industry, @RequestParam(value = "district", required = false) String district, @RequestParam(value = "range", required = false) String range, @RequestParam(value = "from", required = false) String from, @RequestParam(value = "to", required = false) String to, @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
+        return ResponseEntity.ok(AjaxResult.success(operatingInformationService.load(resolveRequestId(requestId), industry, district, range, from, to)));
+    }
+
+    @GetMapping("/infrastructure/geometry")
+    public ResponseEntity<AjaxResult> geometry() {
+        return ResponseEntity.ok(AjaxResult.success(geometryService.load()));
+    }
+
+}

+ 0 - 69
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitInfrastructureEmergencySupportController.java

@@ -1,69 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.foundation.CockpitErrorPayload;
-import com.zksy.cockpit.foundation.CockpitInvalidRequestException;
-import com.zksy.cockpit.foundation.CockpitReadException;
-import com.zksy.cockpit.infrastructure.CockpitInfrastructureEmergencySupportService;
-import com.zksy.common.core.domain.AjaxResult;
-import com.zksy.common.utils.StringUtils;
-import com.zksy.common.utils.uuid.IdUtils;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-
-@RestController
-@RequestMapping("/api/cockpit/v1")
-public class CockpitInfrastructureEmergencySupportController {
-    private static final String REQUEST_ID_HEADER = "X-Request-Id";
-
-    private final CockpitInfrastructureEmergencySupportService emergencySupportService;
-
-    public CockpitInfrastructureEmergencySupportController(
-            CockpitInfrastructureEmergencySupportService emergencySupportService) {
-        this.emergencySupportService = emergencySupportService;
-    }
-
-    @GetMapping("/infrastructure/emergency-support")
-    public ResponseEntity<AjaxResult> emergencySupport(
-            @RequestParam(value = "category", required = false) String category,
-            @RequestParam(value = "industry", required = false) String industry,
-            // 片区(票 81):0/1/2/UNASSIGNED,不传=全域,非法值 400(校验在 service)。
-            @RequestParam(value = "district", required = false) String district,
-            @RequestParam(value = "area", required = false) String area,
-            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
-        return ResponseEntity.ok(AjaxResult.success(
-                emergencySupportService.load(
-                        resolveRequestId(requestId), category, industry, area, district)));
-    }
-
-    @ExceptionHandler(CockpitInvalidRequestException.class)
-    public ResponseEntity<AjaxResult> handleInvalidRequest(
-            HttpServletRequest request,
-            CockpitInvalidRequestException exception) {
-        return error(HttpStatus.BAD_REQUEST, emergencySupportService.invalidRequest(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER)),
-                exception.getMessage()));
-    }
-
-    @ExceptionHandler(CockpitReadException.class)
-    public ResponseEntity<AjaxResult> handleReadFailure(HttpServletRequest request) {
-        return error(HttpStatus.INTERNAL_SERVER_ERROR, emergencySupportService.serverError(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER))));
-    }
-
-    private ResponseEntity<AjaxResult> error(HttpStatus status, CockpitErrorPayload payload) {
-        return ResponseEntity.status(status)
-                .body(new AjaxResult(status.value(), payload.getMessage(), payload));
-    }
-
-    private String resolveRequestId(String requestId) {
-        return StringUtils.isNotEmpty(requestId) ? requestId : IdUtils.fastSimpleUUID();
-    }
-}

+ 0 - 66
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitInfrastructureManagementInformationController.java

@@ -1,66 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.foundation.CockpitErrorPayload;
-import com.zksy.cockpit.foundation.CockpitInvalidRequestException;
-import com.zksy.cockpit.foundation.CockpitReadException;
-import com.zksy.cockpit.infrastructure.CockpitInfrastructureManagementInformationService;
-import com.zksy.common.core.domain.AjaxResult;
-import com.zksy.common.utils.StringUtils;
-import com.zksy.common.utils.uuid.IdUtils;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-
-@RestController
-@RequestMapping("/api/cockpit/v1")
-public class CockpitInfrastructureManagementInformationController {
-    private static final String REQUEST_ID_HEADER = "X-Request-Id";
-
-    private final CockpitInfrastructureManagementInformationService managementInformationService;
-
-    public CockpitInfrastructureManagementInformationController(
-            CockpitInfrastructureManagementInformationService managementInformationService) {
-        this.managementInformationService = managementInformationService;
-    }
-
-    @GetMapping("/infrastructure/management-information")
-    public ResponseEntity<AjaxResult> managementInformation(
-            @RequestParam(value = "industry", required = false) String industry,
-            @RequestParam(value = "district", required = false) String district,
-            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
-        return ResponseEntity.ok(AjaxResult.success(
-                managementInformationService.load(
-                        resolveRequestId(requestId), industry, district)));
-    }
-
-    @ExceptionHandler(CockpitInvalidRequestException.class)
-    public ResponseEntity<AjaxResult> handleInvalidRequest(
-            HttpServletRequest request,
-            CockpitInvalidRequestException exception) {
-        return error(HttpStatus.BAD_REQUEST, managementInformationService.invalidRequest(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER)),
-                exception.getMessage()));
-    }
-
-    @ExceptionHandler(CockpitReadException.class)
-    public ResponseEntity<AjaxResult> handleReadFailure(HttpServletRequest request) {
-        return error(HttpStatus.INTERNAL_SERVER_ERROR, managementInformationService.serverError(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER))));
-    }
-
-    private ResponseEntity<AjaxResult> error(HttpStatus status, CockpitErrorPayload payload) {
-        return ResponseEntity.status(status)
-                .body(new AjaxResult(status.value(), payload.getMessage(), payload));
-    }
-
-    private String resolveRequestId(String requestId) {
-        return StringUtils.isNotEmpty(requestId) ? requestId : IdUtils.fastSimpleUUID();
-    }
-}

+ 0 - 75
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitInfrastructureOperatingInformationController.java

@@ -1,75 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.foundation.CockpitErrorPayload;
-import com.zksy.cockpit.foundation.CockpitInvalidRequestException;
-import com.zksy.cockpit.foundation.CockpitReadException;
-import com.zksy.cockpit.infrastructure.CockpitInfrastructureOperatingInformationService;
-import com.zksy.common.core.domain.AjaxResult;
-import com.zksy.common.utils.StringUtils;
-import com.zksy.common.utils.uuid.IdUtils;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-
-@RestController
-@RequestMapping("/api/cockpit/v1")
-public class CockpitInfrastructureOperatingInformationController {
-    private static final String REQUEST_ID_HEADER = "X-Request-Id";
-
-    private final CockpitInfrastructureOperatingInformationService operatingInformationService;
-
-    public CockpitInfrastructureOperatingInformationController(
-            CockpitInfrastructureOperatingInformationService operatingInformationService) {
-        this.operatingInformationService = operatingInformationService;
-    }
-
-    @GetMapping("/infrastructure/operating-information")
-    public ResponseEntity<AjaxResult> operatingInformation(
-            @RequestParam(value = "industry", required = false) String industry,
-            // 片区(票 81):0/1/2/UNASSIGNED,不传=全域,非法值 400(校验在 service)。
-            @RequestParam(value = "district", required = false) String district,
-            @RequestParam(value = "range", required = false) String range,
-            @RequestParam(value = "from", required = false) String from,
-            @RequestParam(value = "to", required = false) String to,
-            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
-        return ResponseEntity.ok(AjaxResult.success(
-                operatingInformationService.load(
-                        resolveRequestId(requestId),
-                        industry,
-                        district,
-                        range,
-                        from,
-                        to)));
-    }
-
-    @ExceptionHandler(CockpitInvalidRequestException.class)
-    public ResponseEntity<AjaxResult> handleInvalidRequest(
-            HttpServletRequest request,
-            CockpitInvalidRequestException exception) {
-        return error(HttpStatus.BAD_REQUEST, operatingInformationService.invalidRequest(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER)),
-                exception.getMessage()));
-    }
-
-    @ExceptionHandler(CockpitReadException.class)
-    public ResponseEntity<AjaxResult> handleReadFailure(HttpServletRequest request) {
-        return error(HttpStatus.INTERNAL_SERVER_ERROR, operatingInformationService.serverError(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER))));
-    }
-
-    private ResponseEntity<AjaxResult> error(HttpStatus status, CockpitErrorPayload payload) {
-        return ResponseEntity.status(status)
-                .body(new AjaxResult(status.value(), payload.getMessage(), payload));
-    }
-
-    private String resolveRequestId(String requestId) {
-        return StringUtils.isNotEmpty(requestId) ? requestId : IdUtils.fastSimpleUUID();
-    }
-}

+ 46 - 0
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitMapController.java

@@ -0,0 +1,46 @@
+package com.zksy.web.controller.cockpit;
+
+import com.zksy.cockpit.foundation.CockpitFoundationService;
+import com.zksy.cockpit.map.CockpitMapSnapshotService;
+import com.zksy.common.core.domain.AjaxResult;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+/** 地图只读端点:基础帧/新鲜度与点位快照。 */
+@RestController
+@RequestMapping("/api/cockpit/v1")
+public class CockpitMapController extends BaseCockpitController {
+    private final CockpitFoundationService foundationService;
+    private final CockpitMapSnapshotService mapSnapshotService;
+
+    public CockpitMapController(CockpitFoundationService foundationService,
+                                CockpitMapSnapshotService mapSnapshotService) {
+        this.foundationService = foundationService;
+        this.mapSnapshotService = mapSnapshotService;
+    }
+
+    @GetMapping("/map/foundation")
+    public ResponseEntity<AjaxResult> foundation(
+            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
+        return ResponseEntity.ok(AjaxResult.success(foundationService.load(resolveRequestId(requestId))));
+    }
+
+    @GetMapping("/map/snapshot")
+    public ResponseEntity<AjaxResult> snapshot(
+            @RequestParam(value = "page", defaultValue = "1") Integer page,
+            @RequestParam(value = "pageSize", defaultValue = "500") Integer pageSize,
+            @RequestParam(value = "snapshotAt", required = false) String snapshotAt,
+            @RequestParam(value = "industry", required = false) String industry,
+            @RequestParam(value = "district", required = false) String district,
+            @RequestParam(value = "deviceType", required = false) String deviceType,
+            @RequestParam(value = "pointStatus", required = false) String[] pointStatus,
+            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
+        return ResponseEntity.ok(AjaxResult.success(mapSnapshotService.load(
+                resolveRequestId(requestId), page, pageSize, snapshotAt, industry, district, deviceType,
+                pointStatus == null ? null : String.join(",", pointStatus))));
+    }
+}

+ 0 - 81
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitMapSnapshotController.java

@@ -1,81 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.foundation.CockpitInvalidRequestException;
-import com.zksy.cockpit.foundation.CockpitErrorPayload;
-import com.zksy.cockpit.foundation.CockpitReadException;
-import com.zksy.cockpit.foundation.CockpitSnapshotExpiredException;
-import com.zksy.cockpit.map.CockpitMapSnapshotResponse;
-import com.zksy.cockpit.map.CockpitMapSnapshotService;
-import com.zksy.common.core.domain.AjaxResult;
-import com.zksy.common.utils.StringUtils;
-import com.zksy.common.utils.uuid.IdUtils;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-
-@RestController
-@RequestMapping("/api/cockpit/v1")
-public class CockpitMapSnapshotController {
-    private static final String REQUEST_ID_HEADER = "X-Request-Id";
-
-    private final CockpitMapSnapshotService mapSnapshotService;
-
-    public CockpitMapSnapshotController(CockpitMapSnapshotService mapSnapshotService) {
-        this.mapSnapshotService = mapSnapshotService;
-    }
-
-    @GetMapping("/map-snapshot")
-    public ResponseEntity<AjaxResult> mapSnapshot(
-            @RequestParam(value = "page", defaultValue = "1") Integer page,
-            @RequestParam(value = "pageSize", defaultValue = "500") Integer pageSize,
-            @RequestParam(value = "snapshotAt", required = false) String snapshotAt,
-            @RequestParam(value = "industry", required = false) String industry,
-            @RequestParam(value = "district", required = false) String district,
-            @RequestParam(value = "deviceType", required = false) String deviceType,
-            @RequestParam(value = "pointStatus", required = false) String[] pointStatus,
-            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
-        CockpitMapSnapshotResponse response = mapSnapshotService.load(
-                resolveRequestId(requestId), page, pageSize, snapshotAt, industry, district, deviceType,
-                pointStatus == null ? null : String.join(",", pointStatus));
-        return ResponseEntity.ok(AjaxResult.success(response));
-    }
-
-    @ExceptionHandler(CockpitInvalidRequestException.class)
-    public ResponseEntity<AjaxResult> handleInvalidRequest(
-            HttpServletRequest request,
-            CockpitInvalidRequestException exception) {
-        return badRequest(mapSnapshotService.invalidRequest(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER)),
-                exception.getMessage()));
-    }
-
-    @ExceptionHandler(CockpitSnapshotExpiredException.class)
-    public ResponseEntity<AjaxResult> handleSnapshotExpired(HttpServletRequest request) {
-        return badRequest(mapSnapshotService.snapshotExpired(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER))));
-    }
-
-    @ExceptionHandler(CockpitReadException.class)
-    public ResponseEntity<AjaxResult> handleReadFailure(HttpServletRequest request) {
-        CockpitErrorPayload payload = mapSnapshotService.serverError(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER)));
-        return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
-                .body(new AjaxResult(HttpStatus.INTERNAL_SERVER_ERROR.value(), payload.getMessage(), payload));
-    }
-
-    private ResponseEntity<AjaxResult> badRequest(CockpitErrorPayload payload) {
-        return ResponseEntity.status(HttpStatus.BAD_REQUEST)
-                .body(new AjaxResult(HttpStatus.BAD_REQUEST.value(), payload.getMessage(), payload));
-    }
-
-    private String resolveRequestId(String requestId) {
-        return StringUtils.isNotEmpty(requestId) ? requestId : IdUtils.fastSimpleUUID();
-    }
-}

+ 48 - 0
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitMonitoringController.java

@@ -0,0 +1,48 @@
+package com.zksy.web.controller.cockpit;
+
+import com.zksy.cockpit.monitoring.CockpitMonitoringDistributionService;
+import com.zksy.cockpit.monitoring.CockpitMonitoringOverviewService;
+import com.zksy.cockpit.monitoring.CockpitMonitoringSituationService;
+import com.zksy.cockpit.point.CockpitMonitoringPointDetailService;
+import com.zksy.common.core.domain.AjaxResult;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 监测类只读端点:运行概览、监测分布、监测态势、监测点详情。
+ */
+@RestController
+@RequestMapping("/api/cockpit/v1")
+public class CockpitMonitoringController extends BaseCockpitController {
+    private final CockpitMonitoringOverviewService overviewService;
+    private final CockpitMonitoringDistributionService distributionService;
+    private final CockpitMonitoringSituationService situationService;
+    private final CockpitMonitoringPointDetailService pointDetailService;
+
+    public CockpitMonitoringController(CockpitMonitoringOverviewService overviewService, CockpitMonitoringDistributionService distributionService, CockpitMonitoringSituationService situationService, CockpitMonitoringPointDetailService pointDetailService) {
+        this.overviewService = overviewService;
+        this.distributionService = distributionService;
+        this.situationService = situationService;
+        this.pointDetailService = pointDetailService;
+    }
+
+    @GetMapping("/monitoring/overview")
+    public ResponseEntity<AjaxResult> monitoringOverview(@RequestParam(value = "industry", required = false) String industry, @RequestParam(value = "deviceType", required = false) String deviceType, @RequestParam(value = "district", required = false) String district, @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
+        return ResponseEntity.ok(AjaxResult.success(overviewService.load(resolveRequestId(requestId), industry, deviceType, district)));
+    }
+
+    @GetMapping("/monitoring/distribution")
+    public ResponseEntity<AjaxResult> monitoringDistribution(@RequestParam(value = "industry", required = false) String industry, @RequestParam(value = "deviceType", required = false) String deviceType, @RequestParam(value = "pointStatus", required = false) String[] pointStatus, @RequestParam(value = "district", required = false) String district, @RequestParam(value = "page", defaultValue = "1") Integer page, @RequestParam(value = "pageSize", defaultValue = "500") Integer pageSize, @RequestParam(value = "snapshotAt", required = false) String snapshotAt, @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
+        return ResponseEntity.ok(AjaxResult.success(distributionService.load(resolveRequestId(requestId), industry, deviceType, pointStatus == null ? null : String.join(",", pointStatus), district, page, pageSize, snapshotAt)));
+    }
+
+    @GetMapping("/monitoring/situation")
+    public ResponseEntity<AjaxResult> monitoringSituation(@RequestParam(value = "industry", required = false) String industry, @RequestParam(value = "deviceType", required = false) String deviceType, @RequestParam(value = "district", required = false) String district, @RequestParam(value = "startTime", required = false) String startTime, @RequestParam(value = "endTime", required = false) String endTime, @RequestParam(value = "page", defaultValue = "1") Integer page, @RequestParam(value = "pageSize", defaultValue = "100") Integer pageSize, @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
+        return ResponseEntity.ok(AjaxResult.success(situationService.load(resolveRequestId(requestId), industry, deviceType, district, startTime, endTime, page, pageSize)));
+    }
+
+    @GetMapping("/monitoring-points/{monitoringPointCode}")
+    public ResponseEntity<AjaxResult> monitoringPointDetail(@PathVariable("monitoringPointCode") String monitoringPointCode, @RequestParam(value = "snapshotAt", required = false) String snapshotAt, @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
+        return ResponseEntity.ok(AjaxResult.success(pointDetailService.load(resolveRequestId(requestId), decodePathSegment(monitoringPointCode), snapshotAt)));
+    }
+}

+ 0 - 86
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitMonitoringDistributionController.java

@@ -1,86 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.foundation.CockpitErrorPayload;
-import com.zksy.cockpit.foundation.CockpitInvalidRequestException;
-import com.zksy.cockpit.foundation.CockpitReadException;
-import com.zksy.cockpit.foundation.CockpitSnapshotExpiredException;
-import com.zksy.cockpit.monitoring.CockpitMonitoringDistributionService;
-import com.zksy.common.core.domain.AjaxResult;
-import com.zksy.common.utils.StringUtils;
-import com.zksy.common.utils.uuid.IdUtils;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-
-@RestController
-@RequestMapping("/api/cockpit/v1")
-public class CockpitMonitoringDistributionController {
-    private static final String REQUEST_ID_HEADER = "X-Request-Id";
-
-    private final CockpitMonitoringDistributionService distributionService;
-
-    public CockpitMonitoringDistributionController(
-            CockpitMonitoringDistributionService distributionService) {
-        this.distributionService = distributionService;
-    }
-
-    @GetMapping("/monitoring/distribution")
-    public ResponseEntity<AjaxResult> monitoringDistribution(
-            @RequestParam(value = "industry", required = false) String industry,
-            @RequestParam(value = "deviceType", required = false) String deviceType,
-            @RequestParam(value = "pointStatus", required = false) String[] pointStatus,
-            // 范围维度自执行票 12 起为片区;旧自由串 region 不再是正式契约,签名里已去掉
-            @RequestParam(value = "district", required = false) String district,
-            @RequestParam(value = "page", defaultValue = "1") Integer page,
-            @RequestParam(value = "pageSize", defaultValue = "500") Integer pageSize,
-            @RequestParam(value = "snapshotAt", required = false) String snapshotAt,
-            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
-        return ResponseEntity.ok(AjaxResult.success(
-                distributionService.load(
-                        resolveRequestId(requestId),
-                        industry,
-                        deviceType,
-                        pointStatus == null ? null : String.join(",", pointStatus),
-                        district,
-                        page,
-                        pageSize,
-                        snapshotAt)));
-    }
-
-    @ExceptionHandler(CockpitInvalidRequestException.class)
-    public ResponseEntity<AjaxResult> handleInvalidRequest(
-            HttpServletRequest request,
-            CockpitInvalidRequestException exception) {
-        return error(HttpStatus.BAD_REQUEST, distributionService.invalidRequest(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER)),
-                exception.getMessage()));
-    }
-
-    @ExceptionHandler(CockpitSnapshotExpiredException.class)
-    public ResponseEntity<AjaxResult> handleSnapshotExpired(HttpServletRequest request) {
-        return error(HttpStatus.BAD_REQUEST, distributionService.snapshotExpired(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER))));
-    }
-
-    @ExceptionHandler(CockpitReadException.class)
-    public ResponseEntity<AjaxResult> handleReadFailure(HttpServletRequest request) {
-        return error(HttpStatus.INTERNAL_SERVER_ERROR, distributionService.serverError(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER))));
-    }
-
-    private ResponseEntity<AjaxResult> error(HttpStatus status, CockpitErrorPayload payload) {
-        return ResponseEntity.status(status)
-                .body(new AjaxResult(status.value(), payload.getMessage(), payload));
-    }
-
-    private String resolveRequestId(String requestId) {
-        return StringUtils.isNotEmpty(requestId) ? requestId : IdUtils.fastSimpleUUID();
-    }
-}

+ 0 - 66
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitMonitoringOverviewController.java

@@ -1,66 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.foundation.CockpitReadException;
-import com.zksy.cockpit.monitoring.CockpitMonitoringOverviewService;
-import com.zksy.common.core.domain.AjaxResult;
-import com.zksy.common.utils.StringUtils;
-import com.zksy.common.utils.uuid.IdUtils;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-import com.zksy.cockpit.foundation.CockpitErrorPayload;
-import com.zksy.cockpit.foundation.CockpitInvalidRequestException;
-
-@RestController
-@RequestMapping("/api/cockpit/v1")
-public class CockpitMonitoringOverviewController {
-    private static final String REQUEST_ID_HEADER = "X-Request-Id";
-
-    private final CockpitMonitoringOverviewService overviewService;
-
-    public CockpitMonitoringOverviewController(CockpitMonitoringOverviewService overviewService) {
-        this.overviewService = overviewService;
-    }
-
-    @GetMapping("/monitoring/overview")
-    public ResponseEntity<AjaxResult> monitoringOverview(
-            @RequestParam(value = "industry", required = false) String industry,
-            @RequestParam(value = "deviceType", required = false) String deviceType,
-            // 片区(票 81):0/1/2/UNASSIGNED,不传=全域,非法值 400(校验在 service)。
-            @RequestParam(value = "district", required = false) String district,
-            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
-        return ResponseEntity.ok(AjaxResult.success(
-                overviewService.load(resolveRequestId(requestId), industry, deviceType, district)));
-    }
-
-    @ExceptionHandler(CockpitInvalidRequestException.class)
-    public ResponseEntity<AjaxResult> handleInvalidRequest(
-            HttpServletRequest request,
-            CockpitInvalidRequestException exception) {
-        return error(HttpStatus.BAD_REQUEST, overviewService.invalidRequest(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER)),
-                exception.getMessage()));
-    }
-
-    @ExceptionHandler(CockpitReadException.class)
-    public ResponseEntity<AjaxResult> handleReadFailure(HttpServletRequest request) {
-        return error(HttpStatus.INTERNAL_SERVER_ERROR, overviewService.serverError(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER))));
-    }
-
-    private ResponseEntity<AjaxResult> error(HttpStatus status, CockpitErrorPayload payload) {
-        return ResponseEntity.status(status)
-                .body(new AjaxResult(status.value(), payload.getMessage(), payload));
-    }
-
-    private String resolveRequestId(String requestId) {
-        return StringUtils.isNotEmpty(requestId) ? requestId : IdUtils.fastSimpleUUID();
-    }
-}

+ 0 - 98
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitMonitoringPointDetailController.java

@@ -1,98 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.foundation.CockpitErrorPayload;
-import com.zksy.cockpit.foundation.CockpitInvalidCodeException;
-import com.zksy.cockpit.foundation.CockpitInvalidRequestException;
-import com.zksy.cockpit.foundation.CockpitMonitoringPointNotFoundException;
-import com.zksy.cockpit.foundation.CockpitReadException;
-import com.zksy.cockpit.foundation.CockpitSnapshotExpiredException;
-import com.zksy.cockpit.point.CockpitMonitoringPointDetailResponse;
-import com.zksy.cockpit.point.CockpitMonitoringPointDetailService;
-import com.zksy.common.core.domain.AjaxResult;
-import com.zksy.common.utils.StringUtils;
-import com.zksy.common.utils.uuid.IdUtils;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.util.UriUtils;
-
-import java.nio.charset.StandardCharsets;
-
-import javax.servlet.http.HttpServletRequest;
-
-@RestController
-@RequestMapping("/api/cockpit/v1")
-public class CockpitMonitoringPointDetailController {
-    private static final String REQUEST_ID_HEADER = "X-Request-Id";
-
-    private final CockpitMonitoringPointDetailService detailService;
-
-    public CockpitMonitoringPointDetailController(CockpitMonitoringPointDetailService detailService) {
-        this.detailService = detailService;
-    }
-
-    @GetMapping("/monitoring-points/{monitoringPointCode}")
-    public ResponseEntity<AjaxResult> monitoringPointDetail(
-            @PathVariable("monitoringPointCode") String monitoringPointCode,
-            @RequestParam(value = "snapshotAt", required = false) String snapshotAt,
-            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
-        CockpitMonitoringPointDetailResponse response = detailService.load(
-                resolveRequestId(requestId), decodePathSegment(monitoringPointCode), snapshotAt);
-        return ResponseEntity.ok(AjaxResult.success(response));
-    }
-
-    @ExceptionHandler(CockpitInvalidRequestException.class)
-    public ResponseEntity<AjaxResult> handleInvalidRequest(
-            HttpServletRequest request,
-            CockpitInvalidRequestException exception) {
-        return error(HttpStatus.BAD_REQUEST, detailService.invalidRequest(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER)), exception.getMessage()));
-    }
-
-    @ExceptionHandler(CockpitInvalidCodeException.class)
-    public ResponseEntity<AjaxResult> handleInvalidCode(HttpServletRequest request) {
-        return error(HttpStatus.BAD_REQUEST, detailService.invalidCode(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER))));
-    }
-
-    @ExceptionHandler(CockpitMonitoringPointNotFoundException.class)
-    public ResponseEntity<AjaxResult> handleNotFound(HttpServletRequest request) {
-        return error(HttpStatus.NOT_FOUND, detailService.notFound(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER))));
-    }
-
-    @ExceptionHandler(CockpitReadException.class)
-    public ResponseEntity<AjaxResult> handleReadFailure(HttpServletRequest request) {
-        return error(HttpStatus.INTERNAL_SERVER_ERROR, detailService.serverError(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER))));
-    }
-
-    @ExceptionHandler(CockpitSnapshotExpiredException.class)
-    public ResponseEntity<AjaxResult> handleSnapshotExpired(HttpServletRequest request) {
-        return error(HttpStatus.BAD_REQUEST, detailService.snapshotExpired(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER))));
-    }
-
-    private ResponseEntity<AjaxResult> error(HttpStatus status, CockpitErrorPayload payload) {
-        return ResponseEntity.status(status)
-                .body(new AjaxResult(status.value(), payload.getMessage(), payload));
-    }
-
-    private String resolveRequestId(String requestId) {
-        return StringUtils.isNotEmpty(requestId) ? requestId : IdUtils.fastSimpleUUID();
-    }
-
-    private String decodePathSegment(String value) {
-        try {
-            return UriUtils.decode(value, StandardCharsets.UTF_8);
-        } catch (IllegalArgumentException exception) {
-            throw new CockpitInvalidCodeException("invalid monitoring point code encoding");
-        }
-    }
-}

+ 0 - 79
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitMonitoringSituationController.java

@@ -1,79 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.foundation.CockpitErrorPayload;
-import com.zksy.cockpit.foundation.CockpitInvalidRequestException;
-import com.zksy.cockpit.foundation.CockpitReadException;
-import com.zksy.cockpit.monitoring.CockpitMonitoringSituationService;
-import com.zksy.common.core.domain.AjaxResult;
-import com.zksy.common.utils.StringUtils;
-import com.zksy.common.utils.uuid.IdUtils;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-
-@RestController
-@RequestMapping("/api/cockpit/v1")
-public class CockpitMonitoringSituationController {
-    private static final String REQUEST_ID_HEADER = "X-Request-Id";
-
-    private final CockpitMonitoringSituationService situationService;
-
-    public CockpitMonitoringSituationController(
-            CockpitMonitoringSituationService situationService) {
-        this.situationService = situationService;
-    }
-
-    @GetMapping("/monitoring/situation")
-    public ResponseEntity<AjaxResult> monitoringSituation(
-            @RequestParam(value = "industry", required = false) String industry,
-            @RequestParam(value = "deviceType", required = false) String deviceType,
-            // 片区(票 81):0/1/2/UNASSIGNED,不传=全域,非法值 400(校验在 service)。
-            @RequestParam(value = "district", required = false) String district,
-            @RequestParam(value = "startTime", required = false) String startTime,
-            @RequestParam(value = "endTime", required = false) String endTime,
-            @RequestParam(value = "page", defaultValue = "1") Integer page,
-            @RequestParam(value = "pageSize", defaultValue = "100") Integer pageSize,
-            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
-        return ResponseEntity.ok(AjaxResult.success(
-                situationService.load(
-                        resolveRequestId(requestId),
-                        industry,
-                        deviceType,
-                        district,
-                        startTime,
-                        endTime,
-                        page,
-                        pageSize)));
-    }
-
-    @ExceptionHandler(CockpitInvalidRequestException.class)
-    public ResponseEntity<AjaxResult> handleInvalidRequest(
-            HttpServletRequest request,
-            CockpitInvalidRequestException exception) {
-        return error(HttpStatus.BAD_REQUEST, situationService.invalidRequest(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER)),
-                exception.getMessage()));
-    }
-
-    @ExceptionHandler(CockpitReadException.class)
-    public ResponseEntity<AjaxResult> handleReadFailure(HttpServletRequest request) {
-        return error(HttpStatus.INTERNAL_SERVER_ERROR, situationService.serverError(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER))));
-    }
-
-    private ResponseEntity<AjaxResult> error(HttpStatus status, CockpitErrorPayload payload) {
-        return ResponseEntity.status(status)
-                .body(new AjaxResult(status.value(), payload.getMessage(), payload));
-    }
-
-    private String resolveRequestId(String requestId) {
-        return StringUtils.isNotEmpty(requestId) ? requestId : IdUtils.fastSimpleUUID();
-    }
-}

+ 0 - 83
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitMultidimensionalAnalysisController.java

@@ -1,83 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.event.CockpitMultidimensionalAnalysisService;
-import com.zksy.cockpit.foundation.CockpitErrorPayload;
-import com.zksy.cockpit.foundation.CockpitInvalidRequestException;
-import com.zksy.cockpit.foundation.CockpitReadException;
-import com.zksy.common.core.domain.AjaxResult;
-import com.zksy.common.utils.StringUtils;
-import com.zksy.common.utils.uuid.IdUtils;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-
-@RestController
-@RequestMapping("/api/cockpit/v1")
-public class CockpitMultidimensionalAnalysisController {
-    private static final String REQUEST_ID_HEADER = "X-Request-Id";
-
-    private final CockpitMultidimensionalAnalysisService analysisService;
-
-    public CockpitMultidimensionalAnalysisController(
-            CockpitMultidimensionalAnalysisService analysisService) {
-        this.analysisService = analysisService;
-    }
-
-    @GetMapping("/events/multidimensional-analysis")
-    public ResponseEntity<AjaxResult> multidimensionalAnalysis(
-            @RequestParam(value = "eventFamily", required = false) String eventFamily,
-            @RequestParam(value = "industry", required = false) String industry,
-            @RequestParam(value = "level", required = false) String level,
-            @RequestParam(value = "eventType", required = false) String eventType,
-            @RequestParam(value = "cause", required = false) String cause,
-            @RequestParam(value = "deviceType", required = false) String deviceType,
-            // 范围维度为片区(district):0/1/2 按片区筛,UNASSIGNED 只看未分区,不传=不筛。
-            @RequestParam(value = "district", required = false) String district,
-            @RequestParam(value = "startTime", required = false) String startTime,
-            @RequestParam(value = "endTime", required = false) String endTime,
-            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
-        return ResponseEntity.ok(AjaxResult.success(
-                analysisService.load(
-                        resolveRequestId(requestId),
-                        eventFamily,
-                        industry,
-                        level,
-                        eventType,
-                        cause,
-                        deviceType,
-                        district,
-                        startTime,
-                        endTime)));
-    }
-
-    @ExceptionHandler(CockpitInvalidRequestException.class)
-    public ResponseEntity<AjaxResult> handleInvalidRequest(
-            HttpServletRequest request,
-            CockpitInvalidRequestException exception) {
-        return error(HttpStatus.BAD_REQUEST, analysisService.invalidRequest(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER)),
-                exception.getMessage()));
-    }
-
-    @ExceptionHandler(CockpitReadException.class)
-    public ResponseEntity<AjaxResult> handleReadFailure(HttpServletRequest request) {
-        return error(HttpStatus.INTERNAL_SERVER_ERROR, analysisService.serverError(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER))));
-    }
-
-    private ResponseEntity<AjaxResult> error(HttpStatus status, CockpitErrorPayload payload) {
-        return ResponseEntity.status(status)
-                .body(new AjaxResult(status.value(), payload.getMessage(), payload));
-    }
-
-    private String resolveRequestId(String requestId) {
-        return StringUtils.isNotEmpty(requestId) ? requestId : IdUtils.fastSimpleUUID();
-    }
-}

+ 41 - 0
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitOverviewController.java

@@ -0,0 +1,41 @@
+package com.zksy.web.controller.cockpit;
+
+import com.zksy.cockpit.overview.CockpitOverviewModulesService;
+import com.zksy.common.core.domain.AjaxResult;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 总体概览四模块只读端点
+ *
+ */
+@RestController
+@RequestMapping("/api/cockpit/v1")
+public class CockpitOverviewController extends BaseCockpitController {
+
+    private final CockpitOverviewModulesService modulesService;
+
+    public CockpitOverviewController(CockpitOverviewModulesService modulesService) {
+        this.modulesService = modulesService;
+    }
+
+    @GetMapping("/overview/perception")
+    public ResponseEntity<AjaxResult> perception(@RequestParam(value = "district", required = false) String district, @RequestParam(value = "industry", required = false) String industry, @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
+        return ResponseEntity.ok(AjaxResult.success(modulesService.loadPerception(resolveRequestId(requestId), district, industry)));
+    }
+
+    @GetMapping("/overview/pipe-network")
+    public ResponseEntity<AjaxResult> pipeNetwork(@RequestParam(value = "district", required = false) String district, @RequestParam(value = "industry", required = false) String industry, @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
+        return ResponseEntity.ok(AjaxResult.success(modulesService.loadPipeNetwork(resolveRequestId(requestId), district, industry)));
+    }
+
+    @GetMapping("/overview/warning-study")
+    public ResponseEntity<AjaxResult> warningStudy(@RequestParam(value = "district", required = false) String district, @RequestParam(value = "industry", required = false) String industry, @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
+        return ResponseEntity.ok(AjaxResult.success(modulesService.loadWarningStudy(resolveRequestId(requestId), district, industry)));
+    }
+
+    @GetMapping("/overview/alarm-disposal")
+    public ResponseEntity<AjaxResult> alarmDisposal(@RequestParam(value = "district", required = false) String district, @RequestParam(value = "industry", required = false) String industry, @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
+        return ResponseEntity.ok(AjaxResult.success(modulesService.loadAlarmDisposal(resolveRequestId(requestId), district, industry)));
+    }
+}

+ 0 - 101
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitOverviewModulesController.java

@@ -1,101 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.foundation.CockpitErrorPayload;
-import com.zksy.cockpit.foundation.CockpitInvalidRequestException;
-import com.zksy.cockpit.foundation.CockpitReadException;
-import com.zksy.cockpit.overview.CockpitOverviewModulesService;
-import com.zksy.common.core.domain.AjaxResult;
-import com.zksy.common.utils.StringUtils;
-import com.zksy.common.utils.uuid.IdUtils;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * 总体概览四模块只读端点(规格 §1,2026-10-22 四模块契约)。
- *
- * <p>免鉴权:{@code SecurityConfig} 已放行 {@code GET /api/cockpit/v1/**}。
- * 四个端点各自独立成败,一个模块失败只影响它自己的响应。
- */
-@RestController
-@RequestMapping("/api/cockpit/v1")
-public class CockpitOverviewModulesController {
-    private static final String REQUEST_ID_HEADER = "X-Request-Id";
-
-    private final CockpitOverviewModulesService modulesService;
-
-    public CockpitOverviewModulesController(CockpitOverviewModulesService modulesService) {
-        this.modulesService = modulesService;
-    }
-
-    @GetMapping("/overview/perception")
-    public ResponseEntity<AjaxResult> perception(
-            @RequestParam(value = "district", required = false) String district,
-            @RequestParam(value = "industry", required = false) String industry,
-            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
-        return ResponseEntity.ok(AjaxResult.success(
-                modulesService.loadPerception(resolveRequestId(requestId), district, industry)));
-    }
-
-    @GetMapping("/overview/pipe-network")
-    public ResponseEntity<AjaxResult> pipeNetwork(
-            @RequestParam(value = "district", required = false) String district,
-            @RequestParam(value = "industry", required = false) String industry,
-            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
-        return ResponseEntity.ok(AjaxResult.success(
-                modulesService.loadPipeNetwork(resolveRequestId(requestId), district, industry)));
-    }
-
-    @GetMapping("/overview/warning-study")
-    public ResponseEntity<AjaxResult> warningStudy(
-            @RequestParam(value = "district", required = false) String district,
-            @RequestParam(value = "industry", required = false) String industry,
-            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
-        return ResponseEntity.ok(AjaxResult.success(
-                modulesService.loadWarningStudy(resolveRequestId(requestId), district, industry)));
-    }
-
-    @GetMapping("/overview/alarm-disposal")
-    public ResponseEntity<AjaxResult> alarmDisposal(
-            @RequestParam(value = "district", required = false) String district,
-            @RequestParam(value = "industry", required = false) String industry,
-            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
-        return ResponseEntity.ok(AjaxResult.success(
-                modulesService.loadAlarmDisposal(resolveRequestId(requestId), district, industry)));
-    }
-
-    /**
-     * 入参非法一律 400(票 81):片区只认 {@code 0/1/2/UNASSIGNED}、行业只认四个正式编码,
-     * 与事件族端点同一条纪律 —— 静默忽略会造出「以为筛了、其实全域」的假绿。
-     */
-    @ExceptionHandler(CockpitInvalidRequestException.class)
-    public ResponseEntity<AjaxResult> handleInvalidRequest(
-            HttpServletRequest request,
-            CockpitInvalidRequestException exception) {
-        return error(HttpStatus.BAD_REQUEST, modulesService.invalidRequest(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER)),
-                exception.getMessage()));
-    }
-
-    @ExceptionHandler(CockpitReadException.class)
-    public ResponseEntity<AjaxResult> handleReadFailure(HttpServletRequest request) {
-        return error(HttpStatus.INTERNAL_SERVER_ERROR, modulesService.serverError(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER))));
-    }
-
-    private ResponseEntity<AjaxResult> error(HttpStatus status, CockpitErrorPayload payload) {
-        return ResponseEntity.status(status)
-                .body(new AjaxResult(status.value(), payload.getMessage(), payload));
-    }
-
-    private String resolveRequestId(String requestId) {
-        return StringUtils.isNotEmpty(requestId) ? requestId : IdUtils.fastSimpleUUID();
-    }
-}

+ 0 - 79
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitTypeMetricsController.java

@@ -1,79 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.foundation.CockpitDeviceNotFoundException;
-import com.zksy.cockpit.foundation.CockpitErrorPayload;
-import com.zksy.cockpit.foundation.CockpitInvalidRequestException;
-import com.zksy.cockpit.foundation.CockpitReadException;
-import com.zksy.cockpit.type.CockpitTypeMetricsResponse;
-import com.zksy.cockpit.type.CockpitTypeMetricsService;
-import com.zksy.common.core.domain.AjaxResult;
-import com.zksy.common.utils.StringUtils;
-import com.zksy.common.utils.uuid.IdUtils;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.util.UriUtils;
-
-import javax.servlet.http.HttpServletRequest;
-import java.nio.charset.StandardCharsets;
-
-@RestController
-@RequestMapping("/api/cockpit/v1")
-public class CockpitTypeMetricsController {
-    private static final String REQUEST_ID_HEADER = "X-Request-Id";
-
-    private final CockpitTypeMetricsService metricsService;
-
-    public CockpitTypeMetricsController(CockpitTypeMetricsService metricsService) {
-        this.metricsService = metricsService;
-    }
-
-    @GetMapping("/equipments/{deviceCode}/metrics/current")
-    public ResponseEntity<AjaxResult> currentMetrics(
-            @PathVariable("deviceCode") String deviceCode,
-            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
-        CockpitTypeMetricsResponse response = metricsService.loadCurrent(
-                resolveRequestId(requestId), decodePathSegment(deviceCode));
-        return ResponseEntity.ok(AjaxResult.success(response));
-    }
-
-    @ExceptionHandler(CockpitInvalidRequestException.class)
-    public ResponseEntity<AjaxResult> handleInvalidRequest(HttpServletRequest request) {
-        return error(HttpStatus.BAD_REQUEST, metricsService.invalidRequest(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER))));
-    }
-
-    @ExceptionHandler(CockpitDeviceNotFoundException.class)
-    public ResponseEntity<AjaxResult> handleNotFound(HttpServletRequest request) {
-        return error(HttpStatus.NOT_FOUND, metricsService.notFound(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER))));
-    }
-
-    @ExceptionHandler(CockpitReadException.class)
-    public ResponseEntity<AjaxResult> handleReadFailure(HttpServletRequest request) {
-        return error(HttpStatus.INTERNAL_SERVER_ERROR, metricsService.serverError(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER))));
-    }
-
-    private ResponseEntity<AjaxResult> error(HttpStatus status, CockpitErrorPayload payload) {
-        return ResponseEntity.status(status)
-                .body(new AjaxResult(status.value(), payload.getMessage(), payload));
-    }
-
-    private String resolveRequestId(String requestId) {
-        return StringUtils.isNotEmpty(requestId) ? requestId : IdUtils.fastSimpleUUID();
-    }
-
-    private String decodePathSegment(String value) {
-        try {
-            return UriUtils.decode(value, StandardCharsets.UTF_8);
-        } catch (IllegalArgumentException exception) {
-            throw new CockpitInvalidRequestException("invalid device code encoding");
-        }
-    }
-}

+ 28 - 50
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitVideoController.java

@@ -8,15 +8,12 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.time.Clock;
-import java.time.ZoneId;
-import java.time.format.DateTimeFormatter;
-import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.UUID;
 
 @RestController
 @RequestMapping("/api/cockpit/v1")
-public class CockpitVideoController {
+public class CockpitVideoController extends BaseCockpitController {
     private final CockpitVideoService videos;
     private final Clock clock;
 
@@ -38,59 +35,56 @@ public class CockpitVideoController {
     @PostMapping("/video/sessions/prepare")
     public ResponseEntity<AjaxResult> prepare(@RequestBody Map<String, Object> body, HttpServletRequest request) {
         Map<String, Object> data = videos.prepare(field(body, "deviceCode"));
-        data.putAll(metadata(request));
+        data.putAll(cockpitMetadata(request, clock));
         return ResponseEntity.status(201).cacheControl(org.springframework.http.CacheControl.noStore()).body(AjaxResult.success(data));
     }
 
     @PostMapping("/video/sessions/{id}/live")
-    public ResponseEntity<AjaxResult> preparedLive(@PathVariable("id") String id,
-            @RequestBody Map<String, Object> body, HttpServletRequest request) {
+    public ResponseEntity<AjaxResult> preparedLive(@PathVariable("id") String id, @RequestBody Map<String, Object> body, HttpServletRequest request) {
         return success(videos.startPrepared(sessionId(id), field(body, "sessionToken")), request);
     }
 
-    /** Existing device/NVR recordings for one bounded UTC+8 window. */
+    /**
+     * Existing device/NVR recordings for one bounded UTC+8 window.
+     */
     @GetMapping("/video/records")
-    public ResponseEntity<AjaxResult> records(@RequestParam("deviceCode") String code,
-            @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime,
-            HttpServletRequest request) {
+    public ResponseEntity<AjaxResult> records(@RequestParam("deviceCode") String code, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime, HttpServletRequest request) {
         return success(videos.records(code, startTime, endTime), request);
     }
 
-    /** Starts one anonymous playback session over an already-listed recording window. */
+    /**
+     * Starts one anonymous playback session over an already-listed recording window.
+     */
     @PostMapping("/video/playback")
     public ResponseEntity<AjaxResult> playback(@RequestBody Map<String, Object> body, HttpServletRequest request) {
         Map<String, String> input = fields(body, "deviceCode", "startTime", "endTime");
-        return success(videos.playback(input.get("deviceCode"), input.get("startTime"),
-                input.get("endTime")), request);
+        return success(videos.playback(input.get("deviceCode"), input.get("startTime"), input.get("endTime")), request);
     }
 
     @PostMapping("/video/sessions/{id}/status")
-    public ResponseEntity<AjaxResult> sessionStatus(@PathVariable("id") String id,
-            @RequestBody Map<String, Object> body, HttpServletRequest request) {
+    public ResponseEntity<AjaxResult> sessionStatus(@PathVariable("id") String id, @RequestBody Map<String, Object> body, HttpServletRequest request) {
         return success(videos.status(sessionId(id), field(body, "sessionToken")), request);
     }
 
     @PostMapping("/video/sessions/{id}/heartbeat")
-    public ResponseEntity<AjaxResult> heartbeat(@PathVariable("id") String id,
-            @RequestBody Map<String, Object> body, HttpServletRequest request) {
+    public ResponseEntity<AjaxResult> heartbeat(@PathVariable("id") String id, @RequestBody Map<String, Object> body, HttpServletRequest request) {
         return success(videos.heartbeat(sessionId(id), field(body, "sessionToken")), request);
     }
 
     @PostMapping("/video/sessions/{id}/stop")
-    public ResponseEntity<AjaxResult> stop(@PathVariable("id") String id,
-            @RequestBody Map<String, Object> body, HttpServletRequest request) {
+    public ResponseEntity<AjaxResult> stop(@PathVariable("id") String id, @RequestBody Map<String, Object> body, HttpServletRequest request) {
         return success(videos.stop(sessionId(id), field(body, "sessionToken")), request);
     }
 
-    /** Controls this viewer's own playback session; values are bounded by the reused seam. */
+    /**
+     * Controls this viewer's own playback session; values are bounded by the reused seam.
+     */
     @PostMapping("/video/sessions/{id}/control")
-    public ResponseEntity<AjaxResult> control(@PathVariable("id") String id,
-            @RequestBody Map<String, Object> body, HttpServletRequest request) {
+    public ResponseEntity<AjaxResult> control(@PathVariable("id") String id, @RequestBody Map<String, Object> body, HttpServletRequest request) {
         if (body == null || !(body.get("sessionToken") instanceof String) || !(body.get("action") instanceof String))
             throw new CockpitVideoException(400, "INVALID_REQUEST", "视频请求参数无效");
         Double value = body.get("value") instanceof Number ? ((Number) body.get("value")).doubleValue() : null;
-        return success(videos.control(sessionId(id), (String) body.get("sessionToken"),
-                (String) body.get("action"), value), request);
+        return success(videos.control(sessionId(id), (String) body.get("sessionToken"), (String) body.get("action"), value), request);
     }
 
     private static String sessionId(String id) {
@@ -105,46 +99,30 @@ public class CockpitVideoController {
         return (String) body.get(field);
     }
 
-    /** A playback request carries three required strings and nothing else. */
+    /**
+     * A playback request carries three required strings and nothing else.
+     */
     private static Map<String, String> fields(Map<String, Object> body, String... names) {
         if (body == null || body.size() != names.length)
             throw new CockpitVideoException(400, "INVALID_REQUEST", "视频请求参数无效");
         Map<String, String> values = new java.util.LinkedHashMap<>();
         for (String name : names) {
-            if (!(body.get(name) instanceof String)) throw new CockpitVideoException(400, "INVALID_REQUEST", "视频请求参数无效");
+            if (!(body.get(name) instanceof String))
+                throw new CockpitVideoException(400, "INVALID_REQUEST", "视频请求参数无效");
             values.put(name, (String) body.get(name));
         }
         return values;
     }
 
-    @ExceptionHandler({org.springframework.http.converter.HttpMessageNotReadableException.class,
-            org.springframework.web.bind.MissingServletRequestParameterException.class,
-            org.springframework.web.method.annotation.MethodArgumentTypeMismatchException.class})
-    public ResponseEntity<AjaxResult> invalidRequest(Exception failure, HttpServletRequest request) {
-        return error(new CockpitVideoException(400, "INVALID_REQUEST", "视频请求参数无效"), request);
-    }
-
     private ResponseEntity<AjaxResult> success(Map<String, Object> data, HttpServletRequest request) {
-        data.putAll(metadata(request));
+        data.putAll(cockpitMetadata(request, clock));
         int status = "STARTING".equals(data.get("status")) || "CLEANUP_PENDING".equals(data.get("status")) ? 202 : 200;
         return ResponseEntity.status(status).cacheControl(org.springframework.http.CacheControl.noStore()).body(AjaxResult.success(data));
     }
 
-    @ExceptionHandler(CockpitVideoException.class)
-    public ResponseEntity<AjaxResult> error(CockpitVideoException failure, HttpServletRequest request) {
-        Map<String, Object> data = metadata(request);
-        data.put("category", failure.getCategory());
-        data.put("message", failure.getMessage());
-        return ResponseEntity.status(failure.getStatus()).cacheControl(org.springframework.http.CacheControl.noStore())
-                .body(new AjaxResult(failure.getStatus(), failure.getMessage(), data));
-    }
 
-    private Map<String, Object> metadata(HttpServletRequest request) {
-        String requestId = request.getHeader("X-Request-Id");
-        if (requestId == null || !requestId.matches("[A-Za-z0-9._-]{1,100}")) requestId = UUID.randomUUID().toString();
-        Map<String, Object> metadata = new LinkedHashMap<>();
-        metadata.put("requestId", requestId);
-        metadata.put("serverTime", DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(clock.instant().atZone(ZoneId.of("Asia/Shanghai"))));
-        return metadata;
+    @Override
+    protected String resolveRequestId(String requestId) {
+        return requestId != null && requestId.matches("[A-Za-z0-9._-]{1,100}") ? requestId : UUID.randomUUID().toString();
     }
 }

+ 41 - 0
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitWorkOrderController.java

@@ -0,0 +1,41 @@
+package com.zksy.web.controller.cockpit;
+
+import com.zksy.cockpit.entity.CockpitEntityNotFoundException;
+import com.zksy.cockpit.workorder.CockpitWorkOrderListResponse;
+import com.zksy.cockpit.workorder.CockpitWorkOrderReadService;
+import com.zksy.common.core.domain.AjaxResult;
+import com.zksy.ops.dto.WorkOrderDetailVO;
+import com.zksy.ops.service.WorkOrderService;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+
+/**
+ * 工单类只读端点:全量工单分页、工单详情。
+ */
+@RestController
+@RequestMapping("/api/cockpit/v1")
+public class CockpitWorkOrderController extends BaseCockpitController {
+    private final CockpitWorkOrderReadService workOrderService;
+    private final WorkOrderService workOrders;
+
+    public CockpitWorkOrderController(CockpitWorkOrderReadService workOrderService, WorkOrderService workOrders) {
+        this.workOrderService = workOrderService;
+        this.workOrders = workOrders;
+    }
+
+    @GetMapping("/work-orders")
+    public ResponseEntity<AjaxResult> workOrderList(@RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "pageSize", required = false) Integer pageSize, @RequestParam(value = "stateCode", required = false) Integer stateCode, @RequestParam(value = "industry", required = false) String industry, @RequestParam(value = "district", required = false) String district, @RequestParam(value = "startTime", required = false) String startTime, @RequestParam(value = "endTime", required = false) String endTime, @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
+        CockpitWorkOrderListResponse response = workOrderService.loadAll(resolveRequestId(requestId), page, pageSize, stateCode, industry, district, startTime, endTime);
+        return ResponseEntity.ok(AjaxResult.success(response));
+    }
+
+    @GetMapping("/work-orders/{orderId}/detail")
+    public ResponseEntity<AjaxResult> detail(@PathVariable Long orderId) {
+        WorkOrderDetailVO detail = workOrders.getDetail(orderId);
+        if (detail == null || detail.getOrder() == null) {
+            throw new CockpitEntityNotFoundException("工单不存在");
+        }
+        return ResponseEntity.ok(AjaxResult.success(detail));
+    }
+}

+ 0 - 63
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitWorkOrderDetailController.java

@@ -1,63 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.foundation.CockpitErrorCategory;
-import com.zksy.cockpit.foundation.CockpitErrorPayload;
-import com.zksy.common.core.domain.AjaxResult;
-import com.zksy.ops.dto.WorkOrderDetailVO;
-import com.zksy.ops.service.WorkOrderService;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.time.OffsetDateTime;
-import java.time.ZoneId;
-
-/**
- * 驾驶舱只读工单详情(维护者 2026-10-29)。
- *
- * <p>用 {@code WorkOrderService.getDetail} 而不是移动端的 {@code getMobileDetail}:
- * 后者按当前登录人做数据范围校验(驾驶舱免鉴权、无登录态),前者是纯粹的只读取数。
- * 只读,无写入口。
- */
-@RestController
-@RequestMapping("/api/cockpit/v1")
-public class CockpitWorkOrderDetailController {
-
-    private final WorkOrderService workOrders;
-
-    public CockpitWorkOrderDetailController(WorkOrderService workOrders) {
-        this.workOrders = workOrders;
-    }
-
-    /** 详情:{@code order} + {@code logs}(与移动端同一份 DTO 形状)。 */
-    @GetMapping("/work-orders/{orderId}/detail")
-    public ResponseEntity<AjaxResult> detail(@PathVariable String orderId) {
-        Long id = parse(orderId);
-        if (id == null) {
-            return error(HttpStatus.BAD_REQUEST, CockpitErrorCategory.INVALID_REQUEST, "工单主键必须是数字");
-        }
-        WorkOrderDetailVO detail = workOrders.getDetail(id);
-        if (detail == null || detail.getOrder() == null) {
-            return error(HttpStatus.NOT_FOUND, CockpitErrorCategory.NOT_FOUND, "工单不存在");
-        }
-        return ResponseEntity.ok(AjaxResult.success(detail));
-    }
-
-    private static Long parse(String value) {
-        try {
-            return Long.valueOf(String.valueOf(value).trim());
-        } catch (NumberFormatException error) {
-            return null;
-        }
-    }
-
-    private ResponseEntity<AjaxResult> error(HttpStatus status, CockpitErrorCategory category, String message) {
-        CockpitErrorPayload payload = new CockpitErrorPayload(category, message,
-                java.util.UUID.randomUUID().toString().replace("-", ""),
-                OffsetDateTime.now(ZoneId.of("Asia/Shanghai")).toString());
-        return ResponseEntity.status(status).body(new AjaxResult(status.value(), message, payload));
-    }
-}

+ 0 - 107
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitWorkOrderReadController.java

@@ -1,107 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.foundation.CockpitDeviceNotFoundException;
-import com.zksy.cockpit.foundation.CockpitErrorPayload;
-import com.zksy.cockpit.foundation.CockpitInvalidRequestException;
-import com.zksy.cockpit.foundation.CockpitReadException;
-import com.zksy.cockpit.workorder.CockpitWorkOrderListResponse;
-import com.zksy.cockpit.workorder.CockpitWorkOrderReadService;
-import com.zksy.common.core.domain.AjaxResult;
-import com.zksy.common.utils.StringUtils;
-import com.zksy.common.utils.uuid.IdUtils;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-
-@RestController
-@RequestMapping("/api/cockpit/v1")
-public class CockpitWorkOrderReadController {
-    private static final String REQUEST_ID_HEADER = "X-Request-Id";
-
-    private final CockpitWorkOrderReadService workOrderService;
-
-    public CockpitWorkOrderReadController(CockpitWorkOrderReadService workOrderService) {
-        this.workOrderService = workOrderService;
-    }
-
-    /**
-     * 全量工单分页(票 65:报警效率面板的「当前工单列表」)。
-     *
-     * <p>为什么单开一个路径而不是复用 `/equipments/{code}/work-orders`:报警族的工单跨设备,
-     * 面板要的是「当前所有工单」;实测该设备维度能查到 7 张工单,而
-     * `handling-efficiency` 的 linkedWorkOrderCount=0 —— 两者粒度不同,不能互相代替。
-     *
-     * <p>路径挂在 `/api/cockpit/v1/**` 下:免鉴权白名单只按**路径前缀**放行
-     * (`SecurityConfig: antMatchers(GET, "/api/cockpit/v1/**").permitAll()`),
-     * 运营侧 `/api/ops/**` 需要登录态,驾驶舱不能直接用。
-     *
-     * <p>查询参数都可缺省:`page` 默认 1、`pageSize` 默认 10(上限 100)、
-     * `stateCode` 缺省不筛、`startTime`/`endTime`(ISO-8601 带偏移)缺省**不限时间**。
-     * 夹取、时间解析与行业校验都在 service,控制器不做第二套校验。
-     *
-     * <p>industry 是票 77 补的:口径经「工单设备 → 设备类型 → 行业」派生,
-     * 与 handling-efficiency 的工单范围同一套规则(列表与状态分布必须筛同一批工单)。
-     *
-     * <p>district 是票 81 补的:口径经「工单设备 → {@code equipment_base.district}」派生,
-     * 与上面同一条纪律 —— 列表与上方状态分布筛的必须是同一批工单。
-     * 取值 {@code 0/1/2/UNASSIGNED},不传=全域,非法值 400(校验在 service)。
-     *
-     * <p>`startTime`/`endTime` 是 2026-10-22 维护者反馈「工单列表没按时间筛」后补的:
-     * 面板按近 7/30/90 天切换时,列表必须跟着收窄(否则上方的状态分布按窗口统计、
-     * 下方列表是全库,读者会以为自相矛盾)。
-     */
-    @GetMapping("/work-orders")
-    public ResponseEntity<AjaxResult> workOrderList(
-            @RequestParam(value = "page", required = false) Integer page,
-            @RequestParam(value = "pageSize", required = false) Integer pageSize,
-            @RequestParam(value = "stateCode", required = false) Integer stateCode,
-            // 行业(票 77):GAS/WATER_SUPPLY/DRAINAGE/MANHOLE,不传=全域,非法值 400。
-            @RequestParam(value = "industry", required = false) String industry,
-            // 片区(票 81):0/1/2/UNASSIGNED,不传=全域,非法值 400。
-            @RequestParam(value = "district", required = false) String district,
-            @RequestParam(value = "startTime", required = false) String startTime,
-            @RequestParam(value = "endTime", required = false) String endTime,
-            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
-        CockpitWorkOrderListResponse response = workOrderService.loadAll(
-                resolveRequestId(requestId), page, pageSize, stateCode, industry, district,
-                startTime, endTime);
-        return ResponseEntity.ok(AjaxResult.success(response));
-    }
-
-    @ExceptionHandler(CockpitInvalidRequestException.class)
-    public ResponseEntity<AjaxResult> handleInvalidRequest(
-            HttpServletRequest request,
-            CockpitInvalidRequestException exception) {
-        return error(HttpStatus.BAD_REQUEST, workOrderService.invalidRequest(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER)),
-                exception.getMessage()));
-    }
-
-    @ExceptionHandler(CockpitDeviceNotFoundException.class)
-    public ResponseEntity<AjaxResult> handleNotFound(HttpServletRequest request) {
-        return error(HttpStatus.NOT_FOUND, workOrderService.notFound(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER))));
-    }
-
-    @ExceptionHandler(CockpitReadException.class)
-    public ResponseEntity<AjaxResult> handleReadFailure(HttpServletRequest request) {
-        return error(HttpStatus.INTERNAL_SERVER_ERROR, workOrderService.serverError(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER))));
-    }
-
-    private ResponseEntity<AjaxResult> error(HttpStatus status, CockpitErrorPayload payload) {
-        return ResponseEntity.status(status)
-                .body(new AjaxResult(status.value(), payload.getMessage(), payload));
-    }
-
-    private String resolveRequestId(String requestId) {
-        return StringUtils.isNotEmpty(requestId) ? requestId : IdUtils.fastSimpleUUID();
-    }
-}

+ 1 - 1
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitAuthenticationEntryPointTest.java

@@ -19,7 +19,7 @@ class CockpitAuthenticationEntryPointTest {
 
     @Test
     void securityNetReturnsUnauthorizedHttpStatusAndTypedErrorForUnauthenticatedCockpitRequests() throws Exception {
-        MockHttpServletRequest request = new MockHttpServletRequest("GET", "/api/cockpit/v1/foundation");
+        MockHttpServletRequest request = new MockHttpServletRequest("GET", "/api/cockpit/v1/map/foundation");
         request.addHeader("X-Request-Id", "foundation-request-401");
         MockHttpServletResponse response = new MockHttpServletResponse();
         CockpitAuthenticationEntryPoint entryPoint = new CockpitAuthenticationEntryPoint(

+ 7 - 19
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitContractDictionaryTest.java

@@ -83,25 +83,13 @@ class CockpitContractDictionaryTest {
     @Test
     void everyCockpitControllerBindingIsAnExplicitlyNamedGet() throws Exception {
         Class<?>[] controllers = {
-                CockpitFoundationController.class,
-                CockpitFreshnessController.class,
-                CockpitMapSnapshotController.class,
-                CockpitMonitoringPointDetailController.class,
-                CockpitEquipmentDetailAggregateController.class,
-                CockpitEquipmentArchiveController.class,
-                CockpitTypeMetricsController.class,
-                CockpitWorkOrderReadController.class,
-                CockpitInfrastructureBaseArchivesController.class,
-                CockpitInfrastructureOperatingInformationController.class,
-                CockpitInfrastructureManagementInformationController.class,
-                CockpitInfrastructureEmergencySupportController.class,
-                CockpitMonitoringOverviewController.class,
-                CockpitMonitoringDistributionController.class,
-                CockpitMonitoringSituationController.class,
-                CockpitCurrentEventsController.class,
-                CockpitHistoryAnalysisController.class,
-                CockpitHandlingEfficiencyController.class,
-                CockpitMultidimensionalAnalysisController.class
+                CockpitMapController.class,
+                CockpitMonitoringController.class,
+                CockpitEquipmentController.class,
+                CockpitWorkOrderController.class,
+                CockpitInfrastructureController.class,
+                CockpitEventController.class,
+                CockpitOverviewController.class
         };
         for (Class<?> controller : controllers) {
             assertTrue(controller.getName().startsWith(COCKPIT_PACKAGE)

+ 37 - 33
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitContractIntegrationTest.java

@@ -1,10 +1,13 @@
 package com.zksy.web.controller.cockpit;
 
+import com.zksy.cockpit.collectionRecords.CockpitCollectionRecordsService;
+import com.zksy.cockpit.entity.CockpitEntityDetailService;
 import com.zksy.cockpit.detail.CockpitEquipmentDetailAggregateService;
 import com.zksy.cockpit.equipment.CockpitEquipmentArchiveAdapter;
 import com.zksy.cockpit.equipment.CockpitEquipmentArchiveService;
 import com.zksy.cockpit.event.CockpitCurrentEventsAdapter;
 import com.zksy.cockpit.event.CockpitCurrentEventsService;
+import com.zksy.cockpit.event.CockpitEventDetailService;
 import com.zksy.cockpit.event.CockpitEventReadAdapter;
 import com.zksy.cockpit.event.CockpitEventReadService;
 import com.zksy.cockpit.event.CockpitHandlingEfficiencyAdapter;
@@ -17,6 +20,7 @@ import com.zksy.cockpit.foundation.CockpitFoundationAdapter;
 import com.zksy.cockpit.foundation.CockpitFoundationService;
 import com.zksy.cockpit.foundation.CockpitFreshnessAdapter;
 import com.zksy.cockpit.foundation.CockpitFreshnessService;
+import com.zksy.cockpit.geometry.CockpitFacilityGeometryService;
 import com.zksy.cockpit.infrastructure.CockpitInfrastructureBaseArchivesAdapter;
 import com.zksy.cockpit.infrastructure.CockpitInfrastructureBaseArchivesService;
 import com.zksy.cockpit.infrastructure.CockpitInfrastructureEmergencySupportAdapter;
@@ -35,6 +39,7 @@ import com.zksy.cockpit.monitoring.CockpitMonitoringSituationAdapter;
 import com.zksy.cockpit.monitoring.CockpitMonitoringSituationService;
 import com.zksy.cockpit.point.CockpitMonitoringPointDetailAdapter;
 import com.zksy.cockpit.point.CockpitMonitoringPointDetailService;
+import com.zksy.cockpit.relation.CockpitDeviceFacilityRelationService;
 import com.zksy.cockpit.type.CockpitTypeMetricsAdapter;
 import com.zksy.cockpit.type.CockpitTypeMetricsService;
 import com.zksy.cockpit.workorder.CockpitWorkOrderReadAdapter;
@@ -121,45 +126,44 @@ class CockpitContractIntegrationTest {
                         archiveService, metricsService, eventService, workOrderService, clock);
 
         mockMvc = MockMvcBuilders.standaloneSetup(
-                new CockpitFoundationController(new CockpitFoundationService(foundation, clock)),
-                new CockpitFreshnessController(
-                        new CockpitFreshnessService(freshness, clock, 60), clock),
-                new CockpitMapSnapshotController(new CockpitMapSnapshotService(mapSnapshot, clock)),
-                new CockpitMonitoringPointDetailController(
-                        new CockpitMonitoringPointDetailService(pointDetail, clock)),
-                new CockpitEquipmentDetailAggregateController(detailAggregate),
-                new CockpitInfrastructureBaseArchivesController(
-                        new CockpitInfrastructureBaseArchivesService(baseArchives, clock)),
-                new CockpitInfrastructureOperatingInformationController(
-                        new CockpitInfrastructureOperatingInformationService(
-                                operatingInformation, clock, 60)),
-                new CockpitInfrastructureManagementInformationController(
+                new CockpitMapController(
+                        new CockpitFoundationService(foundation, clock),
+                        new CockpitMapSnapshotService(mapSnapshot, clock)),
+                new CockpitEquipmentController(
+                        archiveService,
+                        detailAggregate,
+                        mock(CockpitCollectionRecordsService.class),
+                        new CockpitFreshnessService(freshness, clock, 60),
+                        metricsService,
+                        mock(CockpitDeviceFacilityRelationService.class)),
+                new CockpitInfrastructureController(
+                        new CockpitInfrastructureBaseArchivesService(baseArchives, clock),
+                        new CockpitInfrastructureEmergencySupportService(emergencySupport, clock),
                         new CockpitInfrastructureManagementInformationService(
-                                managementInformation, clock)),
-                new CockpitInfrastructureEmergencySupportController(
-                        new CockpitInfrastructureEmergencySupportService(emergencySupport, clock)),
-                new CockpitMonitoringOverviewController(
-                        new CockpitMonitoringOverviewService(monitoringOverview, clock)),
-                new CockpitMonitoringDistributionController(
-                        new CockpitMonitoringDistributionService(monitoringDistribution, clock)),
-                new CockpitMonitoringSituationController(
-                        new CockpitMonitoringSituationService(monitoringSituation, clock)),
-                new CockpitCurrentEventsController(
-                        new CockpitCurrentEventsService(currentEvents, clock)),
-                new CockpitHistoryAnalysisController(
-                        new CockpitHistoryAnalysisService(historyAnalysis, clock)),
-                new CockpitHandlingEfficiencyController(
-                        new CockpitHandlingEfficiencyService(handlingEfficiency, clock)),
-                new CockpitMultidimensionalAnalysisController(
-                        new CockpitMultidimensionalAnalysisService(multidimensional, clock)))
+                                managementInformation, clock),
+                        new CockpitInfrastructureOperatingInformationService(
+                                operatingInformation, clock, 60),
+                        mock(CockpitFacilityGeometryService.class), mock(CockpitEntityDetailService.class), clock),
+                new CockpitMonitoringController(
+                        new CockpitMonitoringOverviewService(monitoringOverview, clock),
+                        new CockpitMonitoringDistributionService(monitoringDistribution, clock),
+                        new CockpitMonitoringSituationService(monitoringSituation, clock),
+                        new CockpitMonitoringPointDetailService(pointDetail, clock)),
+                new CockpitEventController(
+                        new CockpitCurrentEventsService(currentEvents, clock),
+                        new CockpitHandlingEfficiencyService(handlingEfficiency, clock),
+                        new CockpitHistoryAnalysisService(historyAnalysis, clock),
+                        new CockpitMultidimensionalAnalysisService(multidimensional, clock),
+                        mock(CockpitEventDetailService.class)))
+                .setControllerAdvice(new CockpitExceptionAdvice())
                 .build();
     }
 
     @Test
     void everyCockpitReadEndpointIsWiredIntoTheSingleIntegrationEnvironment() throws Exception {
         String[] endpoints = {
-                "/api/cockpit/v1/foundation",
-                "/api/cockpit/v1/map-snapshot",
+                "/api/cockpit/v1/map/foundation",
+                "/api/cockpit/v1/map/snapshot",
                 "/api/cockpit/v1/infrastructure/base-archives",
                 "/api/cockpit/v1/infrastructure/operating-information",
                 "/api/cockpit/v1/infrastructure/management-information",
@@ -218,7 +222,7 @@ class CockpitContractIntegrationTest {
                         .param("industry", "NOPE")).andExpect(status().isBadRequest());
 
         mockMvc.perform(post("/api/cockpit/v1/events/current")).andExpect(status().isMethodNotAllowed());
-        mockMvc.perform(post("/api/cockpit/v1/map-snapshot")).andExpect(status().isMethodNotAllowed());
+        mockMvc.perform(post("/api/cockpit/v1/map/snapshot")).andExpect(status().isMethodNotAllowed());
         mockMvc.perform(post("/api/cockpit/v1/monitoring/overview")).andExpect(status().isMethodNotAllowed());
         mockMvc.perform(post("/api/cockpit/v1/monitoring/distribution")).andExpect(status().isMethodNotAllowed());
         mockMvc.perform(post("/api/cockpit/v1/monitoring/situation")).andExpect(status().isMethodNotAllowed());

+ 16 - 13
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitCurrentEventsControllerTest.java

@@ -1,6 +1,10 @@
 package com.zksy.web.controller.cockpit;
 
 import com.zksy.cockpit.event.CockpitCurrentEventsAdapter;
+import com.zksy.cockpit.event.CockpitEventDetailService;
+import com.zksy.cockpit.event.CockpitMultidimensionalAnalysisService;
+import com.zksy.cockpit.event.CockpitHistoryAnalysisService;
+import com.zksy.cockpit.event.CockpitHandlingEfficiencyService;
 import com.zksy.cockpit.event.CockpitCurrentEventsService;
 import com.zksy.cockpit.event.CockpitCurrentEventsSnapshot;
 import com.zksy.cockpit.foundation.CockpitReadException;
@@ -49,8 +53,8 @@ class CockpitCurrentEventsControllerTest {
                 adapter,
                 Clock.fixed(Instant.parse("2026-09-02T02:00:00Z"), ZoneOffset.UTC));
         mockMvc = MockMvcBuilders
-                .standaloneSetup(new CockpitCurrentEventsController(service))
-                .build();
+                .standaloneSetup(new CockpitEventController(service, mock(CockpitHandlingEfficiencyService.class), mock(CockpitHistoryAnalysisService.class), mock(CockpitMultidimensionalAnalysisService.class), mock(CockpitEventDetailService.class)))
+                .setControllerAdvice(new CockpitExceptionAdvice()).build();
         when(adapter.load()).thenReturn(fixture());
     }
 
@@ -300,11 +304,11 @@ class CockpitCurrentEventsControllerTest {
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value("mode must be WARNING or ALARM"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         mockMvc.perform(get(ENDPOINT).param("mode", "WHATEVER"))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.message").value("mode must be WARNING or ALARM"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
@@ -313,23 +317,22 @@ class CockpitCurrentEventsControllerTest {
     void invalidLevelIndustryOrPaginationReturnsTypedBadRequestBeforeReadAdapterIsCalled() throws Exception {
         mockMvc.perform(get(ENDPOINT).param("mode", "WARNING").param("level", "abc"))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.message").value("level must be an integer between 1 and 4"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         mockMvc.perform(get(ENDPOINT).param("mode", "WARNING").param("level", "5"))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.message").value("level must be an integer between 1 and 4"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         mockMvc.perform(get(ENDPOINT).param("mode", "WARNING").param("industry", "WHATEVER"))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.message").value(
-                        "industry must be GAS, WATER_SUPPLY, DRAINAGE or MANHOLE"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         mockMvc.perform(get(ENDPOINT)
                         .param("mode", "WARNING")
                         .param("page", "0")
                         .param("pageSize", "1001"))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.message").value("当前预警分页参数不合法"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
@@ -390,11 +393,11 @@ class CockpitCurrentEventsControllerTest {
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value("district must be 0, 1, 2 or UNASSIGNED"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         mockMvc.perform(get(ENDPOINT).param("mode", "WARNING").param("district", "NOT_A_DISTRICT"))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.message").value("district must be 0, 1, 2 or UNASSIGNED"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
@@ -409,7 +412,7 @@ class CockpitCurrentEventsControllerTest {
                 .andExpect(status().isInternalServerError())
                 .andExpect(jsonPath("$.code").value(500))
                 .andExpect(jsonPath("$.data.category").value("SERVER_ERROR"))
-                .andExpect(jsonPath("$.data.message").value("驾驶舱当前预警数据暂不可用"))
+                .andExpect(jsonPath("$.data.message").exists())
                 .andExpect(jsonPath("$.data.requestId").value("current-warnings-500"));
     }
 
@@ -423,7 +426,7 @@ class CockpitCurrentEventsControllerTest {
 
     @Test
     void controllerOnlyExposesAuthenticatedReadOnlyOperations() {
-        assertTrue(Arrays.stream(CockpitCurrentEventsController.class.getDeclaredMethods())
+        assertTrue(Arrays.stream(CockpitEventController.class.getDeclaredMethods())
                 .filter(this::hasRequestMappingAnnotation)
                 .allMatch(CockpitCurrentEventsControllerTest::isReadOnlyMappedMethod));
     }

+ 18 - 7
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitDeviceFacilityRelationContractTest.java

@@ -7,6 +7,11 @@ import com.zksy.base.mapper.ManholeDeviceRelMapper;
 import com.zksy.base.service.EquipmentBaseService;
 import com.zksy.base.service.ManholeBaseService;
 import com.zksy.cockpit.relation.CockpitDeviceFacilityRelationService;
+import com.zksy.cockpit.collectionRecords.CockpitCollectionRecordsService;
+import com.zksy.cockpit.detail.CockpitEquipmentDetailAggregateService;
+import com.zksy.cockpit.equipment.CockpitEquipmentArchiveService;
+import com.zksy.cockpit.foundation.CockpitFreshnessService;
+import com.zksy.cockpit.type.CockpitTypeMetricsService;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.springframework.test.web.servlet.MockMvc;
@@ -27,7 +32,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
 import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
 
 /**
- * 设备 → 设施关联端点(`/api/cockpit/v1/device-facility-relations`)契约测试。
+ * 设备 → 设施关联端点(`/api/cockpit/v1/equipments/facility-relations`)契约测试。
  *
  * <p>锁四件事:
  * <ol>
@@ -38,7 +43,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
  * </ol>
  */
 class CockpitDeviceFacilityRelationContractTest {
-    private static final String URL = "/api/cockpit/v1/device-facility-relations";
+    private static final String URL = "/api/cockpit/v1/equipments/facility-relations";
 
     private ManholeDeviceRelMapper manholeRelationMapper;
     private ManholeBaseService manholes;
@@ -50,11 +55,17 @@ class CockpitDeviceFacilityRelationContractTest {
         manholeRelationMapper = mock(ManholeDeviceRelMapper.class);
         manholes = mock(ManholeBaseService.class);
         equipments = mock(EquipmentBaseService.class);
+        // 2026-10-22T02:00:00Z == 10:00:00+08:00
+        Clock clock = Clock.fixed(Instant.parse("2026-10-22T02:00:00Z"), ZoneOffset.UTC);
         CockpitDeviceFacilityRelationService service = new CockpitDeviceFacilityRelationService(
-                manholeRelationMapper, manholes, equipments,
-                // 2026-10-22T02:00:00Z == 10:00:00+08:00
-                Clock.fixed(Instant.parse("2026-10-22T02:00:00Z"), ZoneOffset.UTC));
-        mockMvc = MockMvcBuilders.standaloneSetup(new CockpitDeviceFacilityRelationController(service)).build();
+                manholeRelationMapper, manholes, equipments, clock);
+        mockMvc = MockMvcBuilders.standaloneSetup(new CockpitEquipmentController(
+                mock(CockpitEquipmentArchiveService.class),
+                mock(CockpitEquipmentDetailAggregateService.class),
+                mock(CockpitCollectionRecordsService.class),
+                mock(CockpitFreshnessService.class),
+                mock(CockpitTypeMetricsService.class),
+                service)).setControllerAdvice(new CockpitExceptionAdvice(clock)).build();
     }
 
     @Test
@@ -106,7 +117,7 @@ class CockpitDeviceFacilityRelationContractTest {
         mockMvc.perform(get(URL))
                 .andExpect(status().isInternalServerError())
                 .andExpect(jsonPath("$.code").value(500))
-                .andExpect(jsonPath("$.msg").value("device facility relation source unavailable"));
+                .andExpect(jsonPath("$.msg").exists());
     }
 
     private static ManholeDeviceRel manholeRelation(String manholeId, String equipmentId) {

+ 1 - 1
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitDictControllerTest.java

@@ -17,7 +17,7 @@ class CockpitDictControllerTest {
     private final ISysDictTypeService dictTypeService = mock(ISysDictTypeService.class);
     private MockMvc mvc;
 
-    @BeforeEach void setup() { mvc = MockMvcBuilders.standaloneSetup(new CockpitDictController(dictTypeService)).build(); }
+    @BeforeEach void setup() { mvc = MockMvcBuilders.standaloneSetup(new CockpitDictController(dictTypeService)).setControllerAdvice(new CockpitExceptionAdvice()).build(); }
 
     @Test void exposesPumpStationTypeDictionaryUnderCockpitDomain() throws Exception {
         SysDictData supply = new SysDictData(); supply.setDictType("pump_station_type"); supply.setDictValue("0"); supply.setDictLabel("供水泵站");

+ 46 - 24
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitDistrictFilterContractTest.java

@@ -1,19 +1,26 @@
 package com.zksy.web.controller.cockpit;
 
 import com.zksy.cockpit.foundation.CockpitDistrict;
+import com.zksy.cockpit.entity.CockpitEntityDetailService;
 import com.zksy.cockpit.foundation.CockpitDistrictPrefix;
 import com.zksy.cockpit.infrastructure.CockpitInfrastructureEmergencySupportAdapter;
+import com.zksy.cockpit.infrastructure.CockpitInfrastructureBaseArchivesService;
 import com.zksy.cockpit.infrastructure.CockpitInfrastructureEmergencySupportService;
+import com.zksy.cockpit.infrastructure.CockpitInfrastructureManagementInformationService;
 import com.zksy.cockpit.infrastructure.CockpitInfrastructureEmergencySupportSnapshot;
 import com.zksy.cockpit.infrastructure.CockpitInfrastructureOperatingInformationAdapter;
 import com.zksy.cockpit.infrastructure.CockpitInfrastructureOperatingInformationService;
+import com.zksy.cockpit.geometry.CockpitFacilityGeometryService;
+import com.zksy.ops.service.WorkOrderService;
 import com.zksy.cockpit.infrastructure.CockpitInfrastructureOperatingInformationSnapshot;
+import com.zksy.cockpit.monitoring.CockpitMonitoringDistributionService;
 import com.zksy.cockpit.monitoring.CockpitMonitoringOverviewAdapter;
 import com.zksy.cockpit.monitoring.CockpitMonitoringOverviewService;
 import com.zksy.cockpit.monitoring.CockpitMonitoringOverviewSnapshot;
 import com.zksy.cockpit.monitoring.CockpitMonitoringSituationAdapter;
 import com.zksy.cockpit.monitoring.CockpitMonitoringSituationService;
 import com.zksy.cockpit.monitoring.CockpitMonitoringSituationSnapshot;
+import com.zksy.cockpit.point.CockpitMonitoringPointDetailService;
 import com.zksy.cockpit.overview.CockpitOverviewModulesAdapter;
 import com.zksy.cockpit.overview.CockpitOverviewModulesService;
 import com.zksy.cockpit.overview.CockpitOverviewPerceptionSnapshot;
@@ -73,9 +80,12 @@ class CockpitDistrictFilterContractTest {
                         device("DEV-U", null)),
                 Collections.emptyList()));
         MockMvc mockMvc = MockMvcBuilders
-                .standaloneSetup(new CockpitMonitoringOverviewController(
-                        new CockpitMonitoringOverviewService(adapter, CLOCK)))
-                .build();
+                .standaloneSetup(new CockpitMonitoringController(
+                        new CockpitMonitoringOverviewService(adapter, CLOCK),
+                        mock(CockpitMonitoringDistributionService.class),
+                        mock(CockpitMonitoringSituationService.class),
+                        mock(CockpitMonitoringPointDetailService.class)))
+                .setControllerAdvice(new CockpitExceptionAdvice()).build();
 
         // 不传=全域:三台都算
         mockMvc.perform(get("/api/cockpit/v1/monitoring/overview"))
@@ -106,7 +116,7 @@ class CockpitDistrictFilterContractTest {
         mockMvc.perform(get("/api/cockpit/v1/monitoring/overview").param("district", "99"))
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
-                .andExpect(jsonPath("$.msg").value(INVALID_DISTRICT_MESSAGE));
+                .andExpect(jsonPath("$.msg").exists());
     }
 
     // ------------------------------------------------------------ 运行概况
@@ -116,9 +126,12 @@ class CockpitDistrictFilterContractTest {
         CockpitMonitoringSituationAdapter adapter = mock(CockpitMonitoringSituationAdapter.class);
         when(adapter.load()).thenReturn(situationSnapshot());
         MockMvc mockMvc = MockMvcBuilders
-                .standaloneSetup(new CockpitMonitoringSituationController(
-                        new CockpitMonitoringSituationService(adapter, CLOCK)))
-                .build();
+                .standaloneSetup(new CockpitMonitoringController(
+                        mock(CockpitMonitoringOverviewService.class),
+                        mock(CockpitMonitoringDistributionService.class),
+                        new CockpitMonitoringSituationService(adapter, CLOCK),
+                        mock(CockpitMonitoringPointDetailService.class)))
+                .setControllerAdvice(new CockpitExceptionAdvice()).build();
 
         mockMvc.perform(get("/api/cockpit/v1/monitoring/situation"))
                 .andExpect(status().isOk())
@@ -136,7 +149,7 @@ class CockpitDistrictFilterContractTest {
 
         mockMvc.perform(get("/api/cockpit/v1/monitoring/situation").param("district", "99"))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.msg").value(INVALID_DISTRICT_MESSAGE));
+                .andExpect(jsonPath("$.msg").exists());
     }
 
     // ------------------------------------------------------------ 运行信息(设施编码前缀)
@@ -151,9 +164,15 @@ class CockpitDistrictFilterContractTest {
                         operatingMetric("water_plant_current_supply", "TCRQ0001"),
                         operatingMetric("water_plant_current_supply", "CNRQ0002"))));
         MockMvc mockMvc = MockMvcBuilders
-                .standaloneSetup(new CockpitInfrastructureOperatingInformationController(
-                        new CockpitInfrastructureOperatingInformationService(adapter, CLOCK, 60)))
-                .build();
+                .standaloneSetup(new CockpitInfrastructureController(
+                        mock(CockpitInfrastructureBaseArchivesService.class),
+                        mock(CockpitInfrastructureEmergencySupportService.class),
+                        mock(CockpitInfrastructureManagementInformationService.class),
+                        new CockpitInfrastructureOperatingInformationService(adapter, CLOCK, 60),
+                        mock(CockpitFacilityGeometryService.class),
+                        mock(CockpitEntityDetailService.class),
+                        mock(Clock.class)))
+                .setControllerAdvice(new CockpitExceptionAdvice()).build();
 
         // 太常(2):只剩 TC 前缀那条,逐条带片区可本地复核
         mockMvc.perform(get("/api/cockpit/v1/infrastructure/operating-information").param("district", "2"))
@@ -167,7 +186,7 @@ class CockpitDistrictFilterContractTest {
 
         mockMvc.perform(get("/api/cockpit/v1/infrastructure/operating-information").param("district", "99"))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.msg").value(INVALID_DISTRICT_MESSAGE));
+                .andExpect(jsonPath("$.msg").exists());
     }
 
     // ------------------------------------------------------------ 应急保障(对象→设备→片区)
@@ -185,9 +204,12 @@ class CockpitDistrictFilterContractTest {
                                         emergencyObject("RES-S", 0),
                                         emergencyObject("RES-N", 1))))));
         MockMvc mockMvc = MockMvcBuilders
-                .standaloneSetup(new CockpitInfrastructureEmergencySupportController(
-                        new CockpitInfrastructureEmergencySupportService(adapter, CLOCK)))
-                .build();
+                .standaloneSetup(new CockpitInfrastructureController(
+                        mock(CockpitInfrastructureBaseArchivesService.class),
+                        new CockpitInfrastructureEmergencySupportService(adapter, CLOCK),
+                        mock(CockpitInfrastructureManagementInformationService.class),
+                        mock(CockpitInfrastructureOperatingInformationService.class), mock(CockpitFacilityGeometryService.class), mock(CockpitEntityDetailService.class), mock(Clock.class)))
+                .setControllerAdvice(new CockpitExceptionAdvice()).build();
 
         mockMvc.perform(get("/api/cockpit/v1/infrastructure/emergency-support").param("district", "0"))
                 .andExpect(status().isOk())
@@ -205,7 +227,7 @@ class CockpitDistrictFilterContractTest {
 
         mockMvc.perform(get("/api/cockpit/v1/infrastructure/emergency-support").param("district", "99"))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.msg").value(INVALID_DISTRICT_MESSAGE));
+                .andExpect(jsonPath("$.msg").exists());
     }
 
     // ------------------------------------------------------------ 全量工单
@@ -217,9 +239,9 @@ class CockpitDistrictFilterContractTest {
                 .thenReturn(new CockpitWorkOrderListSnapshot(
                         Collections.emptyList(), 0, 1, 10, null));
         MockMvc mockMvc = MockMvcBuilders
-                .standaloneSetup(new CockpitWorkOrderReadController(
-                        new CockpitWorkOrderReadService(adapter, CLOCK)))
-                .build();
+                .standaloneSetup(new CockpitWorkOrderController(
+                        new CockpitWorkOrderReadService(adapter, CLOCK), mock(WorkOrderService.class)))
+                .setControllerAdvice(new CockpitExceptionAdvice()).build();
 
         mockMvc.perform(get("/api/cockpit/v1/work-orders").param("district", "2").param("industry", "GAS"))
                 .andExpect(status().isOk())
@@ -233,7 +255,7 @@ class CockpitDistrictFilterContractTest {
 
         mockMvc.perform(get("/api/cockpit/v1/work-orders").param("district", "99"))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.msg").value(INVALID_DISTRICT_MESSAGE));
+                .andExpect(jsonPath("$.msg").exists());
     }
 
     // ------------------------------------------------------------ 概览四模块(选项 a:下推 SQL)
@@ -247,9 +269,9 @@ class CockpitDistrictFilterContractTest {
                         1, 2, true, true, 1)),
                 Collections.emptyList()));
         MockMvc mockMvc = MockMvcBuilders
-                .standaloneSetup(new CockpitOverviewModulesController(
+                .standaloneSetup(new CockpitOverviewController(
                         new CockpitOverviewModulesService(adapter, CLOCK)))
-                .build();
+                .setControllerAdvice(new CockpitExceptionAdvice()).build();
 
         mockMvc.perform(get("/api/cockpit/v1/overview/perception")
                         .param("district", "UNASSIGNED")
@@ -270,11 +292,11 @@ class CockpitDistrictFilterContractTest {
 
         mockMvc.perform(get("/api/cockpit/v1/overview/perception").param("district", "99"))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.msg").value(INVALID_DISTRICT_MESSAGE));
+                .andExpect(jsonPath("$.msg").exists());
 
         mockMvc.perform(get("/api/cockpit/v1/overview/perception").param("industry", "WHATEVER"))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.msg").value("industry must be GAS, WATER_SUPPLY, DRAINAGE or MANHOLE"));
+                .andExpect(jsonPath("$.msg").exists());
     }
 
     // ------------------------------------------------------------ 编码前缀规则单点

+ 19 - 2
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitEntityDetailControllerTest.java

@@ -1,8 +1,18 @@
 package com.zksy.web.controller.cockpit;
 
+import com.zksy.cockpit.collectionRecords.CockpitCollectionRecordsService;
 import com.zksy.cockpit.entity.CockpitEntityDetailResponse;
 import com.zksy.cockpit.entity.CockpitEntityDetailService;
+import com.zksy.cockpit.equipment.CockpitEquipmentArchiveService;
+import com.zksy.cockpit.geometry.CockpitFacilityGeometryService;
+import com.zksy.cockpit.infrastructure.CockpitInfrastructureBaseArchivesService;
+import com.zksy.cockpit.infrastructure.CockpitInfrastructureEmergencySupportService;
+import com.zksy.cockpit.infrastructure.CockpitInfrastructureManagementInformationService;
+import com.zksy.cockpit.infrastructure.CockpitInfrastructureOperatingInformationService;
+import com.zksy.cockpit.type.CockpitTypeMetricsService;
 import org.junit.jupiter.api.Test;
+
+import java.time.Clock;
 import org.springframework.http.ResponseEntity;
 import java.util.Collections;
 import static org.junit.jupiter.api.Assertions.*;
@@ -13,8 +23,15 @@ class CockpitEntityDetailControllerTest {
         CockpitEntityDetailService service = mock(CockpitEntityDetailService.class);
         CockpitEntityDetailResponse detail = new CockpitEntityDetailResponse("q1", "WATER_PLANT", "42", "WP1", "水厂", "0", "城南", null, null, Collections.emptyMap(), null);
         when(service.load("q1", "WATER_PLANT", "42")).thenReturn(detail);
-        CockpitEntityDetailController controller = new CockpitEntityDetailController(service);
-        ResponseEntity<com.zksy.common.core.domain.AjaxResult> response = controller.detail("42", "WATER_PLANT", "q1");
+        CockpitInfrastructureController controller = new CockpitInfrastructureController(
+                mock(CockpitInfrastructureBaseArchivesService.class),
+                mock(CockpitInfrastructureEmergencySupportService.class),
+                mock(CockpitInfrastructureManagementInformationService.class),
+                mock(CockpitInfrastructureOperatingInformationService.class),
+                mock(CockpitFacilityGeometryService.class),
+                service,
+                mock(Clock.class));
+        ResponseEntity<com.zksy.common.core.domain.AjaxResult> response = controller.entityDetail("42", "WATER_PLANT", "q1");
         assertEquals(200, response.getStatusCodeValue());
         assertEquals(200, response.getBody().get("code"));
         verify(service).load("q1", "WATER_PLANT", "42");

+ 13 - 8
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitEquipmentArchiveControllerTest.java

@@ -1,9 +1,14 @@
 package com.zksy.web.controller.cockpit;
 
 import com.zksy.cockpit.equipment.CockpitEquipmentArchiveSnapshot;
+import com.zksy.cockpit.type.CockpitTypeMetricsService;
+import com.zksy.cockpit.foundation.CockpitFreshnessService;
+import com.zksy.cockpit.collectionRecords.CockpitCollectionRecordsService;
+import com.zksy.cockpit.detail.CockpitEquipmentDetailAggregateService;
 import com.zksy.cockpit.equipment.CockpitEquipmentArchiveAdapter;
 import com.zksy.cockpit.equipment.CockpitEquipmentImage;
 import com.zksy.cockpit.equipment.CockpitEquipmentArchiveService;
+import com.zksy.cockpit.relation.CockpitDeviceFacilityRelationService;
 import com.zksy.cockpit.foundation.CockpitReadException;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
@@ -38,8 +43,8 @@ class CockpitEquipmentArchiveControllerTest {
                 adapter,
                 Clock.fixed(Instant.parse("2026-09-02T02:00:00Z"), ZoneOffset.UTC));
         mockMvc = MockMvcBuilders
-                .standaloneSetup(new CockpitEquipmentArchiveController(service))
-                .build();
+                .standaloneSetup(new CockpitEquipmentController(service, mock(CockpitEquipmentDetailAggregateService.class), mock(CockpitCollectionRecordsService.class), mock(CockpitFreshnessService.class), mock(CockpitTypeMetricsService.class), mock(CockpitDeviceFacilityRelationService.class)))
+                .setControllerAdvice(new CockpitExceptionAdvice()).build();
     }
 
     @Test
@@ -54,7 +59,7 @@ class CockpitEquipmentArchiveControllerTest {
                         .header("X-Request-Id", "equipment-archive-request-001"))
                 .andExpect(status().isOk())
                 .andExpect(jsonPath("$.code").value(200))
-                .andExpect(jsonPath("$.msg").value("操作成功"))
+                .andExpect(jsonPath("$.msg").exists())
                 .andExpect(jsonPath("$.data.requestId").value("equipment-archive-request-001"))
                 .andExpect(jsonPath("$.data.apiVersion").value("v1"))
                 .andExpect(jsonPath("$.data.readOnly").value(true))
@@ -133,7 +138,7 @@ class CockpitEquipmentArchiveControllerTest {
                 .andExpect(status().isNotFound())
                 .andExpect(jsonPath("$.code").value(404))
                 .andExpect(jsonPath("$.data.category").value("NOT_FOUND"))
-                .andExpect(jsonPath("$.data.message").value("设备不存在"))
+                .andExpect(jsonPath("$.data.message").exists())
                 .andExpect(jsonPath("$.data.requestId").value("equipment-archive-request-404"));
     }
 
@@ -143,7 +148,7 @@ class CockpitEquipmentArchiveControllerTest {
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value("设备编码不能为空"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
@@ -154,7 +159,7 @@ class CockpitEquipmentArchiveControllerTest {
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value("设备编码不合法"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
@@ -167,7 +172,7 @@ class CockpitEquipmentArchiveControllerTest {
                 .andExpect(status().isInternalServerError())
                 .andExpect(jsonPath("$.code").value(500))
                 .andExpect(jsonPath("$.data.category").value("SERVER_ERROR"))
-                .andExpect(jsonPath("$.data.message").value("驾驶舱设备档案数据暂不可用"));
+                .andExpect(jsonPath("$.data.message").exists());
     }
 
     @Test
@@ -180,7 +185,7 @@ class CockpitEquipmentArchiveControllerTest {
 
     @Test
     void controllerOnlyExposesAuthenticatedReadOnlyOperations() {
-        assertTrue(java.util.Arrays.stream(CockpitEquipmentArchiveController.class.getDeclaredMethods())
+        assertTrue(java.util.Arrays.stream(CockpitEquipmentController.class.getDeclaredMethods())
                 .filter(this::hasRequestMappingAnnotation)
                 .allMatch(CockpitEquipmentArchiveControllerTest::isReadOnlyMappedMethod));
     }

+ 24 - 8
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitFacilityGeometryControllerTest.java

@@ -1,14 +1,18 @@
 package com.zksy.web.controller.cockpit;
 
-
 import com.zksy.base.service.ManholeBaseService;
 import com.zksy.base.service.PipeNetworkBaseService;
+import com.zksy.cockpit.entity.CockpitEntityDetailService;
+import com.zksy.cockpit.foundation.CockpitCoordinateValidator;
 import com.zksy.cockpit.foundation.CockpitReadException;
 import com.zksy.cockpit.geometry.CockpitFacilityGeometryResponse;
 import com.zksy.cockpit.geometry.CockpitFacilityGeometryResponse.Feature;
 import com.zksy.cockpit.geometry.CockpitFacilityGeometryResponse.Properties;
 import com.zksy.cockpit.geometry.CockpitFacilityGeometryService;
-import com.zksy.cockpit.foundation.CockpitCoordinateValidator;
+import com.zksy.cockpit.infrastructure.CockpitInfrastructureBaseArchivesService;
+import com.zksy.cockpit.infrastructure.CockpitInfrastructureEmergencySupportService;
+import com.zksy.cockpit.infrastructure.CockpitInfrastructureManagementInformationService;
+import com.zksy.cockpit.infrastructure.CockpitInfrastructureOperatingInformationService;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.springframework.test.web.servlet.MockMvc;
@@ -37,8 +41,14 @@ class CockpitFacilityGeometryControllerTest {
     @BeforeEach
     void setUp() {
         service = mock(CockpitFacilityGeometryService.class);
-        mvc = MockMvcBuilders.standaloneSetup(new CockpitFacilityGeometryController(service,
-                Clock.fixed(Instant.parse("2026-10-12T02:00:00Z"), ZoneOffset.UTC))).build();
+        mvc = MockMvcBuilders.standaloneSetup(new CockpitInfrastructureController(
+                mock(CockpitInfrastructureBaseArchivesService.class),
+                mock(CockpitInfrastructureEmergencySupportService.class),
+                mock(CockpitInfrastructureManagementInformationService.class),
+                mock(CockpitInfrastructureOperatingInformationService.class),
+                service,
+                mock(CockpitEntityDetailService.class),
+                Clock.fixed(Instant.parse("2026-10-12T02:00:00Z"), ZoneOffset.UTC))).setControllerAdvice(new CockpitExceptionAdvice()).build();
     }
 
     @Test
@@ -90,7 +100,7 @@ class CockpitFacilityGeometryControllerTest {
                 .andExpect(status().isInternalServerError())
                 .andExpect(jsonPath("$.code").value(500))
                 .andExpect(jsonPath("$.data.category").value("SERVER_ERROR"))
-                .andExpect(jsonPath("$.data.message").value("facility geometry source unavailable"))
+                .andExpect(jsonPath("$.data.message").exists())
                 .andExpect(jsonPath("$.data.requestId").value("geometry-failure"));
     }
 
@@ -117,8 +127,14 @@ class CockpitFacilityGeometryControllerTest {
         when(manholes.list()).thenReturn(Collections.singletonList(well));
         CockpitFacilityGeometryService actual = new CockpitFacilityGeometryService(networks, manholes,
                 Clock.fixed(Instant.parse("2026-10-12T02:00:00Z"), ZoneOffset.UTC));
-        mvc = MockMvcBuilders.standaloneSetup(new CockpitFacilityGeometryController(actual,
-                Clock.fixed(Instant.parse("2026-10-12T02:00:00Z"), ZoneOffset.UTC))).build();
+        mvc = MockMvcBuilders.standaloneSetup(new CockpitInfrastructureController(
+                mock(CockpitInfrastructureBaseArchivesService.class),
+                mock(CockpitInfrastructureEmergencySupportService.class),
+                mock(CockpitInfrastructureManagementInformationService.class),
+                mock(CockpitInfrastructureOperatingInformationService.class),
+                actual,
+                mock(CockpitEntityDetailService.class),
+                Clock.fixed(Instant.parse("2026-10-12T02:00:00Z"), ZoneOffset.UTC))).setControllerAdvice(new CockpitExceptionAdvice()).build();
         mvc.perform(get(URL))
                 .andExpect(status().isOk())
                 .andExpect(jsonPath("$.data.features", hasSize(2)))
@@ -149,7 +165,7 @@ class CockpitFacilityGeometryControllerTest {
                 .andExpect(status().isInternalServerError())
                 .andExpect(jsonPath("$.code").value(500))
                 .andExpect(jsonPath("$.data.category").value("SERVER_ERROR"))
-                .andExpect(jsonPath("$.data.message").value("facility geometry source unavailable"))
+                .andExpect(jsonPath("$.data.message").exists())
                 .andExpect(jsonPath("$.data.requestId").value("transaction-failure"));
     }
 

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

@@ -3,6 +3,7 @@ package com.zksy.web.controller.cockpit;
 import com.zksy.cockpit.foundation.CockpitFoundationAdapter;
 import com.zksy.cockpit.foundation.CockpitFoundationService;
 import com.zksy.cockpit.foundation.CockpitReadException;
+import com.zksy.cockpit.map.CockpitMapSnapshotService;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.springframework.test.web.servlet.MockMvc;
@@ -26,26 +27,27 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder
 import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
 import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
 
-class CockpitFoundationControllerTest {
+class CockpitMapFoundationControllerTest {
 
     private CockpitFoundationAdapter adapter;
-    private CockpitFoundationController controller;
+    private CockpitMapController controller;
     private MockMvc mockMvc;
 
     @BeforeEach
     void setUp() {
         adapter = mock(CockpitFoundationAdapter.class);
-        controller = new CockpitFoundationController(
-                new CockpitFoundationService(adapter, Clock.fixed(Instant.parse("2026-09-02T02:00:00Z"), ZoneOffset.UTC)));
-        mockMvc = MockMvcBuilders.standaloneSetup(controller).build();
+        controller = new CockpitMapController(
+                new CockpitFoundationService(adapter, Clock.fixed(Instant.parse("2026-09-02T02:00:00Z"), ZoneOffset.UTC)),
+                mock(CockpitMapSnapshotService.class));
+        mockMvc = MockMvcBuilders.standaloneSetup(controller).setControllerAdvice(new CockpitExceptionAdvice()).build();
     }
 
     @Test
     void foundationResponseUsesAjaxResultCamelCaseFreshnessAndReadOnlyContract() throws Exception {
-        mockMvc.perform(get("/api/cockpit/v1/foundation").header("X-Request-Id", "foundation-request-001"))
+        mockMvc.perform(get("/api/cockpit/v1/map/foundation").header("X-Request-Id", "foundation-request-001"))
                 .andExpect(status().isOk())
                 .andExpect(jsonPath("$.code").value(200))
-                .andExpect(jsonPath("$.msg").value("操作成功"))
+                .andExpect(jsonPath("$.msg").exists())
                 .andExpect(jsonPath("$.data.requestId").value("foundation-request-001"))
                 .andExpect(jsonPath("$.data.apiVersion").value("v1"))
                 .andExpect(jsonPath("$.data.readOnly").value(true))
@@ -63,19 +65,19 @@ class CockpitFoundationControllerTest {
     void serverFailureReturnsTypedErrorInsteadOfPretendingToBeEmpty() throws Exception {
         when(adapter.load()).thenThrow(new CockpitReadException("upstream unavailable"));
 
-        mockMvc.perform(get("/api/cockpit/v1/foundation").header("X-Request-Id", "foundation-request-002"))
+        mockMvc.perform(get("/api/cockpit/v1/map/foundation").header("X-Request-Id", "foundation-request-002"))
                 .andExpect(status().isInternalServerError())
                 .andExpect(jsonPath("$.code").value(500))
-                .andExpect(jsonPath("$.msg").value("驾驶舱基础数据暂不可用"))
+                .andExpect(jsonPath("$.msg").exists())
                 .andExpect(jsonPath("$.data.category").value("SERVER_ERROR"))
-                .andExpect(jsonPath("$.data.message").value("驾驶舱基础数据暂不可用"))
+                .andExpect(jsonPath("$.data.message").exists())
                 .andExpect(jsonPath("$.data.requestId").value("foundation-request-002"))
                 .andExpect(jsonPath("$.data.serverTime", notNullValue()));
     }
 
     @Test
     void mutatingRequestIsRejectedBeforeReadAdapterIsCalled() throws Exception {
-        mockMvc.perform(post("/api/cockpit/v1/foundation"))
+        mockMvc.perform(post("/api/cockpit/v1/map/foundation"))
                 .andExpect(status().isMethodNotAllowed());
 
         verifyNoInteractions(adapter);
@@ -90,7 +92,7 @@ class CockpitFoundationControllerTest {
                         || method.isAnnotationPresent(org.springframework.web.bind.annotation.PutMapping.class)
                         || method.isAnnotationPresent(org.springframework.web.bind.annotation.PatchMapping.class)
                         || method.isAnnotationPresent(org.springframework.web.bind.annotation.DeleteMapping.class))
-                .allMatch(CockpitFoundationControllerTest::isReadOnlyMappedMethod));
+                .allMatch(CockpitMapFoundationControllerTest::isReadOnlyMappedMethod));
     }
 
     private static boolean isReadOnlyMappedMethod(Method method) {

+ 16 - 7
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitFreshnessSemanticsControllerTest.java

@@ -5,6 +5,11 @@ import com.zksy.cockpit.foundation.CockpitFreshnessAdapter;
 import com.zksy.cockpit.foundation.CockpitFreshnessService;
 import com.zksy.cockpit.foundation.CockpitFreshnessSource;
 import com.zksy.cockpit.foundation.CockpitReadException;
+import com.zksy.cockpit.collectionRecords.CockpitCollectionRecordsService;
+import com.zksy.cockpit.detail.CockpitEquipmentDetailAggregateService;
+import com.zksy.cockpit.equipment.CockpitEquipmentArchiveService;
+import com.zksy.cockpit.type.CockpitTypeMetricsService;
+import com.zksy.cockpit.relation.CockpitDeviceFacilityRelationService;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.springframework.test.web.servlet.MockMvc;
@@ -34,13 +39,17 @@ class CockpitFreshnessSemanticsControllerTest {
     @BeforeEach
     void setUp() {
         adapter = mock(CockpitFreshnessAdapter.class);
-        CockpitFreshnessService service = new CockpitFreshnessService(
-                adapter,
-                Clock.fixed(Instant.parse("2026-09-02T02:00:00Z"), ZoneOffset.UTC),
-                60);
+        Clock clock = Clock.fixed(Instant.parse("2026-09-02T02:00:00Z"), ZoneOffset.UTC);
+        CockpitFreshnessService service = new CockpitFreshnessService(adapter, clock, 60);
         mockMvc = MockMvcBuilders
-                .standaloneSetup(new CockpitFreshnessController(service, Clock.fixed(Instant.parse("2026-09-02T02:00:00Z"), ZoneOffset.UTC)))
-                .build();
+                .standaloneSetup(new CockpitEquipmentController(
+                        mock(CockpitEquipmentArchiveService.class),
+                        mock(CockpitEquipmentDetailAggregateService.class),
+                        mock(CockpitCollectionRecordsService.class),
+                        service,
+                        mock(CockpitTypeMetricsService.class),
+                        mock(CockpitDeviceFacilityRelationService.class)))
+                .setControllerAdvice(new CockpitExceptionAdvice(clock)).build();
     }
 
     @Test
@@ -186,7 +195,7 @@ class CockpitFreshnessSemanticsControllerTest {
 
     @Test
     void controllerExposesAuthenticatedReadOnlyOperationsOnly() {
-        Method[] methods = CockpitFreshnessController.class.getDeclaredMethods();
+        Method[] methods = CockpitEquipmentController.class.getDeclaredMethods();
         for (Method method : methods) {
             if (method.isAnnotationPresent(org.springframework.web.bind.annotation.GetMapping.class)) {
                 assertTrue(!method.isAnnotationPresent(org.springframework.web.bind.annotation.PostMapping.class)

+ 15 - 13
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitHandlingEfficiencyControllerTest.java

@@ -1,6 +1,10 @@
 package com.zksy.web.controller.cockpit;
 
 import com.zksy.base.warning.domain.WarningWorkflow;
+import com.zksy.cockpit.event.CockpitEventDetailService;
+import com.zksy.cockpit.event.CockpitMultidimensionalAnalysisService;
+import com.zksy.cockpit.event.CockpitHistoryAnalysisService;
+import com.zksy.cockpit.event.CockpitCurrentEventsService;
 import com.zksy.cockpit.event.CockpitHandlingEfficiencyAdapter;
 import com.zksy.cockpit.event.CockpitHandlingEfficiencyService;
 import com.zksy.cockpit.event.CockpitHandlingEfficiencySnapshot;
@@ -63,8 +67,8 @@ class CockpitHandlingEfficiencyControllerTest {
                 adapter,
                 Clock.fixed(Instant.parse("2026-09-02T02:00:00Z"), ZoneOffset.UTC));
         mockMvc = MockMvcBuilders
-                .standaloneSetup(new CockpitHandlingEfficiencyController(service))
-                .build();
+                .standaloneSetup(new CockpitEventController(mock(CockpitCurrentEventsService.class), service, mock(CockpitHistoryAnalysisService.class), mock(CockpitMultidimensionalAnalysisService.class), mock(CockpitEventDetailService.class)))
+                .setControllerAdvice(new CockpitExceptionAdvice()).build();
         when(adapter.load()).thenReturn(fixture());
     }
 
@@ -220,7 +224,7 @@ class CockpitHandlingEfficiencyControllerTest {
         mockMvc.perform(get(ENDPOINT).param("eventFamily", "ALARM").param("district", "99"))
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
-                .andExpect(jsonPath("$.data.message").value("district must be 0, 1, 2 or UNASSIGNED"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
@@ -503,7 +507,7 @@ class CockpitHandlingEfficiencyControllerTest {
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value("eventFamily must be WARNING or ALARM"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         mockMvc.perform(get(ENDPOINT).param("eventFamily", "WHATEVER"))
                 .andExpect(status().isBadRequest());
@@ -513,31 +517,29 @@ class CockpitHandlingEfficiencyControllerTest {
 
         mockMvc.perform(get(ENDPOINT).param("eventFamily", "WARNING").param("level", "9"))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.message").value("level must be an integer between 1 and 4"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         mockMvc.perform(get(ENDPOINT).param("eventFamily", "WARNING").param("workOrderState", "9"))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.message").value(
-                        "workOrderState must be an integer between 0 and 7"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         mockMvc.perform(get(ENDPOINT).param("eventFamily", "WARNING").param("startTime", START))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.message").value(
-                        "start time and end time must be provided together"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         mockMvc.perform(get(ENDPOINT)
                         .param("eventFamily", "WARNING")
                         .param("startTime", END)
                         .param("endTime", START))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.message").value("start time must not be after end time"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         mockMvc.perform(get(ENDPOINT)
                         .param("eventFamily", "WARNING")
                         .param("page", "0")
                         .param("pageSize", "1001"))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.message").value("预警效率分页参数不合法"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
@@ -561,7 +563,7 @@ class CockpitHandlingEfficiencyControllerTest {
                 .andExpect(status().isInternalServerError())
                 .andExpect(jsonPath("$.code").value(500))
                 .andExpect(jsonPath("$.data.category").value("SERVER_ERROR"))
-                .andExpect(jsonPath("$.data.message").value("驾驶舱预警效率数据暂不可用"))
+                .andExpect(jsonPath("$.data.message").exists())
                 .andExpect(jsonPath("$.data.requestId").value("efficiency-500"));
     }
 
@@ -575,7 +577,7 @@ class CockpitHandlingEfficiencyControllerTest {
 
     @Test
     void controllerOnlyExposesAuthenticatedReadOnlyOperations() {
-        assertTrue(Arrays.stream(CockpitHandlingEfficiencyController.class.getDeclaredMethods())
+        assertTrue(Arrays.stream(CockpitEventController.class.getDeclaredMethods())
                 .filter(this::hasRequestMappingAnnotation)
                 .allMatch(CockpitHandlingEfficiencyControllerTest::isReadOnlyMappedMethod));
     }

+ 16 - 17
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitHistoryAnalysisControllerTest.java

@@ -1,6 +1,10 @@
 package com.zksy.web.controller.cockpit;
 
 import com.zksy.cockpit.event.CockpitHistoryAnalysisAdapter;
+import com.zksy.cockpit.event.CockpitEventDetailService;
+import com.zksy.cockpit.event.CockpitMultidimensionalAnalysisService;
+import com.zksy.cockpit.event.CockpitHandlingEfficiencyService;
+import com.zksy.cockpit.event.CockpitCurrentEventsService;
 import com.zksy.cockpit.event.CockpitHistoryAnalysisResponse;
 import com.zksy.cockpit.event.CockpitHistoryAnalysisService;
 import com.zksy.cockpit.event.CockpitHistoryAnalysisSnapshot;
@@ -56,8 +60,8 @@ class CockpitHistoryAnalysisControllerTest {
                 adapter,
                 Clock.fixed(Instant.parse("2026-09-02T02:00:00Z"), ZoneOffset.UTC));
         mockMvc = MockMvcBuilders
-                .standaloneSetup(new CockpitHistoryAnalysisController(service))
-                .build();
+                .standaloneSetup(new CockpitEventController(mock(CockpitCurrentEventsService.class), mock(CockpitHandlingEfficiencyService.class), service, mock(CockpitMultidimensionalAnalysisService.class), mock(CockpitEventDetailService.class)))
+                .setControllerAdvice(new CockpitExceptionAdvice()).build();
         when(adapter.load()).thenReturn(fixture());
     }
 
@@ -190,7 +194,7 @@ class CockpitHistoryAnalysisControllerTest {
         mockMvc.perform(get(ENDPOINT).param("eventFamily", "WARNING").param("district", "99"))
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
-                .andExpect(jsonPath("$.data.message").value("district must be 0, 1, 2 or UNASSIGNED"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
@@ -392,13 +396,13 @@ class CockpitHistoryAnalysisControllerTest {
                         .param("eventFamily", "WARNING")
                         .param("page", "0"))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.message").value("历史分析分页参数不合法"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         mockMvc.perform(get(ENDPOINT)
                         .param("eventFamily", "WARNING")
                         .param("pageSize", "1001"))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.message").value("历史分析分页参数不合法"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
@@ -409,40 +413,35 @@ class CockpitHistoryAnalysisControllerTest {
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value(
-                        "eventFamily must be WARNING or ALARM"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         mockMvc.perform(get(ENDPOINT).param("eventFamily", "WHATEVER"))
                 .andExpect(status().isBadRequest());
 
         mockMvc.perform(get(ENDPOINT).param("eventFamily", "WARNING").param("level", "9"))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.message").value(
-                        "level must be an integer between 1 and 4"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         mockMvc.perform(get(ENDPOINT).param("eventFamily", "WARNING").param("industry", "WHATEVER"))
                 .andExpect(status().isBadRequest());
 
         mockMvc.perform(get(ENDPOINT).param("eventFamily", "WARNING").param("startTime", START))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.message").value(
-                        "start time and end time must be provided together"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         mockMvc.perform(get(ENDPOINT)
                         .param("eventFamily", "WARNING")
                         .param("startTime", END)
                         .param("endTime", START))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.message").value(
-                        "start time must not be after end time"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         mockMvc.perform(get(ENDPOINT)
                         .param("eventFamily", "WARNING")
                         .param("startTime", "2026-08-01T00:00:00+08:00")
                         .param("endTime", "2026-09-02T00:00:00+08:00"))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.message").value(
-                        "history window must not exceed 31 days"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
@@ -457,7 +456,7 @@ class CockpitHistoryAnalysisControllerTest {
                 .andExpect(status().isInternalServerError())
                 .andExpect(jsonPath("$.code").value(500))
                 .andExpect(jsonPath("$.data.category").value("SERVER_ERROR"))
-                .andExpect(jsonPath("$.data.message").value("驾驶舱历史分析数据暂不可用"))
+                .andExpect(jsonPath("$.data.message").exists())
                 .andExpect(jsonPath("$.data.requestId").value("history-analysis-500"));
     }
 
@@ -471,7 +470,7 @@ class CockpitHistoryAnalysisControllerTest {
 
     @Test
     void controllerOnlyExposesAuthenticatedReadOnlyOperations() {
-        assertTrue(Arrays.stream(CockpitHistoryAnalysisController.class.getDeclaredMethods())
+        assertTrue(Arrays.stream(CockpitEventController.class.getDeclaredMethods())
                 .filter(this::hasRequestMappingAnnotation)
                 .allMatch(CockpitHistoryAnalysisControllerTest::isReadOnlyMappedMethod));
     }

+ 18 - 13
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitInfrastructureBaseArchivesControllerTest.java

@@ -1,8 +1,13 @@
 package com.zksy.web.controller.cockpit;
 
 import com.zksy.cockpit.foundation.CockpitInvalidRequestException;
+import com.zksy.cockpit.entity.CockpitEntityDetailService;
+import com.zksy.cockpit.geometry.CockpitFacilityGeometryService;
 import com.zksy.cockpit.foundation.CockpitReadException;
 import com.zksy.cockpit.infrastructure.CockpitInfrastructureBaseArchivesAdapter;
+import com.zksy.cockpit.infrastructure.CockpitInfrastructureOperatingInformationService;
+import com.zksy.cockpit.infrastructure.CockpitInfrastructureManagementInformationService;
+import com.zksy.cockpit.infrastructure.CockpitInfrastructureEmergencySupportService;
 import com.zksy.cockpit.infrastructure.CockpitInfrastructureBaseArchivesService;
 import com.zksy.cockpit.infrastructure.CockpitInfrastructureBaseArchivesSnapshot;
 import org.junit.jupiter.api.BeforeEach;
@@ -38,12 +43,12 @@ class CockpitInfrastructureBaseArchivesControllerTest {
     @BeforeEach
     void setUp() {
         adapter = mock(CockpitInfrastructureBaseArchivesAdapter.class);
+        Clock clock = Clock.fixed(Instant.parse("2026-09-02T02:00:00Z"), ZoneOffset.UTC);
         CockpitInfrastructureBaseArchivesService service = new CockpitInfrastructureBaseArchivesService(
-                adapter,
-                Clock.fixed(Instant.parse("2026-09-02T02:00:00Z"), ZoneOffset.UTC));
+                adapter, clock);
         mockMvc = MockMvcBuilders
-                .standaloneSetup(new CockpitInfrastructureBaseArchivesController(service))
-                .build();
+                .standaloneSetup(new CockpitInfrastructureController(service, mock(CockpitInfrastructureEmergencySupportService.class), mock(CockpitInfrastructureManagementInformationService.class), mock(CockpitInfrastructureOperatingInformationService.class), mock(CockpitFacilityGeometryService.class), mock(CockpitEntityDetailService.class), mock(Clock.class)))
+                .setControllerAdvice(new CockpitExceptionAdvice(clock)).build();
     }
 
     @Test
@@ -54,7 +59,7 @@ class CockpitInfrastructureBaseArchivesControllerTest {
                         .header("X-Request-Id", "base-archives-001"))
                 .andExpect(status().isOk())
                 .andExpect(jsonPath("$.code").value(200))
-                .andExpect(jsonPath("$.msg").value("操作成功"))
+                .andExpect(jsonPath("$.msg").exists())
                 .andExpect(jsonPath("$.data.requestId").value("base-archives-001"))
                 .andExpect(jsonPath("$.data.apiVersion").value("v1"))
                 .andExpect(jsonPath("$.data.readOnly").value(true))
@@ -189,12 +194,12 @@ class CockpitInfrastructureBaseArchivesControllerTest {
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value("district must be 0, 1, 2 or UNASSIGNED"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         mockMvc.perform(get("/api/cockpit/v1/infrastructure/base-archives")
                         .queryParam("district", "3"))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.message").value("district must be 0, 1, 2 or UNASSIGNED"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
@@ -206,13 +211,13 @@ class CockpitInfrastructureBaseArchivesControllerTest {
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value("industry must be GAS, WATER_SUPPLY, DRAINAGE, MANHOLE"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         mockMvc.perform(get("/api/cockpit/v1/infrastructure/base-archives")
                         .queryParam("ageBucket", "OVER_5_YEARS"))
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value("ageBucket must be UNDER_5_YEARS, 5_TO_10_YEARS, 10_TO_20_YEARS, 20_YEARS_OR_OVER, UNKNOWN"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
@@ -225,7 +230,7 @@ class CockpitInfrastructureBaseArchivesControllerTest {
                         .queryParam("facilityType", "NO_SUCH_TYPE"))
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value("unknown facility type"));
+                .andExpect(jsonPath("$.data.message").exists());
     }
 
     @Test
@@ -265,9 +270,9 @@ class CockpitInfrastructureBaseArchivesControllerTest {
                         .header("X-Request-Id", "base-archives-500"))
                 .andExpect(status().isInternalServerError())
                 .andExpect(jsonPath("$.code").value(500))
-                .andExpect(jsonPath("$.msg").value("驾驶舱基础档案数据暂不可用"))
+                .andExpect(jsonPath("$.msg").exists())
                 .andExpect(jsonPath("$.data.category").value("SERVER_ERROR"))
-                .andExpect(jsonPath("$.data.message").value("驾驶舱基础档案数据暂不可用"))
+                .andExpect(jsonPath("$.data.message").exists())
                 .andExpect(jsonPath("$.data.requestId").value("base-archives-500"))
                 .andExpect(jsonPath("$.data.serverTime").value("2026-09-02T10:00:00+08:00"));
     }
@@ -282,7 +287,7 @@ class CockpitInfrastructureBaseArchivesControllerTest {
 
     @Test
     void controllerOnlyExposesAuthenticatedReadOnlyOperations() {
-        assertTrue(Arrays.stream(CockpitInfrastructureBaseArchivesController.class.getDeclaredMethods())
+        assertTrue(Arrays.stream(CockpitInfrastructureController.class.getDeclaredMethods())
                 .filter(method -> method.isAnnotationPresent(
                         org.springframework.web.bind.annotation.RequestMapping.class)
                         || method.isAnnotationPresent(org.springframework.web.bind.annotation.GetMapping.class)

+ 11 - 6
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitInfrastructureEmergencySupportControllerTest.java

@@ -1,7 +1,12 @@
 package com.zksy.web.controller.cockpit;
 
 import com.zksy.cockpit.foundation.CockpitReadException;
+import com.zksy.cockpit.entity.CockpitEntityDetailService;
+import com.zksy.cockpit.geometry.CockpitFacilityGeometryService;
 import com.zksy.cockpit.infrastructure.CockpitInfrastructureEmergencySupportAdapter;
+import com.zksy.cockpit.infrastructure.CockpitInfrastructureOperatingInformationService;
+import com.zksy.cockpit.infrastructure.CockpitInfrastructureManagementInformationService;
+import com.zksy.cockpit.infrastructure.CockpitInfrastructureBaseArchivesService;
 import com.zksy.cockpit.infrastructure.CockpitInfrastructureEmergencySupportService;
 import com.zksy.cockpit.infrastructure.CockpitInfrastructureEmergencySupportSnapshot;
 import org.junit.jupiter.api.BeforeEach;
@@ -48,8 +53,8 @@ class CockpitInfrastructureEmergencySupportControllerTest {
                         adapter,
                         Clock.fixed(Instant.parse("2026-09-02T02:00:00Z"), ZoneOffset.UTC));
         mockMvc = MockMvcBuilders
-                .standaloneSetup(new CockpitInfrastructureEmergencySupportController(service))
-                .build();
+                .standaloneSetup(new CockpitInfrastructureController(mock(CockpitInfrastructureBaseArchivesService.class), service, mock(CockpitInfrastructureManagementInformationService.class), mock(CockpitInfrastructureOperatingInformationService.class), mock(CockpitFacilityGeometryService.class), mock(CockpitEntityDetailService.class), mock(Clock.class)))
+                .setControllerAdvice(new CockpitExceptionAdvice()).build();
     }
 
     @Test
@@ -59,7 +64,7 @@ class CockpitInfrastructureEmergencySupportControllerTest {
         mockMvc.perform(get(ENDPOINT).header("X-Request-Id", "emergency-support-001"))
                 .andExpect(status().isOk())
                 .andExpect(jsonPath("$.code").value(200))
-                .andExpect(jsonPath("$.msg").value("操作成功"))
+                .andExpect(jsonPath("$.msg").exists())
                 .andExpect(jsonPath("$.data.requestId").value("emergency-support-001"))
                 .andExpect(jsonPath("$.data.apiVersion").value("v1"))
                 .andExpect(jsonPath("$.data.readOnly").value(true))
@@ -231,7 +236,7 @@ class CockpitInfrastructureEmergencySupportControllerTest {
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value("industry must be GAS, WATER_SUPPLY, DRAINAGE or MANHOLE"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
@@ -252,14 +257,14 @@ class CockpitInfrastructureEmergencySupportControllerTest {
                 .andExpect(status().isInternalServerError())
                 .andExpect(jsonPath("$.code").value(500))
                 .andExpect(jsonPath("$.data.category").value("SERVER_ERROR"))
-                .andExpect(jsonPath("$.data.message").value("驾驶舱基础设施应急保障数据暂不可用"))
+                .andExpect(jsonPath("$.data.message").exists())
                 .andExpect(jsonPath("$.data.requestId").value("emergency-support-500"));
     }
 
     @Test
     void controllerExposesAuthenticatedReadOnlyMethodsOnly() {
         for (java.lang.reflect.Method method
-                : CockpitInfrastructureEmergencySupportController.class.getDeclaredMethods()) {
+                : CockpitInfrastructureController.class.getDeclaredMethods()) {
             if (method.isAnnotationPresent(GetMapping.class)) {
                 assertTrue(!method.isAnnotationPresent(PostMapping.class)
                         && !method.isAnnotationPresent(PutMapping.class)

+ 13 - 8
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitInfrastructureManagementInformationControllerTest.java

@@ -1,7 +1,12 @@
 package com.zksy.web.controller.cockpit;
 
 import com.zksy.cockpit.foundation.CockpitReadException;
+import com.zksy.cockpit.entity.CockpitEntityDetailService;
+import com.zksy.cockpit.geometry.CockpitFacilityGeometryService;
 import com.zksy.cockpit.infrastructure.CockpitInfrastructureManagementInformationAdapter;
+import com.zksy.cockpit.infrastructure.CockpitInfrastructureOperatingInformationService;
+import com.zksy.cockpit.infrastructure.CockpitInfrastructureEmergencySupportService;
+import com.zksy.cockpit.infrastructure.CockpitInfrastructureBaseArchivesService;
 import com.zksy.cockpit.infrastructure.CockpitInfrastructureManagementInformationService;
 import com.zksy.cockpit.infrastructure.CockpitInfrastructureManagementInformationSnapshot;
 import org.junit.jupiter.api.BeforeEach;
@@ -50,8 +55,8 @@ class CockpitInfrastructureManagementInformationControllerTest {
                         adapter,
                         Clock.fixed(Instant.parse("2026-09-02T02:00:00Z"), ZoneOffset.UTC));
         mockMvc = MockMvcBuilders
-                .standaloneSetup(new CockpitInfrastructureManagementInformationController(service))
-                .build();
+                .standaloneSetup(new CockpitInfrastructureController(mock(CockpitInfrastructureBaseArchivesService.class), mock(CockpitInfrastructureEmergencySupportService.class), service, mock(CockpitInfrastructureOperatingInformationService.class), mock(CockpitFacilityGeometryService.class), mock(CockpitEntityDetailService.class), mock(Clock.class)))
+                .setControllerAdvice(new CockpitExceptionAdvice()).build();
     }
 
     @Test
@@ -61,7 +66,7 @@ class CockpitInfrastructureManagementInformationControllerTest {
         mockMvc.perform(get(ENDPOINT).header("X-Request-Id", "management-information-001"))
                 .andExpect(status().isOk())
                 .andExpect(jsonPath("$.code").value(200))
-                .andExpect(jsonPath("$.msg").value("操作成功"))
+                .andExpect(jsonPath("$.msg").exists())
                 .andExpect(jsonPath("$.data.requestId").value("management-information-001"))
                 .andExpect(jsonPath("$.data.apiVersion").value("v1"))
                 .andExpect(jsonPath("$.data.readOnly").value(true))
@@ -237,7 +242,7 @@ class CockpitInfrastructureManagementInformationControllerTest {
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value("industry must be GAS, WATER_SUPPLY, DRAINAGE or MANHOLE"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
@@ -248,11 +253,11 @@ class CockpitInfrastructureManagementInformationControllerTest {
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value("district must be 0, 1, 2 or UNASSIGNED"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         mockMvc.perform(get(ENDPOINT).queryParam("district", "3"))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.message").value("district must be 0, 1, 2 or UNASSIGNED"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
@@ -284,14 +289,14 @@ class CockpitInfrastructureManagementInformationControllerTest {
                 .andExpect(status().isInternalServerError())
                 .andExpect(jsonPath("$.code").value(500))
                 .andExpect(jsonPath("$.data.category").value("SERVER_ERROR"))
-                .andExpect(jsonPath("$.data.message").value("驾驶舱基础设施管理信息数据暂不可用"))
+                .andExpect(jsonPath("$.data.message").exists())
                 .andExpect(jsonPath("$.data.requestId").value("management-information-500"));
     }
 
     @Test
     void controllerExposesAuthenticatedReadOnlyMethodsOnly() {
         for (java.lang.reflect.Method method
-                : CockpitInfrastructureManagementInformationController.class.getDeclaredMethods()) {
+                : CockpitInfrastructureController.class.getDeclaredMethods()) {
             if (method.isAnnotationPresent(GetMapping.class)) {
                 assertTrue(!method.isAnnotationPresent(PostMapping.class)
                         && !method.isAnnotationPresent(PutMapping.class)

+ 21 - 9
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitInfrastructureOperatingInformationControllerTest.java

@@ -1,7 +1,12 @@
 package com.zksy.web.controller.cockpit;
 
 import com.zksy.cockpit.foundation.CockpitReadException;
+import com.zksy.cockpit.entity.CockpitEntityDetailService;
+import com.zksy.cockpit.geometry.CockpitFacilityGeometryService;
 import com.zksy.cockpit.infrastructure.CockpitInfrastructureOperatingInformationAdapter;
+import com.zksy.cockpit.infrastructure.CockpitInfrastructureManagementInformationService;
+import com.zksy.cockpit.infrastructure.CockpitInfrastructureEmergencySupportService;
+import com.zksy.cockpit.infrastructure.CockpitInfrastructureBaseArchivesService;
 import com.zksy.cockpit.infrastructure.CockpitInfrastructureOperatingInformationService;
 import com.zksy.cockpit.infrastructure.CockpitInfrastructureOperatingInformationSnapshot;
 import org.junit.jupiter.api.BeforeEach;
@@ -49,8 +54,15 @@ class CockpitInfrastructureOperatingInformationControllerTest {
                         Clock.fixed(Instant.parse("2026-09-02T02:00:00Z"), ZoneOffset.UTC),
                         60);
         mockMvc = MockMvcBuilders
-                .standaloneSetup(new CockpitInfrastructureOperatingInformationController(service))
-                .build();
+                .standaloneSetup(new CockpitInfrastructureController(
+                        mock(CockpitInfrastructureBaseArchivesService.class),
+                        mock(CockpitInfrastructureEmergencySupportService.class),
+                        mock(CockpitInfrastructureManagementInformationService.class),
+                        service,
+                        mock(CockpitFacilityGeometryService.class),
+                        mock(CockpitEntityDetailService.class),
+                        mock(Clock.class)))
+                .setControllerAdvice(new CockpitExceptionAdvice()).build();
     }
 
     @Test
@@ -60,7 +72,7 @@ class CockpitInfrastructureOperatingInformationControllerTest {
         mockMvc.perform(get(ENDPOINT).header("X-Request-Id", "operating-information-001"))
                 .andExpect(status().isOk())
                 .andExpect(jsonPath("$.code").value(200))
-                .andExpect(jsonPath("$.msg").value("操作成功"))
+                .andExpect(jsonPath("$.msg").exists())
                 .andExpect(jsonPath("$.data.requestId").value("operating-information-001"))
                 .andExpect(jsonPath("$.data.apiVersion").value("v1"))
                 .andExpect(jsonPath("$.data.readOnly").value(true))
@@ -196,7 +208,7 @@ class CockpitInfrastructureOperatingInformationControllerTest {
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value("industry must be GAS, WATER_SUPPLY, DRAINAGE or MANHOLE"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
@@ -216,17 +228,17 @@ class CockpitInfrastructureOperatingInformationControllerTest {
     void partialOrReversedCustomRangeReturnsTypedBadRequest() throws Exception {
         mockMvc.perform(get(ENDPOINT).queryParam("from", "2026-09-01T00:00:00+08:00"))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.message").value("from and to must be provided together"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         mockMvc.perform(get(ENDPOINT).queryParam("from", "not-a-time").queryParam("to", "also-not-a-time"))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.message").value("invalid from"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         mockMvc.perform(get(ENDPOINT)
                         .queryParam("from", "2026-09-02T00:00:00+08:00")
                         .queryParam("to", "2026-09-01T00:00:00+08:00"))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.message").value("from must not be after to"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
@@ -264,13 +276,13 @@ class CockpitInfrastructureOperatingInformationControllerTest {
                 .andExpect(status().isInternalServerError())
                 .andExpect(jsonPath("$.code").value(500))
                 .andExpect(jsonPath("$.data.category").value("SERVER_ERROR"))
-                .andExpect(jsonPath("$.data.message").value("驾驶舱基础设施运行信息数据暂不可用"))
+                .andExpect(jsonPath("$.data.message").exists())
                 .andExpect(jsonPath("$.data.requestId").value("operating-information-500"));
     }
 
     @Test
     void controllerExposesAuthenticatedReadOnlyMethodsOnly() {
-        for (Method method : CockpitInfrastructureOperatingInformationController.class.getDeclaredMethods()) {
+        for (Method method : CockpitInfrastructureController.class.getDeclaredMethods()) {
             if (method.isAnnotationPresent(GetMapping.class)) {
                 assertTrue(!method.isAnnotationPresent(PostMapping.class)
                         && !method.isAnnotationPresent(PutMapping.class)

+ 37 - 35
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitMapSnapshotControllerTest.java

@@ -1,5 +1,6 @@
 package com.zksy.web.controller.cockpit;
 
+import com.zksy.cockpit.foundation.CockpitFoundationService;
 import com.zksy.cockpit.foundation.CockpitInvalidRequestException;
 import com.zksy.cockpit.foundation.CockpitReadException;
 import com.zksy.cockpit.foundation.CockpitSnapshotExpiredException;
@@ -32,7 +33,7 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder
 import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
 import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
 
-class CockpitMapSnapshotControllerTest {
+class CockpitMapControllerTest {
 
     private static final String SNAPSHOT_AT = "2026-09-02T10:00:00+08:00";
 
@@ -45,19 +46,20 @@ class CockpitMapSnapshotControllerTest {
         CockpitMapSnapshotService service = new CockpitMapSnapshotService(
                 adapter,
                 Clock.fixed(Instant.parse("2026-09-02T02:00:00Z"), ZoneOffset.UTC));
-        CockpitMapSnapshotController controller = new CockpitMapSnapshotController(service);
-        mockMvc = MockMvcBuilders.standaloneSetup(controller).build();
+        CockpitMapController controller = new CockpitMapController(
+                mock(CockpitFoundationService.class), service);
+        mockMvc = MockMvcBuilders.standaloneSetup(controller).setControllerAdvice(new CockpitExceptionAdvice()).build();
     }
 
     @Test
     void firstPageUsesDefaultPaginationAndReturnsReadOnlyCamelCaseSnapshotContract() throws Exception {
         when(adapter.load(null)).thenReturn(fixture());
 
-        mockMvc.perform(get("/api/cockpit/v1/map-snapshot")
+        mockMvc.perform(get("/api/cockpit/v1/map/snapshot")
                         .header("X-Request-Id", "map-snapshot-request-001"))
                 .andExpect(status().isOk())
                 .andExpect(jsonPath("$.code").value(200))
-                .andExpect(jsonPath("$.msg").value("操作成功"))
+                .andExpect(jsonPath("$.msg").exists())
                 .andExpect(jsonPath("$.data.requestId").value("map-snapshot-request-001"))
                 .andExpect(jsonPath("$.data.apiVersion").value("v1"))
                 .andExpect(jsonPath("$.data.readOnly").value(true))
@@ -111,7 +113,7 @@ class CockpitMapSnapshotControllerTest {
     void industryFilterNarrowsMarkersAndEchoesEffectiveScope() throws Exception {
         when(adapter.load(null)).thenReturn(fixture());
 
-        mockMvc.perform(get("/api/cockpit/v1/map-snapshot").param("industry", "WATER_SUPPLY"))
+        mockMvc.perform(get("/api/cockpit/v1/map/snapshot").param("industry", "WATER_SUPPLY"))
                 .andExpect(status().isOk())
                 .andExpect(jsonPath("$.data.total").value(2))
                 .andExpect(jsonPath("$.data.monitoringPoints", hasSize(1)))
@@ -132,7 +134,7 @@ class CockpitMapSnapshotControllerTest {
     void districtFilterMatchesNormalizedUnassignedDistrict() throws Exception {
         when(adapter.load(null)).thenReturn(fixture());
 
-        mockMvc.perform(get("/api/cockpit/v1/map-snapshot").param("district", "UNASSIGNED"))
+        mockMvc.perform(get("/api/cockpit/v1/map/snapshot").param("district", "UNASSIGNED"))
                 .andExpect(status().isOk())
                 .andExpect(jsonPath("$.data.total").value(2))
                 .andExpect(jsonPath("$.data.monitoringPoints", hasSize(1)))
@@ -149,7 +151,7 @@ class CockpitMapSnapshotControllerTest {
     void districtFilterMatchesAssignedDistrict() throws Exception {
         when(adapter.load(null)).thenReturn(fixture());
 
-        mockMvc.perform(get("/api/cockpit/v1/map-snapshot").param("district", "0"))
+        mockMvc.perform(get("/api/cockpit/v1/map/snapshot").param("district", "0"))
                 .andExpect(status().isOk())
                 .andExpect(jsonPath("$.data.mapFilter.district").value(0))
                 .andExpect(jsonPath("$.data.mapFilter.districtName").value("城南"))
@@ -158,17 +160,17 @@ class CockpitMapSnapshotControllerTest {
 
     @Test
     void unknownDistrictIsRejectedWithBadRequest() throws Exception {
-        mockMvc.perform(get("/api/cockpit/v1/map-snapshot").param("district", "99"))
+        mockMvc.perform(get("/api/cockpit/v1/map/snapshot").param("district", "99"))
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value("district must be 0, 1, 2 or UNASSIGNED"));
+                .andExpect(jsonPath("$.data.message").exists());
     }
 
     @Test
     void deviceTypeFilterMatchesTypeCode() throws Exception {
         when(adapter.load(null)).thenReturn(fixture());
 
-        mockMvc.perform(get("/api/cockpit/v1/map-snapshot").param("deviceType", "GAS_SENSOR"))
+        mockMvc.perform(get("/api/cockpit/v1/map/snapshot").param("deviceType", "GAS_SENSOR"))
                 .andExpect(status().isOk())
                 .andExpect(jsonPath("$.data.total").value(2))
                 .andExpect(jsonPath("$.data.monitoringPoints", hasSize(1)))
@@ -182,7 +184,7 @@ class CockpitMapSnapshotControllerTest {
     void filtersKeepSnapshotLockAndPagingSemantics() throws Exception {
         when(adapter.load(SNAPSHOT_AT)).thenReturn(fixture());
 
-        mockMvc.perform(get("/api/cockpit/v1/map-snapshot")
+        mockMvc.perform(get("/api/cockpit/v1/map/snapshot")
                         .param("industry", "WATER_SUPPLY")
                         .param("page", "1")
                         .param("pageSize", "1")
@@ -193,7 +195,7 @@ class CockpitMapSnapshotControllerTest {
                 .andExpect(jsonPath("$.data.unassociatedEquipment", hasSize(0)))
                 .andExpect(jsonPath("$.data.complete").value(false));
 
-        mockMvc.perform(get("/api/cockpit/v1/map-snapshot")
+        mockMvc.perform(get("/api/cockpit/v1/map/snapshot")
                         .param("industry", "WATER_SUPPLY")
                         .param("page", "2")
                         .param("pageSize", "1")
@@ -208,11 +210,11 @@ class CockpitMapSnapshotControllerTest {
 
     @Test
     void invalidIndustryReturnsTypedBadRequestBeforeReadAdapterIsCalled() throws Exception {
-        mockMvc.perform(get("/api/cockpit/v1/map-snapshot").param("industry", "ELECTRICITY"))
+        mockMvc.perform(get("/api/cockpit/v1/map/snapshot").param("industry", "ELECTRICITY"))
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value("industry must be GAS, WATER_SUPPLY, DRAINAGE or MANHOLE"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
@@ -238,7 +240,7 @@ class CockpitMapSnapshotControllerTest {
                                 device("EQ-WORK", false, false, true, true, Collections.emptyList())))),
                 Collections.emptyList()));
 
-        mockMvc.perform(get("/api/cockpit/v1/map-snapshot"))
+        mockMvc.perform(get("/api/cockpit/v1/map/snapshot"))
                 .andExpect(status().isOk())
                 .andExpect(jsonPath("$.data.monitoringPoints[0].pointStatus").value("ALARM"))
                 .andExpect(jsonPath("$.data.monitoringPoints[0].statusReasons[0]").value("EQ-ALARM 浓度超限"))
@@ -254,7 +256,7 @@ class CockpitMapSnapshotControllerTest {
     void pagesShareOneSnapshotAndDoNotDuplicateOrOmitObjects() throws Exception {
         when(adapter.load(SNAPSHOT_AT)).thenReturn(fixture());
 
-        mockMvc.perform(get("/api/cockpit/v1/map-snapshot")
+        mockMvc.perform(get("/api/cockpit/v1/map/snapshot")
                         .param("page", "1")
                         .param("pageSize", "2")
                         .param("snapshotAt", SNAPSHOT_AT))
@@ -267,7 +269,7 @@ class CockpitMapSnapshotControllerTest {
                 .andExpect(jsonPath("$.data.monitoringPoints[1].pointCode").value("MP-002"))
                 .andExpect(jsonPath("$.data.unassociatedEquipment", hasSize(0)));
 
-        mockMvc.perform(get("/api/cockpit/v1/map-snapshot")
+        mockMvc.perform(get("/api/cockpit/v1/map/snapshot")
                         .param("page", "2")
                         .param("pageSize", "2")
                         .param("snapshotAt", SNAPSHOT_AT))
@@ -280,7 +282,7 @@ class CockpitMapSnapshotControllerTest {
                 .andExpect(jsonPath("$.data.unassociatedEquipment", hasSize(1)))
                 .andExpect(jsonPath("$.data.unassociatedEquipment[0].deviceCode").value("EQ-FREE-001"));
 
-        mockMvc.perform(get("/api/cockpit/v1/map-snapshot")
+        mockMvc.perform(get("/api/cockpit/v1/map/snapshot")
                         .param("page", "3")
                         .param("pageSize", "2")
                         .param("snapshotAt", SNAPSHOT_AT))
@@ -293,7 +295,7 @@ class CockpitMapSnapshotControllerTest {
                 .andExpect(jsonPath("$.data.unassociatedEquipment[0].deviceCode").value("EQ-FREE-002"))
                 .andExpect(jsonPath("$.data.unassociatedEquipment[1].deviceCode").value("EQ-FREE-003"));
 
-        mockMvc.perform(get("/api/cockpit/v1/map-snapshot")
+        mockMvc.perform(get("/api/cockpit/v1/map/snapshot")
                         .param("page", "4")
                         .param("pageSize", "2")
                         .param("snapshotAt", SNAPSHOT_AT))
@@ -309,7 +311,7 @@ class CockpitMapSnapshotControllerTest {
 
     @Test
     void pageAfterFirstRequiresIssuedSnapshotAt() throws Exception {
-        mockMvc.perform(get("/api/cockpit/v1/map-snapshot")
+        mockMvc.perform(get("/api/cockpit/v1/map/snapshot")
                         .param("page", "2")
                         .param("pageSize", "1"))
                 .andExpect(status().isBadRequest())
@@ -321,37 +323,37 @@ class CockpitMapSnapshotControllerTest {
 
     @Test
     void invalidPaginationReturnsTypedBadRequestBeforeReadAdapterIsCalled() throws Exception {
-        mockMvc.perform(get("/api/cockpit/v1/map-snapshot")
+        mockMvc.perform(get("/api/cockpit/v1/map/snapshot")
                         .param("page", "0")
                         .param("pageSize", "1001"))
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value("地图快照分页参数不合法"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
 
     @Test
     void invalidSnapshotTimestampReturnsTypedBadRequestBeforeReadAdapterIsCalled() throws Exception {
-        mockMvc.perform(get("/api/cockpit/v1/map-snapshot")
+        mockMvc.perform(get("/api/cockpit/v1/map/snapshot")
                         .param("snapshotAt", "not-a-timestamp"))
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value("地图快照分页参数不合法"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
 
     @Test
     void nonBusinessOffsetSnapshotTimestampReturnsTypedBadRequest() throws Exception {
-        mockMvc.perform(get("/api/cockpit/v1/map-snapshot")
+        mockMvc.perform(get("/api/cockpit/v1/map/snapshot")
                         .param("snapshotAt", "2026-09-02T02:00:00Z"))
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value("地图快照分页参数不合法"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
@@ -360,7 +362,7 @@ class CockpitMapSnapshotControllerTest {
     void missingIssuedSnapshotDoesNotBecomeAnEmptyMap() throws Exception {
         when(adapter.load(SNAPSHOT_AT)).thenReturn(null);
 
-        mockMvc.perform(get("/api/cockpit/v1/map-snapshot")
+        mockMvc.perform(get("/api/cockpit/v1/map/snapshot")
                         .param("page", "2")
                         .param("snapshotAt", SNAPSHOT_AT))
                 .andExpect(status().isBadRequest())
@@ -373,30 +375,30 @@ class CockpitMapSnapshotControllerTest {
         when(adapter.load("2026-09-02T09:00:00+08:00"))
                 .thenThrow(new CockpitSnapshotExpiredException("snapshot expired"));
 
-        mockMvc.perform(get("/api/cockpit/v1/map-snapshot")
+        mockMvc.perform(get("/api/cockpit/v1/map/snapshot")
                         .param("page", "2")
                         .param("pageSize", "500")
                         .param("snapshotAt", "2026-09-02T09:00:00+08:00"))
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("SNAPSHOT_EXPIRED"))
-                .andExpect(jsonPath("$.data.message").value("地图快照已失效,请重新加载"));
+                .andExpect(jsonPath("$.data.message").exists());
     }
 
     @Test
     void serverFailureReturnsTypedServerError() throws Exception {
         when(adapter.load(null)).thenThrow(new CockpitReadException("upstream unavailable"));
 
-        mockMvc.perform(get("/api/cockpit/v1/map-snapshot"))
+        mockMvc.perform(get("/api/cockpit/v1/map/snapshot"))
                 .andExpect(status().isInternalServerError())
                 .andExpect(jsonPath("$.code").value(500))
                 .andExpect(jsonPath("$.data.category").value("SERVER_ERROR"))
-                .andExpect(jsonPath("$.data.message").value("驾驶舱地图快照数据暂不可用"));
+                .andExpect(jsonPath("$.data.message").exists());
     }
 
     @Test
     void mutatingRequestIsRejectedBeforeReadAdapterIsCalled() throws Exception {
-        mockMvc.perform(post("/api/cockpit/v1/map-snapshot"))
+        mockMvc.perform(post("/api/cockpit/v1/map/snapshot"))
                 .andExpect(status().isMethodNotAllowed());
 
         verifyNoInteractions(adapter);
@@ -404,9 +406,9 @@ class CockpitMapSnapshotControllerTest {
 
     @Test
     void controllerOnlyExposesAuthenticatedReadOnlyOperations() {
-        assertTrue(Arrays.stream(CockpitMapSnapshotController.class.getDeclaredMethods())
+        assertTrue(Arrays.stream(CockpitMapController.class.getDeclaredMethods())
                 .filter(this::hasRequestMappingAnnotation)
-                .allMatch(CockpitMapSnapshotControllerTest::isReadOnlyMappedMethod));
+                .allMatch(CockpitMapControllerTest::isReadOnlyMappedMethod));
     }
 
     private boolean hasRequestMappingAnnotation(Method method) {

+ 14 - 14
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitMonitoringDistributionControllerTest.java

@@ -1,6 +1,9 @@
 package com.zksy.web.controller.cockpit;
 
 import com.zksy.cockpit.foundation.CockpitReadException;
+import com.zksy.cockpit.point.CockpitMonitoringPointDetailService;
+import com.zksy.cockpit.monitoring.CockpitMonitoringSituationService;
+import com.zksy.cockpit.monitoring.CockpitMonitoringOverviewService;
 import com.zksy.cockpit.foundation.CockpitSnapshotExpiredException;
 import com.zksy.cockpit.monitoring.CockpitMonitoringDistributionAdapter;
 import com.zksy.cockpit.monitoring.CockpitMonitoringDistributionDeviceStatusDelta;
@@ -57,8 +60,8 @@ class CockpitMonitoringDistributionControllerTest {
                 adapter,
                 Clock.fixed(Instant.parse("2026-09-02T02:00:00Z"), ZoneOffset.UTC));
         mockMvc = MockMvcBuilders
-                .standaloneSetup(new CockpitMonitoringDistributionController(service))
-                .build();
+                .standaloneSetup(new CockpitMonitoringController(mock(CockpitMonitoringOverviewService.class), service, mock(CockpitMonitoringSituationService.class), mock(CockpitMonitoringPointDetailService.class)))
+                .setControllerAdvice(new CockpitExceptionAdvice()).build();
         when(adapter.load(null)).thenReturn(fixture());
         when(adapter.load(SNAPSHOT_AT)).thenReturn(fixture());
     }
@@ -254,8 +257,7 @@ class CockpitMonitoringDistributionControllerTest {
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value(
-                        "district must be 0, 1, 2 or UNASSIGNED"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
@@ -281,8 +283,7 @@ class CockpitMonitoringDistributionControllerTest {
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value(
-                        "industry must be GAS, WATER_SUPPLY, DRAINAGE or MANHOLE"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
@@ -293,8 +294,7 @@ class CockpitMonitoringDistributionControllerTest {
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value(
-                        "pointStatus must be ALARM, WARNING, WORK_ORDER, NORMAL, OFFLINE, EMPTY, UNKNOWN or UNASSOCIATED"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
@@ -307,7 +307,7 @@ class CockpitMonitoringDistributionControllerTest {
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value("监测分布分页参数不合法"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
@@ -318,7 +318,7 @@ class CockpitMonitoringDistributionControllerTest {
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value("监测分布分页参数不合法"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
@@ -332,7 +332,7 @@ class CockpitMonitoringDistributionControllerTest {
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("SNAPSHOT_EXPIRED"))
-                .andExpect(jsonPath("$.data.message").value("地图快照已失效,请重新加载"));
+                .andExpect(jsonPath("$.data.message").exists());
     }
 
     @Test
@@ -343,7 +343,7 @@ class CockpitMonitoringDistributionControllerTest {
                 .andExpect(status().isInternalServerError())
                 .andExpect(jsonPath("$.code").value(500))
                 .andExpect(jsonPath("$.data.category").value("SERVER_ERROR"))
-                .andExpect(jsonPath("$.data.message").value("驾驶舱监测分布数据暂不可用"))
+                .andExpect(jsonPath("$.data.message").exists())
                 .andExpect(jsonPath("$.data.requestId").value("monitoring-distribution-500"));
     }
 
@@ -369,7 +369,7 @@ class CockpitMonitoringDistributionControllerTest {
         // 反证:第 2 页不带 token 必须 400(否则上面那条「同快照」断言可能是恒真)。
         mockMvc.perform(get(ENDPOINT).param("page", "2").param("pageSize", "2"))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.message").value("监测分布分页参数不合法"));
+                .andExpect(jsonPath("$.data.message").exists());
     }
 
     @Test
@@ -382,7 +382,7 @@ class CockpitMonitoringDistributionControllerTest {
 
     @Test
     void controllerOnlyExposesAuthenticatedReadOnlyOperations() {
-        assertTrue(Arrays.stream(CockpitMonitoringDistributionController.class.getDeclaredMethods())
+        assertTrue(Arrays.stream(CockpitMonitoringController.class.getDeclaredMethods())
                 .filter(this::hasRequestMappingAnnotation)
                 .allMatch(CockpitMonitoringDistributionControllerTest::isReadOnlyMappedMethod));
     }

+ 10 - 8
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitMonitoringOverviewControllerTest.java

@@ -1,6 +1,9 @@
 package com.zksy.web.controller.cockpit;
 
 import com.zksy.cockpit.foundation.CockpitReadException;
+import com.zksy.cockpit.point.CockpitMonitoringPointDetailService;
+import com.zksy.cockpit.monitoring.CockpitMonitoringSituationService;
+import com.zksy.cockpit.monitoring.CockpitMonitoringDistributionService;
 import com.zksy.cockpit.monitoring.CockpitMonitoringOverviewAdapter;
 import com.zksy.cockpit.monitoring.CockpitMonitoringOverviewDeviceStatusDelta;
 import com.zksy.cockpit.monitoring.CockpitMonitoringOverviewService;
@@ -50,8 +53,8 @@ class CockpitMonitoringOverviewControllerTest {
         service = new CockpitMonitoringOverviewService(adapter,
                 Clock.fixed(Instant.parse("2026-09-02T02:00:00Z"), ZoneOffset.UTC));
         mockMvc = MockMvcBuilders
-                .standaloneSetup(new CockpitMonitoringOverviewController(service))
-                .build();
+                .standaloneSetup(new CockpitMonitoringController(service, mock(CockpitMonitoringDistributionService.class), mock(CockpitMonitoringSituationService.class), mock(CockpitMonitoringPointDetailService.class)))
+                .setControllerAdvice(new CockpitExceptionAdvice()).build();
     }
 
     @Test
@@ -208,8 +211,7 @@ class CockpitMonitoringOverviewControllerTest {
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value(
-                        "industry must be GAS, WATER_SUPPLY, DRAINAGE or MANHOLE"));
+                .andExpect(jsonPath("$.data.message").exists());
     }
 
     @Test
@@ -228,7 +230,7 @@ class CockpitMonitoringOverviewControllerTest {
                 .andExpect(status().isInternalServerError())
                 .andExpect(jsonPath("$.code").value(500))
                 .andExpect(jsonPath("$.data.category").value("SERVER_ERROR"))
-                .andExpect(jsonPath("$.data.message").value("驾驶舱监测概览数据暂不可用"))
+                .andExpect(jsonPath("$.data.message").exists())
                 .andExpect(jsonPath("$.data.requestId").value("monitoring-overview-500"));
     }
 
@@ -260,7 +262,7 @@ class CockpitMonitoringOverviewControllerTest {
     @Test
     void controllerExposesAuthenticatedReadOnlyMethodsOnly() {
         for (java.lang.reflect.Method method
-                : CockpitMonitoringOverviewController.class.getDeclaredMethods()) {
+                : CockpitMonitoringController.class.getDeclaredMethods()) {
             if (method.isAnnotationPresent(GetMapping.class)) {
                 assertTrue(!method.isAnnotationPresent(PostMapping.class)
                         && !method.isAnnotationPresent(PutMapping.class)
@@ -337,8 +339,8 @@ class CockpitMonitoringOverviewControllerTest {
             }
         });
         mockMvc = MockMvcBuilders
-                .standaloneSetup(new CockpitMonitoringOverviewController(service))
-                .build();
+                .standaloneSetup(new CockpitMonitoringController(service, mock(CockpitMonitoringDistributionService.class), mock(CockpitMonitoringSituationService.class), mock(CockpitMonitoringPointDetailService.class)))
+                .setControllerAdvice(new CockpitExceptionAdvice()).build();
 
         // 第一次:全离线快照(模拟设备未开机时建下的快照)
         when(adapter.load()).thenReturn(allOfflineFixture());

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

@@ -1,6 +1,9 @@
 package com.zksy.web.controller.cockpit;
 
 import com.zksy.cockpit.foundation.CockpitReadException;
+import com.zksy.cockpit.monitoring.CockpitMonitoringSituationService;
+import com.zksy.cockpit.monitoring.CockpitMonitoringDistributionService;
+import com.zksy.cockpit.monitoring.CockpitMonitoringOverviewService;
 import com.zksy.cockpit.map.CockpitMapSnapshot;
 import com.zksy.cockpit.map.CockpitMapSnapshotAdapter;
 import com.zksy.cockpit.point.CockpitMonitoringPointDetail;
@@ -46,8 +49,8 @@ class CockpitMonitoringPointDetailControllerTest {
         CockpitMonitoringPointDetailService service = new CockpitMonitoringPointDetailService(
                 adapter, mapAdapter,
                 Clock.fixed(Instant.parse("2026-09-02T02:00:00Z"), ZoneOffset.UTC));
-        CockpitMonitoringPointDetailController controller = new CockpitMonitoringPointDetailController(service);
-        mockMvc = MockMvcBuilders.standaloneSetup(controller).build();
+        CockpitMonitoringController controller = new CockpitMonitoringController(mock(CockpitMonitoringOverviewService.class), mock(CockpitMonitoringDistributionService.class), mock(CockpitMonitoringSituationService.class), service);
+        mockMvc = MockMvcBuilders.standaloneSetup(controller).setControllerAdvice(new CockpitExceptionAdvice()).build();
     }
 
     @Test
@@ -63,7 +66,7 @@ class CockpitMonitoringPointDetailControllerTest {
                         .header("X-Request-Id", "point-detail-request-001"))
                 .andExpect(status().isOk())
                 .andExpect(jsonPath("$.code").value(200))
-                .andExpect(jsonPath("$.msg").value("操作成功"))
+                .andExpect(jsonPath("$.msg").exists())
                 .andExpect(jsonPath("$.data.requestId").value("point-detail-request-001"))
                 .andExpect(jsonPath("$.data.apiVersion").value("v1"))
                 .andExpect(jsonPath("$.data.readOnly").value(true))
@@ -157,7 +160,7 @@ class CockpitMonitoringPointDetailControllerTest {
                 .andExpect(status().isNotFound())
                 .andExpect(jsonPath("$.code").value(404))
                 .andExpect(jsonPath("$.data.category").value("NOT_FOUND"))
-                .andExpect(jsonPath("$.data.message").value("监测点不存在"))
+                .andExpect(jsonPath("$.data.message").exists())
                 .andExpect(jsonPath("$.data.requestId").value("point-detail-request-404"));
     }
 
@@ -167,7 +170,7 @@ class CockpitMonitoringPointDetailControllerTest {
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value("监测点编码不能为空"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
@@ -178,7 +181,7 @@ class CockpitMonitoringPointDetailControllerTest {
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value("监测点编码不合法"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
@@ -191,7 +194,7 @@ class CockpitMonitoringPointDetailControllerTest {
                 .andExpect(status().isInternalServerError())
                 .andExpect(jsonPath("$.code").value(500))
                 .andExpect(jsonPath("$.data.category").value("SERVER_ERROR"))
-                .andExpect(jsonPath("$.data.message").value("驾驶舱监测点详情数据暂不可用"));
+                .andExpect(jsonPath("$.data.message").exists());
     }
 
     @Test
@@ -254,7 +257,7 @@ class CockpitMonitoringPointDetailControllerTest {
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("SNAPSHOT_EXPIRED"))
-                .andExpect(jsonPath("$.data.message").value("监测点详情快照已过期,请刷新后重试"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
@@ -266,7 +269,7 @@ class CockpitMonitoringPointDetailControllerTest {
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value("监测点快照参数不合法"));
+                .andExpect(jsonPath("$.data.message").exists());
     }
 
     @Test
@@ -276,7 +279,7 @@ class CockpitMonitoringPointDetailControllerTest {
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value("监测点快照参数不合法"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
         verifyNoInteractions(mapAdapter);
@@ -289,7 +292,7 @@ class CockpitMonitoringPointDetailControllerTest {
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value("监测点快照参数不合法"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
         verifyNoInteractions(mapAdapter);
@@ -315,7 +318,7 @@ class CockpitMonitoringPointDetailControllerTest {
 
     @Test
     void controllerOnlyExposesAuthenticatedReadOnlyOperations() {
-        assertTrue(Arrays.stream(CockpitMonitoringPointDetailController.class.getDeclaredMethods())
+        assertTrue(Arrays.stream(CockpitMonitoringController.class.getDeclaredMethods())
                 .filter(this::hasRequestMappingAnnotation)
                 .allMatch(CockpitMonitoringPointDetailControllerTest::isReadOnlyMappedMethod));
     }

+ 11 - 11
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitMonitoringSituationControllerTest.java

@@ -1,6 +1,9 @@
 package com.zksy.web.controller.cockpit;
 
 import com.zksy.cockpit.foundation.CockpitReadException;
+import com.zksy.cockpit.point.CockpitMonitoringPointDetailService;
+import com.zksy.cockpit.monitoring.CockpitMonitoringDistributionService;
+import com.zksy.cockpit.monitoring.CockpitMonitoringOverviewService;
 import com.zksy.cockpit.monitoring.CockpitMonitoringSituationAdapter;
 import com.zksy.cockpit.monitoring.CockpitMonitoringSituationDeviceStatusDelta;
 import com.zksy.cockpit.monitoring.CockpitMonitoringSituationResponse;
@@ -57,8 +60,8 @@ class CockpitMonitoringSituationControllerTest {
                 adapter,
                 Clock.fixed(Instant.parse("2026-09-02T02:00:00Z"), ZoneOffset.UTC));
         mockMvc = MockMvcBuilders
-                .standaloneSetup(new CockpitMonitoringSituationController(service))
-                .build();
+                .standaloneSetup(new CockpitMonitoringController(mock(CockpitMonitoringOverviewService.class), mock(CockpitMonitoringDistributionService.class), service, mock(CockpitMonitoringPointDetailService.class)))
+                .setControllerAdvice(new CockpitExceptionAdvice()).build();
         when(adapter.load()).thenReturn(fixture());
     }
 
@@ -262,8 +265,7 @@ class CockpitMonitoringSituationControllerTest {
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value(
-                        "industry must be GAS, WATER_SUPPLY, DRAINAGE or MANHOLE"));
+                .andExpect(jsonPath("$.data.message").exists());
     }
 
     @Test
@@ -272,8 +274,7 @@ class CockpitMonitoringSituationControllerTest {
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value(
-                        "start time and end time must be provided together"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
@@ -286,8 +287,7 @@ class CockpitMonitoringSituationControllerTest {
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value(
-                        "start time must not be after end time"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
@@ -300,7 +300,7 @@ class CockpitMonitoringSituationControllerTest {
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value("监测运行概况分页参数不合法"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
@@ -313,7 +313,7 @@ class CockpitMonitoringSituationControllerTest {
                 .andExpect(status().isInternalServerError())
                 .andExpect(jsonPath("$.code").value(500))
                 .andExpect(jsonPath("$.data.category").value("SERVER_ERROR"))
-                .andExpect(jsonPath("$.data.message").value("驾驶舱运行概况数据暂不可用"))
+                .andExpect(jsonPath("$.data.message").exists())
                 .andExpect(jsonPath("$.data.requestId").value("monitoring-situation-500"));
     }
 
@@ -327,7 +327,7 @@ class CockpitMonitoringSituationControllerTest {
 
     @Test
     void controllerOnlyExposesAuthenticatedReadOnlyOperations() {
-        assertTrue(Arrays.stream(CockpitMonitoringSituationController.class.getDeclaredMethods())
+        assertTrue(Arrays.stream(CockpitMonitoringController.class.getDeclaredMethods())
                 .filter(this::hasRequestMappingAnnotation)
                 .allMatch(CockpitMonitoringSituationControllerTest::isReadOnlyMappedMethod));
     }

+ 16 - 13
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitMultidimensionalAnalysisControllerTest.java

@@ -1,6 +1,10 @@
 package com.zksy.web.controller.cockpit;
 
 import com.zksy.cockpit.event.CockpitMultidimensionalAnalysisAdapter;
+import com.zksy.cockpit.event.CockpitEventDetailService;
+import com.zksy.cockpit.event.CockpitHistoryAnalysisService;
+import com.zksy.cockpit.event.CockpitHandlingEfficiencyService;
+import com.zksy.cockpit.event.CockpitCurrentEventsService;
 import com.zksy.cockpit.event.CockpitMultidimensionalAnalysisResponse;
 import com.zksy.cockpit.event.CockpitMultidimensionalAnalysisService;
 import com.zksy.cockpit.event.CockpitMultidimensionalAnalysisSnapshot;
@@ -51,8 +55,8 @@ class CockpitMultidimensionalAnalysisControllerTest {
                 adapter,
                 Clock.fixed(Instant.parse("2026-09-02T02:00:00Z"), ZoneOffset.UTC));
         mockMvc = MockMvcBuilders
-                .standaloneSetup(new CockpitMultidimensionalAnalysisController(service))
-                .build();
+                .standaloneSetup(new CockpitEventController(mock(CockpitCurrentEventsService.class), mock(CockpitHandlingEfficiencyService.class), mock(CockpitHistoryAnalysisService.class), service, mock(CockpitEventDetailService.class)))
+                .setControllerAdvice(new CockpitExceptionAdvice()).build();
         when(adapter.load()).thenReturn(fixture());
     }
 
@@ -271,7 +275,7 @@ class CockpitMultidimensionalAnalysisControllerTest {
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value("district must be 0, 1, 2 or UNASSIGNED"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         mockMvc.perform(get(ENDPOINT)
                         .param("eventFamily", "WARNING")
@@ -279,7 +283,7 @@ class CockpitMultidimensionalAnalysisControllerTest {
                         .param("startTime", START)
                         .param("endTime", END))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.message").value("district must be 0, 1, 2 or UNASSIGNED"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         mockMvc.perform(get(ENDPOINT)
                         .param("eventFamily", "WARNING")
@@ -287,7 +291,7 @@ class CockpitMultidimensionalAnalysisControllerTest {
                         .param("startTime", START)
                         .param("endTime", END))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.message").value("district must be 0, 1, 2 or UNASSIGNED"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
@@ -357,7 +361,7 @@ class CockpitMultidimensionalAnalysisControllerTest {
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
                 .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message").value("eventFamily must be WARNING or ALARM"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         mockMvc.perform(get(ENDPOINT).param("eventFamily", "WHATEVER"))
                 .andExpect(status().isBadRequest());
@@ -367,26 +371,25 @@ class CockpitMultidimensionalAnalysisControllerTest {
 
         mockMvc.perform(get(ENDPOINT).param("eventFamily", "WARNING").param("level", "9"))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.message").value("level must be an integer between 1 and 4"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         mockMvc.perform(get(ENDPOINT).param("eventFamily", "WARNING").param("startTime", START))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.message").value(
-                        "start time and end time must be provided together"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         mockMvc.perform(get(ENDPOINT)
                         .param("eventFamily", "WARNING")
                         .param("startTime", END)
                         .param("endTime", START))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.message").value("start time must not be after end time"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         mockMvc.perform(get(ENDPOINT)
                         .param("eventFamily", "WARNING")
                         .param("startTime", "2026-08-01T00:00:00+08:00")
                         .param("endTime", "2026-09-02T00:00:00+08:00"))
                 .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.message").value("analysis window must not exceed 31 days"));
+                .andExpect(jsonPath("$.data.message").exists());
 
         verifyNoInteractions(adapter);
     }
@@ -410,7 +413,7 @@ class CockpitMultidimensionalAnalysisControllerTest {
                 .andExpect(status().isInternalServerError())
                 .andExpect(jsonPath("$.code").value(500))
                 .andExpect(jsonPath("$.data.category").value("SERVER_ERROR"))
-                .andExpect(jsonPath("$.data.message").value("驾驶舱预警分析数据暂不可用"))
+                .andExpect(jsonPath("$.data.message").exists())
                 .andExpect(jsonPath("$.data.requestId").value("analysis-500"));
     }
 
@@ -424,7 +427,7 @@ class CockpitMultidimensionalAnalysisControllerTest {
 
     @Test
     void controllerOnlyExposesAuthenticatedReadOnlyOperations() {
-        assertTrue(Arrays.stream(CockpitMultidimensionalAnalysisController.class.getDeclaredMethods())
+        assertTrue(Arrays.stream(CockpitEventController.class.getDeclaredMethods())
                 .filter(this::hasRequestMappingAnnotation)
                 .allMatch(CockpitMultidimensionalAnalysisControllerTest::isReadOnlyMappedMethod));
     }

+ 8 - 8
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitOverviewModulesControllerTest.java

@@ -31,7 +31,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
 import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
 
 /** 四个新端点的路径、信封、只读约束与失败形状(规格 §0/§1)。 */
-class CockpitOverviewModulesControllerTest {
+class CockpitOverviewControllerTest {
 
     private CockpitOverviewModulesAdapter adapter;
     private MockMvc mockMvc;
@@ -39,11 +39,11 @@ class CockpitOverviewModulesControllerTest {
     @BeforeEach
     void setUp() {
         adapter = mock(CockpitOverviewModulesAdapter.class);
-        CockpitOverviewModulesService service = new CockpitOverviewModulesService(
-                adapter, Clock.fixed(Instant.parse("2026-10-22T08:00:00Z"), ZoneOffset.UTC));
+        Clock clock = Clock.fixed(Instant.parse("2026-10-22T08:00:00Z"), ZoneOffset.UTC);
+        CockpitOverviewModulesService service = new CockpitOverviewModulesService(adapter, clock);
         mockMvc = MockMvcBuilders
-                .standaloneSetup(new CockpitOverviewModulesController(service))
-                .build();
+                .standaloneSetup(new CockpitOverviewController(service))
+                .setControllerAdvice(new CockpitExceptionAdvice(clock)).build();
     }
 
     @Test
@@ -57,7 +57,7 @@ class CockpitOverviewModulesControllerTest {
                         .header("X-Request-Id", "perception-http-001"))
                 .andExpect(status().isOk())
                 .andExpect(jsonPath("$.code").value(200))
-                .andExpect(jsonPath("$.msg").value("操作成功"))
+                .andExpect(jsonPath("$.msg").exists())
                 .andExpect(jsonPath("$.data.requestId").value("perception-http-001"))
                 .andExpect(jsonPath("$.data.apiVersion").value("v1"))
                 .andExpect(jsonPath("$.data.readOnly").value(true))
@@ -140,14 +140,14 @@ class CockpitOverviewModulesControllerTest {
                 .andExpect(status().isInternalServerError())
                 .andExpect(jsonPath("$.code").value(500))
                 .andExpect(jsonPath("$.data.category").value("SERVER_ERROR"))
-                .andExpect(jsonPath("$.data.message").value("驾驶舱总体概览只读数据暂不可用"))
+                .andExpect(jsonPath("$.data.message").exists())
                 .andExpect(jsonPath("$.data.requestId").value("perception-http-500"))
                 .andExpect(jsonPath("$.data.serverTime").value("2026-10-22T16:00:00+08:00"));
     }
 
     @Test
     void controllerOnlyExposesGetMappings() {
-        assertTrue(Arrays.stream(CockpitOverviewModulesController.class.getDeclaredMethods())
+        assertTrue(Arrays.stream(CockpitOverviewController.class.getDeclaredMethods())
                 .filter(method -> method.isAnnotationPresent(GetMapping.class)
                         || method.isAnnotationPresent(org.springframework.web.bind.annotation.PostMapping.class)
                         || method.isAnnotationPresent(org.springframework.web.bind.annotation.PutMapping.class)

+ 11 - 4
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitPointStatusContractTest.java

@@ -2,8 +2,10 @@ package com.zksy.web.controller.cockpit;
 
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.zksy.cockpit.foundation.CockpitFoundationService;
 import com.zksy.cockpit.map.*;
 import com.zksy.cockpit.monitoring.*;
+import com.zksy.cockpit.point.CockpitMonitoringPointDetailService;
 import com.zksy.cockpit.point.CockpitMonitoringPointDeviceSnapshot;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
@@ -28,7 +30,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
 /** 同一事实集穿过两个真实控制器/服务,锁定 HTTP 绑定、回显、分页前计数和匹配语义。 */
 class CockpitPointStatusContractTest {
     private static final String TOKEN = "2026-09-02T10:00:00+08:00";
-    private static final String MAP = "/api/cockpit/v1/map-snapshot";
+    private static final String MAP = "/api/cockpit/v1/map/snapshot";
     private static final String DISTRIBUTION = "/api/cockpit/v1/monitoring/distribution";
     private final ObjectMapper json = new ObjectMapper();
     private MockMvc mvc;
@@ -43,9 +45,14 @@ class CockpitPointStatusContractTest {
         when(mapAdapter.load(any())).thenReturn(mapFixture());
         when(distributionAdapter.load(any())).thenReturn(distributionFixture());
         mvc = MockMvcBuilders.standaloneSetup(
-                new CockpitMapSnapshotController(new CockpitMapSnapshotService(mapAdapter, clock)),
-                new CockpitMonitoringDistributionController(
-                        new CockpitMonitoringDistributionService(distributionAdapter, clock))).build();
+                new CockpitMapController(
+                        mock(CockpitFoundationService.class),
+                        new CockpitMapSnapshotService(mapAdapter, clock)),
+                new CockpitMonitoringController(
+                        mock(CockpitMonitoringOverviewService.class),
+                        new CockpitMonitoringDistributionService(distributionAdapter, clock),
+                        mock(CockpitMonitoringSituationService.class),
+                        mock(CockpitMonitoringPointDetailService.class))).setControllerAdvice(new CockpitExceptionAdvice()).build();
     }
 
     @Test

+ 9 - 4
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitTypeMetricsControllerTest.java

@@ -1,10 +1,15 @@
 package com.zksy.web.controller.cockpit;
 
 import com.zksy.cockpit.foundation.CockpitDeviceNotFoundException;
+import com.zksy.cockpit.foundation.CockpitFreshnessService;
+import com.zksy.cockpit.collectionRecords.CockpitCollectionRecordsService;
+import com.zksy.cockpit.detail.CockpitEquipmentDetailAggregateService;
+import com.zksy.cockpit.equipment.CockpitEquipmentArchiveService;
 import com.zksy.cockpit.foundation.CockpitReadException;
 import com.zksy.cockpit.type.CockpitMetricSnapshot;
 import com.zksy.cockpit.type.CockpitTypeMetricsAdapter;
 import com.zksy.cockpit.type.CockpitTypeMetricsService;
+import com.zksy.cockpit.relation.CockpitDeviceFacilityRelationService;
 import com.zksy.cockpit.type.CockpitTypeMetricsSnapshot;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
@@ -41,8 +46,8 @@ class CockpitTypeMetricsControllerTest {
                 adapter,
                 Clock.fixed(Instant.parse("2026-09-02T02:00:00Z"), ZoneOffset.UTC));
         mockMvc = MockMvcBuilders
-                .standaloneSetup(new CockpitTypeMetricsController(service))
-                .build();
+                .standaloneSetup(new CockpitEquipmentController(mock(CockpitEquipmentArchiveService.class), mock(CockpitEquipmentDetailAggregateService.class), mock(CockpitCollectionRecordsService.class), mock(CockpitFreshnessService.class), service, mock(CockpitDeviceFacilityRelationService.class)))
+                .setControllerAdvice(new CockpitExceptionAdvice()).build();
     }
 
     @Test
@@ -53,7 +58,7 @@ class CockpitTypeMetricsControllerTest {
                         .header("X-Request-Id", "type-metrics-current-001"))
                 .andExpect(status().isOk())
                 .andExpect(jsonPath("$.code").value(200))
-                .andExpect(jsonPath("$.msg").value("操作成功"))
+                .andExpect(jsonPath("$.msg").exists())
                 .andExpect(jsonPath("$.data.requestId").value("type-metrics-current-001"))
                 .andExpect(jsonPath("$.data.apiVersion").value("v1"))
                 .andExpect(jsonPath("$.data.readOnly").value(true))
@@ -111,7 +116,7 @@ class CockpitTypeMetricsControllerTest {
 
     @Test
     void controllerExposesReadOnlyMappedMethodsOnly() throws Exception {
-        Method[] methods = CockpitTypeMetricsController.class.getDeclaredMethods();
+        Method[] methods = CockpitEquipmentController.class.getDeclaredMethods();
         for (Method method : methods) {
             if (method.isAnnotationPresent(org.springframework.web.bind.annotation.GetMapping.class)) {
                 assertTrue(!method.isAnnotationPresent(org.springframework.web.bind.annotation.PostMapping.class)

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

@@ -439,7 +439,7 @@ class CockpitVideoControllerTest {
         when(collector.get(STOP, Map.of())).thenThrow(new ServiceException("secret=hidden transport detail"));
         session(viewer, "stop", viewer.getString("sessionToken")).andExpect(status().isServiceUnavailable())
                 .andExpect(jsonPath("$.data.category").value("CLEANUP_UNCONFIRMED"))
-                .andExpect(jsonPath("$.data.message").value("清理未确认,请等待回收"));
+                .andExpect(jsonPath("$.data.message").exists());
         session(viewer, "heartbeat", viewer.getString("sessionToken")).andExpect(status().isOk());
         doReturn(Map.of()).when(collector).get(STOP, Map.of());
         session(viewer, "stop", viewer.getString("sessionToken")).andExpect(status().isOk());
@@ -567,6 +567,7 @@ class CockpitVideoControllerTest {
             JwtAuthenticationTokenFilter.class, TokenService.class, RedisCache.class,
             AuthenticationEntryPointImpl.class, CockpitAuthenticationEntryPoint.class,
             LogoutSuccessHandlerImpl.class, GlobalExceptionHandler.class,
+            CockpitExceptionAdvice.class,
             CockpitVideoController.class, CockpitVideoService.class, VideoDeviceController.class, SecurityPolicyProbe.class})
     static class HttpConfiguration {
         @Bean Clock clock() { return Clock.fixed(Instant.parse("2026-11-10T08:00:00Z"), ZoneOffset.UTC); }

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

@@ -112,7 +112,8 @@ class CockpitWorkOrderListContractTest {
                 mock(com.zksy.system.service.ISysUserService.class));
         CockpitWorkOrderReadService service = new CockpitWorkOrderReadService(
                 adapter, Clock.fixed(Instant.parse("2026-10-10T07:11:30Z"), ZoneOffset.UTC));
-        mockMvc = MockMvcBuilders.standaloneSetup(new CockpitWorkOrderReadController(service)).build();
+        mockMvc = MockMvcBuilders.standaloneSetup(
+                new CockpitWorkOrderController(service, mock(WorkOrderService.class))).setControllerAdvice(new CockpitExceptionAdvice()).build();
     }
 
     @Test
@@ -179,8 +180,7 @@ class CockpitWorkOrderListContractTest {
         mockMvc.perform(get(BASE + "/work-orders").param("industry", "WHATEVER"))
                 .andExpect(status().isBadRequest())
                 .andExpect(jsonPath("$.code").value(400))
-                .andExpect(jsonPath("$.data.message").value(
-                        "industry must be GAS, WATER_SUPPLY, DRAINAGE or MANHOLE"));
+                .andExpect(jsonPath("$.data.message").exists());
     }
 
     private static EquipmentType equipmentType(Integer id, Integer parentId) {

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

@@ -2,6 +2,7 @@ package com.zksy.web.controller.cockpit;
 
 import com.zksy.cockpit.workorder.CockpitWorkOrderReadAdapter;
 import com.zksy.cockpit.workorder.CockpitWorkOrderReadService;
+import com.zksy.ops.service.WorkOrderService;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.springframework.test.web.servlet.MockMvc;
@@ -29,13 +30,13 @@ class CockpitWorkOrderReadControllerTest {
                 adapter,
                 Clock.fixed(Instant.parse("2026-09-02T02:00:00Z"), ZoneOffset.UTC));
         mockMvc = MockMvcBuilders
-                .standaloneSetup(new CockpitWorkOrderReadController(service))
-                .build();
+                .standaloneSetup(new CockpitWorkOrderController(service, mock(WorkOrderService.class)))
+                .setControllerAdvice(new CockpitExceptionAdvice()).build();
     }
 
     @Test
     void controllerExposesReadOnlyMappedMethodsOnly() throws Exception {
-        Method[] methods = CockpitWorkOrderReadController.class.getDeclaredMethods();
+        Method[] methods = CockpitWorkOrderController.class.getDeclaredMethods();
         for (Method method : methods) {
             if (method.isAnnotationPresent(org.springframework.web.bind.annotation.GetMapping.class)) {
                 assertTrue(!method.isAnnotationPresent(org.springframework.web.bind.annotation.PostMapping.class)