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

删除cockpit无任何引用的代码,提炼接口前缀到类级

zengy 1 неделя назад
Родитель
Сommit
9a092d0aa5
90 измененных файлов с 89 добавлено и 7832 удалено
  1. 3 1
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitCollectionRecordsController.java
  2. 3 1
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitCurrentEventsController.java
  3. 0 45
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitDeviceBoundaryController.java
  4. 3 1
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitDeviceFacilityRelationController.java
  5. 2 2
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitDictController.java
  6. 3 1
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitEntityDetailController.java
  7. 3 1
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitEquipmentArchiveController.java
  8. 3 1
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitEquipmentDetailAggregateController.java
  9. 0 10
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitEventDetailController.java
  10. 0 96
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitEventReadController.java
  11. 3 1
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitFacilityGeometryController.java
  12. 3 1
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitFreshnessController.java
  13. 3 1
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitHandlingEfficiencyController.java
  14. 3 1
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitHistoryAnalysisController.java
  15. 3 1
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitInfrastructureBaseArchivesController.java
  16. 3 1
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitInfrastructureEmergencySupportController.java
  17. 3 1
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitInfrastructureManagementInformationController.java
  18. 3 1
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitInfrastructureOperatingInformationController.java
  19. 3 1
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitMapSnapshotController.java
  20. 3 1
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitMonitoringDistributionController.java
  21. 3 1
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitMonitoringOverviewController.java
  22. 3 1
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitMonitoringPointDetailController.java
  23. 3 1
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitMonitoringSituationController.java
  24. 3 1
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitMultidimensionalAnalysisController.java
  25. 0 47
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitOverviewInfrastructureController.java
  26. 6 4
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitOverviewModulesController.java
  27. 0 58
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitOverviewMonitoringController.java
  28. 0 65
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitOverviewWarningSettingsController.java
  29. 3 20
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitTypeMetricsController.java
  30. 11 11
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitVideoController.java
  31. 3 44
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitWorkOrderReadController.java
  32. 0 120
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/BusinessCockpitDeviceBoundaryAdapterTest.java
  33. 0 50
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/BusinessCockpitFoundationAdaptersTest.java
  34. 0 192
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/BusinessCockpitOverviewInfrastructureAdapterTest.java
  35. 0 157
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/BusinessCockpitOverviewMonitoringAdapterTest.java
  36. 0 240
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/BusinessCockpitOverviewWarningSettingsAdapterTest.java
  37. 0 40
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/BusinessCockpitWorkOrderReadAdapterTest.java
  38. 0 5
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitContractDictionaryTest.java
  39. 1 29
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitContractIntegrationTest.java
  40. 0 232
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitDeviceBoundaryControllerTest.java
  41. 0 127
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitDeviceBoundaryPipeIndustryTest.java
  42. 0 264
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitEventReadControllerTest.java
  43. 1 6
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitFacilityCountCrossEndpointContractTest.java
  44. 0 303
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitOverviewInfrastructureControllerTest.java
  45. 0 161
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitOverviewMonitoringControllerTest.java
  46. 0 202
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitOverviewMonitoringServiceTest.java
  47. 0 330
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitOverviewWarningSettingsControllerTest.java
  48. 0 305
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitOverviewWarningSettingsServiceTest.java
  49. 0 27
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitPipeNetworkCrossEndpointContractTest.java
  50. 0 101
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitTypeMetricsControllerTest.java
  51. 0 247
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitWorkOrderAssociationContractTest.java
  52. 2 286
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitWorkOrderReadControllerTest.java
  53. 0 132
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/device/BusinessCockpitDeviceBoundaryAdapter.java
  54. 0 33
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/device/CockpitDeviceBoundary.java
  55. 0 5
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/device/CockpitDeviceBoundaryAdapter.java
  56. 0 39
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/device/CockpitDeviceBoundaryResponse.java
  57. 0 222
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/device/CockpitDeviceBoundaryService.java
  58. 0 82
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/device/CockpitDeviceBoundarySnapshot.java
  59. 0 30
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/device/CockpitDeviceBoundaryStatistics.java
  60. 0 14
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/device/CockpitDeviceType.java
  61. 0 27
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/device/CockpitFacilityBoundary.java
  62. 0 18
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/device/CockpitIndustryStatistics.java
  63. 0 19
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/device/CockpitTypeScope.java
  64. 0 13
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/device/EmptyCockpitDeviceBoundaryAdapter.java
  65. 0 11
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/event/CockpitEventDetailService.java
  66. 0 23
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/event/EmptyCockpitEventReadAdapter.java
  67. 0 108
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/BusinessCockpitOverviewInfrastructureAdapter.java
  68. 0 258
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/BusinessCockpitOverviewMonitoringAdapter.java
  69. 0 351
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/BusinessCockpitOverviewWarningSettingsAdapter.java
  70. 0 5
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/CockpitOverviewInfrastructureAdapter.java
  71. 0 185
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/CockpitOverviewInfrastructureResponse.java
  72. 0 265
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/CockpitOverviewInfrastructureService.java
  73. 0 100
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/CockpitOverviewInfrastructureSnapshot.java
  74. 0 5
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/CockpitOverviewMonitoringAdapter.java
  75. 0 28
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/CockpitOverviewMonitoringDeviceStatusDelta.java
  76. 0 249
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/CockpitOverviewMonitoringResponse.java
  77. 0 418
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/CockpitOverviewMonitoringService.java
  78. 0 120
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/CockpitOverviewMonitoringSnapshot.java
  79. 0 6
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/CockpitOverviewWarningSettingsAdapter.java
  80. 0 269
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/CockpitOverviewWarningSettingsResponse.java
  81. 0 641
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/CockpitOverviewWarningSettingsService.java
  82. 0 142
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/CockpitOverviewWarningSettingsSnapshot.java
  83. 0 11
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/EmptyCockpitOverviewInfrastructureAdapter.java
  84. 0 20
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/EmptyCockpitOverviewMonitoringAdapter.java
  85. 0 18
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/EmptyCockpitOverviewWarningSettingsAdapter.java
  86. 0 23
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/type/EmptyCockpitTypeMetricsAdapter.java
  87. 0 43
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/workorder/BusinessCockpitWorkOrderReadAdapter.java
  88. 0 2
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/workorder/CockpitWorkOrderReadAdapter.java
  89. 0 18
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/workorder/CockpitWorkOrderReadService.java
  90. 0 33
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/workorder/EmptyCockpitWorkOrderReadAdapter.java

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

@@ -10,6 +10,7 @@ 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;
 
@@ -17,6 +18,7 @@ import java.nio.charset.StandardCharsets;
 
 /** 驾驶舱公开只读入口,不改变管理端档案接口的授权。 */
 @RestController
+@RequestMapping("/api/cockpit/v1")
 public class CockpitCollectionRecordsController {
     private final CockpitCollectionRecordsService service;
 
@@ -24,7 +26,7 @@ public class CockpitCollectionRecordsController {
         this.service = service;
     }
 
-    @GetMapping("/api/cockpit/v1/equipments/{deviceCode}/collection-records")
+    @GetMapping("/equipments/{deviceCode}/collection-records")
     public ResponseEntity<AjaxResult> collectionRecords(
             @PathVariable("deviceCode") String deviceCode,
             @RequestHeader(value = "X-Request-Id", required = false) String requestId) {

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

@@ -13,11 +13,13 @@ 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";
 
@@ -27,7 +29,7 @@ public class CockpitCurrentEventsController {
         this.currentEventsService = currentEventsService;
     }
 
-    @GetMapping("/api/cockpit/v1/events/current")
+    @GetMapping("/events/current")
     public ResponseEntity<AjaxResult> currentEvents(
             @RequestParam(value = "mode", required = false) String mode,
             @RequestParam(value = "level", required = false) String level,

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

@@ -1,45 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.device.CockpitDeviceBoundaryService;
-import com.zksy.cockpit.foundation.CockpitErrorPayload;
-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.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-
-@RestController
-public class CockpitDeviceBoundaryController {
-    private static final String REQUEST_ID_HEADER = "X-Request-Id";
-
-    private final CockpitDeviceBoundaryService deviceBoundaryService;
-
-    public CockpitDeviceBoundaryController(CockpitDeviceBoundaryService deviceBoundaryService) {
-        this.deviceBoundaryService = deviceBoundaryService;
-    }
-
-    @GetMapping("/api/cockpit/v1/device-boundary")
-    public ResponseEntity<AjaxResult> deviceBoundary(
-            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
-        return ResponseEntity.ok(AjaxResult.success(deviceBoundaryService.load(resolveRequestId(requestId))));
-    }
-
-    @ExceptionHandler(CockpitReadException.class)
-    public ResponseEntity<AjaxResult> handleReadFailure(HttpServletRequest request) {
-        CockpitErrorPayload payload = deviceBoundaryService.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 String resolveRequestId(String requestId) {
-        return StringUtils.isNotEmpty(requestId) ? requestId : IdUtils.fastSimpleUUID();
-    }
-}

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

@@ -9,6 +9,7 @@ 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;
 
 /**
@@ -21,6 +22,7 @@ import org.springframework.web.bind.annotation.RestController;
  * <p>只读:纯查询,无写库、无事务注解。
  */
 @RestController
+@RequestMapping("/api/cockpit/v1")
 public class CockpitDeviceFacilityRelationController {
     private static final Logger LOG = LoggerFactory.getLogger(CockpitDeviceFacilityRelationController.class);
 
@@ -30,7 +32,7 @@ public class CockpitDeviceFacilityRelationController {
         this.service = service;
     }
 
-    @GetMapping("/api/cockpit/v1/device-facility-relations")
+    @GetMapping("/device-facility-relations")
     public ResponseEntity<AjaxResult> relations() {
         return ResponseEntity.ok(AjaxResult.success(service.load()));
     }

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

@@ -19,7 +19,7 @@ import java.util.stream.Collectors;
  * 返回 sys_dict_data 原行(dictValue/dictLabel),不在前端硬编码词表。
  */
 @RestController
-@RequestMapping("/api/cockpit/v1/dict")
+@RequestMapping("/api/cockpit/v1")
 public class CockpitDictController {
     /** 只透传驾驶舱契约需要的字典,避免把后台任意字典暴露到公开端点。 */
     private static final List<String> ALLOWED = Collections.singletonList("pump_station_type");
@@ -30,7 +30,7 @@ public class CockpitDictController {
         this.dictTypeService = dictTypeService;
     }
 
-    @GetMapping("/{dictType}")
+    @GetMapping("/dict/{dictType}")
     public ResponseEntity<AjaxResult> dictType(@PathVariable String dictType) {
         if (!ALLOWED.contains(dictType)) {
             return ResponseEntity.ok(AjaxResult.success(Collections.emptyList()));

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

@@ -15,6 +15,7 @@ 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;
 
@@ -22,13 +23,14 @@ 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("/api/cockpit/v1/entities/{entityId}/detail")
+    @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) {

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

@@ -16,6 +16,7 @@ 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;
 
@@ -24,6 +25,7 @@ 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";
 
@@ -33,7 +35,7 @@ public class CockpitEquipmentArchiveController {
         this.archiveService = archiveService;
     }
 
-    @GetMapping("/api/cockpit/v1/equipments/{deviceCode}/archive")
+    @GetMapping("/equipments/{deviceCode}/archive")
     public ResponseEntity<AjaxResult> equipmentArchive(
             @PathVariable("deviceCode") String deviceCode,
             @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {

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

@@ -14,6 +14,7 @@ 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;
 
@@ -21,6 +22,7 @@ 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";
 
@@ -30,7 +32,7 @@ public class CockpitEquipmentDetailAggregateController {
         this.aggregateService = aggregateService;
     }
 
-    @GetMapping("/api/cockpit/v1/equipments/{deviceCode}/detail-aggregate")
+    @GetMapping("/equipments/{deviceCode}/detail-aggregate")
     public ResponseEntity<AjaxResult> equipmentDetailAggregate(
             @PathVariable("deviceCode") String deviceCode,
             @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {

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

@@ -47,16 +47,6 @@ public class CockpitEventDetailController {
         return error(HttpStatus.BAD_REQUEST, CockpitErrorCategory.INVALID_REQUEST, "family 只取 WARNING 或 ALARM");
     }
 
-    /** 报警处置流程(与详情分开取:失败只影响这一块)。 */
-    @GetMapping("/events/{eventId}/logs")
-    public ResponseEntity<AjaxResult> logs(@PathVariable String eventId,
-                                           @RequestParam(required = false) String family) {
-        if (!"ALARM".equalsIgnoreCase(family == null ? "" : family.trim())) {
-            return error(HttpStatus.BAD_REQUEST, CockpitErrorCategory.INVALID_REQUEST, "仅报警提供处置流程");
-        }
-        return ResponseEntity.ok(AjaxResult.success(events.alarmLogs(eventId)));
-    }
-
     private ResponseEntity<AjaxResult> notFound(String label) {
         return error(HttpStatus.NOT_FOUND, CockpitErrorCategory.NOT_FOUND, label + "不存在");
     }

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

@@ -1,96 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.event.CockpitEventReadResponse;
-import com.zksy.cockpit.event.CockpitEventReadService;
-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.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.RestController;
-import org.springframework.web.util.UriUtils;
-
-import javax.servlet.http.HttpServletRequest;
-import java.nio.charset.StandardCharsets;
-
-@RestController
-public class CockpitEventReadController {
-    private static final String REQUEST_ID_HEADER = "X-Request-Id";
-
-    private final CockpitEventReadService eventService;
-
-    public CockpitEventReadController(CockpitEventReadService eventService) {
-        this.eventService = eventService;
-    }
-
-    @GetMapping("/api/cockpit/v1/equipments/{deviceCode}/events/current")
-    public ResponseEntity<AjaxResult> currentEvents(
-            @PathVariable("deviceCode") String deviceCode,
-            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
-        CockpitEventReadResponse response = eventService.loadCurrent(
-                resolveRequestId(requestId), decodePathSegment(deviceCode));
-        return ResponseEntity.ok(AjaxResult.success(response));
-    }
-
-    @GetMapping("/api/cockpit/v1/equipments/{deviceCode}/events/history")
-    public ResponseEntity<AjaxResult> historyEvents(
-            @PathVariable("deviceCode") String deviceCode,
-            @RequestParam(value = "startTime") String startTime,
-            @RequestParam(value = "endTime") String endTime,
-            @RequestParam(value = "page", required = false) Integer page,
-            @RequestParam(value = "pageSize", required = false) Integer pageSize,
-            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
-        CockpitEventReadResponse response = eventService.loadHistory(
-                resolveRequestId(requestId),
-                decodePathSegment(deviceCode),
-                startTime,
-                endTime,
-                page,
-                pageSize);
-        return ResponseEntity.ok(AjaxResult.success(response));
-    }
-
-    @ExceptionHandler(CockpitInvalidRequestException.class)
-    public ResponseEntity<AjaxResult> handleInvalidRequest(HttpServletRequest request) {
-        return error(HttpStatus.BAD_REQUEST, eventService.invalidRequest(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER))));
-    }
-
-    @ExceptionHandler(CockpitDeviceNotFoundException.class)
-    public ResponseEntity<AjaxResult> handleNotFound(HttpServletRequest request) {
-        return error(HttpStatus.NOT_FOUND, eventService.notFound(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER))));
-    }
-
-    @ExceptionHandler(CockpitReadException.class)
-    public ResponseEntity<AjaxResult> handleReadFailure(HttpServletRequest request) {
-        return error(HttpStatus.INTERNAL_SERVER_ERROR, eventService.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");
-        }
-    }
-}

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

@@ -9,6 +9,7 @@ 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;
@@ -17,6 +18,7 @@ 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;
@@ -26,7 +28,7 @@ public class CockpitFacilityGeometryController {
         this.clock = clock;
     }
 
-    @GetMapping("/api/cockpit/v1/infrastructure/geometry")
+    @GetMapping("/infrastructure/geometry")
     public ResponseEntity<AjaxResult> geometry() {
         return ResponseEntity.ok(AjaxResult.success(service.load()));
     }

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

@@ -18,6 +18,7 @@ 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;
@@ -27,6 +28,7 @@ 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";
 
@@ -41,7 +43,7 @@ public class CockpitFreshnessController {
         this.clock = clock;
     }
 
-    @GetMapping("/api/cockpit/v1/equipments/{deviceCode}/freshness")
+    @GetMapping("/equipments/{deviceCode}/freshness")
     public ResponseEntity<AjaxResult> freshness(
             @PathVariable("deviceCode") String deviceCode,
             @RequestParam(value = "calibrationPeriodSeconds", required = false) Integer calibrationPeriodSeconds,

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

@@ -13,11 +13,13 @@ 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";
 
@@ -28,7 +30,7 @@ public class CockpitHandlingEfficiencyController {
         this.handlingEfficiencyService = handlingEfficiencyService;
     }
 
-    @GetMapping("/api/cockpit/v1/events/handling-efficiency")
+    @GetMapping("/events/handling-efficiency")
     public ResponseEntity<AjaxResult> handlingEfficiency(
             @RequestParam(value = "eventFamily", required = false) String eventFamily,
             @RequestParam(value = "industry", required = false) String industry,

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

@@ -13,11 +13,13 @@ 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";
 
@@ -27,7 +29,7 @@ public class CockpitHistoryAnalysisController {
         this.historyAnalysisService = historyAnalysisService;
     }
 
-    @GetMapping("/api/cockpit/v1/events/history-analysis")
+    @GetMapping("/events/history-analysis")
     public ResponseEntity<AjaxResult> historyAnalysis(
             @RequestParam(value = "eventFamily", required = false) String eventFamily,
             @RequestParam(value = "level", required = false) String level,

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

@@ -13,11 +13,13 @@ 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";
 
@@ -28,7 +30,7 @@ public class CockpitInfrastructureBaseArchivesController {
         this.baseArchivesService = baseArchivesService;
     }
 
-    @GetMapping("/api/cockpit/v1/infrastructure/base-archives")
+    @GetMapping("/infrastructure/base-archives")
     public ResponseEntity<AjaxResult> baseArchives(
             @RequestParam(value = "industry", required = false) String industry,
             @RequestParam(value = "facilityType", required = false) String facilityType,

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

@@ -13,11 +13,13 @@ 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";
 
@@ -28,7 +30,7 @@ public class CockpitInfrastructureEmergencySupportController {
         this.emergencySupportService = emergencySupportService;
     }
 
-    @GetMapping("/api/cockpit/v1/infrastructure/emergency-support")
+    @GetMapping("/infrastructure/emergency-support")
     public ResponseEntity<AjaxResult> emergencySupport(
             @RequestParam(value = "category", required = false) String category,
             @RequestParam(value = "industry", required = false) String industry,

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

@@ -13,11 +13,13 @@ 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";
 
@@ -28,7 +30,7 @@ public class CockpitInfrastructureManagementInformationController {
         this.managementInformationService = managementInformationService;
     }
 
-    @GetMapping("/api/cockpit/v1/infrastructure/management-information")
+    @GetMapping("/infrastructure/management-information")
     public ResponseEntity<AjaxResult> managementInformation(
             @RequestParam(value = "industry", required = false) String industry,
             @RequestParam(value = "district", required = false) String district,

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

@@ -13,11 +13,13 @@ 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";
 
@@ -28,7 +30,7 @@ public class CockpitInfrastructureOperatingInformationController {
         this.operatingInformationService = operatingInformationService;
     }
 
-    @GetMapping("/api/cockpit/v1/infrastructure/operating-information")
+    @GetMapping("/infrastructure/operating-information")
     public ResponseEntity<AjaxResult> operatingInformation(
             @RequestParam(value = "industry", required = false) String industry,
             // 片区(票 81):0/1/2/UNASSIGNED,不传=全域,非法值 400(校验在 service)。

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

@@ -15,11 +15,13 @@ 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";
 
@@ -29,7 +31,7 @@ public class CockpitMapSnapshotController {
         this.mapSnapshotService = mapSnapshotService;
     }
 
-    @GetMapping("/api/cockpit/v1/map-snapshot")
+    @GetMapping("/map-snapshot")
     public ResponseEntity<AjaxResult> mapSnapshot(
             @RequestParam(value = "page", defaultValue = "1") Integer page,
             @RequestParam(value = "pageSize", defaultValue = "500") Integer pageSize,

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

@@ -14,11 +14,13 @@ 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";
 
@@ -29,7 +31,7 @@ public class CockpitMonitoringDistributionController {
         this.distributionService = distributionService;
     }
 
-    @GetMapping("/api/cockpit/v1/monitoring/distribution")
+    @GetMapping("/monitoring/distribution")
     public ResponseEntity<AjaxResult> monitoringDistribution(
             @RequestParam(value = "industry", required = false) String industry,
             @RequestParam(value = "deviceType", required = false) String deviceType,

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

@@ -11,6 +11,7 @@ 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;
@@ -18,6 +19,7 @@ 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";
 
@@ -27,7 +29,7 @@ public class CockpitMonitoringOverviewController {
         this.overviewService = overviewService;
     }
 
-    @GetMapping("/api/cockpit/v1/monitoring/overview")
+    @GetMapping("/monitoring/overview")
     public ResponseEntity<AjaxResult> monitoringOverview(
             @RequestParam(value = "industry", required = false) String industry,
             @RequestParam(value = "deviceType", required = false) String deviceType,

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

@@ -18,6 +18,7 @@ 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;
 
@@ -26,6 +27,7 @@ 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";
 
@@ -35,7 +37,7 @@ public class CockpitMonitoringPointDetailController {
         this.detailService = detailService;
     }
 
-    @GetMapping("/api/cockpit/v1/monitoring-points/{monitoringPointCode}")
+    @GetMapping("/monitoring-points/{monitoringPointCode}")
     public ResponseEntity<AjaxResult> monitoringPointDetail(
             @PathVariable("monitoringPointCode") String monitoringPointCode,
             @RequestParam(value = "snapshotAt", required = false) String snapshotAt,

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

@@ -13,11 +13,13 @@ 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";
 
@@ -28,7 +30,7 @@ public class CockpitMonitoringSituationController {
         this.situationService = situationService;
     }
 
-    @GetMapping("/api/cockpit/v1/monitoring/situation")
+    @GetMapping("/monitoring/situation")
     public ResponseEntity<AjaxResult> monitoringSituation(
             @RequestParam(value = "industry", required = false) String industry,
             @RequestParam(value = "deviceType", required = false) String deviceType,

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

@@ -13,11 +13,13 @@ 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";
 
@@ -28,7 +30,7 @@ public class CockpitMultidimensionalAnalysisController {
         this.analysisService = analysisService;
     }
 
-    @GetMapping("/api/cockpit/v1/events/multidimensional-analysis")
+    @GetMapping("/events/multidimensional-analysis")
     public ResponseEntity<AjaxResult> multidimensionalAnalysis(
             @RequestParam(value = "eventFamily", required = false) String eventFamily,
             @RequestParam(value = "industry", required = false) String industry,

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

@@ -1,47 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.foundation.CockpitErrorPayload;
-import com.zksy.cockpit.foundation.CockpitReadException;
-import com.zksy.cockpit.overview.CockpitOverviewInfrastructureService;
-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.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-
-@RestController
-public class CockpitOverviewInfrastructureController {
-    private static final String REQUEST_ID_HEADER = "X-Request-Id";
-
-    private final CockpitOverviewInfrastructureService overviewInfrastructureService;
-
-    public CockpitOverviewInfrastructureController(
-            CockpitOverviewInfrastructureService overviewInfrastructureService) {
-        this.overviewInfrastructureService = overviewInfrastructureService;
-    }
-
-    @GetMapping("/api/cockpit/v1/overview/infrastructure")
-    public ResponseEntity<AjaxResult> overviewInfrastructure(
-            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
-        return ResponseEntity.ok(AjaxResult.success(
-                overviewInfrastructureService.load(resolveRequestId(requestId))));
-    }
-
-    @ExceptionHandler(CockpitReadException.class)
-    public ResponseEntity<AjaxResult> handleReadFailure(HttpServletRequest request) {
-        CockpitErrorPayload payload = overviewInfrastructureService.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 String resolveRequestId(String requestId) {
-        return StringUtils.isNotEmpty(requestId) ? requestId : IdUtils.fastSimpleUUID();
-    }
-}

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

@@ -13,6 +13,7 @@ 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;
@@ -24,6 +25,7 @@ import javax.servlet.http.HttpServletRequest;
  * 四个端点各自独立成败,一个模块失败只影响它自己的响应。
  */
 @RestController
+@RequestMapping("/api/cockpit/v1")
 public class CockpitOverviewModulesController {
     private static final String REQUEST_ID_HEADER = "X-Request-Id";
 
@@ -33,7 +35,7 @@ public class CockpitOverviewModulesController {
         this.modulesService = modulesService;
     }
 
-    @GetMapping("/api/cockpit/v1/overview/perception")
+    @GetMapping("/overview/perception")
     public ResponseEntity<AjaxResult> perception(
             @RequestParam(value = "district", required = false) String district,
             @RequestParam(value = "industry", required = false) String industry,
@@ -42,7 +44,7 @@ public class CockpitOverviewModulesController {
                 modulesService.loadPerception(resolveRequestId(requestId), district, industry)));
     }
 
-    @GetMapping("/api/cockpit/v1/overview/pipe-network")
+    @GetMapping("/overview/pipe-network")
     public ResponseEntity<AjaxResult> pipeNetwork(
             @RequestParam(value = "district", required = false) String district,
             @RequestParam(value = "industry", required = false) String industry,
@@ -51,7 +53,7 @@ public class CockpitOverviewModulesController {
                 modulesService.loadPipeNetwork(resolveRequestId(requestId), district, industry)));
     }
 
-    @GetMapping("/api/cockpit/v1/overview/warning-study")
+    @GetMapping("/overview/warning-study")
     public ResponseEntity<AjaxResult> warningStudy(
             @RequestParam(value = "district", required = false) String district,
             @RequestParam(value = "industry", required = false) String industry,
@@ -60,7 +62,7 @@ public class CockpitOverviewModulesController {
                 modulesService.loadWarningStudy(resolveRequestId(requestId), district, industry)));
     }
 
-    @GetMapping("/api/cockpit/v1/overview/alarm-disposal")
+    @GetMapping("/overview/alarm-disposal")
     public ResponseEntity<AjaxResult> alarmDisposal(
             @RequestParam(value = "district", required = false) String district,
             @RequestParam(value = "industry", required = false) String industry,

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

@@ -1,58 +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.CockpitOverviewMonitoringService;
-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.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-
-@RestController
-public class CockpitOverviewMonitoringController {
-    private static final String REQUEST_ID_HEADER = "X-Request-Id";
-
-    private final CockpitOverviewMonitoringService overviewMonitoringService;
-
-    public CockpitOverviewMonitoringController(CockpitOverviewMonitoringService overviewMonitoringService) {
-        this.overviewMonitoringService = overviewMonitoringService;
-    }
-
-    @GetMapping("/api/cockpit/v1/overview/monitoring")
-    public ResponseEntity<AjaxResult> overviewMonitoring(
-            @RequestParam(value = "industry", required = false) String industry,
-            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
-        return ResponseEntity.ok(AjaxResult.success(
-                overviewMonitoringService.load(resolveRequestId(requestId), industry)));
-    }
-
-    @ExceptionHandler(CockpitInvalidRequestException.class)
-    public ResponseEntity<AjaxResult> handleInvalidRequest(HttpServletRequest request) {
-        return error(HttpStatus.BAD_REQUEST, overviewMonitoringService.invalidRequest(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER))));
-    }
-
-    @ExceptionHandler(CockpitReadException.class)
-    public ResponseEntity<AjaxResult> handleReadFailure(HttpServletRequest request) {
-        return error(HttpStatus.INTERNAL_SERVER_ERROR, overviewMonitoringService.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 - 65
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitOverviewWarningSettingsController.java

@@ -1,65 +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.CockpitOverviewWarningSettingsService;
-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.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-
-@RestController
-public class CockpitOverviewWarningSettingsController {
-    private static final String REQUEST_ID_HEADER = "X-Request-Id";
-
-    private final CockpitOverviewWarningSettingsService warningSettingsService;
-
-    public CockpitOverviewWarningSettingsController(
-            CockpitOverviewWarningSettingsService warningSettingsService) {
-        this.warningSettingsService = warningSettingsService;
-    }
-
-    @GetMapping("/api/cockpit/v1/overview/warning-settings")
-    public ResponseEntity<AjaxResult> warningSettings(
-            @RequestParam(value = "mode", required = false) String mode,
-            @RequestParam(value = "range", required = false) String range,
-            @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(warningSettingsService.load(
-                resolveRequestId(requestId), mode, range, startTime, endTime)));
-    }
-
-    @ExceptionHandler(CockpitInvalidRequestException.class)
-    public ResponseEntity<AjaxResult> handleInvalidRequest(
-            HttpServletRequest request,
-            CockpitInvalidRequestException exception) {
-        return error(HttpStatus.BAD_REQUEST, warningSettingsService.invalidRequest(
-                resolveRequestId(request.getHeader(REQUEST_ID_HEADER)),
-                exception.getMessage()));
-    }
-
-    @ExceptionHandler(CockpitReadException.class)
-    public ResponseEntity<AjaxResult> handleReadFailure(HttpServletRequest request) {
-        return error(HttpStatus.INTERNAL_SERVER_ERROR, warningSettingsService.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();
-    }
-}

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

@@ -15,7 +15,7 @@ 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;
 
@@ -23,6 +23,7 @@ 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";
 
@@ -32,7 +33,7 @@ public class CockpitTypeMetricsController {
         this.metricsService = metricsService;
     }
 
-    @GetMapping("/api/cockpit/v1/equipments/{deviceCode}/metrics/current")
+    @GetMapping("/equipments/{deviceCode}/metrics/current")
     public ResponseEntity<AjaxResult> currentMetrics(
             @PathVariable("deviceCode") String deviceCode,
             @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
@@ -41,24 +42,6 @@ public class CockpitTypeMetricsController {
         return ResponseEntity.ok(AjaxResult.success(response));
     }
 
-    @GetMapping("/api/cockpit/v1/equipments/{deviceCode}/metrics/history")
-    public ResponseEntity<AjaxResult> historyMetrics(
-            @PathVariable("deviceCode") String deviceCode,
-            @RequestParam(value = "startTime") String startTime,
-            @RequestParam(value = "endTime") String endTime,
-            @RequestParam(value = "page", required = false) Integer page,
-            @RequestParam(value = "pageSize", required = false) Integer pageSize,
-            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
-        CockpitTypeMetricsResponse response = metricsService.loadHistory(
-                resolveRequestId(requestId),
-                decodePathSegment(deviceCode),
-                startTime,
-                endTime,
-                page,
-                pageSize);
-        return ResponseEntity.ok(AjaxResult.success(response));
-    }
-
     @ExceptionHandler(CockpitInvalidRequestException.class)
     public ResponseEntity<AjaxResult> handleInvalidRequest(HttpServletRequest request) {
         return error(HttpStatus.BAD_REQUEST, metricsService.invalidRequest(

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

@@ -15,7 +15,7 @@ import java.util.Map;
 import java.util.UUID;
 
 @RestController
-@RequestMapping("/api/cockpit/v1/video")
+@RequestMapping("/api/cockpit/v1")
 public class CockpitVideoController {
     private final CockpitVideoService videos;
     private final Clock clock;
@@ -25,31 +25,31 @@ public class CockpitVideoController {
         this.clock = clock;
     }
 
-    @GetMapping("/device")
+    @GetMapping("/video/device")
     public ResponseEntity<AjaxResult> device(@RequestParam("deviceCode") String code, HttpServletRequest request) {
         return success(videos.device(code), request);
     }
 
-    @PostMapping("/live")
+    @PostMapping("/video/live")
     public ResponseEntity<AjaxResult> live(@RequestBody Map<String, Object> body, HttpServletRequest request) {
         return success(videos.live(field(body, "deviceCode")), request);
     }
 
-    @PostMapping("/sessions/prepare")
+    @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));
         return ResponseEntity.status(201).cacheControl(org.springframework.http.CacheControl.noStore()).body(AjaxResult.success(data));
     }
 
-    @PostMapping("/sessions/{id}/live")
+    @PostMapping("/video/sessions/{id}/live")
     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. */
-    @GetMapping("/records")
+    @GetMapping("/video/records")
     public ResponseEntity<AjaxResult> records(@RequestParam("deviceCode") String code,
             @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime,
             HttpServletRequest request) {
@@ -57,33 +57,33 @@ public class CockpitVideoController {
     }
 
     /** Starts one anonymous playback session over an already-listed recording window. */
-    @PostMapping("/playback")
+    @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);
     }
 
-    @PostMapping("/sessions/{id}/status")
+    @PostMapping("/video/sessions/{id}/status")
     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("/sessions/{id}/heartbeat")
+    @PostMapping("/video/sessions/{id}/heartbeat")
     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("/sessions/{id}/stop")
+    @PostMapping("/video/sessions/{id}/stop")
     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. */
-    @PostMapping("/sessions/{id}/control")
+    @PostMapping("/video/sessions/{id}/control")
     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))

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

@@ -5,9 +5,7 @@ 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.CockpitWorkOrderReadResponse;
 import com.zksy.cockpit.workorder.CockpitWorkOrderReadService;
-import com.zksy.cockpit.workorder.CockpitWorkOrderTimelineResponse;
 import com.zksy.common.core.domain.AjaxResult;
 import com.zksy.common.utils.StringUtils;
 import com.zksy.common.utils.uuid.IdUtils;
@@ -15,16 +13,15 @@ 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 CockpitWorkOrderReadController {
     private static final String REQUEST_ID_HEADER = "X-Request-Id";
 
@@ -34,36 +31,6 @@ public class CockpitWorkOrderReadController {
         this.workOrderService = workOrderService;
     }
 
-    @GetMapping("/api/cockpit/v1/equipments/{deviceCode}/work-orders")
-    public ResponseEntity<AjaxResult> deviceWorkOrders(
-            @PathVariable("deviceCode") String deviceCode,
-            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
-        CockpitWorkOrderReadResponse response = workOrderService.loadByDevice(
-                resolveRequestId(requestId), decodePathSegment(deviceCode));
-        return ResponseEntity.ok(AjaxResult.success(response));
-    }
-
-    @GetMapping("/api/cockpit/v1/events/{eventSource}/{eventCode}/work-orders")
-    public ResponseEntity<AjaxResult> eventWorkOrders(
-            @PathVariable("eventSource") String eventSource,
-            @PathVariable("eventCode") String eventCode,
-            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
-        CockpitWorkOrderReadResponse response = workOrderService.loadByEvent(
-                resolveRequestId(requestId),
-                decodePathSegment(eventSource),
-                decodePathSegment(eventCode));
-        return ResponseEntity.ok(AjaxResult.success(response));
-    }
-
-    @GetMapping("/api/cockpit/v1/work-orders/{workOrderCode}/timeline")
-    public ResponseEntity<AjaxResult> workOrderTimeline(
-            @PathVariable("workOrderCode") String workOrderCode,
-            @RequestHeader(value = REQUEST_ID_HEADER, required = false) String requestId) {
-        CockpitWorkOrderTimelineResponse response = workOrderService.loadTimeline(
-                resolveRequestId(requestId), decodePathSegment(workOrderCode));
-        return ResponseEntity.ok(AjaxResult.success(response));
-    }
-
     /**
      * 全量工单分页(票 65:报警效率面板的「当前工单列表」)。
      *
@@ -90,7 +57,7 @@ public class CockpitWorkOrderReadController {
      * 面板按近 7/30/90 天切换时,列表必须跟着收窄(否则上方的状态分布按窗口统计、
      * 下方列表是全库,读者会以为自相矛盾)。
      */
-    @GetMapping("/api/cockpit/v1/work-orders")
+    @GetMapping("/work-orders")
     public ResponseEntity<AjaxResult> workOrderList(
             @RequestParam(value = "page", required = false) Integer page,
             @RequestParam(value = "pageSize", required = false) Integer pageSize,
@@ -137,12 +104,4 @@ public class CockpitWorkOrderReadController {
     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 path segment encoding");
-        }
-    }
 }

+ 0 - 120
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/BusinessCockpitDeviceBoundaryAdapterTest.java

@@ -1,120 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.base.domain.EquipmentBase;
-import com.zksy.base.domain.EquipmentType;
-import com.zksy.base.domain.PipeNetworkBase;
-import com.zksy.base.service.EquipmentBaseService;
-import com.zksy.base.service.EquipmentTypeService;
-import com.zksy.base.service.PipeNetworkBaseService;
-import com.zksy.cockpit.device.BusinessCockpitDeviceBoundaryAdapter;
-import com.zksy.cockpit.device.CockpitDeviceBoundarySnapshot;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import java.util.Arrays;
-import java.util.Collections;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-/**
- * 设备边界的**命名空间隔离**契约(执行票 20 现象 2)。
- *
- * <p>回归背景:适配器曾把原始 {@code network_type}({@code 0/1/2})透传给
- * {@code equipment_type} 字典查询。两套编码数值域重叠而语义不同,于是真实库里
- * 3735 条<b>排水</b>设施被标成「供水设备 / WATER_SUPPLY」、996 条<b>供水</b>设施被标成
- * 「排水设备 / DRAINAGE」。本测试固定住「设施用管网命名空间、不借用设备类型命名空间」。</p>
- */
-class BusinessCockpitDeviceBoundaryAdapterTest {
-
-    private BusinessCockpitDeviceBoundaryAdapter adapter;
-    private EquipmentTypeService equipmentTypeService;
-    private EquipmentBaseService equipmentBaseService;
-    private PipeNetworkBaseService pipeNetworkBaseService;
-
-    @BeforeEach
-    void setUp() {
-        equipmentTypeService = mock(EquipmentTypeService.class);
-        equipmentBaseService = mock(EquipmentBaseService.class);
-        pipeNetworkBaseService = mock(PipeNetworkBaseService.class);
-        adapter = new BusinessCockpitDeviceBoundaryAdapter(
-                equipmentTypeService, equipmentBaseService, pipeNetworkBaseService);
-        // 设备类型命名空间:id=1 是「供水设备」,id=2 是「排水设备」——与 network_type 数值域重叠。
-        when(equipmentTypeService.list()).thenReturn(Arrays.asList(type(1, "供水设备", 0), type(2, "排水设备", 0)));
-        when(equipmentBaseService.list()).thenReturn(Collections.emptyList());
-    }
-
-    @Test
-    void facilityTypeCodesNeverCollideWithEquipmentTypePrimaryKeys() {
-        when(pipeNetworkBaseService.list()).thenReturn(Arrays.asList(
-                pipe("P-GAS", "燃气管线", "0"),
-                pipe("P-DRAIN", "排水管线", "1"),
-                pipe("P-WATER", "供水管线", "2")));
-
-        CockpitDeviceBoundarySnapshot snapshot = adapter.load();
-
-        assertEquals(Arrays.asList("GAS_PIPE", "DRAINAGE_PIPE", "WATER_PIPE"),
-                snapshot.getFacilities().stream()
-                        .map(CockpitDeviceBoundarySnapshot.SourceFacility::getTypeCode)
-                        .collect(java.util.stream.Collectors.toList()));
-        // 关键:设施类型码不得再是 "0"/"1"/"2"(那正是与 equipment_type.id 碰撞的根源)
-        for (CockpitDeviceBoundarySnapshot.SourceFacility facility : snapshot.getFacilities()) {
-            assertNotEquals("1", facility.getTypeCode());
-            assertNotEquals("2", facility.getTypeCode());
-        }
-    }
-
-    @Test
-    void pipeFacilityTypesAreRegisteredWithCorrectIndustryAndObjectKind() {
-        when(pipeNetworkBaseService.list()).thenReturn(Collections.singletonList(pipe("P-DRAIN", "排水管线", "1")));
-
-        CockpitDeviceBoundarySnapshot snapshot = adapter.load();
-
-        CockpitDeviceBoundarySnapshot.SourceType drainage = snapshot.getTypes().stream()
-                .filter(type -> "DRAINAGE_PIPE".equals(type.getCode()))
-                .findFirst().orElseThrow(AssertionError::new);
-        assertEquals("排水管线", drainage.getName());
-        assertEquals("DRAINAGE", drainage.getIndustry());
-        assertEquals("FACILITY", drainage.getObjectKind());
-
-        // 设备类型条目仍是 SMART_DEVICE,两套命名空间并存且互不覆盖
-        CockpitDeviceBoundarySnapshot.SourceType waterDevice = snapshot.getTypes().stream()
-                .filter(type -> "1".equals(type.getCode()))
-                .findFirst().orElseThrow(AssertionError::new);
-        assertEquals("供水设备", waterDevice.getName());
-        assertEquals("SMART_DEVICE", waterDevice.getObjectKind());
-    }
-
-    @Test
-    void unclassifiablePipeKeepsSentinelCodeSoServiceCountsItAsUnknown() {
-        when(pipeNetworkBaseService.list()).thenReturn(Collections.singletonList(
-                pipe("P-ODD", "来路不明管线", "99")));
-
-        CockpitDeviceBoundarySnapshot snapshot = adapter.load();
-
-        // 哨兵码不在字典中 → 服务层 unknownTypeCount 会如实计数,设施不静默消失
-        assertEquals("PIPE_UNCLASSIFIED",
-                snapshot.getFacilities().get(0).getTypeCode());
-        assertEquals(0, snapshot.getTypes().stream()
-                .filter(type -> "PIPE_UNCLASSIFIED".equals(type.getCode()))
-                .count(), "未分类哨兵不应进正式字典");
-    }
-
-    private static EquipmentType type(Integer id, String name, Integer parentId) {
-        EquipmentType type = new EquipmentType();
-        type.setId(id);
-        type.setTypeName(name);
-        type.setParentId(parentId);
-        return type;
-    }
-
-    private static PipeNetworkBase pipe(String code, String name, String networkType) {
-        PipeNetworkBase facility = new PipeNetworkBase();
-        facility.setNetworkCode(code);
-        facility.setNetworkName(name);
-        facility.setNetworkType(networkType);
-        return facility;
-    }
-}

+ 0 - 50
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/BusinessCockpitFoundationAdaptersTest.java

@@ -3,16 +3,11 @@ package com.zksy.web.controller.cockpit;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.zksy.base.domain.EquipmentBase;
 import com.zksy.base.domain.EquipmentStatus;
-import com.zksy.base.domain.EquipmentType;
-import com.zksy.base.domain.MonitorPoint;
 import com.zksy.base.domain.PipeNetworkBase;
 import com.zksy.base.service.EquipmentBaseService;
 import com.zksy.base.service.EquipmentStatusService;
-import com.zksy.base.service.EquipmentTypeService;
 import com.zksy.base.service.MonitorPointService;
 import com.zksy.base.service.PipeNetworkBaseService;
-import com.zksy.cockpit.device.BusinessCockpitDeviceBoundaryAdapter;
-import com.zksy.cockpit.device.CockpitDeviceBoundarySnapshot;
 import com.zksy.cockpit.foundation.BusinessCockpitFoundationAdapter;
 import com.zksy.cockpit.foundation.BusinessCockpitFreshnessAdapter;
 import com.zksy.cockpit.foundation.CockpitFoundationSnapshot;
@@ -21,7 +16,6 @@ import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
 import java.time.LocalDateTime;
-import java.util.Arrays;
 import java.util.Collections;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -35,7 +29,6 @@ import static org.mockito.Mockito.when;
 class BusinessCockpitFoundationAdaptersTest {
 
     private EquipmentBaseService equipmentBaseService;
-    private EquipmentTypeService equipmentTypeService;
     private MonitorPointService monitorPointService;
     private PipeNetworkBaseService pipeNetworkBaseService;
     private EquipmentStatusService equipmentStatusService;
@@ -43,7 +36,6 @@ class BusinessCockpitFoundationAdaptersTest {
     @BeforeEach
     void setUp() {
         equipmentBaseService = mock(EquipmentBaseService.class);
-        equipmentTypeService = mock(EquipmentTypeService.class);
         monitorPointService = mock(MonitorPointService.class);
         pipeNetworkBaseService = mock(PipeNetworkBaseService.class);
         equipmentStatusService = mock(EquipmentStatusService.class);
@@ -78,40 +70,6 @@ class BusinessCockpitFoundationAdaptersTest {
         assertFalse(snapshot.getMapFrame().isRenderable());
     }
 
-    @Test
-    void deviceBoundaryListsTypesDevicesAndFacilitiesWithHonestScope() {
-        EquipmentType gasRoot = type(3, "燃气", 0);
-        EquipmentType gasSensor = type(11, "燃气浓度计", 3);
-        when(equipmentTypeService.list()).thenReturn(Arrays.asList(gasRoot, gasSensor));
-        when(equipmentBaseService.list()).thenReturn(Collections.singletonList(device("E-1", "GAS-001")));
-        PipeNetworkBase facility = new PipeNetworkBase();
-        facility.setNetworkId("N-1");
-        facility.setNetworkCode("PIPE-001");
-        facility.setNetworkName("城北主管网");
-        facility.setNetworkType("主管");
-        when(pipeNetworkBaseService.list()).thenReturn(Collections.singletonList(facility));
-
-        CockpitDeviceBoundarySnapshot snapshot =
-                new BusinessCockpitDeviceBoundaryAdapter(
-                        equipmentTypeService, equipmentBaseService, pipeNetworkBaseService).load();
-
-        // 设备类型 2 条 + 管网设施类型 3 条(管网命名空间,执行票 20)
-        assertEquals(5, snapshot.getTypes().size());
-        assertEquals("11", snapshot.getTypes().get(1).getCode());
-        assertEquals("GAS", snapshot.getTypes().get(1).getIndustry());
-        assertEquals("SMART_DEVICE", snapshot.getTypes().get(1).getObjectKind());
-        assertNull(snapshot.getTypes().get(1).getDrainageScope());
-
-        assertEquals(1, snapshot.getDevices().size());
-        assertEquals("GAS-001", snapshot.getDevices().get(0).getEquipmentCode());
-        assertEquals("11", snapshot.getDevices().get(0).getTypeCode());
-
-        assertEquals(1, snapshot.getFacilities().size());
-        assertEquals("PIPE-001", snapshot.getFacilities().get(0).getFacilityCode());
-        // 自由文本「主管」不在权威编码内 → 未分类哨兵码,不再把原始值当类型码(执行票 20)
-        assertEquals("PIPE_UNCLASSIFIED", snapshot.getFacilities().get(0).getTypeCode());
-    }
-
     @Test
     void freshnessUsesLedgerUpdateAndStatusUpdateTimes() {
         EquipmentBase device = device("E-1", "GAS-001");
@@ -141,14 +99,6 @@ class BusinessCockpitFoundationAdaptersTest {
                 .load("UNKNOWN"));
     }
 
-    private static EquipmentType type(int id, String name, int parentId) {
-        EquipmentType type = new EquipmentType();
-        type.setId(id);
-        type.setTypeName(name);
-        type.setParentId(parentId);
-        return type;
-    }
-
     private static EquipmentBase device(String id, String code) {
         EquipmentBase device = new EquipmentBase();
         device.setEquipmentId(id);

+ 0 - 192
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/BusinessCockpitOverviewInfrastructureAdapterTest.java

@@ -1,192 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.watersupply.domain.WaterPlantInfo;
-import com.zksy.watersupply.service.IWaterPlantInfoService;
-import com.zksy.watersupply.domain.PumpStationType;
-import com.zksy.watersupply.domain.PumpStationInfo;
-import com.zksy.watersupply.service.IPumpStationInfoService;
-import com.zksy.base.domain.EquipmentBase;
-import com.zksy.base.domain.EquipmentType;
-import com.zksy.base.domain.PipeNetworkBase;
-import com.zksy.base.service.EquipmentBaseService;
-import com.zksy.base.service.EquipmentTypeService;
-import com.zksy.base.service.PipeNetworkBaseService;
-import com.zksy.cockpit.infrastructure.BusinessCockpitInfrastructureBaseArchivesAdapter;
-import com.zksy.cockpit.infrastructure.CockpitFacilityCatalog;
-import com.zksy.cockpit.overview.BusinessCockpitOverviewInfrastructureAdapter;
-import com.zksy.drainage.service.DrainageGateInfoService;
-import com.zksy.drainage.service.DrainageStorageInfoService;
-import com.zksy.cockpit.overview.CockpitOverviewInfrastructureSnapshot;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import java.math.BigDecimal;
-import java.time.LocalDateTime;
-import java.util.Arrays;
-import java.util.Collections;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-class BusinessCockpitOverviewInfrastructureAdapterTest {
-
-    private EquipmentTypeService equipmentTypeService;
-    private EquipmentBaseService equipmentBaseService;
-    private PipeNetworkBaseService pipeNetworkBaseService;
-    private IWaterPlantInfoService plantService;
-    private IPumpStationInfoService pumpStationService;
-    private BusinessCockpitOverviewInfrastructureAdapter adapter;
-
-    @BeforeEach
-    void setUp() {
-        equipmentTypeService = mock(EquipmentTypeService.class);
-        equipmentBaseService = mock(EquipmentBaseService.class);
-        pipeNetworkBaseService = mock(PipeNetworkBaseService.class);
-        plantService = mock(IWaterPlantInfoService.class);
-        pumpStationService = mock(IPumpStationInfoService.class);
-        CockpitFacilityCatalog catalog = new BusinessCockpitInfrastructureBaseArchivesAdapter(
-                plantService, pumpStationService, pipeNetworkBaseService,
-                mock(DrainageGateInfoService.class), mock(DrainageStorageInfoService.class),
-                mock(com.zksy.watersupply.service.IWaterSourceInfoService.class),
-                mock(com.zksy.base.service.ManholeBaseService.class));
-        adapter = new BusinessCockpitOverviewInfrastructureAdapter(equipmentTypeService, equipmentBaseService, catalog);
-    }
-
-    @Test
-    void countsDevicesByTypeAndFacilitiesByNetworkTypeWithLengthInKm() {
-        EquipmentType gasRoot = type(3, "燃气", 0);
-        EquipmentType gasSensor = type(11, "燃气浓度计", 3);
-        when(equipmentTypeService.list()).thenReturn(Arrays.asList(gasRoot, gasSensor));
-
-        EquipmentBase first = device("E-1", "GAS-001", 11);
-        EquipmentBase second = device("E-2", "GAS-002", 11);
-        second.setUpdateTime(LocalDateTime.parse("2026-09-02T09:59:50"));
-        when(equipmentBaseService.list()).thenReturn(Arrays.asList(first, second));
-
-        PipeNetworkBase facility = new PipeNetworkBase();
-        facility.setNetworkId("N-1");
-        facility.setNetworkCode("PIPE-001");
-        facility.setNetworkName("城北主管网");
-        facility.setNetworkType("主管");
-        facility.setLength(new BigDecimal("5000"));
-        when(pipeNetworkBaseService.list()).thenReturn(Collections.singletonList(facility));
-
-        CockpitOverviewInfrastructureSnapshot snapshot = adapter.load();
-
-        assertEquals(14, snapshot.getTypes().size()); // 设施目录新增用水户与消火栓两类
-        assertEquals("2026-09-02T09:59:50+08:00", snapshot.getUpdatedAt());
-
-        long deviceCount = snapshot.getCounts().stream()
-                .filter(count -> "SMART_DEVICE".equals(count.getObjectKind())
-                        && "11".equals(count.getTypeCode()))
-                .mapToInt(CockpitOverviewInfrastructureSnapshot.SourceCount::getCount)
-                .sum();
-        assertEquals(2, deviceCount);
-
-        CockpitOverviewInfrastructureSnapshot.SourceCount facilityCount = snapshot.getCounts().stream()
-                .filter(count -> "FACILITY".equals(count.getObjectKind()))
-                .findFirst().orElseThrow(AssertionError::new);
-        // 自由文本「主管」不在权威编码内 → 归未分类哨兵码(不再是原始值透传,执行票 20)
-        assertEquals("PIPE_UNCLASSIFIED", facilityCount.getTypeCode());
-        assertEquals(1, facilityCount.getCount());
-        assertEquals(0, new BigDecimal("5.000").compareTo(facilityCount.getValue().getLengthKm()));
-        assertEquals("km", facilityCount.getValue().getScale());
-        assertNull(facilityCount.getValue().getRange());
-    }
-
-    /**
-     * 管网设施类型必须带出**正式行业**,否则 5268 条管网会被服务层整体计入
-     * {@code excluded.unknownTypeCount}(执行票 20 现象 3)。
-     */
-    @Test
-    void resolvesPipeFacilityIndustriesFromAuthoritativeCodes() {
-        when(equipmentTypeService.list()).thenReturn(Collections.emptyList());
-        when(equipmentBaseService.list()).thenReturn(Collections.emptyList());
-        when(plantService.list()).thenReturn(Collections.emptyList());
-        when(pumpStationService.list()).thenReturn(Collections.emptyList());
-
-        java.util.List<PipeNetworkBase> pipes = new java.util.ArrayList<>();
-        pipes.add(pipe("P-GAS", "燃气管线", "0", "500"));
-        pipes.add(pipe("P-DRAIN", "排水管线", "1", "1000"));
-        pipes.add(pipe("P-WATER", "供水管线", "2", "1500"));
-        when(pipeNetworkBaseService.list()).thenReturn(pipes);
-
-        CockpitOverviewInfrastructureSnapshot snapshot = adapter.load();
-
-        for (CockpitOverviewInfrastructureSnapshot.SourceType type : snapshot.getTypes()) {
-            if (!"FACILITY".equals(type.getObjectKind())) {
-                continue;
-            }
-            assertNotNull(type.getIndustry(),
-                    "正式管网类型必须带行业,否则会被计入 excluded.unknownTypeCount");
-        }
-        assertEquals(3, snapshot.getCounts().stream()
-                .filter(count -> "FACILITY".equals(count.getObjectKind()))
-                .mapToInt(CockpitOverviewInfrastructureSnapshot.SourceCount::getCount)
-                .sum(), "0/1/2 三类管网都必须计入");
-    }
-
-    private static PipeNetworkBase pipe(String code, String name, String type, String length) {
-        PipeNetworkBase facility = new PipeNetworkBase();
-        facility.setNetworkId("N-" + code);
-        facility.setNetworkCode(code);
-        facility.setNetworkName(name);
-        facility.setNetworkType(type);
-        facility.setLength(new BigDecimal(length));
-        return facility;
-    }
-
-    @Test
-    void countsWaterPlantsAndSharedPumpStationsSeparately() {
-        WaterPlantInfo plant = new WaterPlantInfo();
-        plant.setPlantCode("WP-1");
-        plant.setUpdateTime(LocalDateTime.parse("2026-09-03T08:00:00"));
-        when(plantService.list()).thenReturn(Collections.singletonList(plant));
-
-        PumpStationInfo water = new PumpStationInfo();
-        water.setStationCode("PS-1");
-        water.setStationType(PumpStationType.WATER_SUPPLY);
-        PumpStationInfo drainage = new PumpStationInfo();
-        drainage.setStationCode("PS-2");
-        drainage.setStationType(PumpStationType.DRAINAGE);
-        PumpStationInfo unclassified = new PumpStationInfo();
-        unclassified.setStationCode("PS-3");
-        unclassified.setStationType("unknown");
-        when(pumpStationService.list()).thenReturn(Arrays.asList(water, drainage, unclassified));
-
-        CockpitOverviewInfrastructureSnapshot snapshot = adapter.load();
-        assertEquals("2026-09-03T08:00:00+08:00", snapshot.getUpdatedAt());
-        assertEquals(4, snapshot.getCounts().size());
-        assertEquals("WATER_PLANT", snapshot.getCounts().get(0).getTypeCode());
-        assertEquals("WATER_PUMP_STATION", snapshot.getCounts().get(1).getTypeCode());
-        assertEquals("DRAINAGE_PUMP_STATION", snapshot.getCounts().get(2).getTypeCode());
-        assertEquals("DRAINAGE", snapshot.getTypes().get(7).getIndustry());
-        verify(equipmentTypeService, times(1)).list();
-        verify(equipmentBaseService, times(1)).list();
-        verify(pipeNetworkBaseService, times(1)).list();
-        verify(plantService, times(1)).list();
-        verify(pumpStationService, times(1)).list();
-    }
-
-    private static EquipmentType type(int id, String name, int parentId) {
-        EquipmentType type = new EquipmentType();
-        type.setId(id);
-        type.setTypeName(name);
-        type.setParentId(parentId);
-        return type;
-    }
-
-    private static EquipmentBase device(String id, String code, int typeId) {
-        EquipmentBase device = new EquipmentBase();
-        device.setEquipmentId(id);
-        device.setEquipmentCode(code);
-        device.setEquipmentName(code);
-        device.setEquipmentTypeId(typeId);
-        return device;
-    }
-}

+ 0 - 157
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/BusinessCockpitOverviewMonitoringAdapterTest.java

@@ -1,157 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.zksy.base.domain.EquipmentBase;
-import com.zksy.base.domain.EquipmentStatus;
-import com.zksy.base.domain.EquipmentType;
-import com.zksy.base.domain.MonitorPoint;
-import com.zksy.base.domain.PipeNetworkBase;
-import com.zksy.base.gas.domain.GasMonitorData;
-import com.zksy.base.gas.service.GasMonitorDataService;
-import com.zksy.base.service.EquipmentBaseService;
-import com.zksy.base.service.EquipmentStatusService;
-import com.zksy.base.service.EquipmentTypeService;
-import com.zksy.base.service.MonitorPointService;
-import com.zksy.base.service.PipeNetworkBaseService;
-import com.zksy.base.water.service.WaterMonitorDataService;
-import com.zksy.cockpit.overview.BusinessCockpitOverviewMonitoringAdapter;
-import com.zksy.cockpit.overview.CockpitOverviewMonitoringSnapshot;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import java.time.LocalDateTime;
-import java.util.Arrays;
-import java.util.Collections;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-class BusinessCockpitOverviewMonitoringAdapterTest {
-
-    private static final String GAS_CODE = "GAS-001";
-
-    private EquipmentTypeService equipmentTypeService;
-    private EquipmentBaseService equipmentBaseService;
-    private MonitorPointService monitorPointService;
-    private PipeNetworkBaseService pipeNetworkBaseService;
-    private EquipmentStatusService equipmentStatusService;
-    private GasMonitorDataService gasMonitorDataService;
-    private WaterMonitorDataService waterMonitorDataService;
-    private BusinessCockpitOverviewMonitoringAdapter adapter;
-
-    @BeforeEach
-    void setUp() {
-        equipmentTypeService = mock(EquipmentTypeService.class);
-        equipmentBaseService = mock(EquipmentBaseService.class);
-        monitorPointService = mock(MonitorPointService.class);
-        pipeNetworkBaseService = mock(PipeNetworkBaseService.class);
-        equipmentStatusService = mock(EquipmentStatusService.class);
-        gasMonitorDataService = mock(GasMonitorDataService.class);
-        waterMonitorDataService = mock(WaterMonitorDataService.class);
-        adapter = new BusinessCockpitOverviewMonitoringAdapter(
-                equipmentTypeService, equipmentBaseService, monitorPointService,
-                pipeNetworkBaseService, equipmentStatusService,
-                gasMonitorDataService, waterMonitorDataService);
-
-        EquipmentType gasRoot = type(3, "燃气", 0);
-        EquipmentType gasSensor = type(11, "燃气浓度计", 3);
-        when(equipmentTypeService.list()).thenReturn(Arrays.asList(gasRoot, gasSensor));
-    }
-
-    @Test
-    void mapsDeviceStatePointTypeAndMetricFreshness() {
-        EquipmentBase device = device("E-1", GAS_CODE, 11);
-        device.setUpdateTime(LocalDateTime.parse("2026-09-02T09:59:50"));
-        when(equipmentBaseService.list()).thenReturn(Collections.singletonList(device));
-
-        MonitorPoint point = new MonitorPoint();
-        point.setPointId("P-1");
-        point.setPointCode("MP-1");
-        when(monitorPointService.list()).thenReturn(Collections.singletonList(point));
-        when(equipmentBaseService.getEquipmentByPoint("P-1"))
-                .thenReturn(Collections.singletonList(device));
-
-        EquipmentStatus status = new EquipmentStatus();
-        status.setStatusId(1);
-        status.setEquipmentId("E-1");
-        status.setOnlineStatus(1);
-        when(equipmentStatusService.getByDeviceCode(GAS_CODE)).thenReturn(status);
-
-        when(pipeNetworkBaseService.list()).thenReturn(Collections.emptyList());
-
-        GasMonitorData frame = new GasMonitorData();
-        frame.setId("F-1");
-        frame.setCreateTime(LocalDateTime.parse("2026-09-02T09:00:00"));
-        when(gasMonitorDataService.list(any(LambdaQueryWrapper.class)))
-                .thenReturn(Collections.singletonList(frame));
-        when(waterMonitorDataService.list(any(LambdaQueryWrapper.class))).thenReturn(Collections.emptyList());
-
-        CockpitOverviewMonitoringSnapshot snapshot = adapter.load();
-
-        assertEquals("2026-09-02T09:59:50+08:00", snapshot.getUpdatedAt());
-        assertEquals("ONLINE", snapshot.getDevices().get(0).getMonitoringState());
-        assertEquals("11", snapshot.getMonitoringPoints().get(0).getTypeCode());
-        assertEquals("CURRENT", snapshot.getMetricFreshness().getStatus());
-        assertEquals("2026-09-02T09:00:00+08:00", snapshot.getMetricFreshness().getUpdatedAt());
-    }
-
-    @Test
-    void deviceWithoutStatusStaysUnknownAndPointWithoutUniqueTypeIsNull() {
-        EquipmentBase device = device("E-1", GAS_CODE, 11);
-        when(equipmentBaseService.list()).thenReturn(Collections.singletonList(device));
-        when(equipmentStatusService.getByDeviceCode(GAS_CODE)).thenReturn(null);
-
-        MonitorPoint point = new MonitorPoint();
-        point.setPointId("P-1");
-        point.setPointCode("PO-1");
-        when(monitorPointService.list()).thenReturn(Collections.singletonList(point));
-        when(equipmentBaseService.getEquipmentByPoint("P-1")).thenReturn(Collections.emptyList());
-        when(pipeNetworkBaseService.list()).thenReturn(Collections.emptyList());
-        when(gasMonitorDataService.list(any(LambdaQueryWrapper.class))).thenReturn(Collections.emptyList());
-        when(waterMonitorDataService.list(any(LambdaQueryWrapper.class))).thenReturn(Collections.emptyList());
-
-        CockpitOverviewMonitoringSnapshot snapshot = adapter.load();
-
-        assertNull(snapshot.getDevices().get(0).getMonitoringState());
-        assertNull(snapshot.getMonitoringPoints().get(0).getTypeCode());
-        assertNull(snapshot.getMetricFreshness());
-    }
-
-    @Test
-    void countsAllInfrastructureFacilities() {
-        when(equipmentBaseService.list()).thenReturn(Collections.emptyList());
-        when(monitorPointService.list()).thenReturn(Collections.emptyList());
-        PipeNetworkBase facility = new PipeNetworkBase();
-        facility.setNetworkId("N-1");
-        facility.setNetworkCode("PIPE-001");
-        facility.setNetworkType("主管");
-        when(pipeNetworkBaseService.list()).thenReturn(Collections.singletonList(facility));
-        when(gasMonitorDataService.list(any(LambdaQueryWrapper.class))).thenReturn(Collections.emptyList());
-        when(waterMonitorDataService.list(any(LambdaQueryWrapper.class))).thenReturn(Collections.emptyList());
-
-        CockpitOverviewMonitoringSnapshot snapshot = adapter.load();
-
-        assertEquals(1, snapshot.getInfrastructureFacilityCount());
-        assertEquals("主管", snapshot.getMonitoringFacilities().get(0).getTypeCode());
-    }
-
-    private static EquipmentType type(int id, String name, int parentId) {
-        EquipmentType type = new EquipmentType();
-        type.setId(id);
-        type.setTypeName(name);
-        type.setParentId(parentId);
-        return type;
-    }
-
-    private static EquipmentBase device(String id, String code, int typeId) {
-        EquipmentBase device = new EquipmentBase();
-        device.setEquipmentId(id);
-        device.setEquipmentCode(code);
-        device.setEquipmentName(code);
-        device.setEquipmentTypeId(typeId);
-        return device;
-    }
-}

+ 0 - 240
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/BusinessCockpitOverviewWarningSettingsAdapterTest.java

@@ -1,240 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.zksy.base.alarm.domain.AlarmData;
-import com.zksy.base.alarm.service.AlarmDataService;
-import com.zksy.base.domain.EquipmentBase;
-import com.zksy.base.domain.EquipmentType;
-import com.zksy.base.service.EquipmentBaseService;
-import com.zksy.base.service.EquipmentTypeService;
-import com.zksy.base.warning.domain.AlarmWarningRel;
-import com.zksy.base.warning.domain.EarlyWarning;
-import com.zksy.base.warning.mapper.AlarmWarningRelMapper;
-import com.zksy.base.warning.service.EarlyWarningService;
-import com.zksy.cockpit.overview.BusinessCockpitOverviewWarningSettingsAdapter;
-import com.zksy.cockpit.overview.CockpitOverviewWarningSettingsSnapshot;
-import com.zksy.ops.domain.WorkOrder;
-import com.zksy.ops.service.WorkOrderService;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import java.sql.Timestamp;
-import java.time.LocalDateTime;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Collectors;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-class BusinessCockpitOverviewWarningSettingsAdapterTest {
-
-    private EarlyWarningService earlyWarningService;
-    private AlarmDataService alarmDataService;
-    private AlarmWarningRelMapper alarmWarningRelMapper;
-    private WorkOrderService workOrderService;
-    private EquipmentBaseService equipmentBaseService;
-    private EquipmentTypeService equipmentTypeService;
-    private BusinessCockpitOverviewWarningSettingsAdapter adapter;
-
-    @BeforeEach
-    void setUp() {
-        earlyWarningService = mock(EarlyWarningService.class);
-        alarmDataService = mock(AlarmDataService.class);
-        alarmWarningRelMapper = mock(AlarmWarningRelMapper.class);
-        workOrderService = mock(WorkOrderService.class);
-        equipmentBaseService = mock(EquipmentBaseService.class);
-        equipmentTypeService = mock(EquipmentTypeService.class);
-        adapter = new BusinessCockpitOverviewWarningSettingsAdapter(
-                earlyWarningService, alarmDataService, alarmWarningRelMapper, workOrderService,
-                equipmentBaseService, equipmentTypeService);
-        // 默认无设备/类型台账,各用例按需覆盖。
-        when(equipmentBaseService.list()).thenReturn(Collections.emptyList());
-        when(equipmentTypeService.list()).thenReturn(Collections.emptyList());
-    }
-
-    /**
-     * 预警不再桥接工单(维护者 2026-10-14 裁定):即便库里有工单,预警事件也不带工单事实,
-     * 只带自身生命周期;报警仍保留工单回联。
-     */
-    @Test
-    void warningCarriesItsOwnLifecycleAndNoWorkOrderWhileAlarmKeepsWorkOrderLink() {
-        EarlyWarning warning = new EarlyWarning();
-        warning.setWarningId("WARN-ID-001");
-        warning.setWarningNo("W-001");
-        warning.setDeviceCode("GAS-001");
-        warning.setStatus("CLOSED");
-        warning.setWarningLevel("2");
-        warning.setPublishTime(LocalDateTime.parse("2026-09-02T09:00:00"));
-        when(earlyWarningService.list()).thenReturn(Collections.singletonList(warning));
-
-        AlarmData alarm = new AlarmData();
-        alarm.setId("A-001");
-        alarm.setDeviceCode("GAS-001");
-        alarm.setWorkOrderId(1001L);
-        alarm.setAlarmStatus(1);
-        alarm.setAlarmLevel("3");
-        alarm.setCreateTime(LocalDateTime.parse("2026-09-02T10:00:00"));
-        when(alarmDataService.list()).thenReturn(Collections.singletonList(alarm));
-
-        AlarmWarningRel relation = new AlarmWarningRel();
-        relation.setRelId("R-1");
-        relation.setWarningId("WARN-ID-001");
-        relation.setAlarmId("A-001");
-        when(alarmWarningRelMapper.selectList(any(QueryWrapper.class)))
-                .thenReturn(Collections.singletonList(relation));
-
-        WorkOrder order = new WorkOrder();
-        order.setOrderId(1001L);
-        order.setOrderNo("WO-001");
-        order.setOrderStatus(5);
-        order.setCreateTime(Timestamp.valueOf("2026-09-02 10:10:00"));
-        when(workOrderService.list()).thenReturn(Collections.singletonList(order));
-
-        CockpitOverviewWarningSettingsSnapshot snapshot = adapter.load();
-
-        assertEquals(2, snapshot.getEvents().size());
-
-        CockpitOverviewWarningSettingsSnapshot.SourceEvent alarmEvent = event(snapshot, "ALARM");
-        assertEquals("A-001", alarmEvent.getEventCode());
-        assertEquals("WO-001", alarmEvent.getWorkOrderCode());
-        assertEquals(Integer.valueOf(5), alarmEvent.getWorkOrderState());
-        assertEquals("HANDLED", alarmEvent.getStatus());
-        assertEquals(Integer.valueOf(3), alarmEvent.getLevel());
-
-        CockpitOverviewWarningSettingsSnapshot.SourceEvent warningEvent = event(snapshot, "WARNING");
-        assertEquals("W-001", warningEvent.getEventCode());
-        assertEquals("CLOSED", warningEvent.getStatus());
-        assertEquals(Integer.valueOf(2), warningEvent.getLevel());
-        // 预警不走工单流程:工单事实一律为空,不因库里有工单就被挂上。
-        assertNull(warningEvent.getWorkOrderCode());
-        assertNull(warningEvent.getWorkOrderState());
-    }
-
-    /** 预警趋势的 handled 按预警自身「已解除」判定,不依赖工单是否结案。 */
-    @Test
-    void warningTrendHandledCountsClosedWarningsNotClosedWorkOrders() {
-        EarlyWarning closed = warning("W-1", "CLOSED", "2026-09-02T09:00:00");
-        EarlyWarning processing = warning("W-2", "PROCESSING", "2026-09-02T11:00:00");
-        when(earlyWarningService.list()).thenReturn(Arrays.asList(closed, processing));
-        when(alarmDataService.list()).thenReturn(Collections.emptyList());
-        when(alarmWarningRelMapper.selectList(any(QueryWrapper.class))).thenReturn(Collections.emptyList());
-        when(workOrderService.list()).thenReturn(Collections.emptyList());
-
-        CockpitOverviewWarningSettingsSnapshot snapshot = adapter.load();
-
-        CockpitOverviewWarningSettingsSnapshot.SourceTrendPoint trend =
-                snapshot.getTrendPoints().stream()
-                        .filter(point -> "WARNING".equals(point.getEventFamily()))
-                        .findFirst().orElseThrow(AssertionError::new);
-        assertEquals("2026-09-02", trend.getBucket());
-        assertEquals(2, trend.getTotal());
-        assertEquals(1, trend.getHandled());
-    }
-
-    /** 片区/行业沿设备解析带入快照;无设备时如实留空,不冒充。 */
-    @Test
-    void districtAndIndustryAreResolvedThroughTheDeviceAndStayNullWithoutOne() {
-        EquipmentType root = new EquipmentType();
-        root.setId(3);
-        root.setParentId(0);
-        root.setTypeName("燃气");
-        when(equipmentTypeService.list()).thenReturn(Collections.singletonList(root));
-
-        EquipmentBase device = new EquipmentBase();
-        device.setEquipmentId("DEV-ID-1");
-        device.setEquipmentCode("GAS-001");
-        device.setEquipmentTypeId(3);
-        device.setDistrict(1);
-        when(equipmentBaseService.list()).thenReturn(Collections.singletonList(device));
-
-        EarlyWarning known = warning("W-1", "PENDING", "2026-09-02T09:00:00");
-        known.setDeviceCode("GAS-001");
-        EarlyWarning unknownDevice = warning("W-2", "PENDING", "2026-09-02T09:00:00");
-        unknownDevice.setDeviceCode("NOPE-999");
-        when(earlyWarningService.list()).thenReturn(Arrays.asList(known, unknownDevice));
-        when(alarmDataService.list()).thenReturn(Collections.emptyList());
-        when(alarmWarningRelMapper.selectList(any(QueryWrapper.class))).thenReturn(Collections.emptyList());
-        when(workOrderService.list()).thenReturn(Collections.emptyList());
-
-        CockpitOverviewWarningSettingsSnapshot snapshot = adapter.load();
-
-        CockpitOverviewWarningSettingsSnapshot.SourceEvent resolved = event(snapshot, "WARNING", "W-1");
-        assertEquals(Integer.valueOf(1), resolved.getDistrictCode());
-        assertEquals("GAS", resolved.getIndustryCode());
-
-        CockpitOverviewWarningSettingsSnapshot.SourceEvent unresolved = event(snapshot, "WARNING", "W-2");
-        assertNull(unresolved.getDistrictCode());
-        assertNull(unresolved.getIndustryCode());
-    }
-
-    @Test
-    void alarmWithoutWorkOrderStaysUnlinkedAndUnhandled() {
-        when(earlyWarningService.list()).thenReturn(Collections.emptyList());
-        AlarmData alarm = new AlarmData();
-        alarm.setId("A-001");
-        alarm.setDeviceCode("GAS-001");
-        alarm.setCreateTime(LocalDateTime.parse("2026-09-02T10:00:00"));
-        when(alarmDataService.list()).thenReturn(Collections.singletonList(alarm));
-        when(alarmWarningRelMapper.selectList(any(QueryWrapper.class)))
-                .thenReturn(Collections.emptyList());
-        when(workOrderService.list()).thenReturn(Collections.emptyList());
-
-        CockpitOverviewWarningSettingsSnapshot snapshot = adapter.load();
-
-        CockpitOverviewWarningSettingsSnapshot.SourceEvent alarmEvent = snapshot.getEvents().get(0);
-        assertNull(alarmEvent.getWorkOrderCode());
-        assertNull(alarmEvent.getWorkOrderState());
-        // alarm_status 缺失 → 自身生命周期状态如实为 null(服务层进未知桶)。
-        assertNull(alarmEvent.getStatus());
-        CockpitOverviewWarningSettingsSnapshot.SourceTrendPoint alarmTrend = snapshot.getTrendPoints().get(0);
-        assertEquals(1, alarmTrend.getTotal());
-        assertEquals(0, alarmTrend.getHandled());
-    }
-
-    @Test
-    void emptySourcesStillProduceEmptySnapshotWithoutNpe() {
-        when(earlyWarningService.list()).thenReturn(Collections.emptyList());
-        when(alarmDataService.list()).thenReturn(Collections.emptyList());
-        when(alarmWarningRelMapper.selectList(any(QueryWrapper.class)))
-                .thenReturn(Collections.emptyList());
-        when(workOrderService.list()).thenReturn(Collections.emptyList());
-
-        CockpitOverviewWarningSettingsSnapshot snapshot = adapter.load();
-
-        assertEquals(0, snapshot.getEvents().size());
-        assertEquals(0, snapshot.getTrendPoints().size());
-        assertNull(snapshot.getUpdatedAt());
-    }
-
-    private static EarlyWarning warning(String no, String status, String publishTime) {
-        EarlyWarning warning = new EarlyWarning();
-        warning.setWarningId("ID-" + no);
-        warning.setWarningNo(no);
-        warning.setDeviceCode("GAS-001");
-        warning.setStatus(status);
-        warning.setPublishTime(LocalDateTime.parse(publishTime));
-        return warning;
-    }
-
-    private static CockpitOverviewWarningSettingsSnapshot.SourceEvent event(
-            CockpitOverviewWarningSettingsSnapshot snapshot, String family) {
-        return event(snapshot, family, null);
-    }
-
-    private static CockpitOverviewWarningSettingsSnapshot.SourceEvent event(
-            CockpitOverviewWarningSettingsSnapshot snapshot, String family, String eventCode) {
-        List<CockpitOverviewWarningSettingsSnapshot.SourceEvent> matches = snapshot.getEvents().stream()
-                .filter(item -> family.equals(item.getEventFamily()))
-                .filter(item -> eventCode == null || eventCode.equals(item.getEventCode()))
-                .collect(Collectors.toList());
-        if (matches.size() != 1) {
-            throw new AssertionError("expected exactly one " + family + " event, got " + matches.size());
-        }
-        return matches.get(0);
-    }
-}

+ 0 - 40
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/BusinessCockpitWorkOrderReadAdapterTest.java

@@ -84,46 +84,6 @@ class BusinessCockpitWorkOrderReadAdapterTest {
                 entityClass);
     }
 
-    /** 报警维度:按报警主键解析,命中后回该报警实际关联的工单(不得恒回 EMPTY)。 */
-    @Test
-    void alarmEventResolvesByAlarmIdAndReturnsItsLinkedOrders() {
-        AlarmData alarm = alarm(ALARM_ID, ALARM_NO, 279L);
-        when(alarmDataService.getById(ALARM_ID)).thenReturn(alarm);
-        when(alarmDataService.list(any(LambdaQueryWrapper.class)))
-                .thenReturn(Collections.singletonList(alarm));
-        when(workOrderService.list(any(LambdaQueryWrapper.class)))
-                .thenReturn(Collections.singletonList(order(279L, "WO-279", 5)));
-
-        CockpitWorkOrderReadSnapshot snapshot = adapter.loadByEvent("ALARM", ALARM_ID);
-
-        assertNotNull(snapshot, "按报警主键必须能解析到报警");
-        assertEquals(1, snapshot.getWorkOrders().size(), "该报警确有工单,不得回 EMPTY");
-        CockpitWorkOrderSummary summary = snapshot.getWorkOrders().get(0);
-        assertEquals("WO-279", summary.getWorkOrderCode());
-        assertTrue(summary.isAssociatedWithCurrentEvent(), "报警维度命中的工单即实际关联");
-        // 对外标识回该报警主键(真实 UUID),与请求标识一致
-        assertEquals(ALARM_ID, summary.getEventAssociation().getEventCode());
-        assertEquals(ALARM_ID, snapshot.getEventCode());
-    }
-
-    /** 主键查不到时回退按 alarm_no 定位,便于调用方用真实单号查询。 */
-    @Test
-    void alarmEventFallsBackToAlarmNoWhenIdMisses() {
-        AlarmData alarm = alarm(ALARM_ID, ALARM_NO, 279L);
-        when(alarmDataService.getById(ALARM_NO)).thenReturn(null);
-        when(alarmDataService.list(any(LambdaQueryWrapper.class)))
-                .thenReturn(Collections.singletonList(alarm));
-        when(workOrderService.list(any(LambdaQueryWrapper.class)))
-                .thenReturn(Collections.singletonList(order(279L, "WO-279", 5)));
-
-        CockpitWorkOrderReadSnapshot snapshot = adapter.loadByEvent("ALARM", ALARM_NO);
-
-        assertNotNull(snapshot);
-        assertEquals(1, snapshot.getWorkOrders().size());
-        // 回显仍用报警主键,而不是请求里那个单号
-        assertEquals(ALARM_ID, snapshot.getEventCode());
-    }
-
     /** 未关联报警的工单:显式 false 且不得伪造 eventAssociation。 */
     @Test
     void deviceScopeMarksUnassociatedOrdersExplicitlyWithoutFabricatingAssociation() {

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

@@ -90,12 +90,7 @@ class CockpitContractDictionaryTest {
                 CockpitEquipmentDetailAggregateController.class,
                 CockpitEquipmentArchiveController.class,
                 CockpitTypeMetricsController.class,
-                CockpitEventReadController.class,
                 CockpitWorkOrderReadController.class,
-                CockpitDeviceBoundaryController.class,
-                CockpitOverviewInfrastructureController.class,
-                CockpitOverviewMonitoringController.class,
-                CockpitOverviewWarningSettingsController.class,
                 CockpitInfrastructureBaseArchivesController.class,
                 CockpitInfrastructureOperatingInformationController.class,
                 CockpitInfrastructureManagementInformationController.class,

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

@@ -1,7 +1,5 @@
 package com.zksy.web.controller.cockpit;
 
-import com.zksy.cockpit.device.CockpitDeviceBoundaryAdapter;
-import com.zksy.cockpit.device.CockpitDeviceBoundaryService;
 import com.zksy.cockpit.detail.CockpitEquipmentDetailAggregateService;
 import com.zksy.cockpit.equipment.CockpitEquipmentArchiveAdapter;
 import com.zksy.cockpit.equipment.CockpitEquipmentArchiveService;
@@ -35,12 +33,6 @@ import com.zksy.cockpit.monitoring.CockpitMonitoringOverviewAdapter;
 import com.zksy.cockpit.monitoring.CockpitMonitoringOverviewService;
 import com.zksy.cockpit.monitoring.CockpitMonitoringSituationAdapter;
 import com.zksy.cockpit.monitoring.CockpitMonitoringSituationService;
-import com.zksy.cockpit.overview.CockpitOverviewInfrastructureAdapter;
-import com.zksy.cockpit.overview.CockpitOverviewInfrastructureService;
-import com.zksy.cockpit.overview.CockpitOverviewMonitoringAdapter;
-import com.zksy.cockpit.overview.CockpitOverviewMonitoringService;
-import com.zksy.cockpit.overview.CockpitOverviewWarningSettingsAdapter;
-import com.zksy.cockpit.overview.CockpitOverviewWarningSettingsService;
 import com.zksy.cockpit.point.CockpitMonitoringPointDetailAdapter;
 import com.zksy.cockpit.point.CockpitMonitoringPointDetailService;
 import com.zksy.cockpit.type.CockpitTypeMetricsAdapter;
@@ -91,13 +83,6 @@ class CockpitContractIntegrationTest {
         CockpitTypeMetricsAdapter metrics = mock(CockpitTypeMetricsAdapter.class);
         CockpitEventReadAdapter eventRead = mock(CockpitEventReadAdapter.class);
         CockpitWorkOrderReadAdapter workOrder = mock(CockpitWorkOrderReadAdapter.class);
-        CockpitDeviceBoundaryAdapter deviceBoundary = mock(CockpitDeviceBoundaryAdapter.class);
-        CockpitOverviewInfrastructureAdapter overviewInfrastructure =
-                mock(CockpitOverviewInfrastructureAdapter.class);
-        CockpitOverviewMonitoringAdapter overviewMonitoring =
-                mock(CockpitOverviewMonitoringAdapter.class);
-        CockpitOverviewWarningSettingsAdapter overviewWarningSettings =
-                mock(CockpitOverviewWarningSettingsAdapter.class);
         CockpitInfrastructureBaseArchivesAdapter baseArchives =
                 mock(CockpitInfrastructureBaseArchivesAdapter.class);
         CockpitInfrastructureOperatingInformationAdapter operatingInformation =
@@ -121,8 +106,7 @@ class CockpitContractIntegrationTest {
 
         adapters = Arrays.asList(
                 foundation, freshness, mapSnapshot, pointDetail, archive, metrics, eventRead,
-                workOrder, deviceBoundary, overviewInfrastructure, overviewMonitoring,
-                overviewWarningSettings, baseArchives, operatingInformation, managementInformation,
+                workOrder, baseArchives, operatingInformation, managementInformation,
                 emergencySupport, monitoringOverview, monitoringDistribution, monitoringSituation,
                 currentEvents, historyAnalysis, handlingEfficiency, multidimensional);
 
@@ -144,14 +128,6 @@ class CockpitContractIntegrationTest {
                 new CockpitMonitoringPointDetailController(
                         new CockpitMonitoringPointDetailService(pointDetail, clock)),
                 new CockpitEquipmentDetailAggregateController(detailAggregate),
-                new CockpitDeviceBoundaryController(
-                        new CockpitDeviceBoundaryService(deviceBoundary, clock)),
-                new CockpitOverviewInfrastructureController(
-                        new CockpitOverviewInfrastructureService(overviewInfrastructure, clock)),
-                new CockpitOverviewMonitoringController(
-                        new CockpitOverviewMonitoringService(overviewMonitoring, clock)),
-                new CockpitOverviewWarningSettingsController(
-                        new CockpitOverviewWarningSettingsService(overviewWarningSettings, clock)),
                 new CockpitInfrastructureBaseArchivesController(
                         new CockpitInfrastructureBaseArchivesService(baseArchives, clock)),
                 new CockpitInfrastructureOperatingInformationController(
@@ -184,10 +160,6 @@ class CockpitContractIntegrationTest {
         String[] endpoints = {
                 "/api/cockpit/v1/foundation",
                 "/api/cockpit/v1/map-snapshot",
-                "/api/cockpit/v1/device-boundary",
-                "/api/cockpit/v1/overview/infrastructure",
-                "/api/cockpit/v1/overview/monitoring",
-                "/api/cockpit/v1/overview/warning-settings",
                 "/api/cockpit/v1/infrastructure/base-archives",
                 "/api/cockpit/v1/infrastructure/operating-information",
                 "/api/cockpit/v1/infrastructure/management-information",

+ 0 - 232
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitDeviceBoundaryControllerTest.java

@@ -1,232 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.device.CockpitDeviceBoundaryAdapter;
-import com.zksy.cockpit.device.CockpitDeviceBoundaryService;
-import com.zksy.cockpit.device.CockpitDeviceBoundarySnapshot;
-import com.zksy.cockpit.device.CockpitDeviceBoundarySnapshot.SourceDevice;
-import com.zksy.cockpit.device.CockpitDeviceBoundarySnapshot.SourceFacility;
-import com.zksy.cockpit.device.CockpitDeviceBoundarySnapshot.SourceType;
-import com.zksy.cockpit.foundation.CockpitReadException;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.springframework.test.web.servlet.MockMvc;
-import org.springframework.test.web.servlet.MvcResult;
-import org.springframework.test.web.servlet.setup.MockMvcBuilders;
-
-import java.time.Clock;
-import java.time.Instant;
-import java.time.ZoneOffset;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import static org.hamcrest.Matchers.hasSize;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verifyNoInteractions;
-import static org.mockito.Mockito.when;
-import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
-import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
-
-class CockpitDeviceBoundaryControllerTest {
-
-    private CockpitDeviceBoundaryAdapter adapter;
-    private MockMvc mockMvc;
-
-    @BeforeEach
-    void setUp() {
-        adapter = mock(CockpitDeviceBoundaryAdapter.class);
-        CockpitDeviceBoundaryService service = new CockpitDeviceBoundaryService(
-                adapter,
-                Clock.fixed(Instant.parse("2026-09-02T02:00:00Z"), ZoneOffset.UTC));
-        CockpitDeviceBoundaryController controller = new CockpitDeviceBoundaryController(service);
-        mockMvc = MockMvcBuilders.standaloneSetup(controller).build();
-    }
-
-    @Test
-    void deviceBoundaryUsesCanonicalDeviceCodeAndSeparatesFacilitiesFromSmartDevices() throws Exception {
-        when(adapter.load()).thenReturn(fixture());
-
-        MvcResult result = mockMvc.perform(get("/api/cockpit/v1/device-boundary")
-                        .header("X-Request-Id", "device-boundary-request-001"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.code").value(200))
-                .andExpect(jsonPath("$.msg").value("操作成功"))
-                .andExpect(jsonPath("$.data.requestId").value("device-boundary-request-001"))
-                .andExpect(jsonPath("$.data.apiVersion").value("v1"))
-                .andExpect(jsonPath("$.data.readOnly").value(true))
-                .andExpect(jsonPath("$.data.typeScope.formalIndustries", hasSize(4)))
-                .andExpect(jsonPath("$.data.typeScope.drainageScopes", hasSize(2)))
-                .andExpect(jsonPath("$.data.typeScope.objectKinds", hasSize(2)))
-                .andExpect(jsonPath("$.data.facilities", hasSize(3)))
-                .andExpect(jsonPath("$.data.devices", hasSize(6)))
-                .andExpect(jsonPath("$.data.facilities[0].facilityCode").value("F-WATER-001"))
-                .andExpect(jsonPath("$.data.facilities[0].objectKind").value("FACILITY"))
-                .andExpect(jsonPath("$.data.facilities[0].industry").value("WATER_SUPPLY"))
-                .andExpect(jsonPath("$.data.facilities[1].facilityCode").value("F-PUMP-001"))
-                .andExpect(jsonPath("$.data.facilities[1].objectKind").value("FACILITY"))
-                .andExpect(jsonPath("$.data.facilities[2].facilityCode").value("F-PIPE-001"))
-                .andExpect(jsonPath("$.data.facilities[2].objectKind").value("FACILITY"))
-                .andExpect(jsonPath("$.data.devices[0].deviceCode").value("EQ-GAS-001"))
-                .andExpect(jsonPath("$.data.devices[0].deviceType.code").value("GAS_SENSOR"))
-                .andExpect(jsonPath("$.data.devices[0].industry").value("GAS"))
-                .andExpect(jsonPath("$.data.devices[0].objectKind").value("SMART_DEVICE"))
-                .andExpect(jsonPath("$.data.devices[0].formalScope").value(true))
-                .andExpect(jsonPath("$.data.devices[1].deviceCode").value("EQ-WS-001"))
-                .andExpect(jsonPath("$.data.devices[1].deviceType.code").value("WATER_SUPPLY_SENSOR"))
-                .andExpect(jsonPath("$.data.devices[1].industry").value("WATER_SUPPLY"))
-                .andExpect(jsonPath("$.data.devices[1].objectKind").value("SMART_DEVICE"))
-                .andExpect(jsonPath("$.data.devices[2].deviceCode").value("EQ-RAIN-001"))
-                .andExpect(jsonPath("$.data.devices[2].deviceType.code").value("RAINWATER_SENSOR"))
-                .andExpect(jsonPath("$.data.devices[2].industry").value("DRAINAGE"))
-                .andExpect(jsonPath("$.data.devices[2].drainageScope").value("RAINWATER"))
-                .andExpect(jsonPath("$.data.devices[2].objectKind").value("SMART_DEVICE"))
-                .andExpect(jsonPath("$.data.devices[3].deviceCode").value("EQ-SEW-001"))
-                .andExpect(jsonPath("$.data.devices[3].deviceType.code").value("SEWAGE_ENVIRONMENT_SENSOR"))
-                .andExpect(jsonPath("$.data.devices[3].industry").value("DRAINAGE"))
-                .andExpect(jsonPath("$.data.devices[3].drainageScope").value("SEWAGE"))
-                .andExpect(jsonPath("$.data.devices[3].objectKind").value("SMART_DEVICE"))
-                .andExpect(jsonPath("$.data.devices[4].deviceCode").value("EQ-MH-001"))
-                .andExpect(jsonPath("$.data.devices[4].deviceType.code").value("SMART_MANHOLE"))
-                .andExpect(jsonPath("$.data.devices[4].objectKind").value("SMART_DEVICE"))
-                .andExpect(jsonPath("$.data.devices[5].deviceCode").value("EQ-UNKNOWN-001"))
-                .andExpect(jsonPath("$.data.devices[5].typeResolution").value("UNKNOWN_TYPE"))
-                .andExpect(jsonPath("$.data.devices[5].formalScope").value(false))
-                .andExpect(jsonPath("$.data.statistics.facilityCount").value(3))
-                .andExpect(jsonPath("$.data.statistics.smartDeviceCount").value(6))
-                .andExpect(jsonPath("$.data.statistics.formalSmartDeviceCount").value(4))
-                .andExpect(jsonPath("$.data.statistics.unknownTypeCount").value(1))
-                .andExpect(jsonPath("$.data.statistics.typeKindMismatchCount").value(0))
-                .andExpect(jsonPath("$.data.statistics.industries.gas.smartDeviceCount").value(1))
-                .andExpect(jsonPath("$.data.statistics.industries.waterSupply.facilityCount").value(3))
-                .andExpect(jsonPath("$.data.statistics.industries.waterSupply.smartDeviceCount").value(1))
-                .andExpect(jsonPath("$.data.statistics.industries.drainage.smartDeviceCount").value(2))
-                .andExpect(jsonPath("$.data.statistics.industries.drainage.rainwaterSmartDeviceCount").value(1))
-                .andExpect(jsonPath("$.data.statistics.industries.drainage.sewageSmartDeviceCount").value(1))
-                .andExpect(jsonPath("$.data.statistics.industries.manhole.smartDeviceCount").value(0))
-                .andReturn();
-
-        String body = result.getResponse().getContentAsString();
-        assertFalse(body.contains("equipment_code"));
-        assertFalse(body.contains("equipmentId"));
-        assertFalse(body.contains("equipmentTypeId"));
-    }
-
-    @Test
-    void serverFailureReturnsTypedErrorInsteadOfPretendingToBeEmpty() throws Exception {
-        when(adapter.load()).thenThrow(new CockpitReadException("upstream unavailable"));
-
-        mockMvc.perform(get("/api/cockpit/v1/device-boundary")
-                        .header("X-Request-Id", "device-boundary-request-002"))
-                .andExpect(status().isInternalServerError())
-                .andExpect(jsonPath("$.code").value(500))
-                .andExpect(jsonPath("$.msg").value("驾驶舱设备边界数据暂不可用"))
-                .andExpect(jsonPath("$.data.category").value("SERVER_ERROR"))
-                .andExpect(jsonPath("$.data.message").value("驾驶舱设备边界数据暂不可用"))
-                .andExpect(jsonPath("$.data.requestId").value("device-boundary-request-002"))
-                .andExpect(jsonPath("$.data.serverTime").value("2026-09-02T10:00:00+08:00"));
-    }
-
-    @Test
-    void facilityFormalScopeRequiresFormalIndustryAndFacilityObjectKind() throws Exception {
-        when(adapter.load()).thenReturn(new CockpitDeviceBoundarySnapshot(
-                Arrays.asList(
-                        new SourceType("WATER_PLANT", "水厂", "WATER_SUPPLY", null, "FACILITY"),
-                        new SourceType("WATER_PLANT_DEVICE", "水厂设备", "WATER_SUPPLY", null, "SMART_DEVICE")),
-                Arrays.asList(
-                        new SourceFacility("F-WATER-001", "第一水厂", "WATER_PLANT"),
-                        new SourceFacility("F-UNKNOWN-001", "未知类型设施", "LEGACY_UNKNOWN_FACILITY_TYPE"),
-                        new SourceFacility("F-MISMATCH-001", "误挂设备类型的设施", "WATER_PLANT_DEVICE")),
-                Collections.emptyList()));
-
-        mockMvc.perform(get("/api/cockpit/v1/device-boundary"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.facilities[0].formalScope").value(true))
-                .andExpect(jsonPath("$.data.facilities[1].formalScope").value(false))
-                .andExpect(jsonPath("$.data.facilities[2].formalScope").value(false))
-                .andExpect(jsonPath("$.data.statistics.facilityCount").value(3))
-                .andExpect(jsonPath("$.data.statistics.industries.waterSupply.facilityCount").value(1))
-                .andExpect(jsonPath("$.data.statistics.unknownTypeCount").value(1))
-                .andExpect(jsonPath("$.data.statistics.typeKindMismatchCount").value(1));
-    }
-
-    @Test
-    void mismatchedDeviceTypeIsExcludedFromFormalIndustryStatistics() throws Exception {
-        when(adapter.load()).thenReturn(new CockpitDeviceBoundarySnapshot(
-                Arrays.asList(
-                        new SourceType("WATER_SUPPLY_SENSOR", "供水压力计", "WATER_SUPPLY", null, "SMART_DEVICE"),
-                        new SourceType("WATER_PLANT", "水厂", "WATER_SUPPLY", null, "FACILITY")),
-                Collections.emptyList(),
-                Arrays.asList(
-                        new SourceDevice("EQ-WS-001", "供水压力计-001", "WATER_SUPPLY_SENSOR"),
-                        new SourceDevice("EQ-MISMATCH-001", "误挂设施类型的设备-001", "WATER_PLANT"))));
-
-        mockMvc.perform(get("/api/cockpit/v1/device-boundary"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.devices[0].formalScope").value(true))
-                .andExpect(jsonPath("$.data.devices[1].formalScope").value(false))
-                .andExpect(jsonPath("$.data.devices[1].typeResolution").value("TYPE_KIND_MISMATCH"))
-                .andExpect(jsonPath("$.data.statistics.smartDeviceCount").value(2))
-                .andExpect(jsonPath("$.data.statistics.formalSmartDeviceCount").value(1))
-                .andExpect(jsonPath("$.data.statistics.industries.waterSupply.smartDeviceCount").value(1))
-                .andExpect(jsonPath("$.data.statistics.typeKindMismatchCount").value(1));
-    }
-
-    @Test
-    void mutatingRequestIsRejectedBeforeReadAdapterIsCalled() throws Exception {
-        mockMvc.perform(post("/api/cockpit/v1/device-boundary"))
-                .andExpect(status().isMethodNotAllowed());
-
-        verifyNoInteractions(adapter);
-    }
-
-    @Test
-    void controllerOnlyExposesAuthenticatedReadOnlyOperations() {
-        assertTrue(Arrays.stream(CockpitDeviceBoundaryController.class.getDeclaredMethods())
-                .filter(method -> method.isAnnotationPresent(org.springframework.web.bind.annotation.RequestMapping.class)
-                        || method.isAnnotationPresent(org.springframework.web.bind.annotation.GetMapping.class)
-                        || method.isAnnotationPresent(org.springframework.web.bind.annotation.PostMapping.class)
-                        || 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(CockpitDeviceBoundaryControllerTest::isReadOnlyMappedMethod));
-    }
-
-    private static boolean isReadOnlyMappedMethod(java.lang.reflect.Method method) {
-        return method.isAnnotationPresent(org.springframework.web.bind.annotation.GetMapping.class)
-                && !method.isAnnotationPresent(org.springframework.web.bind.annotation.PostMapping.class)
-                && !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);
-    }
-
-    private static CockpitDeviceBoundarySnapshot fixture() {
-        List<SourceType> types = Arrays.asList(
-                new SourceType("WATER_PLANT", "水厂", "WATER_SUPPLY", null, "FACILITY"),
-                new SourceType("PUMP_STATION", "泵站", "WATER_SUPPLY", null, "FACILITY"),
-                new SourceType("PIPELINE", "供水管线", "WATER_SUPPLY", null, "FACILITY"),
-                new SourceType("GAS_SENSOR", "燃气浓度计", "GAS", null, "SMART_DEVICE"),
-                new SourceType("WATER_SUPPLY_SENSOR", "供水压力计", "WATER_SUPPLY", null, "SMART_DEVICE"),
-                new SourceType("RAINWATER_SENSOR", "雨水流量计", "DRAINAGE", "RAINWATER", "SMART_DEVICE"),
-                new SourceType("SEWAGE_ENVIRONMENT_SENSOR", "污水环境监测仪", "DRAINAGE", "SEWAGE", "SMART_DEVICE"),
-                new SourceType("SMART_MANHOLE", "智能井盖", null, null, "SMART_DEVICE"));
-
-        List<SourceFacility> facilities = Arrays.asList(
-                new SourceFacility("F-WATER-001", "第一水厂", "WATER_PLANT"),
-                new SourceFacility("F-PUMP-001", "城北泵站", "PUMP_STATION"),
-                new SourceFacility("F-PIPE-001", "供水主线", "PIPELINE"));
-
-        List<SourceDevice> devices = Arrays.asList(
-                new SourceDevice("EQ-GAS-001", "燃气浓度计-001", "GAS_SENSOR"),
-                new SourceDevice("EQ-WS-001", "供水压力计-001", "WATER_SUPPLY_SENSOR"),
-                new SourceDevice("EQ-RAIN-001", "雨水流量计-001", "RAINWATER_SENSOR"),
-                new SourceDevice("EQ-SEW-001", "污水环境监测仪-001", "SEWAGE_ENVIRONMENT_SENSOR"),
-                new SourceDevice("EQ-MH-001", "智能井盖-001", "SMART_MANHOLE"),
-                new SourceDevice("EQ-UNKNOWN-001", "未知类型设备-001", "LEGACY_UNKNOWN_TYPE"));
-
-        return new CockpitDeviceBoundarySnapshot(types, facilities, devices);
-    }
-}

+ 0 - 127
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitDeviceBoundaryPipeIndustryTest.java

@@ -1,127 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.base.domain.EquipmentBase;
-import com.zksy.base.domain.EquipmentType;
-import com.zksy.base.domain.PipeNetworkBase;
-import com.zksy.base.service.EquipmentBaseService;
-import com.zksy.base.service.EquipmentTypeService;
-import com.zksy.base.service.PipeNetworkBaseService;
-import com.zksy.cockpit.device.BusinessCockpitDeviceBoundaryAdapter;
-import com.zksy.cockpit.device.CockpitDeviceBoundaryResponse;
-import com.zksy.cockpit.device.CockpitDeviceBoundaryService;
-import com.zksy.cockpit.device.CockpitFacilityBoundary;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import java.time.Clock;
-import java.time.Instant;
-import java.time.ZoneOffset;
-import java.util.Arrays;
-import java.util.Collections;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-/**
- * 设备边界「适配器 → 服务 → 响应」贯通契约(执行票 20 现象 2 的验收防线)。
- *
- * <p>回归背景:真实库里 {@code network_type=1} 是<b>排水</b>设施(3735 条),
- * 旧实现把它透传去查 {@code equipment_type} 字典,命中 id=1「供水设备」,于是响应里
- * 排水设施的类型名与行业都是「供水 / WATER_SUPPLY」。控制器测试用 mock 适配器,测不到
- * 这一段;本测试用真实适配器 + 真实服务,只 mock 数据源。</p>
- */
-class CockpitDeviceBoundaryPipeIndustryTest {
-
-    private CockpitDeviceBoundaryService service;
-
-    @BeforeEach
-    void setUp() {
-        EquipmentTypeService equipmentTypeService = mock(EquipmentTypeService.class);
-        EquipmentBaseService equipmentBaseService = mock(EquipmentBaseService.class);
-        PipeNetworkBaseService pipeNetworkBaseService = mock(PipeNetworkBaseService.class);
-        // 设备类型命名空间:id=1「供水设备」、id=2「排水设备」——与 network_type 数值域重叠。
-        when(equipmentTypeService.list()).thenReturn(Arrays.asList(
-                type(1, "供水设备", 0), type(2, "排水设备", 0)));
-        when(equipmentBaseService.list()).thenReturn(Collections.emptyList());
-        when(pipeNetworkBaseService.list()).thenReturn(Arrays.asList(
-                pipe("P-GAS", "燃气管线", "0"),
-                pipe("P-DRAIN", "排水管线", "1"),
-                pipe("P-WATER", "供水管线", "2")));
-
-        service = new CockpitDeviceBoundaryService(
-                new BusinessCockpitDeviceBoundaryAdapter(
-                        equipmentTypeService, equipmentBaseService, pipeNetworkBaseService),
-                Clock.fixed(Instant.parse("2026-10-10T02:00:00Z"), ZoneOffset.UTC));
-    }
-
-    @Test
-    void drainagePipeIsReportedAsDrainageNotWaterSupply() {
-        CockpitDeviceBoundaryResponse response = service.load("req-1");
-
-        CockpitFacilityBoundary drainage = facility(response, "P-DRAIN");
-        assertEquals("排水管线", drainage.getFacilityType().getName(),
-                "排水设施不得被标成「供水设备」");
-        assertEquals("DRAINAGE_PIPE", drainage.getFacilityType().getCode());
-        assertEquals("DRAINAGE", drainage.getIndustry());
-        assertTrue(drainage.isFormalScope());
-    }
-
-    @Test
-    void waterPipeIsReportedAsWaterSupplyNotDrainage() {
-        CockpitDeviceBoundaryResponse response = service.load("req-2");
-
-        CockpitFacilityBoundary water = facility(response, "P-WATER");
-        assertEquals("供水管线", water.getFacilityType().getName(),
-                "供水设施不得被标成「排水设备」");
-        assertEquals("WATER_SUPPLY", water.getIndustry());
-        assertTrue(water.isFormalScope());
-    }
-
-    @Test
-    void gasPipeIsReportedAsGasAndNoLongerCountedAsUnknownType() {
-        CockpitDeviceBoundaryResponse response = service.load("req-3");
-
-        CockpitFacilityBoundary gas = facility(response, "P-GAS");
-        assertEquals("燃气管线", gas.getFacilityType().getName());
-        assertEquals("GAS", gas.getIndustry());
-
-        // 旧实现下 network_type=0 查不到 equipment_type.id=0,会被计入 unknownTypeCount
-        assertEquals(0, response.getStatistics().getUnknownTypeCount(),
-                "0/1/2 三类管网都应解析成功,不该有未知类型");
-        assertEquals(3, response.getStatistics().getFacilityCount());
-    }
-
-    @Test
-    void pipeFacilitiesFlowIntoFormalIndustryStatistics() {
-        CockpitDeviceBoundaryResponse response = service.load("req-4");
-
-        assertEquals(1, response.getStatistics().getIndustries().get("gas").getFacilityCount());
-        assertEquals(1, response.getStatistics().getIndustries().get("drainage").getFacilityCount());
-        assertEquals(1, response.getStatistics().getIndustries().get("waterSupply").getFacilityCount());
-    }
-
-    private static CockpitFacilityBoundary facility(
-            CockpitDeviceBoundaryResponse response, String code) {
-        return response.getFacilities().stream()
-                .filter(item -> code.equals(item.getFacilityCode()))
-                .findFirst().orElseThrow(AssertionError::new);
-    }
-
-    private static EquipmentType type(Integer id, String name, Integer parentId) {
-        EquipmentType type = new EquipmentType();
-        type.setId(id);
-        type.setTypeName(name);
-        type.setParentId(parentId);
-        return type;
-    }
-
-    private static PipeNetworkBase pipe(String code, String name, String networkType) {
-        PipeNetworkBase facility = new PipeNetworkBase();
-        facility.setNetworkCode(code);
-        facility.setNetworkName(name);
-        facility.setNetworkType(networkType);
-        return facility;
-    }
-}

+ 0 - 264
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitEventReadControllerTest.java

@@ -1,264 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.event.CockpitAlarmWarningRelation;
-import com.zksy.cockpit.event.CockpitEventAlarm;
-import com.zksy.cockpit.event.CockpitEventReadAdapter;
-import com.zksy.cockpit.event.CockpitEventReadService;
-import com.zksy.cockpit.event.CockpitEventSnapshot;
-import com.zksy.cockpit.event.CockpitEventWarning;
-import com.zksy.cockpit.event.CockpitEventLevelColor;
-import com.zksy.cockpit.foundation.CockpitDeviceNotFoundException;
-import com.zksy.cockpit.foundation.CockpitReadException;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.springframework.test.web.servlet.MockMvc;
-import org.springframework.test.web.servlet.setup.MockMvcBuilders;
-
-import java.lang.reflect.Method;
-import java.math.BigDecimal;
-import java.time.Clock;
-import java.time.Instant;
-import java.time.ZoneOffset;
-import java.util.Arrays;
-import java.util.Collections;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verifyNoInteractions;
-import static org.mockito.Mockito.when;
-import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
-import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
-
-class CockpitEventReadControllerTest {
-    private static final String DEVICE_CODE = "TC-PS-WS-202609020012";
-
-    private CockpitEventReadAdapter adapter;
-    private MockMvc mockMvc;
-
-    @BeforeEach
-    void setUp() {
-        adapter = mock(CockpitEventReadAdapter.class);
-        CockpitEventReadService service = new CockpitEventReadService(
-                adapter,
-                Clock.fixed(Instant.parse("2026-09-02T02:00:00Z"), ZoneOffset.UTC));
-        mockMvc = MockMvcBuilders
-                .standaloneSetup(new CockpitEventReadController(service))
-                .build();
-    }
-
-    @Test
-    void currentEventsReturnSeparateFamiliesAndAuthoritativeRelations() throws Exception {
-        when(adapter.loadCurrent(DEVICE_CODE)).thenReturn(currentFixture());
-
-        mockMvc.perform(get("/api/cockpit/v1/equipments/" + DEVICE_CODE + "/events/current")
-                        .header("X-Request-Id", "event-current-001"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.code").value(200))
-                .andExpect(jsonPath("$.data.requestId").value("event-current-001"))
-                .andExpect(jsonPath("$.data.apiVersion").value("v1"))
-                .andExpect(jsonPath("$.data.readOnly").value(true))
-                .andExpect(jsonPath("$.data.deviceCode").value(DEVICE_CODE))
-                .andExpect(jsonPath("$.data.state").value("READY"))
-                .andExpect(jsonPath("$.data.warnings", org.hamcrest.Matchers.hasSize(2)))
-                .andExpect(jsonPath("$.data.warnings[0].warningNo").value("WRN-20260902-001"))
-                .andExpect(jsonPath("$.data.warnings[0].level").value(1))
-                .andExpect(jsonPath("$.data.warnings[0].levelColor").value("RED"))
-                .andExpect(jsonPath("$.data.warnings[0].levelName").value("一级预警"))
-                .andExpect(jsonPath("$.data.warnings[0].content")
-                        .value("化学需氧量(COD)预警接近上限\n实际值:14.6 mg/L;阈值:上限 20 mg/L"))
-                .andExpect(jsonPath("$.data.warnings[1].content").value(org.hamcrest.Matchers.nullValue()))
-                .andExpect(jsonPath("$.data.warnings[0].status").value("PROCESSING"))
-                .andExpect(jsonPath("$.data.warnings[0].deviceCode").value(DEVICE_CODE))
-                .andExpect(jsonPath("$.data.warnings[1].level").value(2))
-                .andExpect(jsonPath("$.data.warnings[1].levelColor").value("YELLOW"))
-                .andExpect(jsonPath("$.data.alarms", org.hamcrest.Matchers.hasSize(1)))
-                .andExpect(jsonPath("$.data.alarms[0].alarmId").value("ALM-20260902-001"))
-                .andExpect(jsonPath("$.data.alarms[0].alarmNo").value("BJ202609291243545660"))
-                .andExpect(jsonPath("$.data.alarms[0].level").value(3))
-                .andExpect(jsonPath("$.data.alarms[0].levelColor").value("BLUE"))
-                .andExpect(jsonPath("$.data.alarms[0].levelName").value("三级报警"))
-                .andExpect(jsonPath("$.data.alarms[0].content").value("化学需氧量(COD)报警超过上限"))
-                .andExpect(jsonPath("$.data.alarms[0].status").value("UNHANDLED"))
-                .andExpect(jsonPath("$.data.alarms[0].deviceCode").value(DEVICE_CODE))
-                .andExpect(jsonPath("$.data.alarmWarningRelations", org.hamcrest.Matchers.hasSize(1)))
-                .andExpect(jsonPath("$.data.alarmWarningRelations[0].warningNo").value("WRN-20260902-001"))
-                .andExpect(jsonPath("$.data.alarmWarningRelations[0].alarmId").value("ALM-20260902-001"));
-    }
-
-    @Test
-    void eventLevelColorDictionaryCoversOneRedToFourGreen() throws Exception {
-        when(adapter.loadCurrent(DEVICE_CODE)).thenReturn(levelFixture());
-
-        mockMvc.perform(get("/api/cockpit/v1/equipments/" + DEVICE_CODE + "/events/current"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.warnings[0].levelColor").value("RED"))
-                .andExpect(jsonPath("$.data.warnings[1].levelColor").value("YELLOW"))
-                .andExpect(jsonPath("$.data.warnings[2].levelColor").value("BLUE"))
-                .andExpect(jsonPath("$.data.warnings[3].levelColor").value("GREEN"));
-    }
-
-    @Test
-    void historyEventsReturnPagedContractAndPreserveFamilies() throws Exception {
-        when(adapter.loadHistory(
-                DEVICE_CODE,
-                java.time.OffsetDateTime.parse("2026-09-01T10:00:00+08:00"),
-                java.time.OffsetDateTime.parse("2026-09-02T10:00:00+08:00"),
-                1,
-                100)).thenReturn(historyFixture());
-
-        mockMvc.perform(get("/api/cockpit/v1/equipments/" + DEVICE_CODE + "/events/history")
-                        .param("startTime", "2026-09-01T10:00:00+08:00")
-                        .param("endTime", "2026-09-02T10:00:00+08:00")
-                        .param("page", "1")
-                        .param("pageSize", "100")
-                        .header("X-Request-Id", "event-history-001"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.requestId").value("event-history-001"))
-                .andExpect(jsonPath("$.data.startTime").value("2026-09-01T10:00:00+08:00"))
-                .andExpect(jsonPath("$.data.endTime").value("2026-09-02T10:00:00+08:00"))
-                .andExpect(jsonPath("$.data.timezone").value("Asia/Shanghai"))
-                .andExpect(jsonPath("$.data.page").value(1))
-                .andExpect(jsonPath("$.data.pageSize").value(100))
-                .andExpect(jsonPath("$.data.total").value(3))
-                .andExpect(jsonPath("$.data.alarms[0].alarmNo").value(org.hamcrest.Matchers.nullValue()))
-                .andExpect(jsonPath("$.data.warnings", org.hamcrest.Matchers.hasSize(2)))
-                .andExpect(jsonPath("$.data.alarms", org.hamcrest.Matchers.hasSize(1)))
-                .andExpect(jsonPath("$.data.alarmWarningRelations", org.hamcrest.Matchers.hasSize(1)));
-    }
-
-    @Test
-    void historyRejectsInvertedRangeAndInvalidPage() throws Exception {
-        mockMvc.perform(get("/api/cockpit/v1/equipments/" + DEVICE_CODE + "/events/history")
-                        .param("startTime", "2026-09-02T10:00:00+08:00")
-                        .param("endTime", "2026-09-01T10:00:00+08:00"))
-                .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"));
-
-        mockMvc.perform(get("/api/cockpit/v1/equipments/" + DEVICE_CODE + "/events/history")
-                        .param("startTime", "2026-09-01T10:00:00+08:00")
-                        .param("endTime", "2026-09-02T10:00:00+08:00")
-                        .param("page", "0"))
-                .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"));
-    }
-
-    @Test
-    void currentEventsReturnSuccessfulEmptyState() throws Exception {
-        when(adapter.loadCurrent(DEVICE_CODE)).thenReturn(emptyFixture());
-
-        mockMvc.perform(get("/api/cockpit/v1/equipments/" + DEVICE_CODE + "/events/current"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.state").value("EMPTY"))
-                .andExpect(jsonPath("$.data.stateReason").value("NO_EVENTS"))
-                .andExpect(jsonPath("$.data.warnings", org.hamcrest.Matchers.hasSize(0)))
-                .andExpect(jsonPath("$.data.alarms", org.hamcrest.Matchers.hasSize(0)))
-                .andExpect(jsonPath("$.data.alarmWarningRelations", org.hamcrest.Matchers.hasSize(0)));
-    }
-
-    @Test
-    void missingDeviceAndAdapterFailureUseTypedReadOnlyErrors() throws Exception {
-        when(adapter.loadCurrent("MISSING")).thenThrow(new CockpitDeviceNotFoundException("device not found"));
-        when(adapter.loadCurrent("BROKEN")).thenThrow(new CockpitReadException("read failed"));
-
-        mockMvc.perform(get("/api/cockpit/v1/equipments/MISSING/events/current"))
-                .andExpect(status().isNotFound())
-                .andExpect(jsonPath("$.data.category").value("NOT_FOUND"));
-        mockMvc.perform(get("/api/cockpit/v1/equipments/BROKEN/events/current"))
-                .andExpect(status().isInternalServerError())
-                .andExpect(jsonPath("$.data.category").value("SERVER_ERROR"));
-    }
-
-    @Test
-    void controllerExposesReadOnlyMappedMethodsOnly() throws Exception {
-        Method[] methods = CockpitEventReadController.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)
-                        && !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));
-            }
-        }
-
-        mockMvc.perform(post("/api/cockpit/v1/equipments/" + DEVICE_CODE + "/events/current"))
-                .andExpect(status().isMethodNotAllowed());
-        verifyNoInteractions(adapter);
-    }
-
-    private void assertTrue(boolean condition) {
-        org.junit.jupiter.api.Assertions.assertTrue(condition);
-    }
-
-    private CockpitEventSnapshot currentFixture() {
-        return new CockpitEventSnapshot(
-                DEVICE_CODE,
-                "ws_sewage_environment",
-                "污水环境监测设备",
-                Arrays.asList(
-                        new CockpitEventWarning(
-                                "WRN-20260902-001", "污水COD预警", "WS_ENV", 1, "RED", "一级预警",
-                                "化学需氧量(COD)预警接近上限\n实际值:14.6 mg/L;阈值:上限 20 mg/L",
-                                "PROCESSING", "2026-09-02T09:59:30+08:00",
-                                new BigDecimal("18.2"), "mg/L", DEVICE_CODE, "污水环境监测设备", "太常片区"),
-                        new CockpitEventWarning(
-                                "WRN-20260902-002", "污水pH预警", "WS_ENV", 2, "YELLOW", "二级预警",
-                                null,
-                                "PENDING", "2026-09-02T09:58:30+08:00",
-                                new BigDecimal("8.1"), "", DEVICE_CODE, "污水环境监测设备", "太常片区")),
-                Collections.singletonList(new CockpitEventAlarm(
-                        "ALM-20260902-001", "BJ202609291243545660", "WS_ENV_HIGH", "污水COD报警", "WS_ENV",
-                        3, "BLUE", "三级报警",
-                        "化学需氧量(COD)报警超过上限", "UNHANDLED", "2026-09-02T10:00:00+08:00",
-                        new BigDecimal("42.0"), new BigDecimal("40.0"), new BigDecimal("50.0"), "mg/L",
-                        DEVICE_CODE, "污水环境监测设备", "太常片区")),
-                Collections.singletonList(new CockpitAlarmWarningRelation(
-                        "REL-20260902-001", "WRN-20260902-001", "ALM-20260902-001",
-                        "2026-09-02T10:00:00+08:00")),
-                null);
-    }
-
-    private CockpitEventSnapshot levelFixture() {
-        return new CockpitEventSnapshot(
-                DEVICE_CODE,
-                "ws_sewage_environment",
-                "污水环境监测设备",
-                Arrays.asList(
-                        warning("WRN-1", 1), warning("WRN-2", 2),
-                        warning("WRN-3", 3), warning("WRN-4", 4)),
-                Collections.emptyList(),
-                Collections.emptyList(),
-                null);
-    }
-
-    private CockpitEventSnapshot historyFixture() {
-        return new CockpitEventSnapshot(
-                DEVICE_CODE,
-                "ws_sewage_environment",
-                "污水环境监测设备",
-                Arrays.asList(warning("WRN-20260901-001", 2), warning("WRN-20260901-002", 4)),
-                Collections.singletonList(new CockpitEventAlarm(
-                        "ALM-20260901-001", null, "WS_ENV_HIGH", "污水COD报警", "WS_ENV",
-                        1, "RED", "一级报警",
-                        null, "HANDLED", "2026-09-01T15:30:00+08:00",
-                        new BigDecimal("45.0"), new BigDecimal("40.0"), new BigDecimal("50.0"), "mg/L",
-                        DEVICE_CODE, "污水环境监测设备", "太常片区")),
-                Collections.singletonList(new CockpitAlarmWarningRelation(
-                        "REL-20260901-001", "WRN-20260901-001", "ALM-20260901-001",
-                        "2026-09-01T15:30:00+08:00")),
-                3);
-    }
-
-    private CockpitEventSnapshot emptyFixture() {
-        return new CockpitEventSnapshot(
-                DEVICE_CODE, "gas_pressure", "燃气压力计",
-                Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), null);
-    }
-
-    private CockpitEventWarning warning(String warningNo, Integer level) {
-        return new CockpitEventWarning(
-                warningNo, "等级映射预警", "WS_ENV", level, CockpitEventLevelColor.resolve(level),
-                level == null ? null : level + "级预警", null, "PENDING",
-                "2026-09-02T09:59:30+08:00", null, "", DEVICE_CODE, "污水环境监测设备", "太常片区");
-    }
-}

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

@@ -13,7 +13,6 @@ import com.zksy.base.domain.ManholeBase;
 import com.zksy.base.domain.PipeNetworkBase;
 import com.zksy.base.service.*;
 import com.zksy.cockpit.infrastructure.*;
-import com.zksy.cockpit.overview.*;
 import com.zksy.drainage.domain.DrainageGateInfo;
 import com.zksy.drainage.domain.DrainageStorageInfo;
 import com.zksy.drainage.service.DrainageGateInfoService;
@@ -94,12 +93,10 @@ class CockpitFacilityCountCrossEndpointContractTest {
         EquipmentTypeService types = mock(EquipmentTypeService.class);
         JsonNode archives = JSON.valueToTree(new CockpitInfrastructureBaseArchivesService(catalog::load, CLOCK)
                 .load("archives", null, null, null, null));
-        JsonNode overview = JSON.valueToTree(new CockpitOverviewInfrastructureService(
-                new BusinessCockpitOverviewInfrastructureAdapter(types, devices, catalog), CLOCK).load("overview"));
         CockpitInfrastructureManagementInformationService managementService = new CockpitInfrastructureManagementInformationService(
                 new BusinessCockpitInfrastructureManagementInformationAdapter(devices, types, catalog), CLOCK);
         JsonNode management = JSON.valueToTree(managementService.load("management", null, null));
-        for (JsonNode response : Arrays.asList(archives, overview, management)) {
+        for (JsonNode response : Arrays.asList(archives, management)) {
             assertEquals(total, response.path("totals").path("facilityCount").asInt());
         }
         Map<String, Integer> expected = new HashMap<>();
@@ -108,12 +105,10 @@ class CockpitFacilityCountCrossEndpointContractTest {
         expected.put("DRAINAGE", total == 0 ? 0 : 6);
         expected.put("MANHOLE", total == 0 ? 0 : 1);
         assertEquals(expected, industryCounts(archives, "industryDistribution", "code", "count"));
-        assertEquals(expected, industryCounts(overview, "industries", "code", "facilityCount"));
         assertEquals(expected, industryCounts(management, "districtIndustry", "industry", "facilityCount"));
         assertEquals(total, sum(archives, "districtDistribution", "count"), "未来日期不能让片区分布漏设施");
         assertEquals(total, sum(management, "districtIndustry", "facilityCount"));
         assertEquals(excluded, archives.path("excluded").path("unknownTypeCount").asInt());
-        assertEquals(excluded, overview.path("excluded").path("unknownTypeCount").asInt());
         assertEquals(excluded, management.path("excluded").path("unknownIndustryCount").asInt());
         for (String industry : expected.keySet()) {
             JsonNode filtered = JSON.valueToTree(managementService.load("filtered", industry, "UNASSIGNED"));

+ 0 - 303
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitOverviewInfrastructureControllerTest.java

@@ -1,303 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.foundation.CockpitReadException;
-import com.zksy.cockpit.overview.CockpitOverviewInfrastructureAdapter;
-import com.zksy.cockpit.overview.CockpitOverviewInfrastructureService;
-import com.zksy.cockpit.overview.CockpitOverviewInfrastructureSnapshot;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.springframework.test.web.servlet.MockMvc;
-import org.springframework.test.web.servlet.MvcResult;
-import org.springframework.test.web.servlet.setup.MockMvcBuilders;
-
-import java.lang.reflect.Method;
-import java.math.BigDecimal;
-import java.time.Clock;
-import java.time.Instant;
-import java.time.ZoneOffset;
-import java.util.Arrays;
-import java.util.Collections;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verifyNoInteractions;
-import static org.mockito.Mockito.when;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.hamcrest.Matchers.hasSize;
-import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
-import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
-
-class CockpitOverviewInfrastructureControllerTest {
-
-    private CockpitOverviewInfrastructureAdapter adapter;
-    private MockMvc mockMvc;
-
-    @BeforeEach
-    void setUp() {
-        adapter = mock(CockpitOverviewInfrastructureAdapter.class);
-        CockpitOverviewInfrastructureService service = new CockpitOverviewInfrastructureService(
-                adapter,
-                Clock.fixed(Instant.parse("2026-09-02T02:00:00Z"), ZoneOffset.UTC));
-        mockMvc = MockMvcBuilders
-                .standaloneSetup(new com.zksy.web.controller.cockpit.CockpitOverviewInfrastructureController(service))
-                .build();
-    }
-
-    @Test
-    void formalScopesExcludeUnknownAndMismatchedTypes() throws Exception {
-        when(adapter.load()).thenReturn(scopeFixture());
-
-        mockMvc.perform(get("/api/cockpit/v1/overview/infrastructure"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.totals.facilityCount").value(3))
-                .andExpect(jsonPath("$.data.totals.smartDeviceCount").value(12))
-                .andExpect(jsonPath("$.data.industries", hasSize(4)))
-                .andExpect(jsonPath("$.data.industries[0].code").value("GAS"))
-                .andExpect(jsonPath("$.data.industries[0].facilityCount").value(0))
-                .andExpect(jsonPath("$.data.industries[0].smartDeviceCount").value(3))
-                .andExpect(jsonPath("$.data.industries[1].code").value("WATER_SUPPLY"))
-                .andExpect(jsonPath("$.data.industries[1].facilityCount").value(3))
-                .andExpect(jsonPath("$.data.industries[1].smartDeviceCount").value(0))
-                .andExpect(jsonPath("$.data.industries[2].code").value("DRAINAGE"))
-                .andExpect(jsonPath("$.data.industries[2].smartDeviceCount").value(9))
-                .andExpect(jsonPath("$.data.industries[2].deviceTypes", hasSize(2)))
-                .andExpect(jsonPath("$.data.industries[2].deviceTypes[0].code").value("RAINWATER_SENSOR"))
-                .andExpect(jsonPath("$.data.industries[2].deviceTypes[0].count").value(4))
-                .andExpect(jsonPath("$.data.industries[2].deviceTypes[1].code").value("SEWAGE_ENVIRONMENT_SENSOR"))
-                .andExpect(jsonPath("$.data.industries[2].deviceTypes[1].count").value(5))
-                .andExpect(jsonPath("$.data.excluded.unknownTypeCount").value(10))
-                .andExpect(jsonPath("$.data.excluded.typeKindMismatchCount").value(5));
-    }
-
-    @Test
-    void overviewSeparatesFacilitiesFromSmartDevices() throws Exception {
-        when(adapter.load()).thenReturn(fixture());
-
-        mockMvc.perform(get("/api/cockpit/v1/overview/infrastructure")
-                        .header("X-Request-Id", "overview-infrastructure-001"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.code").value(200))
-                .andExpect(jsonPath("$.msg").value("操作成功"))
-                .andExpect(jsonPath("$.data.requestId").value("overview-infrastructure-001"))
-                .andExpect(jsonPath("$.data.apiVersion").value("v1"))
-                .andExpect(jsonPath("$.data.readOnly").value(true))
-                .andExpect(jsonPath("$.data.totals.facilityCount").value(1))
-                .andExpect(jsonPath("$.data.totals.smartDeviceCount").value(1))
-                .andExpect(jsonPath("$.data.industries", org.hamcrest.Matchers.hasSize(4)))
-                .andExpect(jsonPath("$.data.industries[0].code").value("GAS"))
-                .andExpect(jsonPath("$.data.industries[1].code").value("WATER_SUPPLY"))
-                .andExpect(jsonPath("$.data.industries[1].facilityCount").value(1))
-                .andExpect(jsonPath("$.data.industries[1].smartDeviceCount").value(1))
-                .andExpect(jsonPath("$.data.industries[1].facilityTypes", org.hamcrest.Matchers.hasSize(1)))
-                .andExpect(jsonPath("$.data.industries[1].facilityTypes[0].code").value("WATER_PLANT"))
-                .andExpect(jsonPath("$.data.industries[1].deviceTypes", org.hamcrest.Matchers.hasSize(1)))
-                .andExpect(jsonPath("$.data.industries[1].deviceTypes[0].code").value("WATER_SUPPLY_SENSOR"));
-    }
-
-    @Test
-    void infrastructureExposesScaleRangeTimezoneAndFreshness() throws Exception {
-        when(adapter.load()).thenReturn(metadataFixture());
-
-        MvcResult result = mockMvc.perform(get("/api/cockpit/v1/overview/infrastructure")
-                        .header("X-Request-Id", "overview-infrastructure-002"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.timezone").value("Asia/Shanghai"))
-                .andExpect(jsonPath("$.data.range.type").value("CURRENT_BASELINE"))
-                .andExpect(jsonPath("$.data.updatedAt").value("2026-09-02T09:59:50+08:00"))
-                .andExpect(jsonPath("$.data.freshness.status").value("CURRENT"))
-                .andExpect(jsonPath("$.data.freshness.updatedAt").value("2026-09-02T09:59:50+08:00"))
-                .andExpect(jsonPath("$.data.freshness.serverUpdatedAt").value("2026-09-02T10:00:00+08:00"))
-                .andExpect(jsonPath("$.data.industries[1].facilityTypes", hasSize(2)))
-                .andExpect(jsonPath("$.data.industries[1].facilityTypes[0].code").value("PIPELINE"))
-                .andExpect(jsonPath("$.data.industries[1].facilityTypes[0].lengthKm").value(12.5))
-                .andExpect(jsonPath("$.data.industries[1].facilityTypes[0].range.type").value("DIAMETER_MM"))
-                .andExpect(jsonPath("$.data.industries[1].facilityTypes[0].range.start").value("100"))
-                .andExpect(jsonPath("$.data.industries[1].facilityTypes[0].range.end").value("800"))
-                .andExpect(jsonPath("$.data.industries[1].facilityTypes[1].code").value("PUMP_STATION"))
-                .andExpect(jsonPath("$.data.industries[1].facilityTypes[1].scale").value("medium"))
-                .andExpect(jsonPath("$.data.industries[1].deviceTypes[0].scale").value("pressure-meters"))
-                .andReturn();
-
-        String body = result.getResponse().getContentAsString();
-        assertFalse(body.contains("equipment_code"));
-        assertFalse(body.contains("facility_count"));
-        assertFalse(body.contains("smart_device_count"));
-    }
-
-    @Test
-    void emptySourceReturnsExplicitZeroState() throws Exception {
-        when(adapter.load()).thenReturn(new CockpitOverviewInfrastructureSnapshot(
-                "2026-09-02T09:59:50+08:00",
-                Collections.emptyList(),
-                Collections.emptyList()));
-
-        mockMvc.perform(get("/api/cockpit/v1/overview/infrastructure"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.totals.facilityCount").value(0))
-                .andExpect(jsonPath("$.data.totals.smartDeviceCount").value(0))
-                .andExpect(jsonPath("$.data.industries", hasSize(4)))
-                .andExpect(jsonPath("$.data.industries[0].facilityTypes", hasSize(0)))
-                .andExpect(jsonPath("$.data.industries[0].deviceTypes", hasSize(0)))
-                .andExpect(jsonPath("$.data.industries[1].facilityTypes", hasSize(0)))
-                .andExpect(jsonPath("$.data.industries[1].deviceTypes", hasSize(0)))
-                .andExpect(jsonPath("$.data.industries[2].facilityTypes", hasSize(0)))
-                .andExpect(jsonPath("$.data.industries[2].deviceTypes", hasSize(0)))
-                .andExpect(jsonPath("$.data.industries[3].code").value("MANHOLE"))
-                .andExpect(jsonPath("$.data.industries[3].facilityTypes", hasSize(0)))
-                .andExpect(jsonPath("$.data.industries[3].deviceTypes", hasSize(0)))
-                .andExpect(jsonPath("$.data.excluded.unknownTypeCount").value(0))
-                .andExpect(jsonPath("$.data.excluded.typeKindMismatchCount").value(0));
-    }
-
-    @Test
-    void sameTypeCodeAcrossObjectKindsIsResolvedIndependently() throws Exception {
-        when(adapter.load()).thenReturn(new CockpitOverviewInfrastructureSnapshot(
-                "2026-09-02T09:59:50+08:00",
-                Arrays.asList(
-                        new CockpitOverviewInfrastructureSnapshot.SourceType(
-                                "1", "设备一", "GAS", null, "SMART_DEVICE"),
-                        new CockpitOverviewInfrastructureSnapshot.SourceType(
-                                "1", "设施一", "WATER_SUPPLY", null, "FACILITY")),
-                Arrays.asList(
-                        new CockpitOverviewInfrastructureSnapshot.SourceCount("SMART_DEVICE", "1", 2),
-                        new CockpitOverviewInfrastructureSnapshot.SourceCount("FACILITY", "1", 3))));
-
-        mockMvc.perform(get("/api/cockpit/v1/overview/infrastructure"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.totals.facilityCount").value(3))
-                .andExpect(jsonPath("$.data.totals.smartDeviceCount").value(2))
-                .andExpect(jsonPath("$.data.industries[0].facilityCount").value(0))
-                .andExpect(jsonPath("$.data.industries[0].smartDeviceCount").value(2))
-                .andExpect(jsonPath("$.data.industries[1].facilityCount").value(3))
-                .andExpect(jsonPath("$.data.industries[1].smartDeviceCount").value(0))
-                .andExpect(jsonPath("$.data.excluded.unknownTypeCount").value(0))
-                .andExpect(jsonPath("$.data.excluded.typeKindMismatchCount").value(0));
-    }
-
-    @Test
-    void serverFailureReturnsTypedErrorInsteadOfPretendingToBeEmpty() throws Exception {
-        when(adapter.load()).thenThrow(new CockpitReadException("upstream unavailable"));
-
-        mockMvc.perform(get("/api/cockpit/v1/overview/infrastructure")
-                        .header("X-Request-Id", "overview-infrastructure-500"))
-                .andExpect(status().isInternalServerError())
-                .andExpect(jsonPath("$.code").value(500))
-                .andExpect(jsonPath("$.msg").value("驾驶舱基础设施概览数据暂不可用"))
-                .andExpect(jsonPath("$.data.category").value("SERVER_ERROR"))
-                .andExpect(jsonPath("$.data.message").value("驾驶舱基础设施概览数据暂不可用"))
-                .andExpect(jsonPath("$.data.requestId").value("overview-infrastructure-500"))
-                .andExpect(jsonPath("$.data.serverTime").value("2026-09-02T10:00:00+08:00"));
-    }
-
-    @Test
-    void mutatingRequestIsRejectedBeforeReadAdapterIsCalled() throws Exception {
-        mockMvc.perform(post("/api/cockpit/v1/overview/infrastructure"))
-                .andExpect(status().isMethodNotAllowed());
-
-        verifyNoInteractions(adapter);
-    }
-
-    @Test
-    void controllerOnlyExposesAuthenticatedReadOnlyOperations() {
-        assertTrue(Arrays.stream(CockpitOverviewInfrastructureController.class.getDeclaredMethods())
-                .filter(method -> method.isAnnotationPresent(
-                        org.springframework.web.bind.annotation.RequestMapping.class)
-                        || method.isAnnotationPresent(org.springframework.web.bind.annotation.GetMapping.class)
-                        || method.isAnnotationPresent(org.springframework.web.bind.annotation.PostMapping.class)
-                        || 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(CockpitOverviewInfrastructureControllerTest::isReadOnlyMappedMethod));
-    }
-
-    private static CockpitOverviewInfrastructureSnapshot fixture() {
-        return new CockpitOverviewInfrastructureSnapshot(
-                "2026-09-02T09:59:50+08:00",
-                Arrays.asList(
-                        new CockpitOverviewInfrastructureSnapshot.SourceType(
-                                "WATER_PLANT", "水厂", "WATER_SUPPLY", null, "FACILITY"),
-                        new CockpitOverviewInfrastructureSnapshot.SourceType(
-                                "WATER_SUPPLY_SENSOR", "供水压力计", "WATER_SUPPLY", null, "SMART_DEVICE")),
-                Arrays.asList(
-                        new CockpitOverviewInfrastructureSnapshot.SourceCount(
-                                "FACILITY", "WATER_PLANT", 1),
-                        new CockpitOverviewInfrastructureSnapshot.SourceCount(
-                                "SMART_DEVICE", "WATER_SUPPLY_SENSOR", 1)));
-    }
-
-    private static CockpitOverviewInfrastructureSnapshot metadataFixture() {
-        return new CockpitOverviewInfrastructureSnapshot(
-                "2026-09-02T09:59:50+08:00",
-                Arrays.asList(
-                        type("PIPELINE", "供水管线", "WATER_SUPPLY", null, "FACILITY"),
-                        type("PUMP_STATION", "泵站", "WATER_SUPPLY", null, "FACILITY"),
-                        type("WATER_SUPPLY_SENSOR", "供水压力计", "WATER_SUPPLY", null, "SMART_DEVICE")),
-                Arrays.asList(
-                        count("FACILITY", "PIPELINE", 1,
-                                value(new BigDecimal("12.5"), null, range("DIAMETER_MM", "100", "800"))),
-                        count("FACILITY", "PUMP_STATION", 1, value(null, "medium", null)),
-                        count("SMART_DEVICE", "WATER_SUPPLY_SENSOR", 2,
-                                value(null, "pressure-meters", null))));
-    }
-
-    private static CockpitOverviewInfrastructureSnapshot scopeFixture() {
-        return new CockpitOverviewInfrastructureSnapshot(
-                "2026-09-02T09:59:50+08:00",
-                Arrays.asList(
-                        type("WATER_PLANT", "水厂", "WATER_SUPPLY", null, "FACILITY"),
-                        type("PIPELINE", "供水管线", "WATER_SUPPLY", null, "FACILITY"),
-                        type("GAS_SENSOR", "燃气浓度计", "GAS", null, "SMART_DEVICE"),
-                        type("RAINWATER_SENSOR", "雨水流量计", "DRAINAGE", "RAINWATER", "SMART_DEVICE"),
-                        type("SEWAGE_ENVIRONMENT_SENSOR", "污水环境监测仪", "DRAINAGE", "SEWAGE", "SMART_DEVICE"),
-                        type("WATER_PLANT_DEVICE", "水厂设备", "WATER_SUPPLY", null, "SMART_DEVICE"),
-                        type("SMART_MANHOLE", "智能井盖", null, null, "SMART_DEVICE")),
-                Arrays.asList(
-                        count("FACILITY", "WATER_PLANT", 2),
-                        count("FACILITY", "PIPELINE", 1),
-                        count("SMART_DEVICE", "GAS_SENSOR", 3),
-                        count("SMART_DEVICE", "RAINWATER_SENSOR", 4),
-                        count("SMART_DEVICE", "SEWAGE_ENVIRONMENT_SENSOR", 5),
-                        count("SMART_DEVICE", "SMART_MANHOLE", 2),
-                        count("FACILITY", "UNKNOWN_FACILITY_TYPE", 7),
-                        count("SMART_DEVICE", "UNKNOWN_DEVICE_TYPE", 1),
-                        count("FACILITY", "WATER_PLANT_DEVICE", 3),
-                        count("SMART_DEVICE", "WATER_PLANT", 2)));
-    }
-
-    private static CockpitOverviewInfrastructureSnapshot.SourceType type(
-            String code, String name, String industry, String scope, String objectKind) {
-        return new CockpitOverviewInfrastructureSnapshot.SourceType(
-                code, name, industry, scope, objectKind);
-    }
-
-    private static CockpitOverviewInfrastructureSnapshot.SourceCount count(
-            String objectKind, String typeCode, int count) {
-        return new CockpitOverviewInfrastructureSnapshot.SourceCount(objectKind, typeCode, count);
-    }
-
-    private static CockpitOverviewInfrastructureSnapshot.SourceCount count(
-            String objectKind, String typeCode, int count,
-            CockpitOverviewInfrastructureSnapshot.SourceValue value) {
-        return new CockpitOverviewInfrastructureSnapshot.SourceCount(objectKind, typeCode, count, value);
-    }
-
-    private static CockpitOverviewInfrastructureSnapshot.SourceValue value(
-            BigDecimal lengthKm, String scale, CockpitOverviewInfrastructureSnapshot.SourceRange range) {
-        return new CockpitOverviewInfrastructureSnapshot.SourceValue(lengthKm, scale, range);
-    }
-
-    private static CockpitOverviewInfrastructureSnapshot.SourceRange range(
-            String type, String start, String end) {
-        return new CockpitOverviewInfrastructureSnapshot.SourceRange(type, start, end);
-    }
-
-    private static boolean isReadOnlyMappedMethod(Method method) {
-        return method.isAnnotationPresent(org.springframework.web.bind.annotation.GetMapping.class)
-                && !method.isAnnotationPresent(org.springframework.web.bind.annotation.PostMapping.class)
-                && !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);
-    }
-}

+ 0 - 161
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitOverviewMonitoringControllerTest.java

@@ -1,161 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.foundation.CockpitReadException;
-import com.zksy.cockpit.overview.CockpitOverviewMonitoringAdapter;
-import com.zksy.cockpit.overview.CockpitOverviewMonitoringService;
-import com.zksy.cockpit.overview.CockpitOverviewMonitoringSnapshot;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.test.web.servlet.MockMvc;
-import org.springframework.test.web.servlet.setup.MockMvcBuilders;
-
-import java.time.Clock;
-import java.time.Instant;
-import java.time.ZoneOffset;
-import java.util.Arrays;
-import java.util.Collections;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verifyNoInteractions;
-import static org.mockito.Mockito.when;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
-import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
-
-class CockpitOverviewMonitoringControllerTest {
-
-    private CockpitOverviewMonitoringAdapter adapter;
-    private MockMvc mockMvc;
-
-    @BeforeEach
-    void setUp() {
-        adapter = mock(CockpitOverviewMonitoringAdapter.class);
-        CockpitOverviewMonitoringService service = new CockpitOverviewMonitoringService(
-                adapter,
-                Clock.fixed(Instant.parse("2026-09-02T02:00:00Z"), ZoneOffset.UTC));
-        mockMvc = MockMvcBuilders
-                .standaloneSetup(new CockpitOverviewMonitoringController(service))
-                .build();
-    }
-
-    @Test
-    void overviewMonitoringUsesEnvelopeAndCamelCaseContract() throws Exception {
-        when(adapter.load()).thenReturn(fixture());
-
-        mockMvc.perform(get("/api/cockpit/v1/overview/monitoring")
-                        .header("X-Request-Id", "overview-monitoring-001"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.code").value(200))
-                .andExpect(jsonPath("$.msg").value("操作成功"))
-                .andExpect(jsonPath("$.data.requestId").value("overview-monitoring-001"))
-                .andExpect(jsonPath("$.data.apiVersion").value("v1"))
-                .andExpect(jsonPath("$.data.readOnly").value(true))
-                .andExpect(jsonPath("$.data.timezone").value("Asia/Shanghai"))
-                .andExpect(jsonPath("$.data.updatedAt").value("2026-09-02T09:59:50+08:00"))
-                .andExpect(jsonPath("$.data.selectedIndustry.code").doesNotExist())
-                .andExpect(jsonPath("$.data.formalScope.industries[0]").value("GAS"))
-                .andExpect(jsonPath("$.data.formalScope.keys[0]").value("gas"))
-                .andExpect(jsonPath("$.data.counts.deviceCount").value(4))
-                .andExpect(jsonPath("$.data.counts.monitoringPointCount").value(2))
-                .andExpect(jsonPath("$.data.counts.monitoringFacilityCount").value(3))
-                .andExpect(jsonPath("$.data.counts.infrastructureFacilityCount").value(99))
-                .andExpect(jsonPath("$.data.typeDistribution[0].industry.code").value("GAS"))
-                .andExpect(jsonPath("$.data.typeDistribution[0].deviceType.code").value("GAS_SENSOR"))
-                .andExpect(jsonPath("$.data.typeDistribution[0].deviceCount").value(2))
-                .andExpect(jsonPath("$.data.metricFreshness.status").value("CURRENT"));
-    }
-
-    @Test
-    void industryFilterIsAppliedAtTheRestControllerSeam() throws Exception {
-        when(adapter.load()).thenReturn(fixture());
-
-        mockMvc.perform(get("/api/cockpit/v1/overview/monitoring")
-                        .queryParam("industry", "GAS"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.selectedIndustry.code").value("GAS"))
-                .andExpect(jsonPath("$.data.selectedIndustry.key").value("gas"))
-                .andExpect(jsonPath("$.data.counts.deviceCount").value(2))
-                .andExpect(jsonPath("$.data.counts.monitoringPointCount").value(1))
-                .andExpect(jsonPath("$.data.typeDistribution", org.hamcrest.Matchers.hasSize(1)));
-    }
-
-    @Test
-    void invalidIndustryReturnsTypedBadRequestBeforeReadAdapterIsCalled() throws Exception {
-        mockMvc.perform(get("/api/cockpit/v1/overview/monitoring")
-                        .queryParam("industry", "WHATEVER"))
-                .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"));
-
-        verifyNoInteractions(adapter);
-    }
-
-    @Test
-    void mutatingRequestIsRejectedBeforeReadAdapterIsCalled() throws Exception {
-        mockMvc.perform(post("/api/cockpit/v1/overview/monitoring"))
-                .andExpect(status().isMethodNotAllowed());
-
-        verifyNoInteractions(adapter);
-    }
-
-    @Test
-    void serverFailureReturnsTypedServerError() throws Exception {
-        when(adapter.load()).thenThrow(new CockpitReadException("upstream unavailable"));
-
-        mockMvc.perform(get("/api/cockpit/v1/overview/monitoring")
-                        .header("X-Request-Id", "overview-monitoring-500"))
-                .andExpect(status().isInternalServerError())
-                .andExpect(jsonPath("$.code").value(500))
-                .andExpect(jsonPath("$.data.category").value("SERVER_ERROR"))
-                .andExpect(jsonPath("$.data.message").value("驾驶舱运行监测概览数据暂不可用"))
-                .andExpect(jsonPath("$.data.requestId").value("overview-monitoring-500"))
-                .andExpect(jsonPath("$.data.serverTime").value("2026-09-02T10:00:00+08:00"));
-    }
-
-    @Test
-    void controllerOnlyExposesAuthenticatedReadOnlyOperations() {
-        assertTrue(Arrays.stream(CockpitOverviewMonitoringController.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)
-                        || method.isAnnotationPresent(org.springframework.web.bind.annotation.PatchMapping.class)
-                        || method.isAnnotationPresent(org.springframework.web.bind.annotation.DeleteMapping.class))
-                .allMatch(method -> method.isAnnotationPresent(GetMapping.class)));
-    }
-
-    private static CockpitOverviewMonitoringSnapshot fixture() {
-        return new CockpitOverviewMonitoringSnapshot(
-                "2026-09-02T09:59:50+08:00",
-                new CockpitOverviewMonitoringSnapshot.SourceMetricFreshness("CURRENT", "2026-09-02T09:59:50+08:00"),
-                Arrays.asList(
-                        new CockpitOverviewMonitoringSnapshot.SourceType(
-                                "GAS_SENSOR", "燃气浓度计", "GAS", null, "SMART_DEVICE"),
-                        new CockpitOverviewMonitoringSnapshot.SourceType(
-                                "WATER_SUPPLY_SENSOR", "供水压力计", "WATER_SUPPLY", null, "SMART_DEVICE"),
-                        new CockpitOverviewMonitoringSnapshot.SourceType(
-                                "RAINWATER_SENSOR", "雨水流量计", "DRAINAGE", "RAINWATER", "SMART_DEVICE"),
-                        new CockpitOverviewMonitoringSnapshot.SourceType(
-                                "WATER_PLANT", "水厂", "WATER_SUPPLY", null, "FACILITY"),
-                        new CockpitOverviewMonitoringSnapshot.SourceType(
-                                "SMART_MANHOLE", "智能井盖", null, null, "SMART_DEVICE")),
-                Arrays.asList(
-                        new CockpitOverviewMonitoringSnapshot.SourceDevice("GAS-001", "GAS_SENSOR", "ONLINE"),
-                        new CockpitOverviewMonitoringSnapshot.SourceDevice("GAS-002", "GAS_SENSOR", "OFFLINE"),
-                        new CockpitOverviewMonitoringSnapshot.SourceDevice("WS-001", "WATER_SUPPLY_SENSOR", "STALE"),
-                        new CockpitOverviewMonitoringSnapshot.SourceDevice("WS-002", "WATER_SUPPLY_SENSOR", null),
-                        new CockpitOverviewMonitoringSnapshot.SourceDevice("UNKNOWN-001", "SMART_MANHOLE", "ONLINE"),
-                        new CockpitOverviewMonitoringSnapshot.SourceDevice("MISMATCH-001", "WATER_PLANT", "ONLINE")),
-                Arrays.asList(
-                        new CockpitOverviewMonitoringSnapshot.SourceMonitoringPoint("POINT-GAS", "GAS_SENSOR"),
-                        new CockpitOverviewMonitoringSnapshot.SourceMonitoringPoint("POINT-WS", "WATER_SUPPLY_SENSOR")),
-                Arrays.asList(
-                        new CockpitOverviewMonitoringSnapshot.SourceMonitoringFacility("FACILITY-001", "WATER_PLANT"),
-                        new CockpitOverviewMonitoringSnapshot.SourceMonitoringFacility("FACILITY-002", "WATER_PLANT"),
-                        new CockpitOverviewMonitoringSnapshot.SourceMonitoringFacility("FACILITY-003", "WATER_PLANT")),
-                99);
-    }
-}

+ 0 - 202
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitOverviewMonitoringServiceTest.java

@@ -1,202 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.overview.CockpitOverviewMonitoringAdapter;
-import com.zksy.cockpit.overview.CockpitOverviewMonitoringDeviceStatusDelta;
-import com.zksy.cockpit.overview.CockpitOverviewMonitoringResponse;
-import com.zksy.cockpit.overview.CockpitOverviewMonitoringService;
-import com.zksy.cockpit.overview.CockpitOverviewMonitoringSnapshot;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import java.time.Clock;
-import java.time.Instant;
-import java.time.ZoneOffset;
-import java.util.Arrays;
-import java.util.Collections;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-class CockpitOverviewMonitoringServiceTest {
-
-    private CockpitOverviewMonitoringAdapter adapter;
-    private CockpitOverviewMonitoringService service;
-
-    @BeforeEach
-    void setUp() {
-        adapter = mock(CockpitOverviewMonitoringAdapter.class);
-        service = new CockpitOverviewMonitoringService(
-                adapter,
-                Clock.fixed(Instant.parse("2026-09-02T02:00:00Z"), ZoneOffset.UTC));
-    }
-
-    @Test
-    void mixedStatesExposeResolvedDenominatorAndExplicitUnknownState() {
-        when(adapter.load()).thenReturn(fixture());
-
-        CockpitOverviewMonitoringResponse response = service.load("request-001", null);
-
-        assertEquals(Integer.valueOf(4), response.getCounts().getDeviceCount());
-        assertEquals(Integer.valueOf(2), response.getCounts().getMonitoringPointCount());
-        assertEquals(Integer.valueOf(3), response.getCounts().getMonitoringFacilityCount());
-        assertEquals(Integer.valueOf(99), response.getCounts().getInfrastructureFacilityCount());
-        assertEquals(Integer.valueOf(1), response.getCounts().getStatus().getOnline());
-        assertEquals(Integer.valueOf(1), response.getCounts().getStatus().getOffline());
-        assertEquals(Integer.valueOf(1), response.getCounts().getStatus().getStale());
-        assertEquals(Integer.valueOf(1), response.getCounts().getStatus().getUnknownOrMissing());
-        assertEquals(Integer.valueOf(3), response.getCounts().getOnlineRate().getDenominator());
-        assertEquals("0.3333", response.getCounts().getOnlineRate().getValue().toPlainString());
-        assertEquals("AVAILABLE", response.getCounts().getOnlineRate().getState());
-        assertEquals("STALE", response.getFreshness().getStatus());
-        assertEquals("MONITORING_STATE_STALE", response.getFreshness().getReason());
-    }
-
-    @Test
-    void emptyCollectionReturnsExplicitZeroRateAndEmptyFreshness() {
-        when(adapter.load()).thenReturn(emptyFixture());
-
-        CockpitOverviewMonitoringResponse response = service.load("request-empty", null);
-
-        assertEquals(Integer.valueOf(0), response.getCounts().getDeviceCount());
-        assertEquals(Integer.valueOf(0), response.getCounts().getMonitoringPointCount());
-        assertEquals(Integer.valueOf(0), response.getCounts().getMonitoringFacilityCount());
-        assertEquals(Integer.valueOf(0), response.getCounts().getStatus().getUnknownOrMissing());
-        assertEquals(Integer.valueOf(0), response.getCounts().getOnlineRate().getDenominator());
-        assertEquals("0.0000", response.getCounts().getOnlineRate().getValue().toPlainString());
-        assertEquals("EMPTY", response.getCounts().getOnlineRate().getState());
-        assertEquals("NO_RESOLVED_DEVICES", response.getCounts().getOnlineRate().getReason());
-        assertEquals("EMPTY", response.getFreshness().getStatus());
-        assertEquals("NO_RESOLVED_DEVICES", response.getFreshness().getReason());
-    }
-
-    @Test
-    void industryFilterIncludesOnlyTheSelectedFormalIndustry() {
-        when(adapter.load()).thenReturn(fixture());
-
-        CockpitOverviewMonitoringResponse response = service.load("request-gas", "GAS");
-
-        assertEquals("GAS", response.getSelectedIndustry().getCode());
-        assertEquals("gas", response.getSelectedIndustry().getKey());
-        assertEquals(Integer.valueOf(2), response.getCounts().getDeviceCount());
-        assertEquals(Integer.valueOf(1), response.getCounts().getMonitoringPointCount());
-        assertEquals(Integer.valueOf(0), response.getCounts().getMonitoringFacilityCount());
-        assertEquals(Integer.valueOf(99), response.getCounts().getInfrastructureFacilityCount());
-        assertEquals(1, response.getTypeDistribution().size());
-        assertEquals("GAS_SENSOR", response.getTypeDistribution().get(0).getDeviceType().getCode());
-    }
-
-    @Test
-    void allUnknownStatesUseExplicitEmptyFreshnessAndZeroRateDenominator() {
-        when(adapter.load()).thenReturn(unknownOnlyFixture());
-
-        CockpitOverviewMonitoringResponse response = service.load("request-unknown", null);
-
-        assertEquals(Integer.valueOf(2), response.getCounts().getDeviceCount());
-        assertEquals(Integer.valueOf(2), response.getCounts().getStatus().getUnknownOrMissing());
-        assertEquals(Integer.valueOf(0), response.getCounts().getOnlineRate().getDenominator());
-        assertEquals("EMPTY", response.getCounts().getOnlineRate().getState());
-        assertEquals("EMPTY", response.getFreshness().getStatus());
-        assertEquals("NO_RESOLVED_DEVICES", response.getFreshness().getReason());
-    }
-
-    @Test
-    void unknownAndMismatchedTypesAreNotSilentlyCountedInFormalScope() {
-        when(adapter.load()).thenReturn(fixture());
-
-        CockpitOverviewMonitoringResponse response = service.load("request-scope", null);
-
-        assertEquals(Integer.valueOf(1), response.getExcluded().getUnknownTypeCount());
-        assertEquals(Integer.valueOf(1), response.getExcluded().getTypeKindMismatchCount());
-        assertEquals(2, response.getTypeDistribution().size());
-        assertEquals(Integer.valueOf(4), response.getCounts().getDeviceCount());
-    }
-
-    @Test
-    void deviceStatusDeltaRecomputesCountsOnlineRateAndDistribution() {
-        when(adapter.load()).thenReturn(fixture());
-
-        CockpitOverviewMonitoringResponse first = service.applyDeviceStatusDelta(
-                "request-delta-001",
-                null,
-                new CockpitOverviewMonitoringDeviceStatusDelta(
-                        "GAS-002", null, "ONLINE", null, "2026-09-02T10:05:00+08:00"));
-
-        assertEquals(Integer.valueOf(2), first.getCounts().getStatus().getOnline());
-        assertEquals(Integer.valueOf(0), first.getCounts().getStatus().getOffline());
-        assertEquals(Integer.valueOf(1), first.getCounts().getStatus().getStale());
-        assertEquals(Integer.valueOf(3), first.getCounts().getOnlineRate().getDenominator());
-        assertEquals("0.6667", first.getCounts().getOnlineRate().getValue().toPlainString());
-        assertEquals("2026-09-02T10:05:00+08:00", first.getUpdatedAt());
-
-        CockpitOverviewMonitoringResponse second = service.applyDeviceStatusDelta(
-                "request-delta-002",
-                null,
-                new CockpitOverviewMonitoringDeviceStatusDelta(
-                        "GAS-002", null, "OFFLINE", null, "2026-09-02T10:04:00+08:00"));
-
-        assertEquals(Integer.valueOf(2), second.getCounts().getStatus().getOnline());
-        assertEquals(Integer.valueOf(0), second.getCounts().getStatus().getOffline());
-        assertEquals(Integer.valueOf(1), second.getCounts().getStatus().getStale());
-        assertEquals("0.6667", second.getCounts().getOnlineRate().getValue().toPlainString());
-        assertEquals("2026-09-02T10:05:00+08:00", second.getUpdatedAt());
-    }
-
-    private static CockpitOverviewMonitoringSnapshot fixture() {
-        return new CockpitOverviewMonitoringSnapshot(
-                "2026-09-02T09:59:50+08:00",
-                new CockpitOverviewMonitoringSnapshot.SourceMetricFreshness("CURRENT", "2026-09-02T09:59:50+08:00"),
-                Arrays.asList(
-                        new CockpitOverviewMonitoringSnapshot.SourceType(
-                                "GAS_SENSOR", "燃气浓度计", "GAS", null, "SMART_DEVICE"),
-                        new CockpitOverviewMonitoringSnapshot.SourceType(
-                                "WATER_SUPPLY_SENSOR", "供水压力计", "WATER_SUPPLY", null, "SMART_DEVICE"),
-                        new CockpitOverviewMonitoringSnapshot.SourceType(
-                                "RAINWATER_SENSOR", "雨水流量计", "DRAINAGE", "RAINWATER", "SMART_DEVICE"),
-                        new CockpitOverviewMonitoringSnapshot.SourceType(
-                                "WATER_PLANT", "水厂", "WATER_SUPPLY", null, "FACILITY"),
-                        new CockpitOverviewMonitoringSnapshot.SourceType(
-                                "SMART_MANHOLE", "智能井盖", null, null, "SMART_DEVICE")),
-                Arrays.asList(
-                        new CockpitOverviewMonitoringSnapshot.SourceDevice("GAS-001", "GAS_SENSOR", "ONLINE"),
-                        new CockpitOverviewMonitoringSnapshot.SourceDevice("GAS-002", "GAS_SENSOR", "OFFLINE"),
-                        new CockpitOverviewMonitoringSnapshot.SourceDevice("WS-001", "WATER_SUPPLY_SENSOR", "STALE"),
-                        new CockpitOverviewMonitoringSnapshot.SourceDevice("WS-002", "WATER_SUPPLY_SENSOR", null),
-                        new CockpitOverviewMonitoringSnapshot.SourceDevice("UNKNOWN-001", "SMART_MANHOLE", "ONLINE"),
-                        new CockpitOverviewMonitoringSnapshot.SourceDevice("MISMATCH-001", "WATER_PLANT", "ONLINE")),
-                Arrays.asList(
-                        new CockpitOverviewMonitoringSnapshot.SourceMonitoringPoint("POINT-GAS", "GAS_SENSOR"),
-                        new CockpitOverviewMonitoringSnapshot.SourceMonitoringPoint("POINT-WS", "WATER_SUPPLY_SENSOR")),
-                Arrays.asList(
-                        new CockpitOverviewMonitoringSnapshot.SourceMonitoringFacility("FACILITY-001", "WATER_PLANT"),
-                        new CockpitOverviewMonitoringSnapshot.SourceMonitoringFacility("FACILITY-002", "WATER_PLANT"),
-                        new CockpitOverviewMonitoringSnapshot.SourceMonitoringFacility("FACILITY-003", "WATER_PLANT")),
-                99);
-    }
-
-    private static CockpitOverviewMonitoringSnapshot emptyFixture() {
-        return new CockpitOverviewMonitoringSnapshot(
-                "2026-09-02T09:59:50+08:00",
-                null,
-                Collections.emptyList(),
-                Collections.emptyList(),
-                Collections.emptyList(),
-                Collections.emptyList(),
-                0);
-    }
-
-    private static CockpitOverviewMonitoringSnapshot unknownOnlyFixture() {
-        return new CockpitOverviewMonitoringSnapshot(
-                "2026-09-02T09:59:50+08:00",
-                null,
-                Collections.singletonList(new CockpitOverviewMonitoringSnapshot.SourceType(
-                        "WATER_SUPPLY_SENSOR", "供水压力计", "WATER_SUPPLY", null, "SMART_DEVICE")),
-                Arrays.asList(
-                        new CockpitOverviewMonitoringSnapshot.SourceDevice("WS-UNKNOWN-001", "WATER_SUPPLY_SENSOR", null),
-                        new CockpitOverviewMonitoringSnapshot.SourceDevice("WS-UNKNOWN-002", "WATER_SUPPLY_SENSOR", "UNKNOWN")),
-                Collections.emptyList(),
-                Collections.emptyList(),
-                0);
-    }
-}

+ 0 - 330
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitOverviewWarningSettingsControllerTest.java

@@ -1,330 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.foundation.CockpitReadException;
-import com.zksy.cockpit.overview.CockpitOverviewWarningSettingsAdapter;
-import com.zksy.cockpit.overview.CockpitOverviewWarningSettingsService;
-import com.zksy.cockpit.overview.CockpitOverviewWarningSettingsSnapshot;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.PatchMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.test.web.servlet.MockMvc;
-import org.springframework.test.web.servlet.setup.MockMvcBuilders;
-
-import java.time.Clock;
-import java.time.Instant;
-import java.time.ZoneOffset;
-import java.util.Arrays;
-import java.util.Collections;
-import java.lang.reflect.Method;
-
-import static org.hamcrest.Matchers.hasSize;
-import static org.hamcrest.Matchers.nullValue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verifyNoInteractions;
-import static org.mockito.Mockito.when;
-import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
-import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
-
-class CockpitOverviewWarningSettingsControllerTest {
-
-    private CockpitOverviewWarningSettingsAdapter adapter;
-    private MockMvc mockMvc;
-
-    @BeforeEach
-    void setUp() {
-        adapter = mock(CockpitOverviewWarningSettingsAdapter.class);
-        CockpitOverviewWarningSettingsService service = new CockpitOverviewWarningSettingsService(
-                adapter,
-                Clock.fixed(Instant.parse("2026-09-02T02:00:00Z"), ZoneOffset.UTC));
-        mockMvc = MockMvcBuilders
-                .standaloneSetup(new CockpitOverviewWarningSettingsController(service))
-                .build();
-    }
-
-    /**
-     * 维护者 2026-10-14 裁定:预警族只给预警自身生命周期,工单口径字段一律 {@code null};
-     * 报警族保留工单口径并并存自身生命周期。
-     */
-    @Test
-    void warningSettingsUsesEnvelopeCamelCaseAndSplitsTheTwoFamilyVocabularies() throws Exception {
-        when(adapter.load()).thenReturn(fixture());
-
-        mockMvc.perform(get("/api/cockpit/v1/overview/warning-settings")
-                        .header("X-Request-Id", "warning-settings-001"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.code").value(200))
-                .andExpect(jsonPath("$.msg").value("操作成功"))
-                .andExpect(jsonPath("$.data.requestId").value("warning-settings-001"))
-                .andExpect(jsonPath("$.data.apiVersion").value("v1"))
-                .andExpect(jsonPath("$.data.readOnly").value(true))
-                .andExpect(jsonPath("$.data.displayName").value("预警设置"))
-                .andExpect(jsonPath("$.data.selectedMode").value("WARNING"))
-                .andExpect(jsonPath("$.data.timezone").value("Asia/Shanghai"))
-                .andExpect(jsonPath("$.data.range.type").value("CURRENT_BASELINE"))
-                .andExpect(jsonPath("$.data.range.start").value(nullValue()))
-                .andExpect(jsonPath("$.data.range.end").value(nullValue()))
-                .andExpect(jsonPath("$.data.warning.trend", hasSize(4)))
-                .andExpect(jsonPath("$.data.warning.trend[0].bucket").value("2026-09-01"))
-                .andExpect(jsonPath("$.data.freshness.status").value("CURRENT"))
-                .andExpect(jsonPath("$.data.freshness.reason").value("READ_ONLY_AGGREGATE"))
-                .andExpect(jsonPath("$.data.updatedAt").value("2026-09-02T09:59:50+08:00"))
-                // ---- 预警族:自身生命周期,工单口径字段全为 null ----
-                .andExpect(jsonPath("$.data.warning.total").value(3))
-                .andExpect(jsonPath("$.data.warning.handled").value(nullValue()))
-                .andExpect(jsonPath("$.data.warning.pending").value(nullValue()))
-                .andExpect(jsonPath("$.data.warning.cancelledCount").value(nullValue()))
-                .andExpect(jsonPath("$.data.warning.unlinkedEventCount").value(nullValue()))
-                .andExpect(jsonPath("$.data.warning.workOrderStates").value(nullValue()))
-                // 已解除率=已解除 ÷ 总数 = 1/3(预警自身生命周期,不是工单处置率)。
-                .andExpect(jsonPath("$.data.warning.handlingEfficiency.value").value("0.3333"))
-                .andExpect(jsonPath("$.data.warning.handlingEfficiency.state").value("AVAILABLE"))
-                .andExpect(jsonPath("$.data.warning.handlingEfficiency.numerator").value(1))
-                .andExpect(jsonPath("$.data.warning.handlingEfficiency.denominator").value(3))
-                // 状态分布=WarningWorkflow 六态,逐态铺满。
-                .andExpect(jsonPath("$.data.warning.statusDistribution", hasSize(6)))
-                .andExpect(jsonPath("$.data.warning.statusDistribution[0].code").value("DRAFT"))
-                .andExpect(jsonPath("$.data.warning.statusDistribution[1].code").value("PENDING"))
-                .andExpect(jsonPath("$.data.warning.statusDistribution[1].count").value(1))
-                .andExpect(jsonPath("$.data.warning.statusDistribution[3].code").value("PROCESSING"))
-                .andExpect(jsonPath("$.data.warning.statusDistribution[3].count").value(1))
-                .andExpect(jsonPath("$.data.warning.statusDistribution[5].code").value("CLOSED"))
-                .andExpect(jsonPath("$.data.warning.statusDistribution[5].count").value(1))
-                // 等级 1–4 全铺 + 一条等级缺失进未知桶。
-                .andExpect(jsonPath("$.data.warning.levelDistribution", hasSize(5)))
-                .andExpect(jsonPath("$.data.warning.levelDistribution[1].count").value(1))
-                .andExpect(jsonPath("$.data.warning.levelDistribution[4].code").value("UNKNOWN"))
-                .andExpect(jsonPath("$.data.warning.levelDistribution[4].count").value(1))
-                // 行业四正式桶全铺 + 未知桶;片区含恒有的未分区桶。
-                .andExpect(jsonPath("$.data.warning.industryDistribution", hasSize(5)))
-                .andExpect(jsonPath("$.data.warning.districtDistribution", hasSize(4)))
-                .andExpect(jsonPath("$.data.warning.districtDistribution[3].code").value("UNASSIGNED"))
-                .andExpect(jsonPath("$.data.warning.districtDistribution[3].count").value(1))
-                // ---- 报警族:工单口径保留 ----
-                .andExpect(jsonPath("$.data.alarm.total").value(2))
-                .andExpect(jsonPath("$.data.alarm.handled").value(1))
-                .andExpect(jsonPath("$.data.alarm.pending").value(1))
-                .andExpect(jsonPath("$.data.alarm.cancelledCount").value(0))
-                .andExpect(jsonPath("$.data.alarm.handlingEfficiency.value").value("0.2000"))
-                .andExpect(jsonPath("$.data.alarm.handlingEfficiency.numerator").value(1))
-                .andExpect(jsonPath("$.data.alarm.handlingEfficiency.denominator").value(5))
-                .andExpect(jsonPath("$.data.alarm.workOrderStates['1']").value(1))
-                .andExpect(jsonPath("$.data.alarm.workOrderStates['4']").value(2))
-                .andExpect(jsonPath("$.data.alarm.workOrderStates['5']").value(1))
-                .andExpect(jsonPath("$.data.alarm.workOrderStates['6']").value(1))
-                // 报警自身生命周期并存。
-                .andExpect(jsonPath("$.data.alarm.statusDistribution", hasSize(2)))
-                .andExpect(jsonPath("$.data.alarm.statusDistribution[0].code").value("UNHANDLED"))
-                .andExpect(jsonPath("$.data.alarm.statusDistribution[0].count").value(1))
-                .andExpect(jsonPath("$.data.alarm.statusDistribution[1].code").value("HANDLED"))
-                .andExpect(jsonPath("$.data.alarm.statusDistribution[1].count").value(1))
-                .andExpect(jsonPath("$.data.mapFilter.eventFamily").value("WARNING"))
-                .andExpect(jsonPath("$.data.mapFilter.label").value("预警"));
-    }
-
-    @Test
-    void alarmModeSelectsAlarmMapFilterWithoutMergingFamilies() throws Exception {
-        when(adapter.load()).thenReturn(fixture());
-
-        mockMvc.perform(get("/api/cockpit/v1/overview/warning-settings")
-                        .queryParam("mode", "ALARM")
-                        .header("X-Request-Id", "warning-settings-alarm"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.selectedMode").value("ALARM"))
-                .andExpect(jsonPath("$.data.warning.total").value(3))
-                .andExpect(jsonPath("$.data.alarm.total").value(2))
-                .andExpect(jsonPath("$.data.alarm.workOrderStates['4']").value(2))
-                .andExpect(jsonPath("$.data.mapFilter.eventFamily").value("ALARM"))
-                .andExpect(jsonPath("$.data.mapFilter.label").value("报警"));
-    }
-
-    @Test
-    void rangePresetDeclaresWindowAndFiltersTrendBuckets() throws Exception {
-        when(adapter.load()).thenReturn(fixture());
-
-        mockMvc.perform(get("/api/cockpit/v1/overview/warning-settings")
-                        .queryParam("range", "LAST_7_DAYS"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.range.type").value("LAST_7_DAYS"))
-                .andExpect(jsonPath("$.data.range.start").value("2026-08-26T10:00:00+08:00"))
-                .andExpect(jsonPath("$.data.range.end").value("2026-09-02T10:00:00+08:00"))
-                .andExpect(jsonPath("$.data.warning.trend", hasSize(2)))
-                .andExpect(jsonPath("$.data.warning.trend[0].bucket").value("2026-09-01"))
-                .andExpect(jsonPath("$.data.warning.trend[1].bucket").value("2026-09-02"))
-                .andExpect(jsonPath("$.data.alarm.trend", hasSize(2)));
-
-        mockMvc.perform(get("/api/cockpit/v1/overview/warning-settings")
-                        .queryParam("range", "LAST_30_DAYS"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.range.type").value("LAST_30_DAYS"))
-                .andExpect(jsonPath("$.data.range.start").value("2026-08-03T10:00:00+08:00"))
-                .andExpect(jsonPath("$.data.warning.trend", hasSize(3)))
-                .andExpect(jsonPath("$.data.warning.trend[0].bucket").value("2026-09-01"))
-                .andExpect(jsonPath("$.data.warning.trend[1].bucket").value("2026-09-02"))
-                .andExpect(jsonPath("$.data.warning.trend[2].bucket").value("2026-08-20"));
-
-        mockMvc.perform(get("/api/cockpit/v1/overview/warning-settings")
-                        .queryParam("range", "LAST_24_HOURS"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.range.type").value("LAST_24_HOURS"))
-                .andExpect(jsonPath("$.data.range.start").value("2026-09-01T10:00:00+08:00"))
-                .andExpect(jsonPath("$.data.warning.trend", hasSize(2)));
-    }
-
-    @Test
-    void explicitWindowEchoesCustomRangeAndFiltersTrendBuckets() throws Exception {
-        when(adapter.load()).thenReturn(fixture());
-
-        mockMvc.perform(get("/api/cockpit/v1/overview/warning-settings")
-                        .queryParam("startTime", "2026-08-01T00:00:00+08:00")
-                        .queryParam("endTime", "2026-08-31T23:59:59+08:00"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.range.type").value("CUSTOM"))
-                .andExpect(jsonPath("$.data.range.start").value("2026-08-01T00:00:00+08:00"))
-                .andExpect(jsonPath("$.data.range.end").value("2026-08-31T23:59:59+08:00"))
-                .andExpect(jsonPath("$.data.warning.trend", hasSize(2)))
-                .andExpect(jsonPath("$.data.warning.trend[0].bucket").value("2026-08-20"))
-                .andExpect(jsonPath("$.data.warning.trend[1].bucket").value("2026-08-01"));
-    }
-
-    @Test
-    void invalidWindowParametersReturnTypedBadRequestBeforeReadAdapterIsCalled() throws Exception {
-        mockMvc.perform(get("/api/cockpit/v1/overview/warning-settings")
-                        .queryParam("range", "LAST_YEAR"))
-                .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"))
-                .andExpect(jsonPath("$.data.message")
-                        .value("range must be LAST_24_HOURS, LAST_7_DAYS or LAST_30_DAYS"));
-
-        mockMvc.perform(get("/api/cockpit/v1/overview/warning-settings")
-                        .queryParam("startTime", "2026-08-01T00:00:00+08:00"))
-                .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.message")
-                        .value("startTime and endTime must be provided together"));
-
-        mockMvc.perform(get("/api/cockpit/v1/overview/warning-settings")
-                        .queryParam("startTime", "2026-08-31T00:00:00+08:00")
-                        .queryParam("endTime", "2026-08-01T00:00:00+08:00"))
-                .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.message")
-                        .value("startTime must not be after endTime"));
-
-        mockMvc.perform(get("/api/cockpit/v1/overview/warning-settings")
-                        .queryParam("startTime", "not-a-timestamp")
-                        .queryParam("endTime", "2026-08-01T00:00:00+08:00"))
-                .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.message").value("invalid startTime"));
-
-        verifyNoInteractions(adapter);
-    }
-
-    @Test
-    void invalidModeReturnsTypedBadRequestBeforeReadAdapterIsCalled() throws Exception {
-        mockMvc.perform(get("/api/cockpit/v1/overview/warning-settings")
-                        .queryParam("mode", "THRESHOLD"))
-                .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"));
-
-        verifyNoInteractions(adapter);
-    }
-
-    @Test
-    void mutatingRequestIsRejectedBeforeReadAdapterIsCalled() throws Exception {
-        mockMvc.perform(post("/api/cockpit/v1/overview/warning-settings"))
-                .andExpect(status().isMethodNotAllowed());
-
-        verifyNoInteractions(adapter);
-    }
-
-    @Test
-    void controllerExposesAuthenticatedReadOnlyMethodsOnly() {
-        assertTrue(Arrays.stream(CockpitOverviewWarningSettingsController.class.getDeclaredMethods())
-                .filter(method -> method.isAnnotationPresent(GetMapping.class)
-                        || method.isAnnotationPresent(PostMapping.class)
-                        || method.isAnnotationPresent(PutMapping.class)
-                        || method.isAnnotationPresent(PatchMapping.class)
-                        || method.isAnnotationPresent(DeleteMapping.class))
-                .allMatch(method -> method.isAnnotationPresent(GetMapping.class)
-                        && !method.isAnnotationPresent(PostMapping.class)
-                        && !method.isAnnotationPresent(PutMapping.class)
-                        && !method.isAnnotationPresent(PatchMapping.class)
-                        && !method.isAnnotationPresent(DeleteMapping.class)));
-    }
-
-    private static void assertTrue(boolean condition) {
-        org.junit.jupiter.api.Assertions.assertTrue(condition);
-    }
-
-    @Test
-    void serverFailureReturnsTypedServerError() throws Exception {
-        when(adapter.load()).thenThrow(new CockpitReadException("upstream unavailable"));
-
-        mockMvc.perform(get("/api/cockpit/v1/overview/warning-settings")
-                        .header("X-Request-Id", "warning-settings-500"))
-                .andExpect(status().isInternalServerError())
-                .andExpect(jsonPath("$.code").value(500))
-                .andExpect(jsonPath("$.data.category").value("SERVER_ERROR"))
-                .andExpect(jsonPath("$.data.message").value("驾驶舱预警设置概览数据暂不可用"))
-                .andExpect(jsonPath("$.data.requestId").value("warning-settings-500"))
-                .andExpect(jsonPath("$.data.serverTime").value("2026-09-02T10:00:00+08:00"));
-    }
-
-    private static CockpitOverviewWarningSettingsSnapshot fixture() {
-        return new CockpitOverviewWarningSettingsSnapshot(
-                "2026-09-02T09:59:50+08:00",
-                Arrays.asList(
-                        // 预警:自身生命周期 + 维度;工单事实刻意留空(预警不走工单)。
-                        warning("WRN-001", "PENDING", 2, "GAS", 0),
-                        warning("WRN-002", "CLOSED", 3, "WATER_SUPPLY", 1),
-                        warning("WRN-003", "PROCESSING", null, null, null),
-                        // 报警:保留工单回联,并带自身生命周期。
-                        alarm("ALM-001", "UNHANDLED", 4, 3, "GAS", 0),
-                        alarm("ALM-002", "HANDLED", 5, 2, "GAS", 0)),
-                Arrays.asList(
-                        new CockpitOverviewWarningSettingsSnapshot.SourceTrendPoint(
-                                "WARNING", "2026-09-01", 2, 1),
-                        new CockpitOverviewWarningSettingsSnapshot.SourceTrendPoint(
-                                "WARNING", "2026-09-02", 1, 0),
-                        new CockpitOverviewWarningSettingsSnapshot.SourceTrendPoint(
-                                "WARNING", "2026-08-20", 3, 2),
-                        new CockpitOverviewWarningSettingsSnapshot.SourceTrendPoint(
-                                "WARNING", "2026-08-01", 1, 0),
-                        new CockpitOverviewWarningSettingsSnapshot.SourceTrendPoint(
-                                "ALARM", "2026-09-01", 1, 0),
-                        new CockpitOverviewWarningSettingsSnapshot.SourceTrendPoint(
-                                "ALARM", "2026-09-02", 1, 0),
-                        new CockpitOverviewWarningSettingsSnapshot.SourceTrendPoint(
-                                "ALARM", "2026-08-20", 2, 1),
-                        new CockpitOverviewWarningSettingsSnapshot.SourceTrendPoint(
-                                "ALARM", "2026-08-01", 1, 1)),
-                // 报警族工单口径分母来源:状态 1/5/6/4/4 → 分母 5(排除状态 7),分子 1(状态 5)。
-                Arrays.asList(
-                        scopeOrder(1), scopeOrder(5), scopeOrder(6), scopeOrder(4), scopeOrder(4)));
-    }
-
-    private static CockpitOverviewWarningSettingsSnapshot.SourceEvent warning(
-            String code, String status, Integer level, String industry, Integer district) {
-        return new CockpitOverviewWarningSettingsSnapshot.SourceEvent(
-                "WARNING", code, "DEV-" + code, null, null, status, level, district, industry);
-    }
-
-    private static CockpitOverviewWarningSettingsSnapshot.SourceEvent alarm(
-            String code, String status, Integer workOrderState, Integer level,
-            String industry, Integer district) {
-        return new CockpitOverviewWarningSettingsSnapshot.SourceEvent(
-                "ALARM", code, "DEV-" + code, "WO-" + code, workOrderState,
-                status, level, district, industry);
-    }
-
-    private static CockpitOverviewWarningSettingsSnapshot.SourceWorkOrder scopeOrder(Integer state) {
-        return new CockpitOverviewWarningSettingsSnapshot.SourceWorkOrder(
-                state, "2026-09-01T10:00:00+08:00");
-    }
-}

+ 0 - 305
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitOverviewWarningSettingsServiceTest.java

@@ -1,305 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.cockpit.overview.CockpitOverviewWarningSettingsAdapter;
-import com.zksy.cockpit.overview.CockpitOverviewWarningSettingsResponse;
-import com.zksy.cockpit.overview.CockpitOverviewWarningSettingsService;
-import com.zksy.cockpit.overview.CockpitOverviewWarningSettingsSnapshot;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import java.time.Clock;
-import java.time.Instant;
-import java.time.ZoneOffset;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Collectors;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-class CockpitOverviewWarningSettingsServiceTest {
-
-    private CockpitOverviewWarningSettingsAdapter adapter;
-    private CockpitOverviewWarningSettingsService service;
-
-    @BeforeEach
-    void setUp() {
-        adapter = mock(CockpitOverviewWarningSettingsAdapter.class);
-        service = new CockpitOverviewWarningSettingsService(
-                adapter,
-                Clock.fixed(Instant.parse("2026-09-02T02:00:00Z"), ZoneOffset.UTC));
-    }
-
-    /**
-     * 维护者 2026-10-14 裁定:预警不走工单流程 → 预警族的工单口径字段**必须为 null**(不适用),
-     * 而不是 0 —— 0 会被读成"真的是零"。
-     */
-    @Test
-    void warningFamilyDropsWorkOrderVocabularyEntirely() {
-        when(adapter.load()).thenReturn(warningFixture());
-
-        CockpitOverviewWarningSettingsResponse response =
-                service.load("request-warning", "WARNING", null, null, null);
-
-        CockpitOverviewWarningSettingsResponse.FamilyMetrics warning = response.getWarning();
-        assertNull(warning.getHandled());
-        assertNull(warning.getPending());
-        assertNull(warning.getCancelledCount());
-        assertNull(warning.getUnlinkedEventCount());
-        assertNull(warning.getInvalidWorkOrderStateCount());
-        assertNull(warning.getWorkOrderStates());
-    }
-
-    /** 预警族状态分布=预警自身生命周期(六态),逐桶计数自洽(合计=总数)。 */
-    @Test
-    void warningStatusDistributionCoversItsOwnLifecycleAndSumsToTotal() {
-        when(adapter.load()).thenReturn(warningFixture());
-
-        CockpitOverviewWarningSettingsResponse response =
-                service.load("request-warning", "WARNING", null, null, null);
-
-        CockpitOverviewWarningSettingsResponse.FamilyMetrics warning = response.getWarning();
-        assertEquals(6, warning.getTotal());
-        assertEquals(1, count(warning.getStatusDistribution(), "DRAFT"));
-        assertEquals(1, count(warning.getStatusDistribution(), "PENDING"));
-        assertEquals(1, count(warning.getStatusDistribution(), "RECEIVED"));
-        assertEquals(1, count(warning.getStatusDistribution(), "PROCESSING"));
-        assertEquals(1, count(warning.getStatusDistribution(), "HANDLED"));
-        assertEquals(1, count(warning.getStatusDistribution(), "CLOSED"));
-        assertEquals(warning.getTotal(), sum(warning.getStatusDistribution()));
-        // 六态全铺(缺的态是真实 0,不是"没有数据")。
-        assertEquals(6, warning.getStatusDistribution().size());
-    }
-
-    /** 预警自身生命周期「已解除率」=已解除 ÷ 总数(1/6),与工单口径无关。 */
-    @Test
-    void warningEfficiencyIsItsOwnClosedOverTotalNotAWorkOrderRate() {
-        when(adapter.load()).thenReturn(warningFixture());
-
-        CockpitOverviewWarningSettingsResponse response =
-                service.load("request-warning", "WARNING", null, null, null);
-
-        CockpitOverviewWarningSettingsResponse.Efficiency efficiency =
-                response.getWarning().getHandlingEfficiency();
-        assertEquals(1, efficiency.getNumerator());
-        assertEquals(6, efficiency.getDenominator());
-        assertEquals("0.1667", efficiency.getValue().toPlainString());
-        assertEquals("AVAILABLE", efficiency.getState());
-    }
-
-    /** 等级 / 行业 / 片区分布都逐桶自洽,且未分区是显式桶。 */
-    @Test
-    void warningLevelIndustryAndDistrictDistributionsAreSelfConsistent() {
-        when(adapter.load()).thenReturn(warningFixture());
-
-        CockpitOverviewWarningSettingsResponse response =
-                service.load("request-warning", "WARNING", null, null, null);
-
-        CockpitOverviewWarningSettingsResponse.FamilyMetrics warning = response.getWarning();
-        // 1–4 全铺 + 一条等级缺失进未知桶。
-        assertEquals(5, warning.getLevelDistribution().size());
-        assertEquals(2, count(warning.getLevelDistribution(), "2"));
-        assertEquals(3, count(warning.getLevelDistribution(), "3"));
-        assertEquals(1, count(warning.getLevelDistribution(), "UNKNOWN"));
-        assertEquals(warning.getTotal(), sum(warning.getLevelDistribution()));
-
-        assertEquals(2, count(warning.getIndustryDistribution(), "GAS"));
-        assertEquals(3, count(warning.getIndustryDistribution(), "WATER_SUPPLY"));
-        assertEquals(1, count(warning.getIndustryDistribution(), "UNKNOWN"));
-        assertEquals(warning.getTotal(), sum(warning.getIndustryDistribution()));
-
-        assertEquals(2, count(warning.getDistrictDistribution(), "0"));
-        assertEquals(3, count(warning.getDistrictDistribution(), "1"));
-        // 未分区恒有显式桶(设备缺失是合法结果,不是缺数据)。
-        assertEquals(1, count(warning.getDistrictDistribution(), "UNASSIGNED"));
-        assertEquals(warning.getTotal(), sum(warning.getDistrictDistribution()));
-    }
-
-    /** 报警族保留工单口径(维护者裁定:报警靠工单闭环),并并存报警自身生命周期。 */
-    @Test
-    void alarmFamilyKeepsWorkOrderVocabularyAndAddsItsOwnLifecycle() {
-        when(adapter.load()).thenReturn(alarmFixture());
-
-        CockpitOverviewWarningSettingsResponse response =
-                service.load("request-alarm", "ALARM", null, null, null);
-
-        CockpitOverviewWarningSettingsResponse.FamilyMetrics alarm = response.getAlarm();
-        // 工单口径仍在:分母=状态 0–6 工单数(7 张,排除状态 7),分子=状态 5(1 张)。
-        assertEquals(1, alarm.getHandlingEfficiency().getNumerator());
-        assertEquals(7, alarm.getHandlingEfficiency().getDenominator());
-        assertEquals("0.1429", alarm.getHandlingEfficiency().getValue().toPlainString());
-        assertEquals(8, alarm.getWorkOrderStates().size());
-        assertEquals(1, alarm.getWorkOrderStates().get(5));
-        // 报警自身生命周期:alarm_status 0/1。
-        assertEquals(1, count(alarm.getStatusDistribution(), "HANDLED"));
-        assertEquals(2, count(alarm.getStatusDistribution(), "UNHANDLED"));
-        assertEquals(alarm.getTotal(), sum(alarm.getStatusDistribution()));
-    }
-
-    /** 报警族工单口径分列:未回联 / 脏码 / 已取消 各自如实计数,不互相冒充。 */
-    @Test
-    void alarmWorkOrderBucketsSeparateUnlinkedInvalidAndCancelled() {
-        when(adapter.load()).thenReturn(alarmFixture());
-
-        CockpitOverviewWarningSettingsResponse response =
-                service.load("request-alarm", "ALARM", null, null, null);
-
-        CockpitOverviewWarningSettingsResponse.FamilyMetrics alarm = response.getAlarm();
-        assertEquals(1, alarm.getUnlinkedEventCount());
-        assertEquals(1, alarm.getInvalidWorkOrderStateCount());
-        assertEquals(1, alarm.getCancelledCount());
-        assertEquals(1, alarm.getPending());
-    }
-
-    /** 工单表整体不可用时,预警族仍如实出数(这是本票要消除的故障面)。 */
-    @Test
-    void warningFamilyStaysAvailableWhenNoWorkOrderFactsExistAtAll() {
-        when(adapter.load()).thenReturn(warningFixtureWithoutWorkOrders());
-
-        CockpitOverviewWarningSettingsResponse response =
-                service.load("request-warning", "WARNING", null, null, null);
-
-        assertEquals(2, response.getWarning().getTotal());
-        assertEquals("READY", response.getWarning().getState());
-        assertEquals(1, count(response.getWarning().getStatusDistribution(), "CLOSED"));
-        // 报警族没有工单事实 → 处置率显式「不适用」,不是 0%。
-        assertEquals("EMPTY", response.getAlarm().getHandlingEfficiency().getState());
-        assertEquals("NO_ELIGIBLE_WORK_ORDERS", response.getAlarm().getHandlingEfficiency().getReason());
-    }
-
-    /** 空态:两族都显式 EMPTY,预警族处置率不适用。 */
-    @Test
-    void emptyFamilyUsesExplicitEmptyState() {
-        when(adapter.load()).thenReturn(emptyFixture());
-
-        CockpitOverviewWarningSettingsResponse response =
-                service.load("request-empty", "ALARM", null, null, null);
-
-        assertEquals("EMPTY", response.getAlarm().getState());
-        assertEquals("NO_EVENTS", response.getAlarm().getStateReason());
-        assertEquals(0, response.getAlarm().getTotal());
-        assertEquals("EMPTY", response.getWarning().getState());
-        assertEquals("EMPTY", response.getWarning().getHandlingEfficiency().getState());
-        assertEquals("NO_WARNINGS", response.getWarning().getHandlingEfficiency().getReason());
-        // 空态下分布仍全铺已知桶,只是计数为 0。
-        assertEquals(6, response.getWarning().getStatusDistribution().size());
-        assertEquals(0, sum(response.getWarning().getStatusDistribution()));
-    }
-
-    @Test
-    void missingSnapshotUsesExplicitEmptyFreshness() {
-        when(adapter.load()).thenReturn(null);
-
-        CockpitOverviewWarningSettingsResponse response =
-                service.load("request-missing", "WARNING", null, null, null);
-
-        assertEquals("EMPTY", response.getFreshness().getStatus());
-        assertEquals("NO_SNAPSHOT", response.getFreshness().getReason());
-        assertNull(response.getUpdatedAt());
-        assertEquals("EMPTY", response.getWarning().getState());
-    }
-
-    /** 趋势窗口跟随 `range`:窗口外桶被裁掉,窗口内保留。 */
-    @Test
-    void trendWindowFollowsTheDeclaredRange() {
-        when(adapter.load()).thenReturn(warningFixture());
-
-        CockpitOverviewWarningSettingsResponse response =
-                service.load("request-range", "WARNING", "LAST_7_DAYS", null, null);
-
-        assertEquals("LAST_7_DAYS", response.getRange().getType());
-        List<String> buckets = response.getWarning().getTrend().stream()
-                .map(CockpitOverviewWarningSettingsResponse.TrendPoint::getBucket)
-                .collect(Collectors.toList());
-        // 固定时钟 2026-09-02T10:00+08:00 起算近 7 日 → 只保留 2026-09-01。
-        assertTrue(buckets.contains("2026-09-01"));
-        assertTrue(!buckets.contains("2026-08-01"));
-    }
-
-    private static int count(List<CockpitOverviewWarningSettingsResponse.Bucket> buckets, String code) {
-        return buckets.stream()
-                .filter(bucket -> code.equals(bucket.getCode()))
-                .mapToInt(CockpitOverviewWarningSettingsResponse.Bucket::getCount)
-                .findFirst().orElse(-1);
-    }
-
-    private static int sum(List<CockpitOverviewWarningSettingsResponse.Bucket> buckets) {
-        return buckets.stream().mapToInt(CockpitOverviewWarningSettingsResponse.Bucket::getCount).sum();
-    }
-
-    /** 预警族六态各一条(CLOSED 两条)+ 等级/行业/片区维度齐全。 */
-    private static CockpitOverviewWarningSettingsSnapshot warningFixture() {
-        return new CockpitOverviewWarningSettingsSnapshot(
-                "2026-09-02T09:59:50+08:00",
-                Arrays.asList(
-                        warning("W-DRAFT", "DRAFT", 2, "GAS", 0),
-                        warning("W-PENDING", "PENDING", 3, "WATER_SUPPLY", 1),
-                        warning("W-RECEIVED", "RECEIVED", 3, "WATER_SUPPLY", 1),
-                        warning("W-PROCESSING", "PROCESSING", null, null, null),
-                        warning("W-HANDLED", "HANDLED", 3, "WATER_SUPPLY", 1),
-                        warning("W-CLOSED", "CLOSED", 2, "GAS", 0)),
-                Arrays.asList(
-                        new CockpitOverviewWarningSettingsSnapshot.SourceTrendPoint(
-                                "WARNING", "2026-09-01", 2, 1),
-                        new CockpitOverviewWarningSettingsSnapshot.SourceTrendPoint(
-                                "WARNING", "2026-08-01", 1, 0)),
-                Collections.emptyList());
-    }
-
-    /** 预警族有数据、工单事实为空:验证预警不再依赖工单。 */
-    private static CockpitOverviewWarningSettingsSnapshot warningFixtureWithoutWorkOrders() {
-        return new CockpitOverviewWarningSettingsSnapshot(
-                "2026-09-02T09:59:50+08:00",
-                Arrays.asList(
-                        warning("W-1", "CLOSED", 2, "GAS", 0),
-                        warning("W-2", "PROCESSING", 3, "GAS", 0)),
-                Collections.emptyList(),
-                Collections.emptyList());
-    }
-
-    /** 报警族:工单口径(状态 0–7 各一张)+ 自身生命周期(1 已处理 / 2 未处理 / 1 未回联 / 1 脏码)。 */
-    private static CockpitOverviewWarningSettingsSnapshot alarmFixture() {
-        return new CockpitOverviewWarningSettingsSnapshot(
-                "2026-09-02T09:59:50+08:00",
-                Arrays.asList(
-                        alarm("A-1", "HANDLED", 5, 3, "GAS", 0),
-                        alarm("A-2", "UNHANDLED", 3, 3, "WATER_SUPPLY", 1),
-                        alarm("A-3", "UNHANDLED", 7, 2, "GAS", 0),
-                        alarm("A-4", null, null, 2, "GAS", 0),
-                        alarm("A-5", null, 9, 2, "GAS", 0)),
-                Collections.emptyList(),
-                Arrays.asList(
-                        order(0), order(1), order(2), order(3),
-                        order(4), order(5), order(6), order(7)));
-    }
-
-    private static CockpitOverviewWarningSettingsSnapshot.SourceEvent warning(
-            String code, String status, Integer level, String industry, Integer district) {
-        return new CockpitOverviewWarningSettingsSnapshot.SourceEvent(
-                "WARNING", code, "DEV-" + code, null, null, status, level, district, industry);
-    }
-
-    private static CockpitOverviewWarningSettingsSnapshot.SourceEvent alarm(
-            String code, String status, Integer workOrderState, Integer level,
-            String industry, Integer district) {
-        return new CockpitOverviewWarningSettingsSnapshot.SourceEvent(
-                "ALARM", code, "DEV-" + code, "WO-" + code, workOrderState,
-                status, level, district, industry);
-    }
-
-    private static CockpitOverviewWarningSettingsSnapshot.SourceWorkOrder order(Integer state) {
-        return new CockpitOverviewWarningSettingsSnapshot.SourceWorkOrder(
-                state, "2026-09-02T09:00:00+08:00");
-    }
-
-    private static CockpitOverviewWarningSettingsSnapshot emptyFixture() {
-        return new CockpitOverviewWarningSettingsSnapshot(
-                "2026-09-02T09:59:50+08:00",
-                Collections.emptyList(),
-                Collections.emptyList());
-    }
-}

+ 0 - 27
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitPipeNetworkCrossEndpointContractTest.java

@@ -11,16 +11,12 @@ import com.zksy.base.service.EquipmentBaseService;
 import com.zksy.base.service.EquipmentTypeService;
 import com.zksy.base.service.ManholeBaseService;
 import com.zksy.base.service.PipeNetworkBaseService;
-import com.zksy.cockpit.device.BusinessCockpitDeviceBoundaryAdapter;
-import com.zksy.cockpit.device.CockpitDeviceBoundaryService;
 import com.zksy.cockpit.infrastructure.BusinessCockpitInfrastructureBaseArchivesAdapter;
 import com.zksy.cockpit.infrastructure.BusinessCockpitInfrastructureManagementInformationAdapter;
 import com.zksy.cockpit.infrastructure.BusinessCockpitInfrastructureOperatingInformationAdapter;
 import com.zksy.cockpit.infrastructure.CockpitInfrastructureBaseArchivesService;
 import com.zksy.cockpit.infrastructure.CockpitInfrastructureManagementInformationService;
 import com.zksy.cockpit.infrastructure.CockpitInfrastructureOperatingInformationService;
-import com.zksy.cockpit.overview.BusinessCockpitOverviewInfrastructureAdapter;
-import com.zksy.cockpit.overview.CockpitOverviewInfrastructureService;
 import com.zksy.drainage.service.DrainageGateInfoService;
 import com.zksy.drainage.service.DrainageStorageInfoService;
 
@@ -91,12 +87,6 @@ class CockpitPipeNetworkCrossEndpointContractTest {
                 new BusinessCockpitInfrastructureOperatingInformationAdapter(plants, stations, pipes, gates, storages,
                         mock(ManholeBaseService.class)),
                 CLOCK, 60).load("operating", null, null, null, null));
-        JsonNode overview = JSON.valueToTree(new CockpitOverviewInfrastructureService(
-                new BusinessCockpitOverviewInfrastructureAdapter(equipmentTypes, equipment, catalog),
-                CLOCK).load("overview"));
-        JsonNode boundary = JSON.valueToTree(new CockpitDeviceBoundaryService(
-                new BusinessCockpitDeviceBoundaryAdapter(equipmentTypes, equipment, pipes), CLOCK).load("boundary"));
-
         Map<String, Integer> expected = new HashMap<>();
         expected.put("GAS", 2);
         expected.put("WATER_SUPPLY", 2);
@@ -123,28 +113,11 @@ class CockpitPipeNetworkCrossEndpointContractTest {
             operatingCounts.put(row.path("industry").path("code").asText(), count);
         }
         assertEquals(expected, operatingCounts, "运行信息的管网指标条数必须与其它端点一致");
-        Map<String, Integer> overviewCounts = zeroCounts();
-        for (JsonNode row : overview.path("industries")) {
-            overviewCounts.put(row.path("code").asText(), row.path("facilityCount").asInt());
-        }
-        assertEquals(expected, overviewCounts, "总体概览不得把管网行业置空");
-        Map<String, Integer> boundaryCounts = zeroCounts();
-        for (JsonNode row : boundary.path("facilities")) {
-            if (row.path("formalScope").asBoolean()) {
-                boundaryCounts.merge(row.path("industry").asText(), 1, Integer::sum);
-            }
-        }
-        assertEquals(expected, boundaryCounts, "设备边界设施不能借用设备类型命名空间");
-
         assertEquals(6, archives.path("totals").path("facilityCount").asInt());
         assertEquals(6, management.path("totals").path("facilityCount").asInt());
-        assertEquals(6, overview.path("totals").path("facilityCount").asInt());
-        assertEquals(types.size(), boundary.path("statistics").path("facilityCount").asInt());
         assertEquals(unknown, archives.path("excluded").path("unknownTypeCount").asInt());
         assertEquals(unknown, management.path("excluded").path("unknownIndustryCount").asInt());
         assertEquals(unknown, operating.path("excluded").path("unknownIndustryCount").asInt());
-        assertEquals(unknown, overview.path("excluded").path("unknownTypeCount").asInt());
-        assertEquals(unknown, boundary.path("statistics").path("unknownTypeCount").asInt());
     }
 
     private static Map<String, Integer> zeroCounts() {

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

@@ -30,7 +30,6 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
 
 class CockpitTypeMetricsControllerTest {
     private static final String DEVICE_CODE = "TC-PS-WS-202609020012";
-    private static final String NOW = "2026-09-02T10:00:00+08:00";
 
     private CockpitTypeMetricsAdapter adapter;
     private MockMvc mockMvc;
@@ -86,71 +85,6 @@ class CockpitTypeMetricsControllerTest {
                 .andExpect(jsonPath("$.data.metrics[0].freshness").value("STALE"));
     }
 
-    @Test
-    void historyMetricsReturnOrderedPagedContract() throws Exception {
-        when(adapter.loadHistory(
-                DEVICE_CODE,
-                java.time.OffsetDateTime.parse("2026-09-01T10:00:00+08:00"),
-                java.time.OffsetDateTime.parse("2026-09-02T10:00:00+08:00"),
-                1,
-                100)).thenReturn(sewageHistoryFixture());
-
-        mockMvc.perform(get("/api/cockpit/v1/equipments/" + DEVICE_CODE + "/metrics/history")
-                        .param("startTime", "2026-09-01T10:00:00+08:00")
-                        .param("endTime", "2026-09-02T10:00:00+08:00")
-                        .param("page", "1")
-                        .param("pageSize", "100")
-                        .header("X-Request-Id", "type-metrics-history-001"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.code").value(200))
-                .andExpect(jsonPath("$.data.requestId").value("type-metrics-history-001"))
-                .andExpect(jsonPath("$.data.apiVersion").value("v1"))
-                .andExpect(jsonPath("$.data.readOnly").value(true))
-                .andExpect(jsonPath("$.data.startTime").value("2026-09-01T10:00:00+08:00"))
-                .andExpect(jsonPath("$.data.endTime").value("2026-09-02T10:00:00+08:00"))
-                .andExpect(jsonPath("$.data.timezone").value("Asia/Shanghai"))
-                .andExpect(jsonPath("$.data.page").value(1))
-                .andExpect(jsonPath("$.data.pageSize").value(100))
-                .andExpect(jsonPath("$.data.total").value(2))
-                .andExpect(jsonPath("$.data.metrics", org.hamcrest.Matchers.hasSize(1)))
-                .andExpect(jsonPath("$.data.metrics[0].metricCode").value("PH"))
-                .andExpect(jsonPath("$.data.metrics[0].points", org.hamcrest.Matchers.hasSize(2)))
-                .andExpect(jsonPath("$.data.metrics[0].points[0].sampledAt").value("2026-09-02T09:58:00+08:00"))
-                .andExpect(jsonPath("$.data.metrics[0].points[1].sampledAt").value("2026-09-02T09:59:00+08:00"))
-                .andExpect(jsonPath("$.data.metrics[0].points[0].freshness").value("HISTORICAL"));
-    }
-
-    @Test
-    void historyResponseUsesAdapterTotalForPartialPage() throws Exception {
-        when(adapter.loadHistory(
-                DEVICE_CODE,
-                java.time.OffsetDateTime.parse("2026-09-01T10:00:00+08:00"),
-                java.time.OffsetDateTime.parse("2026-09-02T10:00:00+08:00"),
-                2,
-                1)).thenReturn(partialSewageHistoryFixture());
-
-        mockMvc.perform(get("/api/cockpit/v1/equipments/" + DEVICE_CODE + "/metrics/history")
-                        .param("startTime", "2026-09-01T10:00:00+08:00")
-                        .param("endTime", "2026-09-02T10:00:00+08:00")
-                        .param("page", "2")
-                        .param("pageSize", "1"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.page").value(2))
-                .andExpect(jsonPath("$.data.total").value(7))
-                .andExpect(jsonPath("$.data.metrics", org.hamcrest.Matchers.hasSize(1)))
-                .andExpect(jsonPath("$.data.metrics[0].points", org.hamcrest.Matchers.hasSize(1)));
-    }
-
-    @Test
-    void historyRejectsInvertedRange() throws Exception {
-        mockMvc.perform(get("/api/cockpit/v1/equipments/" + DEVICE_CODE + "/metrics/history")
-                        .param("startTime", "2026-09-02T10:00:00+08:00")
-                        .param("endTime", "2026-09-01T10:00:00+08:00"))
-                .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.code").value(400))
-                .andExpect(jsonPath("$.data.category").value("INVALID_REQUEST"));
-    }
-
     @Test
     void currentMetricsReturnEmptyStateWithoutMistakingItForFailure() throws Exception {
         when(adapter.loadCurrent(DEVICE_CODE)).thenReturn(emptyFixture());
@@ -213,25 +147,6 @@ class CockpitTypeMetricsControllerTest {
                                 null)));
     }
 
-    private CockpitTypeMetricsSnapshot sewageHistoryFixture() {
-        return new CockpitTypeMetricsSnapshot(
-                DEVICE_CODE,
-                "ws_sewage_environment",
-                "污水环境监测设备",
-                Collections.singletonList(new CockpitMetricSnapshot(
-                        "PH",
-                        "pH",
-                        null,
-                        "",
-                        null,
-                        null,
-                        Arrays.asList(
-                                new CockpitMetricSnapshot.PointSnapshot(
-                                        new BigDecimal("7.3"), "NORMAL", "2026-09-02T09:59:00+08:00"),
-                                new CockpitMetricSnapshot.PointSnapshot(
-                                        new BigDecimal("7.2"), "NORMAL", "2026-09-02T09:58:00+08:00")))));
-    }
-
     private CockpitTypeMetricsSnapshot emptyFixture() {
         return new CockpitTypeMetricsSnapshot(DEVICE_CODE, "gas_pressure", "燃气压力计", Collections.emptyList());
     }
@@ -253,20 +168,4 @@ class CockpitTypeMetricsControllerTest {
                 sampledAt,
                 points);
     }
-    private CockpitTypeMetricsSnapshot partialSewageHistoryFixture() {
-        return new CockpitTypeMetricsSnapshot(
-                DEVICE_CODE,
-                "ws_sewage_environment",
-                "污水环境监测设备",
-                Collections.singletonList(new CockpitMetricSnapshot(
-                        "PH",
-                        "pH",
-                        null,
-                        "",
-                        null,
-                        null,
-                        Collections.singletonList(new CockpitMetricSnapshot.PointSnapshot(
-                                new BigDecimal("7.2"), "NORMAL", "2026-09-02T09:59:00+08:00")))),
-                7);
-    }
 }

+ 0 - 247
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitWorkOrderAssociationContractTest.java

@@ -1,247 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
-import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
-import com.zksy.base.alarm.domain.AlarmData;
-import com.zksy.base.alarm.service.AlarmDataService;
-import com.zksy.base.domain.EquipmentBase;
-import com.zksy.base.mapper.EquipmentBaseMapper;
-import com.zksy.base.warning.mapper.AlarmWarningRelMapper;
-import com.zksy.base.warning.service.EarlyWarningService;
-import com.zksy.cockpit.workorder.BusinessCockpitWorkOrderReadAdapter;
-import com.zksy.cockpit.workorder.CockpitWorkOrderReadService;
-import com.zksy.ops.domain.WorkOrder;
-import com.zksy.ops.service.WorkOrderService;
-import org.apache.ibatis.builder.MapperBuilderAssistant;
-import org.apache.ibatis.exceptions.PersistenceException;
-import org.springframework.dao.DataAccessResourceFailureException;
-import org.apache.ibatis.session.Configuration;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.mockito.ArgumentCaptor;
-import org.springframework.test.web.servlet.MockMvc;
-import org.springframework.test.web.servlet.ResultActions;
-import org.springframework.test.web.servlet.setup.MockMvcBuilders;
-
-import java.time.Clock;
-import java.time.Instant;
-import java.time.ZoneOffset;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-
-import static org.hamcrest.Matchers.hasSize;
-import static org.hamcrest.Matchers.nullValue;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
-
-/** 真实适配器贯穿三个 HTTP 入口,锁定执行票 21 的关联口径。 */
-class CockpitWorkOrderAssociationContractTest {
-    private static final String DEVICE_CODE = "21119740";
-    private static final String EQUIPMENT_ID = "equipment-id";
-    private static final String ORDER_CODE = "WO202610101511303516";
-    private static final String ALARM_ID = "cd57be42bd18d02f7d3390fb98539b93";
-    private static final String ALARM_NO = "BJ202610101511305660";
-    private static final String ASSOCIATED_AT = "2026-10-10T15:11:30+08:00";
-    private static final String BASE = "/api/cockpit/v1";
-
-    private WorkOrderService workOrderService;
-    private AlarmDataService alarmDataService;
-    private LambdaQueryChainWrapper<WorkOrder> orderQuery;
-    private MockMvc mockMvc;
-    private WorkOrder linkedOrder;
-    private AlarmData linkedAlarm;
-
-    @BeforeEach
-    @SuppressWarnings("unchecked")
-    void setUp() {
-        for (Class<?> entity : Arrays.asList(EquipmentBase.class, WorkOrder.class, AlarmData.class)) {
-            TableInfoHelper.initTableInfo(new MapperBuilderAssistant(new Configuration(), ""), entity);
-        }
-        workOrderService = mock(WorkOrderService.class);
-        alarmDataService = mock(AlarmDataService.class);
-        EquipmentBaseMapper equipmentMapper = mock(EquipmentBaseMapper.class);
-        EquipmentBase equipment = new EquipmentBase();
-        equipment.setEquipmentId(EQUIPMENT_ID);
-        equipment.setEquipmentCode(DEVICE_CODE);
-        when(equipmentMapper.selectOne(any(LambdaQueryWrapper.class))).thenReturn(equipment);
-        when(equipmentMapper.selectById(EQUIPMENT_ID)).thenReturn(equipment);
-        // 详情字段按整页批量取设备(一次 selectBatchIds),设备编码/名称/位置同源。
-        when(equipmentMapper.selectBatchIds(any())).thenReturn(Collections.singletonList(equipment));
-
-        linkedOrder = order(279L, ORDER_CODE);
-        linkedAlarm = new AlarmData();
-        linkedAlarm.setId(ALARM_ID);
-        linkedAlarm.setAlarmNo(ALARM_NO);
-        linkedAlarm.setWorkOrderId(279L);
-        when(workOrderService.list(any(LambdaQueryWrapper.class)))
-                .thenReturn(Collections.singletonList(linkedOrder));
-        when(alarmDataService.list(any(LambdaQueryWrapper.class)))
-                .thenReturn(Collections.singletonList(linkedAlarm));
-        when(alarmDataService.getById(ALARM_ID)).thenReturn(linkedAlarm);
-        when(workOrderService.listLogs(279L)).thenReturn(Collections.emptyList());
-        orderQuery = mock(LambdaQueryChainWrapper.class);
-        when(workOrderService.lambdaQuery()).thenReturn(orderQuery);
-        when(orderQuery.eq(any(), any())).thenReturn(orderQuery);
-        when(orderQuery.one()).thenReturn(linkedOrder);
-
-        BusinessCockpitWorkOrderReadAdapter adapter = new BusinessCockpitWorkOrderReadAdapter(
-                workOrderService, mock(EarlyWarningService.class), mock(AlarmWarningRelMapper.class),
-                alarmDataService, equipmentMapper, mock(com.zksy.base.service.EquipmentTypeService.class),
-                mock(com.zksy.system.mapper.SysDictDataMapper.class),
-                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();
-    }
-
-    @Test
-    @SuppressWarnings("unchecked")
-    void sameOrderHasIdenticalAssociationAcrossDeviceAlarmAndTimeline() throws Exception {
-        expectLinked(mockMvc.perform(get(BASE + "/equipments/" + DEVICE_CODE + "/work-orders")),
-                "$.data.workOrders[0]")
-                .andExpect(jsonPath("$.data.unassociatedWorkOrderCount").value(0));
-        expectLinked(mockMvc.perform(get(BASE + "/events/ALARM/" + ALARM_ID + "/work-orders")),
-                "$.data.workOrders[0]")
-                .andExpect(jsonPath("$.data.eventCode").value(ALARM_ID))
-                .andExpect(jsonPath("$.data.unassociatedWorkOrderCount").value(0));
-        expectLinked(mockMvc.perform(get(BASE + "/work-orders/" + ORDER_CODE + "/timeline")),
-                "$.data.workOrder")
-                .andExpect(jsonPath("$.data.timelineEntries", hasSize(0)));
-
-        // 三个入口均反查真实工单主键,不能靠设备、工单号或时间猜测。
-        ArgumentCaptor<LambdaQueryWrapper<AlarmData>> queries = ArgumentCaptor.forClass(LambdaQueryWrapper.class);
-        verify(alarmDataService, times(3)).list(queries.capture());
-        for (LambdaQueryWrapper<AlarmData> query : queries.getAllValues()) {
-            assertTrue(query.getSqlSegment().contains("work_order_id IN"));
-            assertEquals(Collections.singletonList(279L),
-                    new java.util.ArrayList<>(query.getParamNameValuePairs().values()));
-        }
-    }
-
-    @Test
-    void alarmNumberAliasReturnsTheSameAssociationAsDeviceAndTimeline() throws Exception {
-        expectLinked(mockMvc.perform(get(BASE + "/events/ALARM/" + ALARM_NO + "/work-orders")),
-                "$.data.workOrders[0]")
-                .andExpect(jsonPath("$.data.eventCode").value(ALARM_ID));
-        expectLinked(mockMvc.perform(get(BASE + "/equipments/" + DEVICE_CODE + "/work-orders")),
-                "$.data.workOrders[0]");
-        expectLinked(mockMvc.perform(get(BASE + "/work-orders/" + ORDER_CODE + "/timeline")),
-                "$.data.workOrder");
-        ArgumentCaptor<LambdaQueryWrapper<AlarmData>> queries = ArgumentCaptor.forClass(LambdaQueryWrapper.class);
-        verify(alarmDataService, times(4)).list(queries.capture());
-        LambdaQueryWrapper<AlarmData> aliasQuery = queries.getAllValues().get(0);
-        assertTrue(aliasQuery.getSqlSegment().contains("alarm_no ="));
-        assertEquals(Collections.singletonList(ALARM_NO),
-                new java.util.ArrayList<>(aliasQuery.getParamNameValuePairs().values()));
-    }
-
-    @Test
-    void unlinkedOrderIsExplicitlyFalseInDeviceAndTimelineAndAbsentFromAlarm() throws Exception {
-        when(alarmDataService.list(any(LambdaQueryWrapper.class))).thenReturn(Collections.emptyList());
-        linkedAlarm.setWorkOrderId(null);
-        expectUnlinked(mockMvc.perform(get(BASE + "/equipments/" + DEVICE_CODE + "/work-orders")),
-                "$.data.workOrders[0]")
-                .andExpect(jsonPath("$.data.unassociatedWorkOrderCount").value(1));
-        expectUnlinked(mockMvc.perform(get(BASE + "/work-orders/" + ORDER_CODE + "/timeline")),
-                "$.data.workOrder");
-        mockMvc.perform(get(BASE + "/events/ALARM/" + ALARM_ID + "/work-orders"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.workOrders", hasSize(0)))
-                .andExpect(jsonPath("$.data.state").value("EMPTY"));
-    }
-
-    @Test
-    void anotherOrderOnSameDeviceDoesNotInheritLinkedOrdersAlarm() throws Exception {
-        WorkOrder orphan = order(281L, "WO-UNLINKED");
-        List<WorkOrder> orders = Arrays.asList(linkedOrder, orphan);
-        when(workOrderService.list(any(LambdaQueryWrapper.class))).thenReturn(orders);
-        expectLinked(mockMvc.perform(get(BASE + "/equipments/" + DEVICE_CODE + "/work-orders")),
-                "$.data.workOrders[0]");
-        expectUnlinked(mockMvc.perform(get(BASE + "/equipments/" + DEVICE_CODE + "/work-orders")),
-                "$.data.workOrders[1]")
-                .andExpect(jsonPath("$.data.unassociatedWorkOrderCount").value(1));
-        when(orderQuery.one()).thenReturn(orphan);
-        expectUnlinked(mockMvc.perform(get(BASE + "/work-orders/WO-UNLINKED/timeline")),
-                "$.data.workOrder");
-    }
-
-    @Test
-    void missingOrderReturnsNotFoundBeforeReadingAssociations() throws Exception {
-        when(orderQuery.one()).thenReturn(null);
-        mockMvc.perform(get(BASE + "/work-orders/MISSING/timeline"))
-                .andExpect(status().isNotFound());
-        verify(alarmDataService, never()).list(any(LambdaQueryWrapper.class));
-    }
-
-    @Test
-    void duplicateAlarmReferencesFailAcrossAllScopesRegardlessOfOrder() throws Exception {
-        AlarmData otherAlarm = new AlarmData();
-        otherAlarm.setId("another-alarm");
-        otherAlarm.setWorkOrderId(279L);
-        when(alarmDataService.getById(otherAlarm.getId())).thenReturn(otherAlarm);
-        for (List<AlarmData> alarms : Arrays.asList(
-                Arrays.asList(linkedAlarm, otherAlarm), Arrays.asList(otherAlarm, linkedAlarm))) {
-            when(alarmDataService.list(any(LambdaQueryWrapper.class))).thenReturn(alarms);
-            expectAssociationFailure(mockMvc.perform(get(BASE + "/equipments/" + DEVICE_CODE + "/work-orders")));
-            expectAssociationFailure(mockMvc.perform(get(BASE + "/work-orders/" + ORDER_CODE + "/timeline")));
-            expectAssociationFailure(mockMvc.perform(get(BASE + "/events/ALARM/" + ALARM_ID + "/work-orders")));
-            expectAssociationFailure(mockMvc.perform(get(BASE + "/events/ALARM/" + otherAlarm.getId() + "/work-orders")));
-        }
-    }
-
-    @Test
-    void databaseAssociationReadFailureDoesNotBecomeSuccessfulUnassociatedOrder() throws Exception {
-        for (RuntimeException failure : Arrays.asList(
-                new DataAccessResourceFailureException("database unavailable"),
-                new PersistenceException("association query failed"))) {
-            org.mockito.Mockito.doThrow(failure).when(alarmDataService).list(any(LambdaQueryWrapper.class));
-            expectAssociationFailure(mockMvc.perform(get(BASE + "/equipments/" + DEVICE_CODE + "/work-orders")));
-            expectAssociationFailure(mockMvc.perform(get(BASE + "/work-orders/" + ORDER_CODE + "/timeline")));
-            expectAssociationFailure(mockMvc.perform(get(BASE + "/events/ALARM/" + ALARM_ID + "/work-orders")));
-        }
-    }
-
-    private static ResultActions expectAssociationFailure(ResultActions result) throws Exception {
-        return result.andExpect(status().isInternalServerError())
-                .andExpect(jsonPath("$.data.category").value("SERVER_ERROR"))
-                .andExpect(jsonPath("$.data.workOrder").doesNotExist())
-                .andExpect(jsonPath("$.data.workOrders").doesNotExist());
-    }
-
-    private static ResultActions expectLinked(ResultActions result, String path) throws Exception {
-        return result.andExpect(status().isOk())
-                .andExpect(jsonPath(path + ".workOrderCode").value(ORDER_CODE))
-                .andExpect(jsonPath(path + ".associatedWithCurrentEvent").value(true))
-                .andExpect(jsonPath(path + ".eventAssociation.eventSource").value("ALARM"))
-                .andExpect(jsonPath(path + ".eventAssociation.eventCode").value(ALARM_ID))
-                .andExpect(jsonPath(path + ".eventAssociation.associatedAt").value(ASSOCIATED_AT));
-    }
-
-    private static ResultActions expectUnlinked(ResultActions result, String path) throws Exception {
-        return result.andExpect(status().isOk())
-                .andExpect(jsonPath(path + ".associatedWithCurrentEvent").value(false))
-                .andExpect(jsonPath(path + ".eventAssociation").value(nullValue()));
-    }
-
-    private static WorkOrder order(Long id, String code) {
-        WorkOrder order = new WorkOrder();
-        order.setOrderId(id);
-        order.setOrderNo(code);
-        order.setDeviceId(EQUIPMENT_ID);
-        order.setOrderStatus(5);
-        order.setCreateTime(Date.from(Instant.parse("2026-10-10T07:11:30Z")));
-        return order;
-    }
-}

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

@@ -1,16 +1,7 @@
 package com.zksy.web.controller.cockpit;
 
-import com.zksy.cockpit.foundation.CockpitDeviceNotFoundException;
-import com.zksy.cockpit.foundation.CockpitReadException;
-import com.zksy.cockpit.workorder.CockpitWorkOrderEventAssociation;
 import com.zksy.cockpit.workorder.CockpitWorkOrderReadAdapter;
 import com.zksy.cockpit.workorder.CockpitWorkOrderReadService;
-import com.zksy.cockpit.workorder.CockpitWorkOrderReadSnapshot;
-import com.zksy.cockpit.workorder.CockpitWorkOrderState;
-import com.zksy.cockpit.workorder.CockpitWorkOrderStateDictionary;
-import com.zksy.cockpit.workorder.CockpitWorkOrderSummary;
-import com.zksy.cockpit.workorder.CockpitWorkOrderTimelineEntry;
-import com.zksy.cockpit.workorder.CockpitWorkOrderTimelineSnapshot;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.springframework.test.web.servlet.MockMvc;
@@ -20,23 +11,14 @@ import java.lang.reflect.Method;
 import java.time.Clock;
 import java.time.Instant;
 import java.time.ZoneOffset;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
 
-import static org.hamcrest.Matchers.hasSize;
-import static org.hamcrest.Matchers.nullValue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verifyNoInteractions;
-import static org.mockito.Mockito.when;
-import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
 import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
 import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
 
 class CockpitWorkOrderReadControllerTest {
-    private static final String DEVICE_CODE = "TC-PS-WS-202609020012";
-
     private CockpitWorkOrderReadAdapter adapter;
     private MockMvc mockMvc;
 
@@ -51,175 +33,6 @@ class CockpitWorkOrderReadControllerTest {
                 .build();
     }
 
-    @Test
-    void deviceWorkOrdersReturnEightStateDictionary() throws Exception {
-        when(adapter.loadByDevice(DEVICE_CODE)).thenReturn(sevenStateFixture());
-
-        mockMvc.perform(get("/api/cockpit/v1/equipments/" + DEVICE_CODE + "/work-orders")
-                        .header("X-Request-Id", "work-order-device-001"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.code").value(200))
-                .andExpect(jsonPath("$.data.requestId").value("work-order-device-001"))
-                .andExpect(jsonPath("$.data.apiVersion").value("v1"))
-                .andExpect(jsonPath("$.data.readOnly").value(true))
-                .andExpect(jsonPath("$.data.deviceCode").value(DEVICE_CODE))
-                .andExpect(jsonPath("$.data.stateDictionary", hasSize(8)))
-                .andExpect(jsonPath("$.data.stateDictionary[0].code").value(0))
-                .andExpect(jsonPath("$.data.stateDictionary[0].name").value("待派单"))
-                .andExpect(jsonPath("$.data.stateDictionary[5].code").value(5))
-                .andExpect(jsonPath("$.data.stateDictionary[5].name").value("已结案"))
-                .andExpect(jsonPath("$.data.stateDictionary[6].code").value(6))
-                .andExpect(jsonPath("$.data.stateDictionary[6].name").value("延期中"))
-                .andExpect(jsonPath("$.data.stateDictionary[7].code").value(7))
-                .andExpect(jsonPath("$.data.stateDictionary[7].name").value("已取消"))
-                .andExpect(jsonPath("$.data.stateDictionary[0].legacyCode").doesNotExist())
-                .andExpect(jsonPath("$.data.stateDictionary[0].deprecated").doesNotExist())
-                .andExpect(jsonPath("$.data.workOrders", hasSize(7)))
-                .andExpect(jsonPath("$.data.workOrders[0].stateCode").value(0))
-                .andExpect(jsonPath("$.data.workOrders[0].stateName").value("待派单"))
-                .andExpect(jsonPath("$.data.workOrders[6].stateCode").value(7))
-                .andExpect(jsonPath("$.data.workOrders[6].stateName").value("已取消"))
-                .andExpect(jsonPath("$.data.workOrders[0].legacyState").doesNotExist())
-                .andExpect(jsonPath("$.data.workOrders[0].deprecatedState").doesNotExist());
-    }
-
-    @Test
-    void eventWorkOrdersPreserveAssociationsAndSeparateEventFamilies() throws Exception {
-        when(adapter.loadByEvent("ALARM", "ALM-20260902-001")).thenReturn(singleAlarmFixture());
-        when(adapter.loadByEvent("WARNING", "WRN-20260902-001")).thenReturn(singleWarningFixture());
-
-        mockMvc.perform(get("/api/cockpit/v1/events/ALARM/ALM-20260902-001/work-orders")
-                        .header("X-Request-Id", "work-order-alarm-001"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.eventSource").value("ALARM"))
-                .andExpect(jsonPath("$.data.eventCode").value("ALM-20260902-001"))
-                .andExpect(jsonPath("$.data.workOrders", hasSize(1)))
-                .andExpect(jsonPath("$.data.workOrders[0].eventAssociation.eventSource").value("ALARM"))
-                .andExpect(jsonPath("$.data.workOrders[0].eventAssociation.eventCode").value("ALM-20260902-001"));
-
-        mockMvc.perform(get("/api/cockpit/v1/events/WARNING/WRN-20260902-001/work-orders")
-                        .header("X-Request-Id", "work-order-warning-001"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.eventSource").value("WARNING"))
-                .andExpect(jsonPath("$.data.eventCode").value("WRN-20260902-001"))
-                .andExpect(jsonPath("$.data.workOrders", hasSize(1)))
-                .andExpect(jsonPath("$.data.workOrders[0].eventAssociation.eventSource").value("WARNING"))
-                .andExpect(jsonPath("$.data.workOrders[0].eventAssociation.eventCode").value("WRN-20260902-001"));
-    }
-
-    @Test
-    void sameDeviceDifferentAlarmTypesCanHaveSeparateWorkOrders() throws Exception {
-        when(adapter.loadByDevice(DEVICE_CODE)).thenReturn(new CockpitWorkOrderReadSnapshot(
-                DEVICE_CODE,
-                null,
-                null,
-                Arrays.asList(
-                        summary("WO-2026090200101", 4, "ALM-WS_ENV_HIGH-001"),
-                        summary("WO-2026090200102", 5, "ALM-WS_ENV_PH-002"))));
-
-        mockMvc.perform(get("/api/cockpit/v1/equipments/" + DEVICE_CODE + "/work-orders"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.workOrders", hasSize(2)))
-                .andExpect(jsonPath("$.data.workOrders[0].eventAssociation.eventCode").value("ALM-WS_ENV_HIGH-001"))
-                .andExpect(jsonPath("$.data.workOrders[1].eventAssociation.eventCode").value("ALM-WS_ENV_PH-002"));
-    }
-
-    /**
-     * 执行票 12 范围 1:「设备详情展示该设备已有全部工单,其中未与当前报警关联的工单必须明确提示」。
-     * 该提示是**显式**的 —— 每张工单带 associatedWithCurrentEvent,另有顶层未关联计数,
-     * 调用方不必从 eventAssociation == null 反推。
-     */
-    @Test
-    void deviceOrdersFlagUnassociatedWorkOrdersExplicitly() throws Exception {
-        when(adapter.loadByDevice(DEVICE_CODE)).thenReturn(new CockpitWorkOrderReadSnapshot(
-                DEVICE_CODE,
-                null,
-                null,
-                Arrays.asList(
-                        summary("WO-ASSOCIATED", 5, "ALARM", "ALM-20260902-001"),
-                        unassociated("WO-LINKED-OTHER", 1),
-                        unassociated("WO-NO-ALARM", 3))));
-
-        mockMvc.perform(get("/api/cockpit/v1/equipments/" + DEVICE_CODE + "/work-orders"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.workOrders", hasSize(3)))
-                // 已关联报警的那张:显式 true 且带回关联信息
-                .andExpect(jsonPath("$.data.workOrders[0].workOrderCode").value("WO-ASSOCIATED"))
-                .andExpect(jsonPath("$.data.workOrders[0].associatedWithCurrentEvent").value(true))
-                .andExpect(jsonPath("$.data.workOrders[0].eventAssociation.eventCode").value("ALM-20260902-001"))
-                // 未关联的两张:显式 false(而非仅 eventAssociation 为 null)
-                .andExpect(jsonPath("$.data.workOrders[1].associatedWithCurrentEvent").value(false))
-                .andExpect(jsonPath("$.data.workOrders[1].eventAssociation").value(nullValue()))
-                .andExpect(jsonPath("$.data.workOrders[2].associatedWithCurrentEvent").value(false))
-                .andExpect(jsonPath("$.data.workOrders[2].eventAssociation").value(nullValue()))
-                .andExpect(jsonPath("$.data.unassociatedWorkOrderCount").value(2));
-    }
-
-    /** 事件维度:命中的工单都是「实际关联本事件」,未关联计数恒为 0。 */
-    @Test
-    void eventOrdersAreAllMarkedAssociated() throws Exception {
-        when(adapter.loadByEvent("ALARM", "ALM-20260902-001")).thenReturn(singleAlarmFixture());
-
-        mockMvc.perform(get("/api/cockpit/v1/events/ALARM/ALM-20260902-001/work-orders"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.workOrders[0].associatedWithCurrentEvent").value(true))
-                .andExpect(jsonPath("$.data.unassociatedWorkOrderCount").value(0));
-    }
-
-    @Test
-    void timelinesAreIndependentBetweenWorkOrders() throws Exception {
-        when(adapter.loadTimeline("WO-2026090200001")).thenReturn(timelineFixture("WO-2026090200001", "3"));
-        when(adapter.loadTimeline("WO-2026090200002")).thenReturn(timelineFixture("WO-2026090200002", "6"));
-
-        mockMvc.perform(get("/api/cockpit/v1/work-orders/WO-2026090200001/timeline")
-                        .header("X-Request-Id", "timeline-001"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.requestId").value("timeline-001"))
-                .andExpect(jsonPath("$.data.workOrderCode").value("WO-2026090200001"))
-                .andExpect(jsonPath("$.data.stateDictionary", hasSize(8)))
-                .andExpect(jsonPath("$.data.timelineEntries", hasSize(3)))
-                .andExpect(jsonPath("$.data.timelineEntries[0].workOrderCode").value("WO-2026090200001"))
-                .andExpect(jsonPath("$.data.timelineEntries[0].stateCode").value(0))
-                .andExpect(jsonPath("$.data.timelineEntries[0].stateName").value("待派单"))
-                .andExpect(jsonPath("$.data.timelineEntries[2].stateCode").value(2))
-                .andExpect(jsonPath("$.data.timelineEntries[2].stateName").value("已接单"))
-                .andExpect(jsonPath("$.data.timelineEntries[0].legacyState").doesNotExist());
-
-        mockMvc.perform(get("/api/cockpit/v1/work-orders/WO-2026090200002/timeline")
-                        .header("X-Request-Id", "timeline-002"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.workOrderCode").value("WO-2026090200002"))
-                .andExpect(jsonPath("$.data.timelineEntries", hasSize(1)))
-                .andExpect(jsonPath("$.data.timelineEntries[0].workOrderCode").value("WO-2026090200002"))
-                .andExpect(jsonPath("$.data.timelineEntries[0].stateCode").value(5))
-                .andExpect(jsonPath("$.data.timelineEntries[0].stateName").value("已结案"));
-    }
-
-    @Test
-    void emptyDeviceWorkOrdersReturnSuccessfulEmptyState() throws Exception {
-        when(adapter.loadByDevice(DEVICE_CODE)).thenReturn(new CockpitWorkOrderReadSnapshot(
-                DEVICE_CODE, null, null, Collections.emptyList()));
-
-        mockMvc.perform(get("/api/cockpit/v1/equipments/" + DEVICE_CODE + "/work-orders"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.state").value("EMPTY"))
-                .andExpect(jsonPath("$.data.stateReason").value("NO_WORK_ORDERS"))
-                .andExpect(jsonPath("$.data.workOrders", hasSize(0)));
-    }
-
-    @Test
-    void missingDeviceAndAdapterFailureUseTypedReadOnlyErrors() throws Exception {
-        when(adapter.loadByDevice("MISSING")).thenThrow(new CockpitDeviceNotFoundException("device not found"));
-        when(adapter.loadByDevice("BROKEN")).thenThrow(new CockpitReadException("read failed"));
-
-        mockMvc.perform(get("/api/cockpit/v1/equipments/MISSING/work-orders"))
-                .andExpect(status().isNotFound())
-                .andExpect(jsonPath("$.data.category").value("NOT_FOUND"));
-        mockMvc.perform(get("/api/cockpit/v1/equipments/BROKEN/work-orders"))
-                .andExpect(status().isInternalServerError())
-                .andExpect(jsonPath("$.data.category").value("SERVER_ERROR"));
-    }
-
     @Test
     void controllerExposesReadOnlyMappedMethodsOnly() throws Exception {
         Method[] methods = CockpitWorkOrderReadController.class.getDeclaredMethods();
@@ -232,105 +45,8 @@ class CockpitWorkOrderReadControllerTest {
             }
         }
 
-        mockMvc.perform(post("/api/cockpit/v1/equipments/" + DEVICE_CODE + "/work-orders"))
+        mockMvc.perform(post("/api/cockpit/v1/work-orders"))
                 .andExpect(status().isMethodNotAllowed());
         verifyNoInteractions(adapter);
     }
-
-    private void assertTrue(boolean condition) {
-        org.junit.jupiter.api.Assertions.assertTrue(condition);
-    }
-
-    private CockpitWorkOrderReadSnapshot sevenStateFixture() {
-        List<CockpitWorkOrderSummary> summaries = new java.util.ArrayList<>();
-        for (int state = 1; state <= 7; state++) {
-            summaries.add(summary("WO-202609020000" + state, state, "ALM-20260902-00" + state));
-        }
-        return new CockpitWorkOrderReadSnapshot(DEVICE_CODE, null, null, summaries);
-    }
-
-    private CockpitWorkOrderReadSnapshot singleAlarmFixture() {
-        return new CockpitWorkOrderReadSnapshot(
-                DEVICE_CODE,
-                "ALARM",
-                "ALM-20260902-001",
-                Collections.singletonList(summary("WO-2026090200001", 1, "ALM-20260902-001")));
-    }
-
-    private CockpitWorkOrderReadSnapshot singleWarningFixture() {
-        return new CockpitWorkOrderReadSnapshot(
-                DEVICE_CODE,
-                "WARNING",
-                "WRN-20260902-001",
-                Collections.singletonList(summary("WO-2026090200002", 2, "WARNING", "WRN-20260902-001")));
-    }
-    private CockpitWorkOrderSummary summary(String workOrderCode, int state, String eventCode) {
-        return summary(workOrderCode, state, "ALARM", eventCode);
-    }
-
-    /** 未与任何报警关联的工单(设备已有全部工单里的那一类)。 */
-    private CockpitWorkOrderSummary unassociated(String workOrderCode, int state) {
-        CockpitWorkOrderState stateEntry = CockpitWorkOrderStateDictionary.byLegacyCode(state);
-        return new CockpitWorkOrderSummary(
-                279L,
-                workOrderCode,
-                DEVICE_CODE,
-                2,
-                "处理异常",
-                stateEntry.getCode(),
-                stateEntry.getName(),
-                "2026-09-02T09:59:30+08:00",
-                "2026-09-02T10:00:00+08:00",
-                "2026-09-02T09:00:00+08:00",
-                null,
-                null,
-                false);
-    }
-
-    private CockpitWorkOrderSummary summary(String workOrderCode, int state, String eventSource, String eventCode) {        CockpitWorkOrderState stateEntry = CockpitWorkOrderStateDictionary.byLegacyCode(state);
-        return new CockpitWorkOrderSummary(
-                280L,
-                workOrderCode,
-                DEVICE_CODE,
-                2,
-                "处理异常",
-                stateEntry.getCode(),
-                stateEntry.getName(),
-                "2026-09-02T09:59:30+08:00",
-                "2026-09-02T10:00:00+08:00",
-                "2026-09-02T09:00:00+08:00",
-                "2026-09-02T09:30:00+08:00",
-                new CockpitWorkOrderEventAssociation(eventSource, eventCode, "2026-09-02T10:00:00+08:00"),
-                // 事件维度构造的工单即「实际关联本事件」(执行票 12 的显式关联标记)。
-                true);
-    }
-
-    private CockpitWorkOrderTimelineSnapshot timelineFixture(String workOrderCode, String lastState) {
-        int state = Integer.parseInt(lastState);
-        CockpitWorkOrderSummary summary = summary(workOrderCode, state, "ALM-20260902-001");
-        if (state >= 6) {
-            return new CockpitWorkOrderTimelineSnapshot(
-                    summary,
-                    Collections.singletonList(entry(workOrderCode, 6)));
-        }
-        return new CockpitWorkOrderTimelineSnapshot(
-                summary,
-                Arrays.asList(
-                        entry(workOrderCode, 1),
-                        entry(workOrderCode, 2),
-                        entry(workOrderCode, 3)));
-    }
-
-    private CockpitWorkOrderTimelineEntry entry(String workOrderCode, int state) {
-        CockpitWorkOrderState stateEntry = CockpitWorkOrderStateDictionary.byLegacyCode(state);
-        return new CockpitWorkOrderTimelineEntry(
-                (long) state,
-                workOrderCode,
-                stateEntry.getCode(),
-                stateEntry.getName(),
-                "创建",
-                "创建工单",
-                "系统",
-                "2026-09-02T09:00:00+08:00");
-    }
 }

+ 0 - 132
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/device/BusinessCockpitDeviceBoundaryAdapter.java

@@ -1,132 +0,0 @@
-package com.zksy.cockpit.device;
-
-import com.zksy.base.domain.EquipmentBase;
-import com.zksy.base.domain.EquipmentType;
-import com.zksy.base.domain.PipeNetworkBase;
-import com.zksy.base.service.EquipmentBaseService;
-import com.zksy.base.service.EquipmentTypeService;
-import com.zksy.base.service.PipeNetworkBaseService;
-import com.zksy.cockpit.foundation.CockpitPipeNetworkType;
-import com.zksy.cockpit.foundation.CockpitTypeIndustry;
-import org.springframework.context.annotation.Primary;
-import org.springframework.stereotype.Component;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.stream.Collectors;
-
-/**
- * 设备边界真实数据适配器(BT-5)。
- *
- * <p>类型字典有两套**互不相干**的命名空间(执行票 20):
- * <ul>
- *   <li><b>设备</b>:{@code equipment_type},对外 {@code code = String(id)},行业沿类型树
- *       上溯推导,{@code objectKind=SMART_DEVICE};{@code equipment_type} 无排水口径列,
- *       因此 {@code drainageScope} 如实为 {@code null}(服务层按非雨水/非污水统计)。</li>
- *   <li><b>管网设施</b>:{@code pipe_network_base.network_type},权威映射见
- *       {@link CockpitPipeNetworkType}({@code 0}-燃气 / {@code 1}-排水 / {@code 2}-供水),
- *       对外使用<strong>管网命名空间</strong>类型码({@code GAS_PIPE/WATER_PIPE/DRAINAGE_PIPE}),
- *       {@code objectKind=FACILITY}。</li>
- * </ul>
- *
- * <p><b>为什么必须隔离</b>:两套编码的数值域重叠而语义不同({@code equipment_type.id=1}
- * 是「供水设备」,{@code network_type=1} 是「排水」)。此前把原始 {@code network_type}
- * 透传给设备类型字典查询,导致 3735 条排水设施被标成「供水设备 / WATER_SUPPLY」、
- * 996 条供水设施被标成「排水设备 / DRAINAGE」——这是命名空间碰撞,不是缺数据。</p>
- *
- * <p><b>不臆造、不丢弃</b>:无法映射的 {@code network_type} 归未分类哨兵码,
- * 该码不在字典中,由服务层计入 {@code unknownTypeCount}(保留在清单,不计入正式行业统计)。
- */
-@Component
-@Primary
-public class BusinessCockpitDeviceBoundaryAdapter implements CockpitDeviceBoundaryAdapter {
-
-    private final EquipmentTypeService equipmentTypeService;
-    private final EquipmentBaseService equipmentBaseService;
-    private final PipeNetworkBaseService pipeNetworkBaseService;
-
-    public BusinessCockpitDeviceBoundaryAdapter(
-            EquipmentTypeService equipmentTypeService,
-            EquipmentBaseService equipmentBaseService,
-            PipeNetworkBaseService pipeNetworkBaseService) {
-        this.equipmentTypeService = equipmentTypeService;
-        this.equipmentBaseService = equipmentBaseService;
-        this.pipeNetworkBaseService = pipeNetworkBaseService;
-    }
-
-    @Override
-    public CockpitDeviceBoundarySnapshot load() {
-        Map<Integer, EquipmentType> types = equipmentTypes();
-
-        List<CockpitDeviceBoundarySnapshot.SourceType> sourceTypes = new ArrayList<>();
-        for (EquipmentType type : safeList(equipmentTypeService.list())) {
-            if (type == null || type.getId() == null) {
-                continue;
-            }
-            sourceTypes.add(new CockpitDeviceBoundarySnapshot.SourceType(
-                    String.valueOf(type.getId()),
-                    type.getTypeName(),
-                    CockpitTypeIndustry.industryOf(type, types),
-                    null,
-                    "SMART_DEVICE"));
-        }
-
-        // 管网设施命名空间的类型条目:与设备类型字典并列注入,objectKind=FACILITY 以示区分。
-        for (CockpitPipeNetworkType.Type pipeType : CockpitPipeNetworkType.types()) {
-            sourceTypes.add(new CockpitDeviceBoundarySnapshot.SourceType(
-                    pipeType.getCode(),
-                    pipeType.getName(),
-                    pipeType.getIndustry(),
-                    null,
-                    "FACILITY"));
-        }
-
-        List<CockpitDeviceBoundarySnapshot.SourceDevice> sourceDevices = new ArrayList<>();
-        for (EquipmentBase device : safeList(equipmentBaseService.list())) {
-            if (device == null || isBlank(device.getEquipmentCode())) {
-                continue;
-            }
-            sourceDevices.add(new CockpitDeviceBoundarySnapshot.SourceDevice(
-                    device.getEquipmentCode().trim(),
-                    device.getEquipmentName(),
-                    device.getEquipmentTypeId() == null ? null : String.valueOf(device.getEquipmentTypeId())));
-        }
-
-        List<CockpitDeviceBoundarySnapshot.SourceFacility> sourceFacilities = new ArrayList<>();
-        for (PipeNetworkBase facility : safeList(pipeNetworkBaseService.list())) {
-            if (facility == null || isBlank(facility.getNetworkCode())) {
-                continue;
-            }
-            // 解析到管网命名空间类型码,而不是把原始 network_type(0/1/2)透传给
-            // equipment_type 字典 —— 后者会造成命名空间碰撞(执行票 20)。
-            sourceFacilities.add(new CockpitDeviceBoundarySnapshot.SourceFacility(
-                    facility.getNetworkCode().trim(),
-                    facility.getNetworkName(),
-                    CockpitPipeNetworkType.typeCodeOf(facility.getNetworkType())));
-        }
-
-        return new CockpitDeviceBoundarySnapshot(sourceTypes, sourceFacilities, sourceDevices);
-    }
-
-    private Map<Integer, EquipmentType> equipmentTypes() {
-        Map<Integer, EquipmentType> result = new HashMap<>();
-        for (EquipmentType type : safeList(equipmentTypeService.list())) {
-            if (type != null && type.getId() != null) {
-                result.put(type.getId(), type);
-            }
-        }
-        return result;
-    }
-
-    private static <T> List<T> safeList(List<T> value) {
-        return value == null ? Collections.emptyList() : value.stream().filter(Objects::nonNull).collect(Collectors.toList());
-    }
-
-    private static boolean isBlank(String value) {
-        return value == null || value.trim().isEmpty();
-    }
-}

+ 0 - 33
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/device/CockpitDeviceBoundary.java

@@ -1,33 +0,0 @@
-package com.zksy.cockpit.device;
-
-public class CockpitDeviceBoundary {
-    private final String deviceCode;
-    private final String deviceName;
-    private final CockpitDeviceType deviceType;
-    private final String industry;
-    private final String drainageScope;
-    private final String objectKind;
-    private final boolean formalScope;
-    private final String typeResolution;
-
-    public CockpitDeviceBoundary(String deviceCode, String deviceName, CockpitDeviceType deviceType,
-            String industry, String drainageScope, String objectKind, boolean formalScope, String typeResolution) {
-        this.deviceCode = deviceCode;
-        this.deviceName = deviceName;
-        this.deviceType = deviceType;
-        this.industry = industry;
-        this.drainageScope = drainageScope;
-        this.objectKind = objectKind;
-        this.formalScope = formalScope;
-        this.typeResolution = typeResolution;
-    }
-
-    public String getDeviceCode() { return deviceCode; }
-    public String getDeviceName() { return deviceName; }
-    public CockpitDeviceType getDeviceType() { return deviceType; }
-    public String getIndustry() { return industry; }
-    public String getDrainageScope() { return drainageScope; }
-    public String getObjectKind() { return objectKind; }
-    public boolean isFormalScope() { return formalScope; }
-    public String getTypeResolution() { return typeResolution; }
-}

+ 0 - 5
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/device/CockpitDeviceBoundaryAdapter.java

@@ -1,5 +0,0 @@
-package com.zksy.cockpit.device;
-
-public interface CockpitDeviceBoundaryAdapter {
-    CockpitDeviceBoundarySnapshot load();
-}

+ 0 - 39
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/device/CockpitDeviceBoundaryResponse.java

@@ -1,39 +0,0 @@
-package com.zksy.cockpit.device;
-
-import java.util.List;
-import com.zksy.cockpit.foundation.CockpitFreshnessStatus;
-
-public class CockpitDeviceBoundaryResponse {
-    private final String requestId;
-    private final String apiVersion;
-    private final boolean readOnly;
-    private final CockpitTypeScope typeScope;
-    private final List<CockpitFacilityBoundary> facilities;
-    private final List<CockpitDeviceBoundary> devices;
-    private final CockpitDeviceBoundaryStatistics statistics;
-
-    public CockpitDeviceBoundaryResponse(String requestId, String apiVersion, boolean readOnly,
-            CockpitTypeScope typeScope, List<CockpitFacilityBoundary> facilities,
-            List<CockpitDeviceBoundary> devices, CockpitDeviceBoundaryStatistics statistics) {
-        this.requestId = requestId;
-        this.apiVersion = apiVersion;
-        this.readOnly = readOnly;
-        this.typeScope = typeScope;
-        this.facilities = facilities;
-        this.devices = devices;
-        this.statistics = statistics;
-    }
-
-    public String getRequestId() { return requestId; }
-    public String getApiVersion() { return apiVersion; }
-    public boolean isReadOnly() { return readOnly; }
-    public CockpitTypeScope getTypeScope() { return typeScope; }
-    public List<CockpitFacilityBoundary> getFacilities() { return facilities; }
-    public List<CockpitDeviceBoundary> getDevices() { return devices; }
-    public CockpitDeviceBoundaryStatistics getStatistics() { return statistics; }
-    public CockpitFreshnessStatus getFreshness() {
-        boolean hasFacilities = facilities != null && !facilities.isEmpty();
-        boolean hasDevices = devices != null && !devices.isEmpty();
-        return hasFacilities || hasDevices ? CockpitFreshnessStatus.CURRENT : CockpitFreshnessStatus.EMPTY;
-    }
-}

+ 0 - 222
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/device/CockpitDeviceBoundaryService.java

@@ -1,222 +0,0 @@
-package com.zksy.cockpit.device;
-
-import com.zksy.cockpit.foundation.CockpitErrorCategory;
-import com.zksy.cockpit.foundation.CockpitErrorPayload;
-import org.springframework.stereotype.Service;
-
-import java.time.Clock;
-import java.time.ZoneId;
-import java.time.format.DateTimeFormatter;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-@Service
-public class CockpitDeviceBoundaryService {
-    private static final List<String> FORMAL_INDUSTRIES =
-            Collections.unmodifiableList(Arrays.asList("GAS", "WATER_SUPPLY", "DRAINAGE", "MANHOLE"));
-    private static final List<String> DRAINAGE_SCOPES =
-            Collections.unmodifiableList(Arrays.asList("RAINWATER", "SEWAGE"));
-    private static final List<String> OBJECT_KINDS =
-            Collections.unmodifiableList(Arrays.asList("FACILITY", "SMART_DEVICE"));
-
-    private final CockpitDeviceBoundaryAdapter adapter;
-    private final Clock clock;
-
-    public CockpitDeviceBoundaryService(CockpitDeviceBoundaryAdapter adapter, Clock clock) {
-        this.adapter = adapter;
-        this.clock = clock;
-    }
-
-    public CockpitDeviceBoundaryResponse load(String requestId) {
-        CockpitDeviceBoundarySnapshot snapshot = adapter.load();
-        Map<String, CockpitDeviceBoundarySnapshot.SourceType> types = snapshot == null || snapshot.getTypes() == null
-                ? Collections.emptyMap()
-                : snapshot.getTypes().stream()
-                        .filter(type -> type.getCode() != null)
-                        .collect(Collectors.toMap(
-                                CockpitDeviceBoundarySnapshot.SourceType::getCode,
-                                type -> type,
-                                (left, right) -> left));
-
-        List<CockpitFacilityBoundary> facilities = snapshot == null || snapshot.getFacilities() == null
-                ? Collections.emptyList()
-                : snapshot.getFacilities().stream()
-                        .map(facility -> mapFacility(facility, types))
-                        .collect(Collectors.toList());
-        List<CockpitDeviceBoundary> devices = snapshot == null || snapshot.getDevices() == null
-                ? Collections.emptyList()
-                : snapshot.getDevices().stream()
-                        .map(device -> mapDevice(device, types))
-                        .collect(Collectors.toList());
-        int typeKindMismatchCount = typeKindMismatchCount(snapshot, types);
-        int unknownTypeCount = unknownTypeCount(snapshot, types);
-
-        return new CockpitDeviceBoundaryResponse(
-                requestId,
-                "v1",
-                true,
-                new CockpitTypeScope(FORMAL_INDUSTRIES, DRAINAGE_SCOPES, OBJECT_KINDS),
-                facilities,
-                devices,
-                statistics(facilities, devices, unknownTypeCount, typeKindMismatchCount));
-    }
-
-    public CockpitErrorPayload serverError(String requestId) {
-        return new CockpitErrorPayload(
-                CockpitErrorCategory.SERVER_ERROR,
-                "驾驶舱设备边界数据暂不可用",
-                requestId,
-                businessTime());
-    }
-
-    private static CockpitFacilityBoundary mapFacility(CockpitDeviceBoundarySnapshot.SourceFacility facility,
-            Map<String, CockpitDeviceBoundarySnapshot.SourceType> types) {
-        CockpitDeviceBoundarySnapshot.SourceType type = types.get(facility.getTypeCode());
-        String industry = type == null ? null : type.getIndustry();
-        return new CockpitFacilityBoundary(
-                facility.getFacilityCode(),
-                facility.getFacilityName(),
-                new CockpitDeviceType(facility.getTypeCode(), type == null ? null : type.getName()),
-                "FACILITY",
-                industry,
-                type != null
-                        && "FACILITY".equals(type.getObjectKind())
-                        && industry != null
-                        && FORMAL_INDUSTRIES.contains(industry));
-    }
-
-    private static CockpitDeviceBoundary mapDevice(CockpitDeviceBoundarySnapshot.SourceDevice device,
-            Map<String, CockpitDeviceBoundarySnapshot.SourceType> types) {
-        CockpitDeviceBoundarySnapshot.SourceType type = types.get(device.getTypeCode());
-        String industry = type == null ? null : type.getIndustry();
-        String drainageScope = type == null ? null : type.getDrainageScope();
-        boolean formalScope = industry != null
-                && FORMAL_INDUSTRIES.contains(industry)
-                && (type != null && "SMART_DEVICE".equals(type.getObjectKind()));
-        String typeResolution = type == null
-                ? "UNKNOWN_TYPE"
-                : "SMART_DEVICE".equals(type.getObjectKind()) ? "RESOLVED" : "TYPE_KIND_MISMATCH";
-        return new CockpitDeviceBoundary(
-                device.getEquipmentCode(),
-                device.getDeviceName(),
-                new CockpitDeviceType(device.getTypeCode(), type == null ? null : type.getName()),
-                industry,
-                drainageScope,
-                "SMART_DEVICE",
-                formalScope,
-                typeResolution);
-    }
-
-    private static CockpitDeviceBoundaryStatistics statistics(List<CockpitFacilityBoundary> facilities,
-            List<CockpitDeviceBoundary> devices, int unknownTypeCount, int typeKindMismatchCount) {
-        Map<String, CockpitIndustryStatistics> industries = new LinkedHashMap<>();
-        industries.put("gas", new CockpitIndustryStatistics());
-        industries.put("waterSupply", new CockpitIndustryStatistics());
-        industries.put("drainage", new CockpitIndustryStatistics());
-        industries.put("manhole", new CockpitIndustryStatistics());
-
-        for (CockpitFacilityBoundary facility : facilities) {
-            if (facility.isFormalScope()) {
-                CockpitIndustryStatistics industryStatistics = industryBucket(industries, facility.getIndustry());
-                if (industryStatistics != null) {
-                    industryStatistics.addFacility();
-                }
-            }
-        }
-        for (CockpitDeviceBoundary device : devices) {
-            if (device.isFormalScope()) {
-                CockpitIndustryStatistics industryStatistics = industryBucket(industries, device.getIndustry());
-                if (industryStatistics != null) {
-                    industryStatistics.addSmartDevice();
-                }
-                if ("DRAINAGE".equals(device.getIndustry()) && "RAINWATER".equals(device.getDrainageScope())) {
-                    industries.get("drainage").addRainwaterSmartDevice();
-                } else if ("DRAINAGE".equals(device.getIndustry()) && "SEWAGE".equals(device.getDrainageScope())) {
-                    industries.get("drainage").addSewageSmartDevice();
-                }
-            }
-        }
-
-        return new CockpitDeviceBoundaryStatistics(
-                facilities.size(),
-                devices.size(),
-                (int) devices.stream().filter(CockpitDeviceBoundary::isFormalScope).count(),
-                unknownTypeCount,
-                typeKindMismatchCount,
-                industries);
-    }
-
-    private static int unknownTypeCount(CockpitDeviceBoundarySnapshot snapshot,
-            Map<String, CockpitDeviceBoundarySnapshot.SourceType> types) {
-        if (snapshot == null) {
-            return 0;
-        }
-        int unknownCount = 0;
-        if (snapshot.getFacilities() != null) {
-            for (CockpitDeviceBoundarySnapshot.SourceFacility facility : snapshot.getFacilities()) {
-                if (!types.containsKey(facility.getTypeCode())) {
-                    unknownCount++;
-                }
-            }
-        }
-        if (snapshot.getDevices() != null) {
-            for (CockpitDeviceBoundarySnapshot.SourceDevice device : snapshot.getDevices()) {
-                if (!types.containsKey(device.getTypeCode())) {
-                    unknownCount++;
-                }
-            }
-        }
-        return unknownCount;
-    }
-
-    private static int typeKindMismatchCount(CockpitDeviceBoundarySnapshot snapshot,
-            Map<String, CockpitDeviceBoundarySnapshot.SourceType> types) {
-        if (snapshot == null) {
-            return 0;
-        }
-        int mismatchCount = 0;
-        if (snapshot.getFacilities() != null) {
-            for (CockpitDeviceBoundarySnapshot.SourceFacility facility : snapshot.getFacilities()) {
-                CockpitDeviceBoundarySnapshot.SourceType type = types.get(facility.getTypeCode());
-                if (type != null && !"FACILITY".equals(type.getObjectKind())) {
-                    mismatchCount++;
-                }
-            }
-        }
-        if (snapshot.getDevices() != null) {
-            for (CockpitDeviceBoundarySnapshot.SourceDevice device : snapshot.getDevices()) {
-                CockpitDeviceBoundarySnapshot.SourceType type = types.get(device.getTypeCode());
-                if (type != null && !"SMART_DEVICE".equals(type.getObjectKind())) {
-                    mismatchCount++;
-                }
-            }
-        }
-        return mismatchCount;
-    }
-
-    private static CockpitIndustryStatistics industryBucket(Map<String, CockpitIndustryStatistics> industries,
-            String industry) {
-        if ("GAS".equals(industry)) {
-            return industries.get("gas");
-        }
-        if ("WATER_SUPPLY".equals(industry)) {
-            return industries.get("waterSupply");
-        }
-        if ("DRAINAGE".equals(industry)) {
-            return industries.get("drainage");
-        }
-        if ("MANHOLE".equals(industry)) {
-            return industries.get("manhole");
-        }
-        return null;
-    }
-
-    private String businessTime() {
-        return DateTimeFormatter.ISO_OFFSET_DATE_TIME
-                .format(clock.instant().atZone(ZoneId.of("Asia/Shanghai")));
-    }
-}

+ 0 - 82
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/device/CockpitDeviceBoundarySnapshot.java

@@ -1,82 +0,0 @@
-package com.zksy.cockpit.device;
-
-import java.util.List;
-
-public class CockpitDeviceBoundarySnapshot {
-    private final List<SourceType> types;
-    private final List<SourceFacility> facilities;
-    private final List<SourceDevice> devices;
-
-    public CockpitDeviceBoundarySnapshot(List<SourceType> types, List<SourceFacility> facilities,
-            List<SourceDevice> devices) {
-        this.types = types;
-        this.facilities = facilities;
-        this.devices = devices;
-    }
-
-    public List<SourceType> getTypes() {
-        return types;
-    }
-
-    public List<SourceFacility> getFacilities() {
-        return facilities;
-    }
-
-    public List<SourceDevice> getDevices() {
-        return devices;
-    }
-
-    public static class SourceType {
-        private final String code;
-        private final String name;
-        private final String industry;
-        private final String drainageScope;
-        private final String objectKind;
-
-        public SourceType(String code, String name, String industry, String drainageScope, String objectKind) {
-            this.code = code;
-            this.name = name;
-            this.industry = industry;
-            this.drainageScope = drainageScope;
-            this.objectKind = objectKind;
-        }
-
-        public String getCode() { return code; }
-        public String getName() { return name; }
-        public String getIndustry() { return industry; }
-        public String getDrainageScope() { return drainageScope; }
-        public String getObjectKind() { return objectKind; }
-    }
-
-    public static class SourceFacility {
-        private final String facilityCode;
-        private final String facilityName;
-        private final String typeCode;
-
-        public SourceFacility(String facilityCode, String facilityName, String typeCode) {
-            this.facilityCode = facilityCode;
-            this.facilityName = facilityName;
-            this.typeCode = typeCode;
-        }
-
-        public String getFacilityCode() { return facilityCode; }
-        public String getFacilityName() { return facilityName; }
-        public String getTypeCode() { return typeCode; }
-    }
-
-    public static class SourceDevice {
-        private final String equipmentCode;
-        private final String deviceName;
-        private final String typeCode;
-
-        public SourceDevice(String equipmentCode, String deviceName, String typeCode) {
-            this.equipmentCode = equipmentCode;
-            this.deviceName = deviceName;
-            this.typeCode = typeCode;
-        }
-
-        public String getEquipmentCode() { return equipmentCode; }
-        public String getDeviceName() { return deviceName; }
-        public String getTypeCode() { return typeCode; }
-    }
-}

+ 0 - 30
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/device/CockpitDeviceBoundaryStatistics.java

@@ -1,30 +0,0 @@
-package com.zksy.cockpit.device;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-public class CockpitDeviceBoundaryStatistics {
-    private final int facilityCount;
-    private final int smartDeviceCount;
-    private final int formalSmartDeviceCount;
-    private final int unknownTypeCount;
-    private final int typeKindMismatchCount;
-    private final Map<String, CockpitIndustryStatistics> industries;
-
-    public CockpitDeviceBoundaryStatistics(int facilityCount, int smartDeviceCount, int formalSmartDeviceCount,
-            int unknownTypeCount, int typeKindMismatchCount, Map<String, CockpitIndustryStatistics> industries) {
-        this.facilityCount = facilityCount;
-        this.smartDeviceCount = smartDeviceCount;
-        this.formalSmartDeviceCount = formalSmartDeviceCount;
-        this.unknownTypeCount = unknownTypeCount;
-        this.typeKindMismatchCount = typeKindMismatchCount;
-        this.industries = new LinkedHashMap<>(industries);
-    }
-
-    public int getFacilityCount() { return facilityCount; }
-    public int getSmartDeviceCount() { return smartDeviceCount; }
-    public int getFormalSmartDeviceCount() { return formalSmartDeviceCount; }
-    public int getUnknownTypeCount() { return unknownTypeCount; }
-    public int getTypeKindMismatchCount() { return typeKindMismatchCount; }
-    public Map<String, CockpitIndustryStatistics> getIndustries() { return industries; }
-}

+ 0 - 14
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/device/CockpitDeviceType.java

@@ -1,14 +0,0 @@
-package com.zksy.cockpit.device;
-
-public class CockpitDeviceType {
-    private final String code;
-    private final String name;
-
-    public CockpitDeviceType(String code, String name) {
-        this.code = code;
-        this.name = name;
-    }
-
-    public String getCode() { return code; }
-    public String getName() { return name; }
-}

+ 0 - 27
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/device/CockpitFacilityBoundary.java

@@ -1,27 +0,0 @@
-package com.zksy.cockpit.device;
-
-public class CockpitFacilityBoundary {
-    private final String facilityCode;
-    private final String facilityName;
-    private final CockpitDeviceType facilityType;
-    private final String objectKind;
-    private final String industry;
-    private final boolean formalScope;
-
-    public CockpitFacilityBoundary(String facilityCode, String facilityName, CockpitDeviceType facilityType,
-            String objectKind, String industry, boolean formalScope) {
-        this.facilityCode = facilityCode;
-        this.facilityName = facilityName;
-        this.facilityType = facilityType;
-        this.objectKind = objectKind;
-        this.industry = industry;
-        this.formalScope = formalScope;
-    }
-
-    public String getFacilityCode() { return facilityCode; }
-    public String getFacilityName() { return facilityName; }
-    public CockpitDeviceType getFacilityType() { return facilityType; }
-    public String getObjectKind() { return objectKind; }
-    public String getIndustry() { return industry; }
-    public boolean isFormalScope() { return formalScope; }
-}

+ 0 - 18
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/device/CockpitIndustryStatistics.java

@@ -1,18 +0,0 @@
-package com.zksy.cockpit.device;
-
-public class CockpitIndustryStatistics {
-    private int facilityCount;
-    private int smartDeviceCount;
-    private int rainwaterSmartDeviceCount;
-    private int sewageSmartDeviceCount;
-
-    public int getFacilityCount() { return facilityCount; }
-    public int getSmartDeviceCount() { return smartDeviceCount; }
-    public int getRainwaterSmartDeviceCount() { return rainwaterSmartDeviceCount; }
-    public int getSewageSmartDeviceCount() { return sewageSmartDeviceCount; }
-
-    void addFacility() { facilityCount++; }
-    void addSmartDevice() { smartDeviceCount++; }
-    void addRainwaterSmartDevice() { rainwaterSmartDeviceCount++; }
-    void addSewageSmartDevice() { sewageSmartDeviceCount++; }
-}

+ 0 - 19
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/device/CockpitTypeScope.java

@@ -1,19 +0,0 @@
-package com.zksy.cockpit.device;
-
-import java.util.List;
-
-public class CockpitTypeScope {
-    private final List<String> formalIndustries;
-    private final List<String> drainageScopes;
-    private final List<String> objectKinds;
-
-    public CockpitTypeScope(List<String> formalIndustries, List<String> drainageScopes, List<String> objectKinds) {
-        this.formalIndustries = formalIndustries;
-        this.drainageScopes = drainageScopes;
-        this.objectKinds = objectKinds;
-    }
-
-    public List<String> getFormalIndustries() { return formalIndustries; }
-    public List<String> getDrainageScopes() { return drainageScopes; }
-    public List<String> getObjectKinds() { return objectKinds; }
-}

+ 0 - 13
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/device/EmptyCockpitDeviceBoundaryAdapter.java

@@ -1,13 +0,0 @@
-package com.zksy.cockpit.device;
-
-import org.springframework.stereotype.Component;
-
-import java.util.Collections;
-
-@Component
-public class EmptyCockpitDeviceBoundaryAdapter implements CockpitDeviceBoundaryAdapter {
-    @Override
-    public CockpitDeviceBoundarySnapshot load() {
-        return new CockpitDeviceBoundarySnapshot(Collections.emptyList(), Collections.emptyList(), Collections.emptyList());
-    }
-}

+ 0 - 11
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/event/CockpitEventDetailService.java

@@ -1,8 +1,6 @@
 package com.zksy.cockpit.event;
 
-import com.zksy.base.alarm.domain.AlarmLog;
 import com.zksy.base.alarm.dto.AlarmVO;
-import com.zksy.base.alarm.mapper.AlarmLogMapper;
 import com.zksy.base.alarm.mapper.AlarmOperationsMapper;
 import com.zksy.base.warning.domain.WarningSupervision;
 import com.zksy.base.warning.mapper.AlarmWarningRelMapper;
@@ -17,7 +15,6 @@ import org.springframework.stereotype.Service;
 
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
 /**
@@ -38,7 +35,6 @@ public class CockpitEventDetailService {
 
     private final EarlyWarningMapper warnings;
     private final AlarmOperationsMapper alarms;
-    private final AlarmLogMapper alarmLogs;
     private final WarningDisposalMapper disposals;
     private final WarningAttachmentMapper attachments;
     private final WarningSupervisionMapper supervisions;
@@ -93,13 +89,6 @@ public class CockpitEventDetailService {
         return detail != null ? detail : alarms.selectCockpitDetail(key);
     }
 
-    /** 报警处置流程(与详情分开取,失败只影响这一步)。 */
-    public List<AlarmLog> alarmLogs(String alarmId) {
-        return safe(() -> alarmLogs.selectList(
-                new LambdaQueryWrapper<AlarmLog>().eq(AlarmLog::getAlarmId, alarmId)
-                        .orderByAsc(AlarmLog::getOperTime)));
-    }
-
     /** 下划线列名 → 驼峰键(SQL Map 与 Java Bean 输出口径对齐)。 */
     private static Map<String, Object> camelize(Map<String, Object> source) {
         Map<String, Object> out = new HashMap<>();

+ 0 - 23
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/event/EmptyCockpitEventReadAdapter.java

@@ -1,23 +0,0 @@
-package com.zksy.cockpit.event;
-
-import org.springframework.stereotype.Component;
-
-import java.time.OffsetDateTime;
-
-@Component
-public class EmptyCockpitEventReadAdapter implements CockpitEventReadAdapter {
-    @Override
-    public CockpitEventSnapshot loadCurrent(String deviceCode) {
-        return null;
-    }
-
-    @Override
-    public CockpitEventSnapshot loadHistory(
-            String deviceCode,
-            OffsetDateTime startTime,
-            OffsetDateTime endTime,
-            int page,
-            int pageSize) {
-        return null;
-    }
-}

+ 0 - 108
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/BusinessCockpitOverviewInfrastructureAdapter.java

@@ -1,108 +0,0 @@
-package com.zksy.cockpit.overview;
-
-import com.zksy.base.domain.EquipmentBase;
-import com.zksy.base.domain.EquipmentType;
-import com.zksy.base.service.EquipmentBaseService;
-import com.zksy.base.service.EquipmentTypeService;
-import com.zksy.cockpit.foundation.CockpitTypeIndustry;
-import com.zksy.cockpit.infrastructure.CockpitFacilityCatalog;
-import com.zksy.cockpit.infrastructure.CockpitInfrastructureBaseArchivesSnapshot;
-import org.springframework.context.annotation.Primary;
-import org.springframework.stereotype.Component;
-
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.time.LocalDateTime;
-import java.time.ZoneId;
-import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.stream.Collectors;
-
-/** 设备按类型计数;设施只投影权威目录,禁止另选设施表集合(执行票 31)。 */
-@Component
-@Primary
-public class BusinessCockpitOverviewInfrastructureAdapter implements CockpitOverviewInfrastructureAdapter {
-    private final EquipmentTypeService equipmentTypes;
-    private final EquipmentBaseService equipment;
-    private final CockpitFacilityCatalog facilities;
-
-    public BusinessCockpitOverviewInfrastructureAdapter(EquipmentTypeService equipmentTypes,
-            EquipmentBaseService equipment, CockpitFacilityCatalog facilities) {
-        this.equipmentTypes = equipmentTypes;
-        this.equipment = equipment;
-        this.facilities = facilities;
-    }
-
-    @Override
-    public CockpitOverviewInfrastructureSnapshot load() {
-        List<EquipmentType> deviceTypes = safeList(equipmentTypes.list());
-        Map<Integer, EquipmentType> index = new HashMap<>();
-        for (EquipmentType type : deviceTypes) if (type.getId() != null) index.put(type.getId(), type);
-        List<CockpitOverviewInfrastructureSnapshot.SourceType> types = new ArrayList<>();
-        for (EquipmentType type : deviceTypes) {
-            if (type.getId() != null) types.add(new CockpitOverviewInfrastructureSnapshot.SourceType(
-                    String.valueOf(type.getId()), type.getTypeName(), CockpitTypeIndustry.industryOf(type, index), null, "SMART_DEVICE"));
-        }
-        List<CockpitOverviewInfrastructureSnapshot.SourceCount> counts = new ArrayList<>();
-        Map<Integer, Integer> deviceCounts = new LinkedHashMap<>();
-        String updatedAt = null;
-        for (EquipmentBase device : safeList(equipment.list())) {
-            if (device.getEquipmentTypeId() != null) deviceCounts.merge(device.getEquipmentTypeId(), 1, Integer::sum);
-            updatedAt = latest(updatedAt, format(device.getUpdateTime()));
-            updatedAt = latest(updatedAt, format(device.getCreateTime()));
-        }
-        for (Map.Entry<Integer, Integer> entry : deviceCounts.entrySet()) counts.add(
-                new CockpitOverviewInfrastructureSnapshot.SourceCount("SMART_DEVICE", String.valueOf(entry.getKey()), entry.getValue()));
-
-        CockpitInfrastructureBaseArchivesSnapshot catalog = facilities.load();
-        if (catalog != null) {
-            updatedAt = latest(updatedAt, catalog.getUpdatedAt());
-            for (CockpitInfrastructureBaseArchivesSnapshot.SourceType type : safeList(catalog.getTypes())) {
-                types.add(new CockpitOverviewInfrastructureSnapshot.SourceType(
-                        type.getCode(), type.getName(), type.getIndustry(), null, type.getObjectKind()));
-            }
-            // 未分类哨兵不在正式字典中,由概览服务累计 excluded.unknownTypeCount。
-            Map<String, FacilityAggregate> aggregates = new LinkedHashMap<>();
-            for (CockpitInfrastructureBaseArchivesSnapshot.SourceFacility facility : safeList(catalog.getFacilities())) {
-                FacilityAggregate aggregate = aggregates.computeIfAbsent(facility.getTypeCode(), key -> new FacilityAggregate());
-                aggregate.count++;
-                if (facility.getLengthKm() != null) aggregate.lengthKm =
-                        (aggregate.lengthKm == null ? BigDecimal.ZERO : aggregate.lengthKm).add(facility.getLengthKm());
-            }
-            for (Map.Entry<String, FacilityAggregate> entry : aggregates.entrySet()) {
-                FacilityAggregate aggregate = entry.getValue();
-                counts.add(new CockpitOverviewInfrastructureSnapshot.SourceCount("FACILITY", entry.getKey(), aggregate.count,
-                        new CockpitOverviewInfrastructureSnapshot.SourceValue(
-                                aggregate.lengthKm == null ? null : aggregate.lengthKm.setScale(3, RoundingMode.HALF_UP),
-                                aggregate.lengthKm == null ? null : "km", null)));
-            }
-        }
-        return new CockpitOverviewInfrastructureSnapshot(updatedAt, types, counts);
-    }
-
-    private static class FacilityAggregate {
-        private int count;
-        private BigDecimal lengthKm;
-    }
-
-    private static String latest(String current, String candidate) {
-        if (candidate == null) return current;
-        return current == null || candidate.compareTo(current) > 0 ? candidate : current;
-    }
-
-    private static String format(LocalDateTime value) {
-        return value == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME
-                .format(value.atZone(ZoneId.of("Asia/Shanghai")));
-    }
-
-    private static <T> List<T> safeList(List<T> values) {
-        return values == null ? Collections.emptyList()
-                : values.stream().filter(Objects::nonNull).collect(Collectors.toList());
-    }
-}

+ 0 - 258
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/BusinessCockpitOverviewMonitoringAdapter.java

@@ -1,258 +0,0 @@
-package com.zksy.cockpit.overview;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.zksy.base.domain.EquipmentBase;
-import com.zksy.base.domain.EquipmentStatus;
-import com.zksy.base.domain.EquipmentType;
-import com.zksy.base.domain.MonitorPoint;
-import com.zksy.base.domain.PipeNetworkBase;
-import com.zksy.base.gas.domain.GasMonitorData;
-import com.zksy.base.gas.service.GasMonitorDataService;
-import com.zksy.base.service.EquipmentBaseService;
-import com.zksy.base.service.EquipmentStatusService;
-import com.zksy.base.service.EquipmentTypeService;
-import com.zksy.base.service.MonitorPointService;
-import com.zksy.base.service.PipeNetworkBaseService;
-import com.zksy.base.water.domain.WaterMonitorData;
-import com.zksy.base.water.service.WaterMonitorDataService;
-import com.zksy.cockpit.foundation.CockpitTypeIndustry;
-import org.springframework.context.annotation.Primary;
-import org.springframework.stereotype.Component;
-
-import java.time.LocalDateTime;
-import java.time.ZoneId;
-import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-/**
- * 总体概览-运行监测 真实数据适配器(BT-5)。
- *
- * <p>设备来自 {@code equipment_base},监测状态取 {@code equipment_status}(在线→ONLINE、离线→OFFLINE,
- * 缺失→未知,不产生 STALE——现网无样本过期依据);监测点经 {@code getEquipmentByPoint} 关联设备,
- * 仅当点内设备类型唯一时推导类型编码;设施按 {@code pipe_network_base.network_type} 计为 FACILITY。
- * 指标新鲜度取燃气/水位监测表最新入库时间(无帧 → 不提供)。
- */
-@Component
-@Primary
-public class BusinessCockpitOverviewMonitoringAdapter
-        implements CockpitOverviewMonitoringAdapter {
-
-    private static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
-    private static final ZoneId BUSINESS_ZONE = ZoneId.of("Asia/Shanghai");
-
-    private final EquipmentTypeService equipmentTypeService;
-    private final EquipmentBaseService equipmentBaseService;
-    private final MonitorPointService monitorPointService;
-    private final PipeNetworkBaseService pipeNetworkBaseService;
-    private final EquipmentStatusService equipmentStatusService;
-    private final GasMonitorDataService gasMonitorDataService;
-    private final WaterMonitorDataService waterMonitorDataService;
-
-    public BusinessCockpitOverviewMonitoringAdapter(
-            EquipmentTypeService equipmentTypeService,
-            EquipmentBaseService equipmentBaseService,
-            MonitorPointService monitorPointService,
-            PipeNetworkBaseService pipeNetworkBaseService,
-            EquipmentStatusService equipmentStatusService,
-            GasMonitorDataService gasMonitorDataService,
-            WaterMonitorDataService waterMonitorDataService) {
-        this.equipmentTypeService = equipmentTypeService;
-        this.equipmentBaseService = equipmentBaseService;
-        this.monitorPointService = monitorPointService;
-        this.pipeNetworkBaseService = pipeNetworkBaseService;
-        this.equipmentStatusService = equipmentStatusService;
-        this.gasMonitorDataService = gasMonitorDataService;
-        this.waterMonitorDataService = waterMonitorDataService;
-    }
-
-    @Override
-    public CockpitOverviewMonitoringSnapshot load() {
-        Map<Integer, EquipmentType> types = equipmentTypes();
-
-        List<CockpitOverviewMonitoringSnapshot.SourceType> sourceTypes = new ArrayList<>();
-        for (EquipmentType type : safeList(equipmentTypeService.list())) {
-            if (type == null || type.getId() == null) {
-                continue;
-            }
-            sourceTypes.add(new CockpitOverviewMonitoringSnapshot.SourceType(
-                    String.valueOf(type.getId()),
-                    type.getTypeName(),
-                    CockpitTypeIndustry.industryOf(type, types),
-                    null,
-                    "SMART_DEVICE"));
-        }
-        Set<String> facilityTypeCodes = new LinkedHashSet<>();
-        List<CockpitOverviewMonitoringSnapshot.SourceMonitoringFacility> monitoringFacilities = new ArrayList<>();
-        int infrastructureFacilityCount = 0;
-        for (PipeNetworkBase facility : safeList(pipeNetworkBaseService.list())) {
-            if (facility == null || isBlank(facility.getNetworkCode())) {
-                continue;
-            }
-            infrastructureFacilityCount++;
-            String typeCode = trimToNull(facility.getNetworkType());
-            if (typeCode != null) {
-                facilityTypeCodes.add(typeCode);
-            }
-            monitoringFacilities.add(new CockpitOverviewMonitoringSnapshot.SourceMonitoringFacility(
-                    facility.getNetworkCode().trim(), typeCode));
-        }
-        for (String typeCode : facilityTypeCodes) {
-            sourceTypes.add(new CockpitOverviewMonitoringSnapshot.SourceType(
-                    typeCode, typeCode, null, null, "FACILITY"));
-        }
-
-        Map<String, String> pointTypeByCode = pointTypes(safeList(monitorPointService.list()));
-        List<CockpitOverviewMonitoringSnapshot.SourceMonitoringPoint> monitoringPoints = new ArrayList<>();
-        for (MonitorPoint point : safeList(monitorPointService.list())) {
-            if (point == null || isBlank(point.getPointCode())) {
-                continue;
-            }
-            monitoringPoints.add(new CockpitOverviewMonitoringSnapshot.SourceMonitoringPoint(
-                    point.getPointCode().trim(), pointTypeByCode.get(point.getPointCode().trim())));
-        }
-
-        List<CockpitOverviewMonitoringSnapshot.SourceDevice> sourceDevices = new ArrayList<>();
-        LocalDateTime updatedAt = null;
-        for (EquipmentBase device : safeList(equipmentBaseService.list())) {
-            if (device == null || isBlank(device.getEquipmentCode())) {
-                continue;
-            }
-            updatedAt = latest(updatedAt, device.getUpdateTime());
-            updatedAt = latest(updatedAt, device.getCreateTime());
-            sourceDevices.add(new CockpitOverviewMonitoringSnapshot.SourceDevice(
-                    device.getEquipmentCode().trim(),
-                    device.getEquipmentTypeId() == null ? null : String.valueOf(device.getEquipmentTypeId()),
-                    monitoringState(device.getEquipmentCode().trim())));
-        }
-
-        LocalDateTime metricUpdatedAt = metricUpdatedAt();
-        CockpitOverviewMonitoringSnapshot.SourceMetricFreshness metricFreshness =
-                metricUpdatedAt == null ? null
-                        : new CockpitOverviewMonitoringSnapshot.SourceMetricFreshness(
-                                "CURRENT", offsetTime(metricUpdatedAt));
-
-        return new CockpitOverviewMonitoringSnapshot(
-                offsetTime(updatedAt),
-                metricFreshness,
-                sourceTypes,
-                sourceDevices,
-                monitoringPoints,
-                monitoringFacilities,
-                infrastructureFacilityCount);
-    }
-
-    private Map<String, String> pointTypes(List<MonitorPoint> points) {
-        Map<String, String> result = new HashMap<>();
-        for (MonitorPoint point : points) {
-            if (point == null || isBlank(point.getPointId())) {
-                continue;
-            }
-            Set<String> types = new LinkedHashSet<>();
-            try {
-                for (EquipmentBase device : safeList(equipmentBaseService.getEquipmentByPoint(point.getPointId()))) {
-                    if (device != null && device.getEquipmentTypeId() != null) {
-                        types.add(String.valueOf(device.getEquipmentTypeId()));
-                    }
-                }
-            } catch (RuntimeException ignored) {
-                continue;
-            }
-            if (types.size() == 1 && point.getPointCode() != null) {
-                result.put(point.getPointCode().trim(), types.iterator().next());
-            }
-        }
-        return result;
-    }
-
-    /**
-     * 监测状态:在线/离线取自 {@code equipment_status.online_status};缺失 → null(未知),
-     * 不产生 STALE(无样本过期依据)。
-     */
-    private String monitoringState(String deviceCode) {
-        EquipmentStatus status = null;
-        try {
-            status = equipmentStatusService.getByDeviceCode(deviceCode);
-        } catch (Exception ignored) {
-            return null;
-        }
-        if (status == null || status.getOnlineStatus() == null) {
-            return null;
-        }
-        return Integer.valueOf(1).equals(status.getOnlineStatus()) ? "ONLINE" : "OFFLINE";
-    }
-
-    private LocalDateTime metricUpdatedAt() {
-        LocalDateTime latestGas = latestCreateTime(gasMonitorDataService);
-        LocalDateTime latestWater = latestCreateTime(waterMonitorDataService);
-        return latest(latestGas, latestWater);
-    }
-
-    private LocalDateTime latestCreateTime(GasMonitorDataService service) {
-        List<GasMonitorData> rows = safeList(service.list(
-                new LambdaQueryWrapper<GasMonitorData>()
-                        .orderByDesc(GasMonitorData::getCreateTime)
-                        .last("limit 1")));
-        if (rows.isEmpty() || rows.get(0).getCreateTime() == null) {
-            return null;
-        }
-        return rows.get(0).getCreateTime();
-    }
-
-    private LocalDateTime latestCreateTime(WaterMonitorDataService service) {
-        List<WaterMonitorData> rows = safeList(service.list(
-                new LambdaQueryWrapper<WaterMonitorData>()
-                        .orderByDesc(WaterMonitorData::getCreateTime)
-                        .last("limit 1")));
-        if (rows.isEmpty() || rows.get(0).getCreateTime() == null) {
-            return null;
-        }
-        return rows.get(0).getCreateTime();
-    }
-
-    private Map<Integer, EquipmentType> equipmentTypes() {
-        Map<Integer, EquipmentType> result = new HashMap<>();
-        for (EquipmentType type : safeList(equipmentTypeService.list())) {
-            if (type != null && type.getId() != null) {
-                result.put(type.getId(), type);
-            }
-        }
-        return result;
-    }
-
-    private static LocalDateTime latest(LocalDateTime current, LocalDateTime candidate) {
-        if (candidate == null) {
-            return current;
-        }
-        if (current == null || candidate.isAfter(current)) {
-            return candidate;
-        }
-        return current;
-    }
-
-    private static String offsetTime(LocalDateTime value) {
-        return value == null ? null : TIME_FORMATTER.format(value.atZone(BUSINESS_ZONE).toOffsetDateTime());
-    }
-
-    private static String trimToNull(String value) {
-        if (value == null || value.trim().isEmpty()) {
-            return null;
-        }
-        return value.trim();
-    }
-
-    private static <T> List<T> safeList(List<T> value) {
-        return value == null ? Collections.emptyList() : value.stream().filter(Objects::nonNull).collect(Collectors.toList());
-    }
-
-    private static boolean isBlank(String value) {
-        return value == null || value.trim().isEmpty();
-    }
-}

+ 0 - 351
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/BusinessCockpitOverviewWarningSettingsAdapter.java

@@ -1,351 +0,0 @@
-package com.zksy.cockpit.overview;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.zksy.base.alarm.domain.AlarmData;
-import com.zksy.base.alarm.service.AlarmDataService;
-import com.zksy.base.domain.EquipmentBase;
-import com.zksy.base.domain.EquipmentType;
-import com.zksy.base.service.EquipmentBaseService;
-import com.zksy.base.service.EquipmentTypeService;
-import com.zksy.base.warning.domain.AlarmWarningRel;
-import com.zksy.base.warning.domain.EarlyWarning;
-import com.zksy.base.warning.mapper.AlarmWarningRelMapper;
-import com.zksy.base.warning.service.EarlyWarningService;
-import com.zksy.cockpit.foundation.CockpitDistrict;
-import com.zksy.cockpit.foundation.CockpitTypeIndustry;
-import com.zksy.ops.domain.WorkOrder;
-import com.zksy.ops.service.WorkOrderService;
-import org.springframework.context.annotation.Primary;
-import org.springframework.stereotype.Component;
-
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.ZoneId;
-import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.stream.Collectors;
-
-/**
- * 总体概览-预警设置 真实数据适配器(BT-5)。
- *
- * <p><b>口径(维护者 2026-10-14 裁定)</b>:预警不走工单流程,故预警事件**不再经工单桥接**,
- * 只带 {@code early_warning} 自身生命周期({@code status} / {@code warning_level});
- * 报警保留工单回联(报警靠工单闭环),并额外带 {@code alarm_status} / {@code alarm_level}。
- *
- * <p>两族都沿设备解析**片区**({@code equipment_base.district})与**行业**
- * ({@code equipment_type} 树上溯根),解析不出时如实留空、不冒充 ——
- * 这两项服务层拿不到设备台账,必须在此带入快照。
- *
- * <p>趋势桶按业务时区日期({@code yyyy-MM-dd})聚合。{@code handled} 的含义**按族不同**:
- * 预警=该桶内已解除({@code CLOSED});报警=该桶内关联工单已结案(状态 5)。
- * {@code updatedAt} 取事件与工单的最新时间。
- */
-@Component
-@Primary
-public class BusinessCockpitOverviewWarningSettingsAdapter
-        implements CockpitOverviewWarningSettingsAdapter {
-
-    private static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
-    private static final DateTimeFormatter BUCKET_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
-    private static final ZoneId BUSINESS_ZONE = ZoneId.of("Asia/Shanghai");
-    private static final int WORK_ORDER_HANDLED = 5;
-    private static final String WARNING_CLOSED = "CLOSED";
-
-    private final EarlyWarningService earlyWarningService;
-    private final AlarmDataService alarmDataService;
-    private final AlarmWarningRelMapper alarmWarningRelMapper;
-    private final WorkOrderService workOrderService;
-    private final EquipmentBaseService equipmentBaseService;
-    private final EquipmentTypeService equipmentTypeService;
-
-    public BusinessCockpitOverviewWarningSettingsAdapter(
-            EarlyWarningService earlyWarningService,
-            AlarmDataService alarmDataService,
-            AlarmWarningRelMapper alarmWarningRelMapper,
-            WorkOrderService workOrderService,
-            EquipmentBaseService equipmentBaseService,
-            EquipmentTypeService equipmentTypeService) {
-        this.earlyWarningService = earlyWarningService;
-        this.alarmDataService = alarmDataService;
-        this.alarmWarningRelMapper = alarmWarningRelMapper;
-        this.workOrderService = workOrderService;
-        this.equipmentBaseService = equipmentBaseService;
-        this.equipmentTypeService = equipmentTypeService;
-    }
-
-    @Override
-    public CockpitOverviewWarningSettingsSnapshot load() {
-        List<EarlyWarning> warnings = safeList(earlyWarningService.list());
-        List<AlarmData> alarms = safeList(alarmDataService.list());
-        List<AlarmWarningRel> relations = safeList(alarmWarningRelMapper.selectList(new QueryWrapper<AlarmWarningRel>()));
-        List<WorkOrder> orders = safeList(workOrderService.list());
-
-        Map<Long, WorkOrder> orderByOrderId = new HashMap<>();
-        for (WorkOrder order : orders) {
-            if (order != null && order.getOrderId() != null) {
-                orderByOrderId.put(order.getOrderId(), order);
-            }
-        }
-
-        // 设备与类型索引:片区/行业只能沿设备解析,服务层拿不到台账。
-        Map<String, EquipmentBase> deviceByCode = deviceIndex();
-        Map<Integer, EquipmentType> typesById = typeIndex();
-
-        List<CockpitOverviewWarningSettingsSnapshot.SourceEvent> events = new ArrayList<>();
-        LocalDateTime updatedAt = null;
-
-        for (AlarmData alarm : alarms) {
-            if (alarm == null || isBlank(alarm.getId())) {
-                continue;
-            }
-            updatedAt = latest(updatedAt, alarm.getUpdateTime());
-            updatedAt = latest(updatedAt, alarm.getCreateTime());
-            WorkOrder order = alarm.getWorkOrderId() == null ? null : orderByOrderId.get(alarm.getWorkOrderId());
-            if (order != null) {
-                updatedAt = latest(updatedAt, toLocal(order.getUpdateTime()));
-                updatedAt = latest(updatedAt, toLocal(order.getCreateTime()));
-            }
-            events.add(new CockpitOverviewWarningSettingsSnapshot.SourceEvent(
-                    "ALARM",
-                    alarm.getId().trim(),
-                    trimToNull(alarm.getDeviceCode()),
-                    order == null ? null : order.getOrderNo(),
-                    order == null || order.getOrderStatus() == null ? null : order.getOrderStatus(),
-                    alarmStatus(alarm.getAlarmStatus()),
-                    level(alarm.getAlarmLevel()),
-                    districtCode(alarm.getDeviceCode(), deviceByCode),
-                    industryCode(alarm.getDeviceCode(), deviceByCode, typesById)));
-        }
-
-        for (EarlyWarning warning : warnings) {
-            if (warning == null || isBlank(warning.getWarningNo())) {
-                continue;
-            }
-            updatedAt = latest(updatedAt, warning.getUpdateTime());
-            updatedAt = latest(updatedAt, warning.getPublishTime());
-            // 预警不走工单流程(维护者 2026-10-14 裁定):不再桥接工单,
-            // 只带自身生命周期与维度;趋势 handled 也改按预警自身 CLOSED 判定。
-            events.add(new CockpitOverviewWarningSettingsSnapshot.SourceEvent(
-                    "WARNING",
-                    warning.getWarningNo().trim(),
-                    trimToNull(warning.getDeviceCode()),
-                    null,
-                    null,
-                    trimToNull(warning.getStatus()),
-                    level(warning.getWarningLevel()),
-                    districtCode(warning.getDeviceCode(), deviceByCode),
-                    industryCode(warning.getDeviceCode(), deviceByCode, typesById)));
-        }
-
-        List<CockpitOverviewWarningSettingsSnapshot.SourceTrendPoint> trendPoints = new ArrayList<>();
-        addBuckets(trendPoints, "WARNING", warningBuckets(warnings));
-        addBuckets(trendPoints, "ALARM", alarmBuckets(alarms, orderByOrderId));
-
-        return new CockpitOverviewWarningSettingsSnapshot(
-                offsetTime(updatedAt), events, trendPoints, scopeWorkOrders(orders));
-    }
-
-    /**
-     * 范围内**全部工单**(决策票 06):**报警族**处置率分母要的是工单事实,不要求事件回联。
-     * 状态码原样透出(是否计入分母由服务层的 0–6 口径判定)。
-     *
-     * <p>维护者 2026-10-14 裁定后,本读数只服务报警族。
-     */
-    private static List<CockpitOverviewWarningSettingsSnapshot.SourceWorkOrder> scopeWorkOrders(
-            List<WorkOrder> orders) {
-        List<CockpitOverviewWarningSettingsSnapshot.SourceWorkOrder> result = new ArrayList<>();
-        for (WorkOrder order : orders) {
-            if (order == null) {
-                continue;
-            }
-            result.add(new CockpitOverviewWarningSettingsSnapshot.SourceWorkOrder(
-                    order.getOrderStatus(),
-                    offsetTime(toLocal(order.getCreateTime()))));
-        }
-        return result;
-    }
-
-    /**
-     * 预警趋势桶:按发布时间分桶,{@code handled}=该桶内**已解除**的预警数
-     * (预警自身生命周期,不依赖工单)。
-     */
-    private Map<String, Counter> warningBuckets(List<EarlyWarning> warnings) {
-        Map<String, Counter> buckets = new LinkedHashMap<>();
-        for (EarlyWarning warning : warnings) {
-            if (warning == null || isBlank(warning.getWarningNo())) {
-                continue;
-            }
-            LocalDateTime time = firstNonNull(warning.getPublishTime(), warning.getCreateTime());
-            if (time == null) {
-                continue;
-            }
-            Counter counter = buckets.computeIfAbsent(bucket(time), key -> new Counter());
-            counter.total++;
-            if (WARNING_CLOSED.equals(normalize(warning.getStatus()))) {
-                counter.handled++;
-            }
-        }
-        return buckets;
-    }
-
-    /** 报警趋势桶:按更新时间分桶,{@code handled}=该桶内关联工单已结案的报警数(工单口径)。 */
-    private Map<String, Counter> alarmBuckets(List<AlarmData> alarms, Map<Long, WorkOrder> orderByOrderId) {
-        Map<String, Counter> buckets = new LinkedHashMap<>();
-        for (AlarmData alarm : alarms) {
-            if (alarm == null || isBlank(alarm.getId())) {
-                continue;
-            }
-            LocalDateTime time = firstNonNull(alarm.getUpdateTime(), alarm.getCreateTime());
-            if (time == null) {
-                continue;
-            }
-            Counter counter = buckets.computeIfAbsent(bucket(time), key -> new Counter());
-            counter.total++;
-            WorkOrder order = alarm.getWorkOrderId() == null ? null : orderByOrderId.get(alarm.getWorkOrderId());
-            if (order != null && Integer.valueOf(WORK_ORDER_HANDLED).equals(order.getOrderStatus())) {
-                counter.handled++;
-            }
-        }
-        return buckets;
-    }
-
-    private void addBuckets(
-            List<CockpitOverviewWarningSettingsSnapshot.SourceTrendPoint> trendPoints,
-            String family,
-            Map<String, Counter> buckets) {
-        for (Map.Entry<String, Counter> entry : buckets.entrySet()) {
-            trendPoints.add(new CockpitOverviewWarningSettingsSnapshot.SourceTrendPoint(
-                    family, entry.getKey(), entry.getValue().total, entry.getValue().handled));
-        }
-    }
-
-    /** 报警自身生命周期:{@code alarm_status} 0 未处理 / 1 已处理;其余回 {@code null}(服务层进未知桶)。 */
-    private static String alarmStatus(Integer status) {
-        if (Integer.valueOf(0).equals(status)) {
-            return "UNHANDLED";
-        }
-        if (Integer.valueOf(1).equals(status)) {
-            return "HANDLED";
-        }
-        return null;
-    }
-
-    /** 等级:{@code alarm_level} / {@code warning_level} 均为字符串字典编码,仅 1–4 有效;其余回 {@code null}。 */
-    private static Integer level(String level) {
-        if (level == null) {
-            return null;
-        }
-        try {
-            int resolved = Integer.parseInt(level.trim());
-            return resolved >= 1 && resolved <= 4 ? resolved : null;
-        } catch (NumberFormatException ignored) {
-            return null;
-        }
-    }
-
-    /**
-     * 事件片区:沿事件设备解析到 {@code equipment_base.district}(片区权威来源),
-     * 再经 {@link CockpitDistrict#codeOf} 归一;设备缺失或片区未识别时如实回 {@code null}(=未分区)。
-     */
-    private static Integer districtCode(String deviceCode, Map<String, EquipmentBase> deviceByCode) {
-        EquipmentBase device = device(deviceCode, deviceByCode);
-        return device == null ? null : CockpitDistrict.codeOf(device.getDistrict());
-    }
-
-    /**
-     * 事件行业:沿设备类型树上溯到根再映射({@link CockpitTypeIndustry})。
-     * 设备缺失、类型缺失或根不在取值域内时如实回 {@code null}(服务层进未知桶),不按片区或名称冒充。
-     */
-    private static String industryCode(
-            String deviceCode,
-            Map<String, EquipmentBase> deviceByCode,
-            Map<Integer, EquipmentType> typesById) {
-        EquipmentBase device = device(deviceCode, deviceByCode);
-        if (device == null || device.getEquipmentTypeId() == null) {
-            return null;
-        }
-        return CockpitTypeIndustry.industryOf(typesById.get(device.getEquipmentTypeId()), typesById);
-    }
-
-    private static EquipmentBase device(String deviceCode, Map<String, EquipmentBase> deviceByCode) {
-        String normalized = trimToNull(deviceCode);
-        return normalized == null ? null : deviceByCode.get(normalized);
-    }
-
-    private Map<String, EquipmentBase> deviceIndex() {
-        Map<String, EquipmentBase> result = new LinkedHashMap<>();
-        for (EquipmentBase device : safeList(equipmentBaseService.list())) {
-            if (device != null && !isBlank(device.getEquipmentCode())) {
-                result.put(device.getEquipmentCode().trim(), device);
-            }
-        }
-        return result;
-    }
-
-    private Map<Integer, EquipmentType> typeIndex() {
-        Map<Integer, EquipmentType> result = new LinkedHashMap<>();
-        for (EquipmentType type : safeList(equipmentTypeService.list())) {
-            if (type != null && type.getId() != null) {
-                result.put(type.getId(), type);
-            }
-        }
-        return result;
-    }
-
-    private static String normalize(String value) {
-        return value == null ? null : value.trim().toUpperCase();
-    }
-
-    private static String bucket(LocalDateTime time) {
-        return BUCKET_FORMATTER.format(time.atZone(BUSINESS_ZONE).toLocalDate());
-    }
-
-    private static LocalDateTime firstNonNull(LocalDateTime primary, LocalDateTime fallback) {
-        return primary != null ? primary : fallback;
-    }
-
-    private static LocalDateTime toLocal(java.util.Date value) {
-        return value == null ? null
-                : LocalDateTime.ofInstant(value.toInstant(), BUSINESS_ZONE);
-    }
-
-    private static LocalDateTime latest(LocalDateTime current, LocalDateTime candidate) {
-        if (candidate == null) {
-            return current;
-        }
-        if (current == null || candidate.isAfter(current)) {
-            return candidate;
-        }
-        return current;
-    }
-
-    private static String offsetTime(LocalDateTime value) {
-        return value == null ? null : TIME_FORMATTER.format(value.atZone(BUSINESS_ZONE).toOffsetDateTime());
-    }
-
-    private static String trimToNull(String value) {
-        if (value == null || value.trim().isEmpty()) {
-            return null;
-        }
-        return value.trim();
-    }
-
-    private static <T> List<T> safeList(List<T> value) {
-        return value == null ? Collections.emptyList() : value.stream().filter(Objects::nonNull).collect(Collectors.toList());
-    }
-
-    private static boolean isBlank(String value) {
-        return value == null || value.trim().isEmpty();
-    }
-
-    private static class Counter {
-        private int total;
-        private int handled;
-    }
-}

+ 0 - 5
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/CockpitOverviewInfrastructureAdapter.java

@@ -1,5 +0,0 @@
-package com.zksy.cockpit.overview;
-
-public interface CockpitOverviewInfrastructureAdapter {
-    CockpitOverviewInfrastructureSnapshot load();
-}

+ 0 - 185
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/CockpitOverviewInfrastructureResponse.java

@@ -1,185 +0,0 @@
-package com.zksy.cockpit.overview;
-
-import java.math.BigDecimal;
-import java.util.List;
-
-public class CockpitOverviewInfrastructureResponse {
-    private final String requestId;
-    private final String apiVersion;
-    private final boolean readOnly;
-    private final String timezone;
-    private final Range range;
-    private final String updatedAt;
-    private final Freshness freshness;
-    private final Totals totals;
-    private final List<Industry> industries;
-    private final Excluded excluded;
-
-    public CockpitOverviewInfrastructureResponse(
-            String requestId,
-            String apiVersion,
-            boolean readOnly,
-            String timezone,
-            Range range,
-            String updatedAt,
-            Freshness freshness,
-            Totals totals,
-            List<Industry> industries,
-            Excluded excluded) {
-        this.requestId = requestId;
-        this.apiVersion = apiVersion;
-        this.readOnly = readOnly;
-        this.timezone = timezone;
-        this.range = range;
-        this.updatedAt = updatedAt;
-        this.freshness = freshness;
-        this.totals = totals;
-        this.industries = industries;
-        this.excluded = excluded;
-    }
-
-    public String getRequestId() { return requestId; }
-    public String getApiVersion() { return apiVersion; }
-    public boolean isReadOnly() { return readOnly; }
-    public String getTimezone() { return timezone; }
-    public Range getRange() { return range; }
-    public String getUpdatedAt() { return updatedAt; }
-    public Freshness getFreshness() { return freshness; }
-    public Totals getTotals() { return totals; }
-    public List<Industry> getIndustries() { return industries; }
-    public Excluded getExcluded() { return excluded; }
-
-    public static class Freshness {
-        private final String status;
-        private final String updatedAt;
-        private final String serverUpdatedAt;
-
-        public Freshness(String status, String updatedAt, String serverUpdatedAt) {
-            this.status = status;
-            this.updatedAt = updatedAt;
-            this.serverUpdatedAt = serverUpdatedAt;
-        }
-
-        public String getStatus() { return status; }
-        public String getUpdatedAt() { return updatedAt; }
-        public String getServerUpdatedAt() { return serverUpdatedAt; }
-    }
-
-    public static class Range {
-        private final String type;
-
-        public Range(String type) {
-            this.type = type;
-        }
-
-        public String getType() { return type; }
-    }
-
-    public static class Totals {
-        private final int facilityCount;
-        private final int smartDeviceCount;
-
-        public Totals(int facilityCount, int smartDeviceCount) {
-            this.facilityCount = facilityCount;
-            this.smartDeviceCount = smartDeviceCount;
-        }
-
-        public int getFacilityCount() { return facilityCount; }
-        public int getSmartDeviceCount() { return smartDeviceCount; }
-    }
-
-    public static class Industry {
-        private final String code;
-        private final String key;
-        private final String label;
-        private final int facilityCount;
-        private final int smartDeviceCount;
-        private final List<TypeSummary> facilityTypes;
-        private final List<TypeSummary> deviceTypes;
-
-        public Industry(
-                String code,
-                String key,
-                String label,
-                int facilityCount,
-                int smartDeviceCount,
-                List<TypeSummary> facilityTypes,
-                List<TypeSummary> deviceTypes) {
-            this.code = code;
-            this.key = key;
-            this.label = label;
-            this.facilityCount = facilityCount;
-            this.smartDeviceCount = smartDeviceCount;
-            this.facilityTypes = facilityTypes;
-            this.deviceTypes = deviceTypes;
-        }
-
-        public String getCode() { return code; }
-        public String getKey() { return key; }
-        public String getLabel() { return label; }
-        public int getFacilityCount() { return facilityCount; }
-        public int getSmartDeviceCount() { return smartDeviceCount; }
-        public List<TypeSummary> getFacilityTypes() { return facilityTypes; }
-        public List<TypeSummary> getDeviceTypes() { return deviceTypes; }
-    }
-
-    public static class TypeSummary {
-        private final String code;
-        private final String name;
-        private final int count;
-        private final BigDecimal lengthKm;
-        private final String scale;
-        private final RangeMetadata range;
-
-        public TypeSummary(
-                String code,
-                String name,
-                int count,
-                BigDecimal lengthKm,
-                String scale,
-                RangeMetadata range) {
-            this.code = code;
-            this.name = name;
-            this.count = count;
-            this.lengthKm = lengthKm;
-            this.scale = scale;
-            this.range = range;
-        }
-
-        public String getCode() { return code; }
-        public String getName() { return name; }
-        public int getCount() { return count; }
-        public BigDecimal getLengthKm() { return lengthKm; }
-        public String getScale() { return scale; }
-        public RangeMetadata getRange() { return range; }
-    }
-
-    public static class RangeMetadata {
-        private final String type;
-        private final String start;
-        private final String end;
-
-        public RangeMetadata(String type, String start, String end) {
-            this.type = type;
-            this.start = start;
-            this.end = end;
-        }
-
-        public String getType() { return type; }
-        public String getStart() { return start; }
-        public String getEnd() { return end; }
-    }
-
-    public static class Excluded {
-        private final int unknownTypeCount;
-        private final int typeKindMismatchCount;
-
-        public Excluded(int unknownTypeCount, int typeKindMismatchCount) {
-            this.unknownTypeCount = unknownTypeCount;
-            this.typeKindMismatchCount = typeKindMismatchCount;
-        }
-
-        public int getUnknownTypeCount() { return unknownTypeCount; }
-        public int getTypeKindMismatchCount() { return typeKindMismatchCount; }
-    }
-}

+ 0 - 265
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/CockpitOverviewInfrastructureService.java

@@ -1,265 +0,0 @@
-package com.zksy.cockpit.overview;
-
-import com.zksy.cockpit.foundation.CockpitErrorCategory;
-import com.zksy.cockpit.foundation.CockpitErrorPayload;
-import org.springframework.stereotype.Service;
-
-import java.math.BigDecimal;
-import java.time.Clock;
-import java.time.ZoneId;
-import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-
-@Service
-public class CockpitOverviewInfrastructureService {
-    private static final ZoneId BUSINESS_ZONE = ZoneId.of("Asia/Shanghai");
-
-    private final CockpitOverviewInfrastructureAdapter adapter;
-    private final Clock clock;
-
-    public CockpitOverviewInfrastructureService(
-            CockpitOverviewInfrastructureAdapter adapter,
-            Clock clock) {
-        this.adapter = adapter;
-        this.clock = clock;
-    }
-
-    public CockpitOverviewInfrastructureResponse load(String requestId) {
-        CockpitOverviewInfrastructureSnapshot snapshot = adapter.load();
-        String serverUpdatedAt = businessTime();
-        String updatedAt = snapshot == null || isBlank(snapshot.getUpdatedAt())
-                ? serverUpdatedAt
-                : snapshot.getUpdatedAt();
-        TotalsBuilder totals = new TotalsBuilder();
-        List<IndustryBuilder> industryBuilders = new ArrayList<>();
-        industryBuilders.add(new IndustryBuilder("GAS", "gas", "燃气"));
-        industryBuilders.add(new IndustryBuilder("WATER_SUPPLY", "waterSupply", "供水"));
-        industryBuilders.add(new IndustryBuilder("DRAINAGE", "drainage", "排水"));
-        industryBuilders.add(new IndustryBuilder("MANHOLE", "manhole", "窨井"));
-        int unknownTypeCount = 0;
-        int typeKindMismatchCount = 0;
-
-        if (snapshot != null && snapshot.getCounts() != null) {
-            Map<String, Map<String, CockpitOverviewInfrastructureSnapshot.SourceType>> types = types(snapshot);
-            for (CockpitOverviewInfrastructureSnapshot.SourceCount count : snapshot.getCounts()) {
-                if (count == null || isBlank(count.getTypeCode())) {
-                    continue;
-                }
-                Map<String, CockpitOverviewInfrastructureSnapshot.SourceType> byCode = types.get(count.getObjectKind());
-                CockpitOverviewInfrastructureSnapshot.SourceType type =
-                        byCode == null ? null : byCode.get(count.getTypeCode());
-                if (type == null) {
-                    boolean wrongKind = types.values().stream()
-                            .anyMatch(group -> group.containsKey(count.getTypeCode()));
-                    if (wrongKind) {
-                        typeKindMismatchCount += count.getCount();
-                    } else {
-                        unknownTypeCount += count.getCount();
-                    }
-                } else {
-                    if (industryBuilders.stream().noneMatch(candidate ->
-                            candidate.getCode().equals(type.getIndustry()))) {
-                        unknownTypeCount += count.getCount();
-                    } else {
-                        addResolvedCount(count, type, industryBuilders, totals);
-                    }
-                }
-            }
-        }
-
-        CockpitOverviewInfrastructureResponse.Freshness freshness =
-                new CockpitOverviewInfrastructureResponse.Freshness(
-                        totals.facilityCount == 0 && totals.smartDeviceCount == 0 ? "EMPTY" : "CURRENT",
-                        snapshot == null ? null : snapshot.getUpdatedAt(), serverUpdatedAt);
-        return new CockpitOverviewInfrastructureResponse(
-                requestId,
-                "v1",
-                true,
-                "Asia/Shanghai",
-                new CockpitOverviewInfrastructureResponse.Range("CURRENT_BASELINE"),
-                updatedAt,
-                freshness,
-                totals.build(),
-                buildIndustries(industryBuilders),
-                new CockpitOverviewInfrastructureResponse.Excluded(unknownTypeCount, typeKindMismatchCount));
-    }
-
-    public CockpitErrorPayload serverError(String requestId) {
-        return new CockpitErrorPayload(
-                CockpitErrorCategory.SERVER_ERROR,
-                "驾驶舱基础设施概览数据暂不可用",
-                requestId,
-                businessTime());
-    }
-
-    private static Map<String, Map<String, CockpitOverviewInfrastructureSnapshot.SourceType>> types(
-            CockpitOverviewInfrastructureSnapshot snapshot) {
-        if (snapshot.getTypes() == null) {
-            return Collections.emptyMap();
-        }
-        Map<String, Map<String, CockpitOverviewInfrastructureSnapshot.SourceType>> types = new LinkedHashMap<>();
-        for (CockpitOverviewInfrastructureSnapshot.SourceType type : snapshot.getTypes()) {
-            if (type != null && !isBlank(type.getCode()) && !isBlank(type.getObjectKind())) {
-                types.computeIfAbsent(type.getObjectKind(), key -> new LinkedHashMap<>())
-                        .put(type.getCode(), type);
-            }
-        }
-        return types;
-    }
-
-    private static void addResolvedCount(
-            CockpitOverviewInfrastructureSnapshot.SourceCount source,
-            CockpitOverviewInfrastructureSnapshot.SourceType type,
-            List<IndustryBuilder> industries,
-            TotalsBuilder totals) {
-        IndustryBuilder industry = industries.stream()
-                .filter(candidate -> candidate.getCode().equals(type.getIndustry()))
-                .findFirst()
-                .orElse(null);
-
-        if ("FACILITY".equals(source.getObjectKind())) {
-            totals.addFacility(source.getCount());
-            if (industry != null) {
-                addSummary(industry.getFacilityTypes(), summary(source, type));
-                industry.addFacility(source.getCount());
-            }
-        } else if ("SMART_DEVICE".equals(source.getObjectKind())) {
-            totals.addSmartDevice(source.getCount());
-            if (industry != null) {
-                addSummary(industry.getDeviceTypes(), summary(source, type));
-                industry.addSmartDevice(source.getCount());
-            }
-        }
-    }
-
-    private static CockpitOverviewInfrastructureResponse.TypeSummary summary(
-            CockpitOverviewInfrastructureSnapshot.SourceCount source,
-            CockpitOverviewInfrastructureSnapshot.SourceType type) {
-        CockpitOverviewInfrastructureSnapshot.SourceValue value = source.getValue();
-        CockpitOverviewInfrastructureSnapshot.SourceRange range = value == null ? null : value.getRange();
-        return new CockpitOverviewInfrastructureResponse.TypeSummary(
-                type.getCode(),
-                type.getName(),
-                source.getCount(),
-                value == null ? null : value.getLengthKm(),
-                value == null ? null : value.getScale(),
-                range == null ? null : new CockpitOverviewInfrastructureResponse.RangeMetadata(
-                        range.getType(),
-                        range.getStart(),
-                        range.getEnd()));
-    }
-
-    private static void addSummary(
-            List<CockpitOverviewInfrastructureResponse.TypeSummary> summaries,
-            CockpitOverviewInfrastructureResponse.TypeSummary summary) {
-        for (int index = 0; index < summaries.size(); index++) {
-            CockpitOverviewInfrastructureResponse.TypeSummary existing = summaries.get(index);
-            if (Objects.equals(existing.getCode(), summary.getCode())) {
-                summaries.set(index, mergeSummary(existing, summary));
-                return;
-            }
-        }
-        summaries.add(summary);
-    }
-
-    private static CockpitOverviewInfrastructureResponse.TypeSummary mergeSummary(
-            CockpitOverviewInfrastructureResponse.TypeSummary left,
-            CockpitOverviewInfrastructureResponse.TypeSummary right) {
-        return new CockpitOverviewInfrastructureResponse.TypeSummary(
-                left.getCode(),
-                left.getName(),
-                left.getCount() + right.getCount(),
-                sumLength(left.getLengthKm(), right.getLengthKm()),
-                right.getScale() == null ? left.getScale() : right.getScale(),
-                right.getRange() == null ? left.getRange() : right.getRange());
-    }
-
-    private static BigDecimal sumLength(BigDecimal left, BigDecimal right) {
-        if (left == null) {
-            return right;
-        }
-        if (right == null) {
-            return left;
-        }
-        return left.add(right);
-    }
-
-    private static List<CockpitOverviewInfrastructureResponse.Industry> buildIndustries(
-            List<IndustryBuilder> builders) {
-        List<CockpitOverviewInfrastructureResponse.Industry> industries = new ArrayList<>();
-        for (IndustryBuilder builder : builders) {
-            industries.add(builder.build());
-        }
-        return industries;
-    }
-
-    private static class TotalsBuilder {
-        private int facilityCount;
-        private int smartDeviceCount;
-
-        private void addFacility(int count) {
-            facilityCount += count;
-        }
-
-        private void addSmartDevice(int count) {
-            smartDeviceCount += count;
-        }
-
-        private CockpitOverviewInfrastructureResponse.Totals build() {
-            return new CockpitOverviewInfrastructureResponse.Totals(facilityCount, smartDeviceCount);
-        }
-    }
-
-    private static class IndustryBuilder {
-        private final String code;
-        private final String key;
-        private final String label;
-        private final List<CockpitOverviewInfrastructureResponse.TypeSummary> facilityTypes = new ArrayList<>();
-        private final List<CockpitOverviewInfrastructureResponse.TypeSummary> deviceTypes = new ArrayList<>();
-        private int facilityCount;
-        private int smartDeviceCount;
-
-        private IndustryBuilder(String code, String key, String label) {
-            this.code = code;
-            this.key = key;
-            this.label = label;
-        }
-
-        private String getCode() { return code; }
-        private List<CockpitOverviewInfrastructureResponse.TypeSummary> getFacilityTypes() { return facilityTypes; }
-        private List<CockpitOverviewInfrastructureResponse.TypeSummary> getDeviceTypes() { return deviceTypes; }
-
-        private void addFacility(int count) {
-            facilityCount += count;
-        }
-
-        private void addSmartDevice(int count) {
-            smartDeviceCount += count;
-        }
-
-        private CockpitOverviewInfrastructureResponse.Industry build() {
-            return new CockpitOverviewInfrastructureResponse.Industry(
-                    code,
-                    key,
-                    label,
-                    facilityCount,
-                    smartDeviceCount,
-                    facilityTypes,
-                    deviceTypes);
-        }
-    }
-
-    private String businessTime() {
-        return DateTimeFormatter.ISO_OFFSET_DATE_TIME
-                .format(clock.instant().atZone(BUSINESS_ZONE));
-    }
-
-    private static boolean isBlank(String value) {
-        return value == null || value.trim().isEmpty();
-    }
-}

+ 0 - 100
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/CockpitOverviewInfrastructureSnapshot.java

@@ -1,100 +0,0 @@
-package com.zksy.cockpit.overview;
-
-import java.math.BigDecimal;
-import java.util.List;
-
-public class CockpitOverviewInfrastructureSnapshot {
-    private final String updatedAt;
-    private final List<SourceType> types;
-    private final List<SourceCount> counts;
-
-    public CockpitOverviewInfrastructureSnapshot(
-            String updatedAt,
-            List<SourceType> types,
-            List<SourceCount> counts) {
-        this.updatedAt = updatedAt;
-        this.types = types;
-        this.counts = counts;
-    }
-
-    public String getUpdatedAt() { return updatedAt; }
-    public List<SourceType> getTypes() { return types; }
-    public List<SourceCount> getCounts() { return counts; }
-
-    public static class SourceType {
-        private final String code;
-        private final String name;
-        private final String industry;
-        private final String drainageScope;
-        private final String objectKind;
-
-        public SourceType(String code, String name, String industry, String drainageScope, String objectKind) {
-            this.code = code;
-            this.name = name;
-            this.industry = industry;
-            this.drainageScope = drainageScope;
-            this.objectKind = objectKind;
-        }
-
-        public String getCode() { return code; }
-        public String getName() { return name; }
-        public String getIndustry() { return industry; }
-        public String getDrainageScope() { return drainageScope; }
-        public String getObjectKind() { return objectKind; }
-    }
-
-    public static class SourceCount {
-        private final String objectKind;
-        private final String typeCode;
-        private final int count;
-        private final SourceValue value;
-
-        public SourceCount(String objectKind, String typeCode, int count) {
-            this(objectKind, typeCode, count, null);
-        }
-
-        public SourceCount(String objectKind, String typeCode, int count, SourceValue value) {
-            this.objectKind = objectKind;
-            this.typeCode = typeCode;
-            this.count = count;
-            this.value = value;
-        }
-
-        public String getObjectKind() { return objectKind; }
-        public String getTypeCode() { return typeCode; }
-        public int getCount() { return count; }
-        public SourceValue getValue() { return value; }
-    }
-
-    public static class SourceValue {
-        private final BigDecimal lengthKm;
-        private final String scale;
-        private final SourceRange range;
-
-        public SourceValue(BigDecimal lengthKm, String scale, SourceRange range) {
-            this.lengthKm = lengthKm;
-            this.scale = scale;
-            this.range = range;
-        }
-
-        public BigDecimal getLengthKm() { return lengthKm; }
-        public String getScale() { return scale; }
-        public SourceRange getRange() { return range; }
-    }
-
-    public static class SourceRange {
-        private final String type;
-        private final String start;
-        private final String end;
-
-        public SourceRange(String type, String start, String end) {
-            this.type = type;
-            this.start = start;
-            this.end = end;
-        }
-
-        public String getType() { return type; }
-        public String getStart() { return start; }
-        public String getEnd() { return end; }
-    }
-}

+ 0 - 5
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/CockpitOverviewMonitoringAdapter.java

@@ -1,5 +0,0 @@
-package com.zksy.cockpit.overview;
-
-public interface CockpitOverviewMonitoringAdapter {
-    CockpitOverviewMonitoringSnapshot load();
-}

+ 0 - 28
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/CockpitOverviewMonitoringDeviceStatusDelta.java

@@ -1,28 +0,0 @@
-package com.zksy.cockpit.overview;
-
-public class CockpitOverviewMonitoringDeviceStatusDelta {
-    private final String deviceCode;
-    private final String monitoringPointCode;
-    private final String monitoringState;
-    private final String statusTime;
-    private final String serverUpdatedAt;
-
-    public CockpitOverviewMonitoringDeviceStatusDelta(
-            String deviceCode,
-            String monitoringPointCode,
-            String monitoringState,
-            String statusTime,
-            String serverUpdatedAt) {
-        this.deviceCode = deviceCode;
-        this.monitoringPointCode = monitoringPointCode;
-        this.monitoringState = monitoringState;
-        this.statusTime = statusTime;
-        this.serverUpdatedAt = serverUpdatedAt;
-    }
-
-    public String getDeviceCode() { return deviceCode; }
-    public String getMonitoringPointCode() { return monitoringPointCode; }
-    public String getMonitoringState() { return monitoringState; }
-    public String getStatusTime() { return statusTime; }
-    public String getServerUpdatedAt() { return serverUpdatedAt; }
-}

+ 0 - 249
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/CockpitOverviewMonitoringResponse.java

@@ -1,249 +0,0 @@
-package com.zksy.cockpit.overview;
-
-import java.math.BigDecimal;
-import java.util.List;
-
-public class CockpitOverviewMonitoringResponse {
-    private final String requestId;
-    private final String apiVersion;
-    private final boolean readOnly;
-    private final String timezone;
-    private final String updatedAt;
-    private final Freshness freshness;
-    private final MetricFreshness metricFreshness;
-    private final Industry selectedIndustry;
-    private final FormalScope formalScope;
-    private final Counts counts;
-    private final List<TypeDistribution> typeDistribution;
-    private final Excluded excluded;
-
-    public CockpitOverviewMonitoringResponse(
-            String requestId,
-            String apiVersion,
-            boolean readOnly,
-            String timezone,
-            String updatedAt,
-            Freshness freshness,
-            MetricFreshness metricFreshness,
-            Industry selectedIndustry,
-            FormalScope formalScope,
-            Counts counts,
-            List<TypeDistribution> typeDistribution,
-            Excluded excluded) {
-        this.requestId = requestId;
-        this.apiVersion = apiVersion;
-        this.readOnly = readOnly;
-        this.timezone = timezone;
-        this.updatedAt = updatedAt;
-        this.freshness = freshness;
-        this.metricFreshness = metricFreshness;
-        this.selectedIndustry = selectedIndustry;
-        this.formalScope = formalScope;
-        this.counts = counts;
-        this.typeDistribution = typeDistribution;
-        this.excluded = excluded;
-    }
-
-    public String getRequestId() { return requestId; }
-    public String getApiVersion() { return apiVersion; }
-    public boolean isReadOnly() { return readOnly; }
-    public String getTimezone() { return timezone; }
-    public String getUpdatedAt() { return updatedAt; }
-    public Freshness getFreshness() { return freshness; }
-    public MetricFreshness getMetricFreshness() { return metricFreshness; }
-    public Industry getSelectedIndustry() { return selectedIndustry; }
-    public FormalScope getFormalScope() { return formalScope; }
-    public Counts getCounts() { return counts; }
-    public List<TypeDistribution> getTypeDistribution() { return typeDistribution; }
-    public Excluded getExcluded() { return excluded; }
-
-    public static class Freshness {
-        private final String status;
-        private final String reason;
-        private final String updatedAt;
-        private final String serverUpdatedAt;
-
-        public Freshness(
-                String status,
-                String reason,
-                String updatedAt,
-                String serverUpdatedAt) {
-            this.status = status;
-            this.reason = reason;
-            this.updatedAt = updatedAt;
-            this.serverUpdatedAt = serverUpdatedAt;
-        }
-
-        public String getStatus() { return status; }
-        public String getReason() { return reason; }
-        public String getUpdatedAt() { return updatedAt; }
-        public String getServerUpdatedAt() { return serverUpdatedAt; }
-    }
-
-    public static class MetricFreshness {
-        private final String status;
-        private final String updatedAt;
-        private final String serverUpdatedAt;
-
-        public MetricFreshness(String status, String updatedAt, String serverUpdatedAt) {
-            this.status = status;
-            this.updatedAt = updatedAt;
-            this.serverUpdatedAt = serverUpdatedAt;
-        }
-
-        public String getStatus() { return status; }
-        public String getUpdatedAt() { return updatedAt; }
-        public String getServerUpdatedAt() { return serverUpdatedAt; }
-    }
-
-    public static class Industry {
-        private final String code;
-        private final String key;
-        private final String label;
-
-        public Industry(String code, String key, String label) {
-            this.code = code;
-            this.key = key;
-            this.label = label;
-        }
-
-        public String getCode() { return code; }
-        public String getKey() { return key; }
-        public String getLabel() { return label; }
-    }
-
-    public static class FormalScope {
-        private final List<String> industries;
-        private final List<String> keys;
-
-        public FormalScope(List<String> industries, List<String> keys) {
-            this.industries = industries;
-            this.keys = keys;
-        }
-
-        public List<String> getIndustries() { return industries; }
-        public List<String> getKeys() { return keys; }
-    }
-
-    public static class Counts {
-        private final int deviceCount;
-        private final int monitoringPointCount;
-        private final int monitoringFacilityCount;
-        private final int infrastructureFacilityCount;
-        private final Status status;
-        private final OnlineRate onlineRate;
-
-        public Counts(
-                int deviceCount,
-                int monitoringPointCount,
-                int monitoringFacilityCount,
-                int infrastructureFacilityCount,
-                Status status,
-                OnlineRate onlineRate) {
-            this.deviceCount = deviceCount;
-            this.monitoringPointCount = monitoringPointCount;
-            this.monitoringFacilityCount = monitoringFacilityCount;
-            this.infrastructureFacilityCount = infrastructureFacilityCount;
-            this.status = status;
-            this.onlineRate = onlineRate;
-        }
-
-        public int getDeviceCount() { return deviceCount; }
-        public int getMonitoringPointCount() { return monitoringPointCount; }
-        public int getMonitoringFacilityCount() { return monitoringFacilityCount; }
-        public int getInfrastructureFacilityCount() { return infrastructureFacilityCount; }
-        public Status getStatus() { return status; }
-        public OnlineRate getOnlineRate() { return onlineRate; }
-    }
-
-    public static class Status {
-        private final int online;
-        private final int offline;
-        private final int stale;
-        private final int unknownOrMissing;
-        private final int denominator;
-
-        public Status(int online, int offline, int stale, int unknownOrMissing, int denominator) {
-            this.online = online;
-            this.offline = offline;
-            this.stale = stale;
-            this.unknownOrMissing = unknownOrMissing;
-            this.denominator = denominator;
-        }
-
-        public int getOnline() { return online; }
-        public int getOffline() { return offline; }
-        public int getStale() { return stale; }
-        public int getUnknownOrMissing() { return unknownOrMissing; }
-        public int getDenominator() { return denominator; }
-    }
-
-    public static class OnlineRate {
-        private final BigDecimal value;
-        private final int onlineCount;
-        private final int denominator;
-        private final String state;
-        private final String reason;
-
-        public OnlineRate(
-                BigDecimal value,
-                int onlineCount,
-                int denominator,
-                String state,
-                String reason) {
-            this.value = value;
-            this.onlineCount = onlineCount;
-            this.denominator = denominator;
-            this.state = state;
-            this.reason = reason;
-        }
-
-        public BigDecimal getValue() { return value; }
-        public int getOnlineCount() { return onlineCount; }
-        public int getDenominator() { return denominator; }
-        public String getState() { return state; }
-        public String getReason() { return reason; }
-    }
-
-    public static class TypeDistribution {
-        private final Industry industry;
-        private final DeviceType deviceType;
-        private final int deviceCount;
-
-        public TypeDistribution(Industry industry, DeviceType deviceType, int deviceCount) {
-            this.industry = industry;
-            this.deviceType = deviceType;
-            this.deviceCount = deviceCount;
-        }
-
-        public Industry getIndustry() { return industry; }
-        public DeviceType getDeviceType() { return deviceType; }
-        public int getDeviceCount() { return deviceCount; }
-    }
-
-    public static class DeviceType {
-        private final String code;
-        private final String name;
-
-        public DeviceType(String code, String name) {
-            this.code = code;
-            this.name = name;
-        }
-
-        public String getCode() { return code; }
-        public String getName() { return name; }
-    }
-
-    public static class Excluded {
-        private final int unknownTypeCount;
-        private final int typeKindMismatchCount;
-
-        public Excluded(int unknownTypeCount, int typeKindMismatchCount) {
-            this.unknownTypeCount = unknownTypeCount;
-            this.typeKindMismatchCount = typeKindMismatchCount;
-        }
-
-        public int getUnknownTypeCount() { return unknownTypeCount; }
-        public int getTypeKindMismatchCount() { return typeKindMismatchCount; }
-    }
-}

+ 0 - 418
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/CockpitOverviewMonitoringService.java

@@ -1,418 +0,0 @@
-package com.zksy.cockpit.overview;
-
-import com.zksy.cockpit.foundation.CockpitErrorCategory;
-import com.zksy.cockpit.foundation.CockpitErrorPayload;
-import com.zksy.cockpit.foundation.CockpitInvalidRequestException;
-import org.springframework.stereotype.Service;
-
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.time.Clock;
-import java.time.OffsetDateTime;
-import java.time.ZoneId;
-import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-
-@Service
-public class CockpitOverviewMonitoringService {
-    private static final ZoneId BUSINESS_ZONE = ZoneId.of("Asia/Shanghai");
-    private static final List<String> FORMAL_INDUSTRIES =
-            Collections.unmodifiableList(Arrays.asList("GAS", "WATER_SUPPLY", "DRAINAGE", "MANHOLE"));
-    private static final List<String> FORMAL_INDUSTRY_KEYS =
-            Collections.unmodifiableList(Arrays.asList("gas", "waterSupply", "drainage", "manhole"));
-
-    private final CockpitOverviewMonitoringAdapter adapter;
-    private final Clock clock;
-    private RuntimeState state;
-
-    public CockpitOverviewMonitoringService(
-            CockpitOverviewMonitoringAdapter adapter,
-            Clock clock) {
-        this.adapter = adapter;
-        this.clock = clock;
-    }
-
-    public synchronized CockpitOverviewMonitoringResponse load(String requestId, String industry) {
-        return read(industry, requestId, () -> refreshState());
-    }
-
-    public synchronized CockpitOverviewMonitoringResponse applyDeviceStatusDelta(
-            String requestId,
-            String industry,
-            CockpitOverviewMonitoringDeviceStatusDelta delta) {
-        return read(industry, requestId, () -> applyDelta(delta));
-    }
-
-    public CockpitErrorPayload invalidRequest(String requestId) {
-        return new CockpitErrorPayload(
-                CockpitErrorCategory.INVALID_REQUEST,
-                "industry must be GAS, WATER_SUPPLY, DRAINAGE or MANHOLE",
-                requestId,
-                businessTime());
-    }
-
-    public CockpitErrorPayload serverError(String requestId) {
-        return new CockpitErrorPayload(
-                CockpitErrorCategory.SERVER_ERROR,
-                "驾驶舱运行监测概览数据暂不可用",
-                requestId,
-                businessTime());
-    }
-
-    private CockpitOverviewMonitoringResponse read(
-            String industry,
-            String requestId,
-            StateSupplier stateSupplier) {
-        validateIndustry(industry);
-        RuntimeState currentState = stateSupplier.get();
-        return buildResponse(requestId, industry, currentState);
-    }
-
-    private RuntimeState refreshState() {
-        CockpitOverviewMonitoringSnapshot snapshot = adapter.load();
-        Map<String, DeviceRuntime> devices = new LinkedHashMap<>();
-        if (snapshot != null && snapshot.getDevices() != null) {
-            for (CockpitOverviewMonitoringSnapshot.SourceDevice source : snapshot.getDevices()) {
-                if (source == null || isBlank(source.getDeviceCode())) {
-                    continue;
-                }
-                devices.put(
-                        source.getDeviceCode(),
-                        new DeviceRuntime(
-                                source.getTypeCode(),
-                                source.getMonitoringState(),
-                                null));
-            }
-        }
-        state = new RuntimeState(snapshot, devices, snapshot == null ? null : snapshot.getUpdatedAt());
-        return state;
-    }
-
-    private RuntimeState applyDelta(CockpitOverviewMonitoringDeviceStatusDelta delta) {
-        if (state == null) {
-            refreshState();
-        }
-        if (delta == null || isBlank(delta.getDeviceCode())) {
-            throw new CockpitInvalidRequestException("device code is required");
-        }
-        OffsetDateTime serverUpdatedAt = parseTime(delta.getServerUpdatedAt(), "serverUpdatedAt");
-        DeviceRuntime previous = state.getDevices().get(delta.getDeviceCode());
-        if (previous == null) {
-            return state;
-        }
-        if (previous.getServerUpdatedAt() != null
-                && !serverUpdatedAt.isAfter(parseTime(previous.getServerUpdatedAt(), "serverUpdatedAt"))) {
-            return state;
-        }
-
-        Map<String, DeviceRuntime> devices = new LinkedHashMap<>(state.getDevices());
-        devices.put(
-                delta.getDeviceCode(),
-                new DeviceRuntime(
-                        previous.getTypeCode(),
-                        delta.getMonitoringState(),
-                        DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(serverUpdatedAt)));
-        state = new RuntimeState(state.getSnapshot(), devices, delta.getServerUpdatedAt());
-        return state;
-    }
-
-    private void validateIndustry(String industry) {
-        if (!isBlank(industry) && !FORMAL_INDUSTRIES.contains(industry)) {
-            throw new CockpitInvalidRequestException("industry must be GAS, WATER_SUPPLY, DRAINAGE or MANHOLE");
-        }
-    }
-
-    private CockpitOverviewMonitoringResponse buildResponse(
-            String requestId,
-            String selectedIndustry,
-            RuntimeState currentState) {
-        CockpitOverviewMonitoringSnapshot snapshot = currentState.getSnapshot();
-        Map<String, Map<String, CockpitOverviewMonitoringSnapshot.SourceType>> types = types(snapshot);
-        List<CockpitOverviewMonitoringSnapshot.SourceDevice> selectedDevices = new ArrayList<>();
-        Map<String, Integer> distributionCounts = new LinkedHashMap<>();
-        Map<String, CockpitOverviewMonitoringSnapshot.SourceType> distributionTypes = new LinkedHashMap<>();
-        int online = 0;
-        int offline = 0;
-        int stale = 0;
-        int unknownOrMissing = 0;
-        int unknownTypeCount = 0;
-        int typeKindMismatchCount = 0;
-
-        for (CockpitOverviewMonitoringSnapshot.SourceDevice device : list(snapshot, snapshot == null ? null : snapshot.getDevices())) {
-            if (device == null || isBlank(device.getTypeCode())) {
-                unknownTypeCount++;
-                continue;
-            }
-            CockpitOverviewMonitoringSnapshot.SourceType type = typeOf(types, "SMART_DEVICE", device.getTypeCode());
-            if (type == null) {
-                CockpitOverviewMonitoringSnapshot.SourceType other = typeOf(types, "FACILITY", device.getTypeCode());
-                if (isFormal(other)) {
-                    typeKindMismatchCount++;
-                } else {
-                    unknownTypeCount++;
-                }
-                continue;
-            }
-            if (!isFormal(type)) {
-                unknownTypeCount++;
-                continue;
-            }
-            if (selectedIndustry != null && !selectedIndustry.equals(type.getIndustry())) {
-                continue;
-            }
-
-            DeviceRuntime runtime = currentState.getDevices().get(device.getDeviceCode());
-            String monitoringState = runtime == null ? device.getMonitoringState() : runtime.getMonitoringState();
-            selectedDevices.add(device);
-            distributionCounts.merge(device.getTypeCode(), 1, Integer::sum);
-            distributionTypes.putIfAbsent(device.getTypeCode(), type);
-            if ("ONLINE".equals(monitoringState)) {
-                online++;
-            } else if ("OFFLINE".equals(monitoringState)) {
-                offline++;
-            } else if ("STALE".equals(monitoringState)) {
-                stale++;
-            } else {
-                unknownOrMissing++;
-            }
-        }
-
-        int monitoringPointCount = countByType(
-                snapshot,
-                snapshot == null ? null : snapshot.getMonitoringPoints(),
-                CockpitOverviewMonitoringSnapshot.SourceMonitoringPoint::getTypeCode,
-                types,
-                selectedIndustry,
-                "SMART_DEVICE");
-        int monitoringFacilityCount = countByType(
-                snapshot,
-                snapshot == null ? null : snapshot.getMonitoringFacilities(),
-                CockpitOverviewMonitoringSnapshot.SourceMonitoringFacility::getTypeCode,
-                types,
-                selectedIndustry,
-                "FACILITY");
-        int deviceCount = selectedDevices.size();
-        int denominator = online + offline + stale;
-        BigDecimal rate = denominator == 0
-                ? BigDecimal.ZERO.setScale(4)
-                : BigDecimal.valueOf(online)
-                        .divide(BigDecimal.valueOf(denominator), 4, RoundingMode.HALF_UP);
-        String freshnessStatus = deviceCount == 0
-                ? "EMPTY"
-                : denominator == 0 ? "EMPTY" : stale == 0 ? "CURRENT" : "STALE";
-        String freshnessReason = deviceCount == 0
-                ? "NO_RESOLVED_DEVICES"
-                : denominator == 0 ? "NO_RESOLVED_DEVICES" : stale == 0
-                        ? "RESOLVED_MONITORING_STATES" : "MONITORING_STATE_STALE";
-        String updatedAt = currentState.getAcceptedAt() == null
-                ? businessTime()
-                : currentState.getAcceptedAt();
-
-        CockpitOverviewMonitoringSnapshot.SourceMetricFreshness sourceFreshness =
-                snapshot == null ? null : snapshot.getMetricFreshness();
-        CockpitOverviewMonitoringResponse.MetricFreshness metricFreshness = sourceFreshness == null
-                ? null
-                : new CockpitOverviewMonitoringResponse.MetricFreshness(
-                        sourceFreshness.getStatus(),
-                        sourceFreshness.getUpdatedAt(),
-                        businessTime());
-        CockpitOverviewMonitoringResponse.Industry industry = industry(selectedIndustry);
-
-        return new CockpitOverviewMonitoringResponse(
-                requestId,
-                "v1",
-                true,
-                "Asia/Shanghai",
-                updatedAt,
-                new CockpitOverviewMonitoringResponse.Freshness(
-                        freshnessStatus,
-                        freshnessReason,
-                        updatedAt,
-                        businessTime()),
-                metricFreshness,
-                industry,
-                new CockpitOverviewMonitoringResponse.FormalScope(
-                        FORMAL_INDUSTRIES,
-                        FORMAL_INDUSTRY_KEYS),
-                new CockpitOverviewMonitoringResponse.Counts(
-                        deviceCount,
-                        monitoringPointCount,
-                        monitoringFacilityCount,
-                        snapshot == null ? 0 : snapshot.getInfrastructureFacilityCount(),
-                        new CockpitOverviewMonitoringResponse.Status(
-                                online,
-                                offline,
-                                stale,
-                                unknownOrMissing,
-                                denominator),
-                        new CockpitOverviewMonitoringResponse.OnlineRate(
-                                rate,
-                                online,
-                                denominator,
-                                denominator == 0 ? "EMPTY" : "AVAILABLE",
-                                denominator == 0 ? "NO_RESOLVED_DEVICES" : null)),
-                typeDistribution(distributionCounts, distributionTypes),
-                new CockpitOverviewMonitoringResponse.Excluded(unknownTypeCount, typeKindMismatchCount));
-    }
-
-    private List<CockpitOverviewMonitoringResponse.TypeDistribution> typeDistribution(
-            Map<String, Integer> counts,
-            Map<String, CockpitOverviewMonitoringSnapshot.SourceType> types) {
-        List<CockpitOverviewMonitoringResponse.TypeDistribution> distribution = new ArrayList<>();
-        for (Map.Entry<String, Integer> entry : counts.entrySet()) {
-            CockpitOverviewMonitoringSnapshot.SourceType type = types.get(entry.getKey());
-            distribution.add(new CockpitOverviewMonitoringResponse.TypeDistribution(
-                    industry(type == null ? null : type.getIndustry()),
-                    new CockpitOverviewMonitoringResponse.DeviceType(
-                            entry.getKey(),
-                            type == null ? null : type.getName()),
-                    entry.getValue()));
-        }
-        return distribution;
-    }
-
-    private <T> int countByType(
-            CockpitOverviewMonitoringSnapshot snapshot,
-            List<T> sources,
-            java.util.function.Function<T, String> typeCodeGetter,
-            Map<String, Map<String, CockpitOverviewMonitoringSnapshot.SourceType>> types,
-            String selectedIndustry,
-            String expectedKind) {
-        if (snapshot == null || sources == null) {
-            return 0;
-        }
-        int count = 0;
-        for (T source : sources) {
-            if (source == null) {
-                continue;
-            }
-            String typeCode = typeCodeGetter.apply(source);
-            CockpitOverviewMonitoringSnapshot.SourceType type =
-                    isBlank(typeCode) ? null : typeOf(types, expectedKind, typeCode);
-            if (!isFormal(type)) {
-                continue;
-            }
-            if (selectedIndustry != null && !selectedIndustry.equals(type.getIndustry())) {
-                continue;
-            }
-            count++;
-        }
-        return count;
-    }
-
-    private static boolean isFormal(CockpitOverviewMonitoringSnapshot.SourceType type) {
-        return type != null
-                && type.getIndustry() != null
-                && FORMAL_INDUSTRIES.contains(type.getIndustry());
-    }
-
-    private static CockpitOverviewMonitoringSnapshot.SourceType typeOf(
-            Map<String, Map<String, CockpitOverviewMonitoringSnapshot.SourceType>> types,
-            String objectKind, String code) {
-        Map<String, CockpitOverviewMonitoringSnapshot.SourceType> byCode = types.get(objectKind);
-        return byCode == null ? null : byCode.get(code);
-    }
-
-    private static Map<String, Map<String, CockpitOverviewMonitoringSnapshot.SourceType>> types(
-            CockpitOverviewMonitoringSnapshot snapshot) {
-        if (snapshot == null || snapshot.getTypes() == null) {
-            return Collections.emptyMap();
-        }
-        Map<String, Map<String, CockpitOverviewMonitoringSnapshot.SourceType>> types = new LinkedHashMap<>();
-        for (CockpitOverviewMonitoringSnapshot.SourceType type : snapshot.getTypes()) {
-            if (type != null && !isBlank(type.getCode()) && !isBlank(type.getObjectKind())) {
-                types.computeIfAbsent(type.getObjectKind(), key -> new LinkedHashMap<>())
-                        .putIfAbsent(type.getCode(), type);
-            }
-        }
-        return types;
-    }
-
-    private static <T> List<T> list(CockpitOverviewMonitoringSnapshot snapshot, List<T> values) {
-        return values == null ? Collections.emptyList() : values;
-    }
-
-    private static CockpitOverviewMonitoringResponse.Industry industry(String code) {
-        if (code == null) {
-            return new CockpitOverviewMonitoringResponse.Industry(null, null, "全部");
-        }
-        int index = FORMAL_INDUSTRIES.indexOf(code);
-        return new CockpitOverviewMonitoringResponse.Industry(
-                code,
-                FORMAL_INDUSTRY_KEYS.get(index),
-                label(code));
-    }
-
-    private static String label(String code) {
-        if ("GAS".equals(code)) return "燃气";
-        if ("WATER_SUPPLY".equals(code)) return "供水";
-        if ("DRAINAGE".equals(code)) return "排水";
-        if ("MANHOLE".equals(code)) return "窨井";
-        return code;
-    }
-
-    private static OffsetDateTime parseTime(String value, String fieldName) {
-        if (isBlank(value)) {
-            throw new CockpitInvalidRequestException(fieldName + " is required");
-        }
-        try {
-            return OffsetDateTime.parse(value);
-        } catch (Exception exception) {
-            throw new CockpitInvalidRequestException("invalid " + fieldName);
-        }
-    }
-
-    private String businessTime() {
-        return DateTimeFormatter.ISO_OFFSET_DATE_TIME
-                .format(clock.instant().atZone(BUSINESS_ZONE));
-    }
-
-    private static boolean isBlank(String value) {
-        return value == null || value.trim().isEmpty();
-    }
-
-    private interface StateSupplier {
-        RuntimeState get();
-    }
-
-    private static class RuntimeState {
-        private final CockpitOverviewMonitoringSnapshot snapshot;
-        private final Map<String, DeviceRuntime> devices;
-        private final String acceptedAt;
-
-        private RuntimeState(
-                CockpitOverviewMonitoringSnapshot snapshot,
-                Map<String, DeviceRuntime> devices,
-                String acceptedAt) {
-            this.snapshot = snapshot;
-            this.devices = devices;
-            this.acceptedAt = acceptedAt;
-        }
-
-        private CockpitOverviewMonitoringSnapshot getSnapshot() { return snapshot; }
-        private Map<String, DeviceRuntime> getDevices() { return devices; }
-        private String getAcceptedAt() { return acceptedAt; }
-    }
-
-    private static class DeviceRuntime {
-        private final String typeCode;
-        private final String monitoringState;
-        private final String serverUpdatedAt;
-
-        private DeviceRuntime(String typeCode, String monitoringState, String serverUpdatedAt) {
-            this.typeCode = typeCode;
-            this.monitoringState = monitoringState;
-            this.serverUpdatedAt = serverUpdatedAt;
-        }
-
-        private String getTypeCode() { return typeCode; }
-        private String getMonitoringState() { return monitoringState; }
-        private String getServerUpdatedAt() { return serverUpdatedAt; }
-    }
-}

+ 0 - 120
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/CockpitOverviewMonitoringSnapshot.java

@@ -1,120 +0,0 @@
-package com.zksy.cockpit.overview;
-
-import java.util.List;
-
-public class CockpitOverviewMonitoringSnapshot {
-    private final String updatedAt;
-    private final SourceMetricFreshness metricFreshness;
-    private final List<SourceType> types;
-    private final List<SourceDevice> devices;
-    private final List<SourceMonitoringPoint> monitoringPoints;
-    private final List<SourceMonitoringFacility> monitoringFacilities;
-    private final int infrastructureFacilityCount;
-
-    public CockpitOverviewMonitoringSnapshot(
-            String updatedAt,
-            SourceMetricFreshness metricFreshness,
-            List<SourceType> types,
-            List<SourceDevice> devices,
-            List<SourceMonitoringPoint> monitoringPoints,
-            List<SourceMonitoringFacility> monitoringFacilities,
-            int infrastructureFacilityCount) {
-        this.updatedAt = updatedAt;
-        this.metricFreshness = metricFreshness;
-        this.types = types;
-        this.devices = devices;
-        this.monitoringPoints = monitoringPoints;
-        this.monitoringFacilities = monitoringFacilities;
-        this.infrastructureFacilityCount = infrastructureFacilityCount;
-    }
-
-    public String getUpdatedAt() { return updatedAt; }
-    public SourceMetricFreshness getMetricFreshness() { return metricFreshness; }
-    public List<SourceType> getTypes() { return types; }
-    public List<SourceDevice> getDevices() { return devices; }
-    public List<SourceMonitoringPoint> getMonitoringPoints() { return monitoringPoints; }
-    public List<SourceMonitoringFacility> getMonitoringFacilities() { return monitoringFacilities; }
-    public int getInfrastructureFacilityCount() { return infrastructureFacilityCount; }
-
-    public static class SourceMetricFreshness {
-        private final String status;
-        private final String updatedAt;
-
-        public SourceMetricFreshness(String status, String updatedAt) {
-            this.status = status;
-            this.updatedAt = updatedAt;
-        }
-
-        public String getStatus() { return status; }
-        public String getUpdatedAt() { return updatedAt; }
-    }
-
-    public static class SourceType {
-        private final String code;
-        private final String name;
-        private final String industry;
-        private final String drainageScope;
-        private final String objectKind;
-
-        public SourceType(
-                String code,
-                String name,
-                String industry,
-                String drainageScope,
-                String objectKind) {
-            this.code = code;
-            this.name = name;
-            this.industry = industry;
-            this.drainageScope = drainageScope;
-            this.objectKind = objectKind;
-        }
-
-        public String getCode() { return code; }
-        public String getName() { return name; }
-        public String getIndustry() { return industry; }
-        public String getDrainageScope() { return drainageScope; }
-        public String getObjectKind() { return objectKind; }
-    }
-
-    public static class SourceDevice {
-        private final String deviceCode;
-        private final String typeCode;
-        private final String monitoringState;
-
-        public SourceDevice(String deviceCode, String typeCode, String monitoringState) {
-            this.deviceCode = deviceCode;
-            this.typeCode = typeCode;
-            this.monitoringState = monitoringState;
-        }
-
-        public String getDeviceCode() { return deviceCode; }
-        public String getTypeCode() { return typeCode; }
-        public String getMonitoringState() { return monitoringState; }
-    }
-
-    public static class SourceMonitoringPoint {
-        private final String pointCode;
-        private final String typeCode;
-
-        public SourceMonitoringPoint(String pointCode, String typeCode) {
-            this.pointCode = pointCode;
-            this.typeCode = typeCode;
-        }
-
-        public String getPointCode() { return pointCode; }
-        public String getTypeCode() { return typeCode; }
-    }
-
-    public static class SourceMonitoringFacility {
-        private final String facilityCode;
-        private final String typeCode;
-
-        public SourceMonitoringFacility(String facilityCode, String typeCode) {
-            this.facilityCode = facilityCode;
-            this.typeCode = typeCode;
-        }
-
-        public String getFacilityCode() { return facilityCode; }
-        public String getTypeCode() { return typeCode; }
-    }
-}

+ 0 - 6
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/CockpitOverviewWarningSettingsAdapter.java

@@ -1,6 +0,0 @@
-package com.zksy.cockpit.overview;
-
-public interface CockpitOverviewWarningSettingsAdapter {
-    CockpitOverviewWarningSettingsSnapshot load();
-}
-

+ 0 - 269
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/CockpitOverviewWarningSettingsResponse.java

@@ -1,269 +0,0 @@
-package com.zksy.cockpit.overview;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-
-import java.math.BigDecimal;
-import java.util.List;
-import java.util.Map;
-
-public class CockpitOverviewWarningSettingsResponse {
-    private final String requestId;
-    private final String apiVersion;
-    private final boolean readOnly;
-    private final String displayName;
-    private final String selectedMode;
-    private final String timezone;
-    private final Range range;
-    private final String updatedAt;
-    private final Freshness freshness;
-    private final FamilyMetrics warning;
-    private final FamilyMetrics alarm;
-    private final MapFilter mapFilter;
-
-    public CockpitOverviewWarningSettingsResponse(
-            String requestId,
-            String apiVersion,
-            boolean readOnly,
-            String displayName,
-            String selectedMode,
-            String timezone,
-            Range range,
-            String updatedAt,
-            Freshness freshness,
-            FamilyMetrics warning,
-            FamilyMetrics alarm,
-            MapFilter mapFilter) {
-        this.requestId = requestId;
-        this.apiVersion = apiVersion;
-        this.readOnly = readOnly;
-        this.displayName = displayName;
-        this.selectedMode = selectedMode;
-        this.timezone = timezone;
-        this.range = range;
-        this.updatedAt = updatedAt;
-        this.freshness = freshness;
-        this.warning = warning;
-        this.alarm = alarm;
-        this.mapFilter = mapFilter;
-    }
-
-    public String getRequestId() { return requestId; }
-    public String getApiVersion() { return apiVersion; }
-    public boolean isReadOnly() { return readOnly; }
-    public String getDisplayName() { return displayName; }
-    public String getSelectedMode() { return selectedMode; }
-    public String getTimezone() { return timezone; }
-    public Range getRange() { return range; }
-    public String getUpdatedAt() { return updatedAt; }
-    public Freshness getFreshness() { return freshness; }
-    public FamilyMetrics getWarning() { return warning; }
-    public FamilyMetrics getAlarm() { return alarm; }
-    public MapFilter getMapFilter() { return mapFilter; }
-
-    public static class Range {
-        private final String type;
-        private final String start;
-        private final String end;
-
-        public Range(String type, String start, String end) {
-            this.type = type;
-            this.start = start;
-            this.end = end;
-        }
-
-        public String getType() { return type; }
-        public String getStart() { return start; }
-        public String getEnd() { return end; }
-    }
-
-    public static class Freshness {
-        private final String status;
-        private final String reason;
-        private final String updatedAt;
-        private final String serverUpdatedAt;
-
-        public Freshness(
-                String status,
-                String reason,
-                String updatedAt,
-                String serverUpdatedAt) {
-            this.status = status;
-            this.reason = reason;
-            this.updatedAt = updatedAt;
-            this.serverUpdatedAt = serverUpdatedAt;
-        }
-
-        public String getStatus() { return status; }
-        public String getReason() { return reason; }
-        public String getUpdatedAt() { return updatedAt; }
-        public String getServerUpdatedAt() { return serverUpdatedAt; }
-    }
-
-    /**
-     * 一族(预警或报警)的统计。
-     *
-     * <p><b>预警族</b>(维护者 2026-10-14 裁定:预警不走工单流程)只给**预警自身生命周期**读数:
-     * {@code total}、{@code statusDistribution}({@code WarningWorkflow} 六态)、{@code levelDistribution}、
-     * {@code industryDistribution}、{@code districtDistribution}、{@code handlingEfficiency}
-     * (已解除 ÷ 预警总数,非工单口径)、{@code trend}(按发布时间分桶)。
-     * 工单口径字段({@code handled}/{@code pending}/{@code cancelledCount}/{@code unlinkedEventCount}/
-     * {@code invalidWorkOrderStateCount}/{@code workOrderStates})一律回 {@code null} ——
-     * 「不适用」与「真的是 0」必须分得开,故用包装类型而非 0 冒充。
-     *
-     * <p><b>报警族</b>(维护者裁定:报警生命周期与工单关联性强,报警靠工单闭环)**保留工单口径**
-     * 全部字段与语义({@code handlingEfficiency} 仍是工单口径处置率),同时**并存**报警自身生命周期的
-     * {@code statusDistribution}({@code alarm_status})、{@code levelDistribution}、
-     * {@code industryDistribution}、{@code districtDistribution}。两者并存,不互相冒充。
-     *
-     * <p>除 {@code trend} 外,全部读数取**整个快照**(不随 {@code range} 收缩),
-     * 故 {@code sum(statusDistribution)} == {@code total} 恒成立,与既有 {@code total} 的
-     * 「当前」语义一致;只有趋势桶跟随声明窗口。
-     */
-    public static class FamilyMetrics {
-        private final String eventFamily;
-        private final String state;
-        private final String stateReason;
-        private final int total;
-        private final Integer handled;
-        private final Integer pending;
-        private final Integer cancelledCount;
-        private final Integer unlinkedEventCount;
-        private final Integer invalidWorkOrderStateCount;
-        private final Efficiency handlingEfficiency;
-        private final Map<Integer, Integer> workOrderStates;
-        private final List<Bucket> statusDistribution;
-        private final List<Bucket> levelDistribution;
-        private final List<Bucket> industryDistribution;
-        private final List<Bucket> districtDistribution;
-        private final List<TrendPoint> trend;
-
-        public FamilyMetrics(
-                String eventFamily,
-                String state,
-                String stateReason,
-                int total,
-                Integer handled,
-                Integer pending,
-                Integer cancelledCount,
-                Integer unlinkedEventCount,
-                Integer invalidWorkOrderStateCount,
-                Efficiency handlingEfficiency,
-                Map<Integer, Integer> workOrderStates,
-                List<Bucket> statusDistribution,
-                List<Bucket> levelDistribution,
-                List<Bucket> industryDistribution,
-                List<Bucket> districtDistribution,
-                List<TrendPoint> trend) {
-            this.eventFamily = eventFamily;
-            this.state = state;
-            this.stateReason = stateReason;
-            this.total = total;
-            this.handled = handled;
-            this.pending = pending;
-            this.cancelledCount = cancelledCount;
-            this.unlinkedEventCount = unlinkedEventCount;
-            this.invalidWorkOrderStateCount = invalidWorkOrderStateCount;
-            this.handlingEfficiency = handlingEfficiency;
-            this.workOrderStates = workOrderStates;
-            this.statusDistribution = statusDistribution;
-            this.levelDistribution = levelDistribution;
-            this.industryDistribution = industryDistribution;
-            this.districtDistribution = districtDistribution;
-            this.trend = trend;
-        }
-
-        public String getEventFamily() { return eventFamily; }
-        public String getState() { return state; }
-        public String getStateReason() { return stateReason; }
-        public int getTotal() { return total; }
-        public Integer getHandled() { return handled; }
-        public Integer getPending() { return pending; }
-        public Integer getCancelledCount() { return cancelledCount; }
-        public Integer getUnlinkedEventCount() { return unlinkedEventCount; }
-        public Integer getInvalidWorkOrderStateCount() { return invalidWorkOrderStateCount; }
-        public Efficiency getHandlingEfficiency() { return handlingEfficiency; }
-        public Map<Integer, Integer> getWorkOrderStates() { return workOrderStates; }
-        public List<Bucket> getStatusDistribution() { return statusDistribution; }
-        public List<Bucket> getLevelDistribution() { return levelDistribution; }
-        public List<Bucket> getIndustryDistribution() { return industryDistribution; }
-        public List<Bucket> getDistrictDistribution() { return districtDistribution; }
-        public List<TrendPoint> getTrend() { return trend; }
-    }
-
-    /**
-     * 一个分布桶。{@code code} 是机器键;{@code label} 是展示词。
-     *
-     * <p>「未知」类桶(状态/等级无法识别、行业推不出、片区未分区)也如实入桶,
-     * 因此 {@code sum(桶计数)} 恒等于该族 {@code total},不静默丢数据。
-     */
-    public static class Bucket {
-        private final String code;
-        private final String label;
-        private final int count;
-
-        public Bucket(String code, String label, int count) {
-            this.code = code;
-            this.label = label;
-            this.count = count;
-        }
-
-        public String getCode() { return code; }
-        public String getLabel() { return label; }
-        public int getCount() { return count; }
-    }
-
-    public static class Efficiency {
-        private final int numerator;
-        private final int denominator;
-        private final BigDecimal value;
-        private final String state;
-        private final String reason;
-
-        public Efficiency(int numerator, int denominator, BigDecimal value, String state, String reason) {
-            this.numerator = numerator;
-            this.denominator = denominator;
-            this.value = value;
-            this.state = state;
-            this.reason = reason;
-        }
-
-        public int getNumerator() { return numerator; }
-        public int getDenominator() { return denominator; }
-        @JsonFormat(shape = JsonFormat.Shape.STRING)
-        public BigDecimal getValue() { return value; }
-        public String getState() { return state; }
-        public String getReason() { return reason; }
-    }
-
-    public static class TrendPoint {
-        private final String bucket;
-        private final int total;
-        private final int handled;
-        private final Efficiency handlingEfficiency;
-
-        public TrendPoint(String bucket, int total, int handled, Efficiency handlingEfficiency) {
-            this.bucket = bucket;
-            this.total = total;
-            this.handled = handled;
-            this.handlingEfficiency = handlingEfficiency;
-        }
-
-        public String getBucket() { return bucket; }
-        public int getTotal() { return total; }
-        public int getHandled() { return handled; }
-        public Efficiency getHandlingEfficiency() { return handlingEfficiency; }
-    }
-
-    public static class MapFilter {
-        private final String eventFamily;
-        private final String label;
-
-        public MapFilter(String eventFamily, String label) {
-            this.eventFamily = eventFamily;
-            this.label = label;
-        }
-
-        public String getEventFamily() { return eventFamily; }
-        public String getLabel() { return label; }
-    }
-}

+ 0 - 641
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/CockpitOverviewWarningSettingsService.java

@@ -1,641 +0,0 @@
-package com.zksy.cockpit.overview;
-
-import com.zksy.base.warning.domain.WarningWorkflow;
-import com.zksy.cockpit.workorder.CockpitWorkOrderState;
-import com.zksy.cockpit.workorder.CockpitWorkOrderStateDictionary;
-import com.zksy.cockpit.foundation.CockpitDistrict;
-import com.zksy.cockpit.foundation.CockpitErrorCategory;
-import com.zksy.cockpit.foundation.CockpitErrorPayload;
-import com.zksy.cockpit.foundation.CockpitInvalidRequestException;
-import org.springframework.stereotype.Service;
-
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.time.Clock;
-import java.time.LocalDate;
-import java.time.OffsetDateTime;
-import java.time.ZoneId;
-import java.time.format.DateTimeFormatter;
-import java.time.format.DateTimeParseException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
-/**
- * 总体概览-预警设置。
- *
- * <p><b>口径(维护者 2026-10-14 裁定)</b>:
- * <ul>
- *   <li><b>预警不走工单流程</b>:预警族只给预警自身生命周期读数
- *       (状态分布取 {@link WarningWorkflow} 六态、等级分布、行业/片区分布、
- *       已解除÷总数、按发布时间分桶的趋势)。其工单口径字段一律 {@code null}。</li>
- *   <li><b>报警靠工单闭环</b>:报警族保留工单口径({@code handled}/{@code pending}/
- *       {@code cancelledCount}/{@code workOrderStates}/工单口径处置率),**同时**并存
- *       报警自身生命周期分布。</li>
- * </ul>
- *
- * <p>本端点因此**不再要求工单事实对预警族可用**:预警族读的是 {@code early_warning} 自身,
- * 工单表不可用时预警族仍如实出数。
- */
-@Service
-public class CockpitOverviewWarningSettingsService {
-    private static final ZoneId BUSINESS_ZONE = ZoneId.of("Asia/Shanghai");
-    private static final List<String> MODES =
-            Collections.unmodifiableList(Arrays.asList("WARNING", "ALARM"));
-    private static final List<String> RANGES = Collections.unmodifiableList(
-            Arrays.asList("LAST_24_HOURS", "LAST_7_DAYS", "LAST_30_DAYS"));
-    private static final List<Integer> WORK_ORDER_STATES =
-            CockpitWorkOrderStateDictionary.states().stream()
-                    .map(CockpitWorkOrderState::getCode)
-                    .collect(Collectors.toList());
-    private static final int HANDLED_STATE = CockpitWorkOrderStateDictionary.CLOSED_RATE_CODE;
-    private static final int CANCELLED_STATE = CockpitWorkOrderStateDictionary.CANCELLED_RATE_CODE;
-    private static final DateTimeFormatter BUCKET_DATE = DateTimeFormatter.ofPattern("yyyy-MM-dd");
-
-    /** 预警自身生命周期的展示顺序({@link WarningWorkflow} 主线),不重排、不合并。 */
-    private static final List<String> WARNING_STATUSES = Collections.unmodifiableList(Arrays.asList(
-            WarningWorkflow.DRAFT,
-            WarningWorkflow.PENDING,
-            WarningWorkflow.RECEIVED,
-            WarningWorkflow.PROCESSING,
-            WarningWorkflow.HANDLED,
-            WarningWorkflow.CLOSED));
-
-    /** 报警自身生命周期:{@code alarm_data.alarm_status} 0/1。 */
-    private static final String ALARM_UNHANDLED = "UNHANDLED";
-    private static final String ALARM_HANDLED = "HANDLED";
-    private static final List<String> ALARM_STATUSES =
-            Collections.unmodifiableList(Arrays.asList(ALARM_UNHANDLED, ALARM_HANDLED));
-
-    private static final List<Integer> LEVELS = Collections.unmodifiableList(Arrays.asList(1, 2, 3, 4));
-
-    private static final List<String> INDUSTRIES = Collections.unmodifiableList(
-            Arrays.asList("GAS", "WATER_SUPPLY", "DRAINAGE", "MANHOLE"));
-
-    /** 未知类桶的机器键与展示词:无法识别时如实入桶,不静默丢数据。 */
-    private static final String UNKNOWN_CODE = "UNKNOWN";
-    private static final String UNKNOWN_LABEL = "未知";
-
-    private final CockpitOverviewWarningSettingsAdapter adapter;
-    private final Clock clock;
-
-    public CockpitOverviewWarningSettingsService(
-            CockpitOverviewWarningSettingsAdapter adapter,
-            Clock clock) {
-        this.adapter = adapter;
-        this.clock = clock;
-    }
-
-    /**
-     * 预警设置概览。趋势窗口可声明:`range` 预设(同 `infrastructure/operating-information` 三档)
-     * 或 `startTime`/`endTime` 显式区间;都不声明时维持原 `CURRENT_BASELINE` 行为。
-     */
-    public CockpitOverviewWarningSettingsResponse load(String requestId, String mode,
-            String range, String startTime, String endTime) {
-        String selectedMode = validateMode(mode);
-        Window window = resolveWindow(range, startTime, endTime);
-        CockpitOverviewWarningSettingsSnapshot snapshot = adapter.load();
-        boolean hasSnapshot = snapshot != null && !isBlank(snapshot.getUpdatedAt());
-        String updatedAt = hasSnapshot ? snapshot.getUpdatedAt() : null;
-        String freshnessStatus = hasSnapshot ? "CURRENT" : "EMPTY";
-        String freshnessReason = hasSnapshot ? "READ_ONLY_AGGREGATE" : "NO_SNAPSHOT";
-
-        return new CockpitOverviewWarningSettingsResponse(
-                requestId,
-                "v1",
-                true,
-                "预警设置",
-                selectedMode,
-                "Asia/Shanghai",
-                new CockpitOverviewWarningSettingsResponse.Range(
-                        window.type,
-                        window.start == null ? null : format(window.start),
-                        window.end == null ? null : format(window.end)),
-                updatedAt,
-                new CockpitOverviewWarningSettingsResponse.Freshness(
-                        freshnessStatus,
-                        freshnessReason,
-                        updatedAt,
-                        businessTime()),
-                warningFamily(events(snapshot, "WARNING"), snapshot, window),
-                alarmFamily(events(snapshot, "ALARM"), snapshot, window),
-                mapFilter(selectedMode));
-    }
-
-    public CockpitErrorPayload invalidRequest(String requestId, String message) {
-        return new CockpitErrorPayload(
-                CockpitErrorCategory.INVALID_REQUEST,
-                message,
-                requestId,
-                businessTime());
-    }
-
-    public CockpitErrorPayload serverError(String requestId) {
-        return new CockpitErrorPayload(
-                CockpitErrorCategory.SERVER_ERROR,
-                "驾驶舱预警设置概览数据暂不可用",
-                requestId,
-                businessTime());
-    }
-
-    private String validateMode(String mode) {
-        if (isBlank(mode)) {
-            return "WARNING";
-        }
-        if (!MODES.contains(mode)) {
-            throw new CockpitInvalidRequestException("mode must be WARNING or ALARM");
-        }
-        return mode;
-    }
-
-    /**
-     * 窗口解析:显式区间优先;否则按 `range` 预设;都不给时维持 `CURRENT_BASELINE`(无界)。
-     */
-    private Window resolveWindow(String range, String startTime, String endTime) {
-        boolean hasStart = !isBlank(startTime);
-        boolean hasEnd = !isBlank(endTime);
-        if (hasStart != hasEnd) {
-            throw new CockpitInvalidRequestException("startTime and endTime must be provided together");
-        }
-        if (hasStart) {
-            OffsetDateTime start = parseTime(startTime, "startTime");
-            OffsetDateTime end = parseTime(endTime, "endTime");
-            if (start.isAfter(end)) {
-                throw new CockpitInvalidRequestException("startTime must not be after endTime");
-            }
-            return new Window("CUSTOM", start, end);
-        }
-        if (isBlank(range)) {
-            return new Window("CURRENT_BASELINE", null, null);
-        }
-        String resolved = range.trim();
-        if (!RANGES.contains(resolved)) {
-            throw new CockpitInvalidRequestException(
-                    "range must be LAST_24_HOURS, LAST_7_DAYS or LAST_30_DAYS");
-        }
-        OffsetDateTime end = OffsetDateTime.now(clock)
-                .atZoneSameInstant(BUSINESS_ZONE)
-                .toOffsetDateTime();
-        OffsetDateTime start;
-        if ("LAST_7_DAYS".equals(resolved)) {
-            start = end.minusDays(7);
-        } else if ("LAST_30_DAYS".equals(resolved)) {
-            start = end.minusDays(30);
-        } else {
-            start = end.minusHours(24);
-        }
-        return new Window(resolved, start, end);
-    }
-
-    private static OffsetDateTime parseTime(String value, String fieldName) {
-        try {
-            return OffsetDateTime.parse(value);
-        } catch (DateTimeParseException exception) {
-            throw new CockpitInvalidRequestException("invalid " + fieldName);
-        }
-    }
-
-    private static List<CockpitOverviewWarningSettingsSnapshot.SourceEvent> events(
-            CockpitOverviewWarningSettingsSnapshot snapshot, String eventFamily) {
-        if (snapshot == null || snapshot.getEvents() == null) {
-            return Collections.emptyList();
-        }
-        return snapshot.getEvents().stream()
-                .filter(event -> event != null && eventFamily.equals(event.getEventFamily()))
-                .collect(Collectors.toList());
-    }
-
-    /**
-     * 预警族:**只**给预警自身生命周期读数。工单口径字段全部 {@code null}。
-     *
-     * <p>分布取**整个快照**(不随 `range` 收缩),与既有 {@code total} 的「当前」语义一致,
-     * 故 `sum(statusDistribution) == total` 恒成立;只有趋势桶跟随声明窗口。
-     */
-    private CockpitOverviewWarningSettingsResponse.FamilyMetrics warningFamily(
-            List<CockpitOverviewWarningSettingsSnapshot.SourceEvent> events,
-            CockpitOverviewWarningSettingsSnapshot snapshot,
-            Window window) {
-        int total = events.size();
-        int closed = 0;
-        Map<String, Integer> statusCounts = new LinkedHashMap<>();
-        Map<Integer, Integer> levelCounts = new LinkedHashMap<>();
-        Map<String, Integer> industryCounts = new LinkedHashMap<>();
-        Map<Integer, Integer> districtCounts = new LinkedHashMap<>();
-
-        for (CockpitOverviewWarningSettingsSnapshot.SourceEvent event : events) {
-            String status = normalizeWarningStatus(event.getStatus());
-            statusCounts.merge(status == null ? UNKNOWN_CODE : status, 1, Integer::sum);
-            if (WarningWorkflow.CLOSED.equals(status)) {
-                closed++;
-            }
-            levelCounts.merge(normalizeLevel(event.getLevel()), 1, Integer::sum);
-            industryCounts.merge(
-                    event.getIndustryCode() == null ? UNKNOWN_CODE : event.getIndustryCode(), 1, Integer::sum);
-            districtCounts.merge(event.getDistrictCode(), 1, Integer::sum);
-        }
-
-        return new CockpitOverviewWarningSettingsResponse.FamilyMetrics(
-                "WARNING",
-                total == 0 ? "EMPTY" : "READY",
-                total == 0 ? "NO_EVENTS" : "WARNINGS_RESOLVED",
-                total,
-                // 工单口径字段:预警不走工单流程 → 显式 null(不适用),不用 0 冒充。
-                null,
-                null,
-                null,
-                null,
-                null,
-                selfLifecycleEfficiency(closed, total),
-                null,
-                statusBuckets(statusCounts, WARNING_STATUSES,
-                        CockpitOverviewWarningSettingsService::warningStatusLabel),
-                levelBuckets(levelCounts),
-                industryBuckets(industryCounts),
-                districtBuckets(districtCounts),
-                trend(snapshot, "WARNING", window));
-    }
-
-    /**
-     * 报警族:保留工单口径(维护者裁定:报警靠工单闭环),并**并存**报警自身生命周期分布。
-     *
-     * <p>{@code handled} 是报警自身生命周期({@code alarm_status=1}),
-     * {@code handlingEfficiency} 仍是**工单口径**处置率(状态 5 ÷ 状态 0–6)——
-     * 两者刻意不同源,各自命名清楚,不互相冒充。
-     */
-    private CockpitOverviewWarningSettingsResponse.FamilyMetrics alarmFamily(
-            List<CockpitOverviewWarningSettingsSnapshot.SourceEvent> events,
-            CockpitOverviewWarningSettingsSnapshot snapshot,
-            Window window) {
-        ScopeRate scopeRate = scopeRate(snapshot, window);
-
-        int total = events.size();
-        int handled = 0;
-        int pending = 0;
-        int cancelledCount = 0;
-        int unlinkedEventCount = 0;
-        int invalidWorkOrderStateCount = 0;
-        Map<String, Integer> statusCounts = new LinkedHashMap<>();
-        Map<Integer, Integer> levelCounts = new LinkedHashMap<>();
-        Map<String, Integer> industryCounts = new LinkedHashMap<>();
-        Map<Integer, Integer> districtCounts = new LinkedHashMap<>();
-
-        for (CockpitOverviewWarningSettingsSnapshot.SourceEvent event : events) {
-            String status = normalizeAlarmStatus(event.getStatus());
-            statusCounts.merge(status == null ? UNKNOWN_CODE : status, 1, Integer::sum);
-            if (ALARM_HANDLED.equals(status)) {
-                handled++;
-            }
-            levelCounts.merge(normalizeLevel(event.getLevel()), 1, Integer::sum);
-            industryCounts.merge(
-                    event.getIndustryCode() == null ? UNKNOWN_CODE : event.getIndustryCode(), 1, Integer::sum);
-            districtCounts.merge(event.getDistrictCode(), 1, Integer::sum);
-
-            // 工单口径(与改造前一致):报警靠工单闭环,未回联/脏码如实分列。
-            Integer state = event.getWorkOrderState();
-            if (state == null) {
-                unlinkedEventCount++;
-            } else if (!WORK_ORDER_STATES.contains(state)) {
-                invalidWorkOrderStateCount++;
-            } else if (state == CANCELLED_STATE) {
-                cancelledCount++;
-            } else if (state != HANDLED_STATE) {
-                pending++;
-            }
-        }
-
-        return new CockpitOverviewWarningSettingsResponse.FamilyMetrics(
-                "ALARM",
-                total == 0 ? "EMPTY" : "READY",
-                total == 0 ? "NO_EVENTS" : "EVENTS_RESOLVED",
-                total,
-                handled,
-                pending,
-                cancelledCount,
-                unlinkedEventCount,
-                invalidWorkOrderStateCount,
-                // 报警族处置率仍是**工单口径**(决策票 06 / 维护者 2026-10-14 裁定)。
-                scopeEfficiency(scopeRate.handled, scopeRate.eligible),
-                scopeRate.stateCounts,
-                statusBuckets(statusCounts, ALARM_STATUSES,
-                        CockpitOverviewWarningSettingsService::alarmStatusLabel),
-                levelBuckets(levelCounts),
-                industryBuckets(industryCounts),
-                districtBuckets(districtCounts),
-                trend(snapshot, "ALARM", window));
-    }
-
-    /**
-     * 趋势桶跟随声明窗口:桶为业务时区日期(适配器契约 `yyyy-MM-dd`),
-     * 保留桶日期落在窗口起止日期之间(含端点)的桶;窗口无界时不筛选;
-     * 桶标签无法解析时保留该桶,不静默丢数据。
-     */
-    private List<CockpitOverviewWarningSettingsResponse.TrendPoint> trend(
-            CockpitOverviewWarningSettingsSnapshot snapshot,
-            String eventFamily,
-            Window window) {
-        if (snapshot == null || snapshot.getTrendPoints() == null) {
-            return Collections.emptyList();
-        }
-        List<CockpitOverviewWarningSettingsResponse.TrendPoint> trend = new ArrayList<>();
-        for (CockpitOverviewWarningSettingsSnapshot.SourceTrendPoint point : snapshot.getTrendPoints()) {
-            if (point == null || !eventFamily.equals(point.getEventFamily())) {
-                continue;
-            }
-            if (!window.covers(point.getBucket())) {
-                continue;
-            }
-            trend.add(new CockpitOverviewWarningSettingsResponse.TrendPoint(
-                    point.getBucket(), point.getTotal(), point.getHandled(),
-                    efficiency(point.getTotal(), point.getHandled())));
-        }
-        return trend;
-    }
-
-    /**
-     * 报警族范围处置率:分母=窗口内全部工单的状态 0–6 计数(状态 7 已取消排除),
-     * 按 {@code create_time} 界定窗口。
-     *
-     * <p>只有报警族消费本读数 —— 预警族已按维护者裁定脱离工单。
-     */
-    private ScopeRate scopeRate(CockpitOverviewWarningSettingsSnapshot snapshot, Window window) {
-        Map<Integer, Integer> stateCounts = new LinkedHashMap<>();
-        for (Integer state : WORK_ORDER_STATES) {
-            stateCounts.put(state, 0);
-        }
-        List<CockpitOverviewWarningSettingsSnapshot.SourceWorkOrder> orders =
-                snapshot == null || snapshot.getScopeWorkOrders() == null
-                        ? Collections.emptyList()
-                        : snapshot.getScopeWorkOrders();
-        for (CockpitOverviewWarningSettingsSnapshot.SourceWorkOrder order : orders) {
-            if (order == null || !inWindow(order.getCreateTime(), window)) {
-                continue;
-            }
-            Integer state = order.getStateCode();
-            if (state == null || !WORK_ORDER_STATES.contains(state)) {
-                continue;
-            }
-            stateCounts.merge(state, 1, Integer::sum);
-        }
-        int eligible = 0;
-        for (Map.Entry<Integer, Integer> entry : stateCounts.entrySet()) {
-            if (CockpitWorkOrderStateDictionary.isRateEligible(entry.getKey())) {
-                eligible += entry.getValue();
-            }
-        }
-        return new ScopeRate(stateCounts.getOrDefault(HANDLED_STATE, 0), eligible, stateCounts);
-    }
-
-    /** 无界窗口(`CURRENT_BASELINE`)覆盖全部工单;有界时按 create_time 判定。 */
-    private static boolean inWindow(String createTime, Window window) {
-        if (!window.isBounded()) {
-            return true;
-        }
-        if (isBlank(createTime)) {
-            return false;
-        }
-        try {
-            OffsetDateTime parsed = OffsetDateTime.parse(createTime);
-            return !parsed.isBefore(window.start) && !parsed.isAfter(window.end);
-        } catch (DateTimeParseException ignored) {
-            return false;
-        }
-    }
-
-    /** 预警自身生命周期状态归一:只认 {@link WarningWorkflow} 六态,其余回 {@code null}(进未知桶)。 */
-    private static String normalizeWarningStatus(String status) {
-        if (status == null) {
-            return null;
-        }
-        String value = status.trim().toUpperCase();
-        return WARNING_STATUSES.contains(value) ? value : null;
-    }
-
-    /** 报警自身生命周期状态归一:{@code alarm_status} 0/1,其余回 {@code null}(进未知桶)。 */
-    private static String normalizeAlarmStatus(String status) {
-        if (status == null) {
-            return null;
-        }
-        String value = status.trim().toUpperCase();
-        return ALARM_STATUSES.contains(value) ? value : null;
-    }
-
-    /** 等级归一:{@code warning_level}/{@code alarm_level} 的 1–4 计算编码,其余回 {@code null}(进未知桶)。 */
-    private static Integer normalizeLevel(Integer level) {
-        return level != null && LEVELS.contains(level) ? level : null;
-    }
-
-    private static String warningStatusLabel(String code) {
-        return WarningWorkflow.label(code);
-    }
-
-    private static String alarmStatusLabel(String code) {
-        if (ALARM_HANDLED.equals(code)) {
-            return "已处理";
-        }
-        if (ALARM_UNHANDLED.equals(code)) {
-            return "未处理";
-        }
-        return UNKNOWN_LABEL;
-    }
-
-    private static String industryLabel(String code) {
-        if ("GAS".equals(code)) return "燃气";
-        if ("WATER_SUPPLY".equals(code)) return "供水";
-        if ("DRAINAGE".equals(code)) return "排水";
-        if ("MANHOLE".equals(code)) return "窨井";
-        return UNKNOWN_LABEL;
-    }
-
-    /**
-     * 状态分布:先按族的主线顺序铺全部已知状态(缺的态是真实计数 0,不是"没有数据"),
-     * 再在确有无法识别的状态时补一个未知桶 —— 故 `sum(桶计数) == total` 恒成立。
-     */
-    private static List<CockpitOverviewWarningSettingsResponse.Bucket> statusBuckets(
-            Map<String, Integer> counts,
-            List<String> known,
-            Function<String, String> label) {
-        List<CockpitOverviewWarningSettingsResponse.Bucket> buckets = new ArrayList<>();
-        for (String code : known) {
-            buckets.add(new CockpitOverviewWarningSettingsResponse.Bucket(
-                    code, label.apply(code), counts.getOrDefault(code, 0)));
-        }
-        int unknown = counts.getOrDefault(UNKNOWN_CODE, 0);
-        if (unknown > 0) {
-            buckets.add(new CockpitOverviewWarningSettingsResponse.Bucket(
-                    UNKNOWN_CODE, UNKNOWN_LABEL, unknown));
-        }
-        return buckets;
-    }
-
-    /** 等级分布:1–4 全铺(缺的是真实 0),有脏等级时补未知桶。 */
-    private static List<CockpitOverviewWarningSettingsResponse.Bucket> levelBuckets(
-            Map<Integer, Integer> counts) {
-        List<CockpitOverviewWarningSettingsResponse.Bucket> buckets = new ArrayList<>();
-        for (Integer level : LEVELS) {
-            buckets.add(new CockpitOverviewWarningSettingsResponse.Bucket(
-                    String.valueOf(level), level + "级", counts.getOrDefault(level, 0)));
-        }
-        int unknown = counts.getOrDefault(null, 0);
-        if (unknown > 0) {
-            buckets.add(new CockpitOverviewWarningSettingsResponse.Bucket(
-                    UNKNOWN_CODE, UNKNOWN_LABEL, unknown));
-        }
-        return buckets;
-    }
-
-    /** 行业分布:四个正式行业全铺,推不出行业的进未知桶(不冒充)。 */
-    private static List<CockpitOverviewWarningSettingsResponse.Bucket> industryBuckets(
-            Map<String, Integer> counts) {
-        List<CockpitOverviewWarningSettingsResponse.Bucket> buckets = new ArrayList<>();
-        for (String industry : INDUSTRIES) {
-            buckets.add(new CockpitOverviewWarningSettingsResponse.Bucket(
-                    industry, industryLabel(industry), counts.getOrDefault(industry, 0)));
-        }
-        int unknown = counts.getOrDefault(UNKNOWN_CODE, 0);
-        if (unknown > 0) {
-            buckets.add(new CockpitOverviewWarningSettingsResponse.Bucket(
-                    UNKNOWN_CODE, UNKNOWN_LABEL, unknown));
-        }
-        return buckets;
-    }
-
-    /**
-     * 片区分布:0/1/2 三个正式片区全铺,另**恒有**「未分区」桶 ——
-     * 未分区是合法结果(设备缺失或片区未识别),不是缺数据。
-     */
-    private static List<CockpitOverviewWarningSettingsResponse.Bucket> districtBuckets(
-            Map<Integer, Integer> counts) {
-        List<CockpitOverviewWarningSettingsResponse.Bucket> buckets = new ArrayList<>();
-        for (Integer code : Arrays.asList(0, 1, 2)) {
-            buckets.add(new CockpitOverviewWarningSettingsResponse.Bucket(
-                    String.valueOf(code), CockpitDistrict.nameOf(code), counts.getOrDefault(code, 0)));
-        }
-        buckets.add(new CockpitOverviewWarningSettingsResponse.Bucket(
-                CockpitDistrict.UNASSIGNED_KEY,
-                CockpitDistrict.UNASSIGNED_NAME,
-                counts.getOrDefault(null, 0)));
-        return buckets;
-    }
-
-    /** 预警自身生命周期「已解除率」:分子=已解除,分母=预警总数;分母 0 → 不适用。 */
-    private static CockpitOverviewWarningSettingsResponse.Efficiency selfLifecycleEfficiency(
-            int closed, int total) {
-        BigDecimal value = total == 0
-                ? BigDecimal.ZERO.setScale(4)
-                : BigDecimal.valueOf(closed)
-                        .divide(BigDecimal.valueOf(total), 4, RoundingMode.HALF_UP);
-        return new CockpitOverviewWarningSettingsResponse.Efficiency(
-                closed,
-                total,
-                value,
-                total == 0 ? "EMPTY" : "AVAILABLE",
-                total == 0 ? "NO_WARNINGS" : null);
-    }
-
-    private static CockpitOverviewWarningSettingsResponse.Efficiency scopeEfficiency(int handled, int eligible) {
-        BigDecimal value = eligible == 0
-                ? BigDecimal.ZERO.setScale(4)
-                : BigDecimal.valueOf(handled)
-                        .divide(BigDecimal.valueOf(eligible), 4, RoundingMode.HALF_UP);
-        return new CockpitOverviewWarningSettingsResponse.Efficiency(
-                handled,
-                eligible,
-                value,
-                eligible == 0 ? "EMPTY" : "AVAILABLE",
-                eligible == 0 ? "NO_ELIGIBLE_WORK_ORDERS" : null);
-    }
-
-    /** 报警族范围处置率读数:分子(状态 5)、分母(状态 0–6)、逐态分布。 */
-    private static class ScopeRate {
-        private final int handled;
-        private final int eligible;
-        private final Map<Integer, Integer> stateCounts;
-
-        private ScopeRate(int handled, int eligible, Map<Integer, Integer> stateCounts) {
-            this.handled = handled;
-            this.eligible = eligible;
-            this.stateCounts = stateCounts;
-        }
-    }
-
-    private static CockpitOverviewWarningSettingsResponse.Efficiency efficiency(int total, int handled) {
-        BigDecimal value = total == 0
-                ? BigDecimal.ZERO.setScale(4)
-                : BigDecimal.valueOf(handled)
-                        .divide(BigDecimal.valueOf(total), 4, RoundingMode.HALF_UP);
-        return new CockpitOverviewWarningSettingsResponse.Efficiency(
-                handled,
-                total,
-                value,
-                total == 0 ? "EMPTY" : "AVAILABLE",
-                total == 0 ? "NO_EVENTS" : null);
-    }
-
-    private CockpitOverviewWarningSettingsResponse.MapFilter mapFilter(String selectedMode) {
-        return new CockpitOverviewWarningSettingsResponse.MapFilter(
-                selectedMode,
-                "WARNING".equals(selectedMode) ? "预警" : "报警");
-    }
-
-    private String businessTime() {
-        return format(OffsetDateTime.now(clock).atZoneSameInstant(BUSINESS_ZONE).toOffsetDateTime());
-    }
-
-    private static String format(OffsetDateTime value) {
-        return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value);
-    }
-
-    private static boolean isBlank(String value) {
-        return value == null || value.trim().isEmpty();
-    }
-
-    /** 声明窗口;`start`/`end` 为 `null` 表示无界(`CURRENT_BASELINE`)。 */
-    private static class Window {
-        private final String type;
-        private final OffsetDateTime start;
-        private final OffsetDateTime end;
-
-        private Window(String type, OffsetDateTime start, OffsetDateTime end) {
-            this.type = type;
-            this.start = start;
-            this.end = end;
-        }
-
-        private boolean isBounded() {
-            return start != null && end != null;
-        }
-
-        private boolean covers(String bucket) {
-            if (!isBounded() || isBlank(bucket)) {
-                return true;
-            }
-            LocalDate date = bucketDate(bucket);
-            if (date == null) {
-                return true;
-            }
-            LocalDate startDate = start.atZoneSameInstant(BUSINESS_ZONE).toLocalDate();
-            LocalDate endDate = end.atZoneSameInstant(BUSINESS_ZONE).toLocalDate();
-            return !date.isBefore(startDate) && !date.isAfter(endDate);
-        }
-
-        /** 桶标签:优先按业务日解析,其次按带偏移时间戳解析;都失败返回 `null`。 */
-        private static LocalDate bucketDate(String bucket) {
-            String value = bucket.trim();
-            try {
-                return LocalDate.parse(value, BUCKET_DATE);
-            } catch (DateTimeParseException ignored) {
-                // 继续尝试时间戳形态
-            }
-            try {
-                return OffsetDateTime.parse(value).atZoneSameInstant(BUSINESS_ZONE).toLocalDate();
-            } catch (DateTimeParseException ignored) {
-                return null;
-            }
-        }
-    }
-}

+ 0 - 142
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/CockpitOverviewWarningSettingsSnapshot.java

@@ -1,142 +0,0 @@
-package com.zksy.cockpit.overview;
-
-import java.util.List;
-
-public class CockpitOverviewWarningSettingsSnapshot {
-    private final String updatedAt;
-    private final List<SourceEvent> events;
-    private final List<SourceTrendPoint> trendPoints;
-    private final List<SourceWorkOrder> scopeWorkOrders;
-
-    public CockpitOverviewWarningSettingsSnapshot(
-            String updatedAt,
-            List<SourceEvent> events,
-            List<SourceTrendPoint> trendPoints) {
-        this(updatedAt, events, trendPoints, java.util.Collections.emptyList());
-    }
-
-    public CockpitOverviewWarningSettingsSnapshot(
-            String updatedAt,
-            List<SourceEvent> events,
-            List<SourceTrendPoint> trendPoints,
-            List<SourceWorkOrder> scopeWorkOrders) {
-        this.updatedAt = updatedAt;
-        this.events = events;
-        this.trendPoints = trendPoints;
-        this.scopeWorkOrders = scopeWorkOrders;
-    }
-
-    public String getUpdatedAt() { return updatedAt; }
-    public List<SourceEvent> getEvents() { return events; }
-    public List<SourceTrendPoint> getTrendPoints() { return trendPoints; }
-
-    /**
-     * 范围内**全部工单**(决策票 06):**报警族**处置率分母=状态 0–6 工单数,
-     * 不要求事件回联;按 {@code create_time} 界定窗口。
-     *
-     * <p>维护者 2026-10-14 裁定:预警不走工单流程,故该读数**只服务报警族**,
-     * 预警族不再消费它。事件趋势仍走 {@link SourceTrendPoint}。
-     */
-    public List<SourceWorkOrder> getScopeWorkOrders() { return scopeWorkOrders; }
-
-    public static class SourceWorkOrder {
-        private final Integer stateCode;
-        private final String createTime;
-
-        public SourceWorkOrder(Integer stateCode, String createTime) {
-            this.stateCode = stateCode;
-            this.createTime = createTime;
-        }
-
-        public Integer getStateCode() { return stateCode; }
-        public String getCreateTime() { return createTime; }
-    }
-
-    /**
-     * 一条事件事实(预警或报警),携带**该对象自身生命周期**与**沿设备解析的维度**。
-     *
-     * <p>{@code status} 是对象自身状态原样词:预警取 {@code WarningWorkflow} 六态
-     * ({@code DRAFT/PENDING/RECEIVED/PROCESSING/HANDLED/CLOSED});报警取
-     * {@code alarm_status} 归一后的 {@code UNHANDLED}/{@code HANDLED}。两者都是「自身生命周期」,
-     * 不是工单状态 —— 工单状态另由 {@code workOrderState} 承载(只有报警族消费)。
-     *
-     * <p>{@code districtCode}/{@code industryCode} 由适配器沿设备解析后带入:服务层拿不到
-     * 设备台账,不能在服务层补算。推不出时如实为 {@code null}(未分区/未知行业),不冒充。
-     */
-    public static class SourceEvent {
-        private final String eventFamily;
-        private final String eventCode;
-        private final String deviceCode;
-        private final String workOrderCode;
-        private final Integer workOrderState;
-        private final String status;
-        private final Integer level;
-        private final Integer districtCode;
-        private final String industryCode;
-
-        /** 兼容旧调用点:只给工单回联事实,自身生命周期与维度留空。 */
-        public SourceEvent(
-                String eventFamily,
-                String eventCode,
-                String deviceCode,
-                String workOrderCode,
-                Integer workOrderState) {
-            this(eventFamily, eventCode, deviceCode, workOrderCode, workOrderState, null, null, null, null);
-        }
-
-        public SourceEvent(
-                String eventFamily,
-                String eventCode,
-                String deviceCode,
-                String workOrderCode,
-                Integer workOrderState,
-                String status,
-                Integer level,
-                Integer districtCode,
-                String industryCode) {
-            this.eventFamily = eventFamily;
-            this.eventCode = eventCode;
-            this.deviceCode = deviceCode;
-            this.workOrderCode = workOrderCode;
-            this.workOrderState = workOrderState;
-            this.status = status;
-            this.level = level;
-            this.districtCode = districtCode;
-            this.industryCode = industryCode;
-        }
-
-        public String getEventFamily() { return eventFamily; }
-        public String getEventCode() { return eventCode; }
-        public String getDeviceCode() { return deviceCode; }
-        public String getWorkOrderCode() { return workOrderCode; }
-        public Integer getWorkOrderState() { return workOrderState; }
-        public String getStatus() { return status; }
-        public Integer getLevel() { return level; }
-        public Integer getDistrictCode() { return districtCode; }
-        public String getIndustryCode() { return industryCode; }
-    }
-
-    /**
-     * 趋势桶。{@code handled} 的含义**按族不同**,不共用一套判据:
-     * 预警族=该桶内**已解除({@code CLOSED})**的预警数(自身生命周期);
-     * 报警族=该桶内**关联工单已结案**的报警数(工单口径,维护者裁定报警靠工单闭环)。
-     */
-    public static class SourceTrendPoint {
-        private final String eventFamily;
-        private final String bucket;
-        private final int total;
-        private final int handled;
-
-        public SourceTrendPoint(String eventFamily, String bucket, int total, int handled) {
-            this.eventFamily = eventFamily;
-            this.bucket = bucket;
-            this.total = total;
-            this.handled = handled;
-        }
-
-        public String getEventFamily() { return eventFamily; }
-        public String getBucket() { return bucket; }
-        public int getTotal() { return total; }
-        public int getHandled() { return handled; }
-    }
-}

+ 0 - 11
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/EmptyCockpitOverviewInfrastructureAdapter.java

@@ -1,11 +0,0 @@
-package com.zksy.cockpit.overview;
-
-import org.springframework.stereotype.Component;
-
-@Component
-public class EmptyCockpitOverviewInfrastructureAdapter implements CockpitOverviewInfrastructureAdapter {
-    @Override
-    public CockpitOverviewInfrastructureSnapshot load() {
-        return null;
-    }
-}

+ 0 - 20
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/EmptyCockpitOverviewMonitoringAdapter.java

@@ -1,20 +0,0 @@
-package com.zksy.cockpit.overview;
-
-import org.springframework.stereotype.Component;
-
-import java.util.Collections;
-
-@Component
-public class EmptyCockpitOverviewMonitoringAdapter implements CockpitOverviewMonitoringAdapter {
-    @Override
-    public CockpitOverviewMonitoringSnapshot load() {
-        return new CockpitOverviewMonitoringSnapshot(
-                null,
-                null,
-                Collections.emptyList(),
-                Collections.emptyList(),
-                Collections.emptyList(),
-                Collections.emptyList(),
-                0);
-    }
-}

+ 0 - 18
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/overview/EmptyCockpitOverviewWarningSettingsAdapter.java

@@ -1,18 +0,0 @@
-package com.zksy.cockpit.overview;
-
-import org.springframework.stereotype.Component;
-
-import java.util.Collections;
-
-@Component
-public class EmptyCockpitOverviewWarningSettingsAdapter
-        implements CockpitOverviewWarningSettingsAdapter {
-    @Override
-    public CockpitOverviewWarningSettingsSnapshot load() {
-        return new CockpitOverviewWarningSettingsSnapshot(
-                null,
-                Collections.emptyList(),
-                Collections.emptyList());
-    }
-}
-

+ 0 - 23
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/type/EmptyCockpitTypeMetricsAdapter.java

@@ -1,23 +0,0 @@
-package com.zksy.cockpit.type;
-
-import org.springframework.stereotype.Component;
-
-import java.time.OffsetDateTime;
-
-@Component
-public class EmptyCockpitTypeMetricsAdapter implements CockpitTypeMetricsAdapter {
-    @Override
-    public CockpitTypeMetricsSnapshot loadCurrent(String deviceCode) {
-        return null;
-    }
-
-    @Override
-    public CockpitTypeMetricsSnapshot loadHistory(
-            String deviceCode,
-            OffsetDateTime startTime,
-            OffsetDateTime endTime,
-            int page,
-            int pageSize) {
-        return null;
-    }
-}

+ 0 - 43
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/workorder/BusinessCockpitWorkOrderReadAdapter.java

@@ -269,49 +269,6 @@ public class BusinessCockpitWorkOrderReadAdapter implements CockpitWorkOrderRead
         return result;
     }
 
-    @Override
-    public CockpitWorkOrderReadSnapshot loadByEvent(String eventSource, String eventCode) {
-        if ("ALARM".equals(eventSource)) {
-            // 报警对外标识=alarm_data.id(真实 UUID,实测互不相同);按 alarm_no 亦可定位。
-            AlarmData alarm = findAlarmByReference(eventCode);
-            List<WorkOrder> orders = alarm == null || alarm.getWorkOrderId() == null
-                    ? Collections.emptyList()
-                    : workOrderService.list(new LambdaQueryWrapper<WorkOrder>()
-                            .eq(WorkOrder::getOrderId, alarm.getWorkOrderId())
-                            .orderByDesc(WorkOrder::getCreateTime));
-            // 报警维度:工单经 alarm_data.work_order_id 反查,命中即「实际关联本报警」。
-            // 回显的 eventCode 用报警真实单号(与请求标识一致的可读值)。
-            String resolvedEventCode = alarm == null ? eventCode : alarmReference(alarm);
-            return new CockpitWorkOrderReadSnapshot(null, eventSource, resolvedEventCode,
-                    toAlarmSummaries(orders));
-        }
-        if ("WARNING".equals(eventSource)) {
-            EarlyWarning warning = earlyWarningService.lambdaQuery()
-                    .eq(EarlyWarning::getWarningNo, eventCode)
-                    .one();
-            if (warning == null) {
-                return null;
-            }
-            List<AlarmWarningRel> relations = alarmWarningRelMapper.selectList(
-                    new LambdaQueryWrapper<AlarmWarningRel>()
-                            .eq(AlarmWarningRel::getWarningId, warning.getWarningId()));
-            List<String> alarmIds = relations.stream()
-                    .map(AlarmWarningRel::getAlarmId)
-                    .filter(Objects::nonNull)
-                    .distinct()
-                    .collect(Collectors.toList());
-            List<WorkOrder> orders = alarmIds.isEmpty()
-                    ? Collections.emptyList()
-                    : findOrdersByAlarmIds(alarmIds);
-            Enrichment enrichment = enrichment(orders);
-            List<CockpitWorkOrderSummary> summaries = orders.stream()
-                    .map(order -> toSummary(order, eventSource, eventCode, true, enrichment))
-                    .collect(Collectors.toList());
-            return new CockpitWorkOrderReadSnapshot(null, eventSource, eventCode, summaries);
-        }
-        return null;
-    }
-
     @Override
     public CockpitWorkOrderTimelineSnapshot loadTimeline(String workOrderCode) {
         WorkOrder order = workOrderService.lambdaQuery()

+ 0 - 2
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/workorder/CockpitWorkOrderReadAdapter.java

@@ -5,8 +5,6 @@ import java.util.Date;
 public interface CockpitWorkOrderReadAdapter {
     CockpitWorkOrderReadSnapshot loadByDevice(String deviceCode);
 
-    CockpitWorkOrderReadSnapshot loadByEvent(String eventSource, String eventCode);
-
     CockpitWorkOrderTimelineSnapshot loadTimeline(String workOrderCode);
 
     /**

+ 0 - 18
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/workorder/CockpitWorkOrderReadService.java

@@ -20,8 +20,6 @@ import java.util.List;
 
 @Service
 public class CockpitWorkOrderReadService {
-    private static final List<String> VALID_EVENT_SOURCES = Arrays.asList("ALARM", "WARNING");
-
     /** 正式行业域(与事件族端点同一份词表;票 77 为 /work-orders 补上行业筛选)。 */
     private static final List<String> INDUSTRIES =
             Arrays.asList("GAS", "WATER_SUPPLY", "DRAINAGE", "MANHOLE");
@@ -49,22 +47,6 @@ public class CockpitWorkOrderReadService {
         return response(requestId, snapshot);
     }
 
-    public CockpitWorkOrderReadResponse loadByEvent(
-            String requestId,
-            String eventSource,
-            String eventCode) {
-        if (eventSource == null || !VALID_EVENT_SOURCES.contains(eventSource.trim())) {
-            throw new CockpitInvalidRequestException("event source must be ALARM or WARNING");
-        }
-        validateCode(eventCode, "event code is required");
-        CockpitWorkOrderReadSnapshot snapshot = adapter.loadByEvent(
-                eventSource.trim(), eventCode.trim());
-        if (snapshot == null) {
-            throw new CockpitDeviceNotFoundException("event not found");
-        }
-        return response(requestId, snapshot);
-    }
-
     public CockpitWorkOrderTimelineResponse loadTimeline(String requestId, String workOrderCode) {
         validateCode(workOrderCode, "work order code is required");
         CockpitWorkOrderTimelineSnapshot snapshot = adapter.loadTimeline(workOrderCode.trim());

+ 0 - 33
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/workorder/EmptyCockpitWorkOrderReadAdapter.java

@@ -1,33 +0,0 @@
-package com.zksy.cockpit.workorder;
-
-import org.springframework.stereotype.Component;
-
-@Component
-public class EmptyCockpitWorkOrderReadAdapter implements CockpitWorkOrderReadAdapter {
-    @Override
-    public CockpitWorkOrderReadSnapshot loadByDevice(String deviceCode) {
-        return null;
-    }
-
-    @Override
-    public CockpitWorkOrderReadSnapshot loadByEvent(String eventSource, String eventCode) {
-        return null;
-    }
-
-    @Override
-    public CockpitWorkOrderTimelineSnapshot loadTimeline(String workOrderCode) {
-        return null;
-    }
-
-    @Override
-    public CockpitWorkOrderListSnapshot loadAll(
-            Integer stateCode,
-            java.util.Date startTime,
-            java.util.Date endTime,
-            String industry,
-            com.zksy.cockpit.foundation.CockpitDistrict.Query district,
-            int limit,
-            int offset) {
-        return null;
-    }
-}