Procházet zdrojové kódy

Merge remote-tracking branch 'origin/master'

zengy před 2 týdny
rodič
revize
5ea792f3db
23 změnil soubory, kde provedl 1112 přidání a 415 odebrání
  1. 3 1
      pipe-network-service/pom.xml
  2. 44 0
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/cockpit/CockpitDictController.java
  3. 90 3
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/BusinessCockpitInfrastructureBaseArchivesAdapterTest.java
  4. 220 3
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/BusinessCockpitInfrastructureOperatingInformationAdapterTest.java
  5. 1 1
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/BusinessCockpitOverviewInfrastructureAdapterTest.java
  6. 0 293
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitCollectionRecordsControllerTest.java
  7. 42 0
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitDictControllerTest.java
  8. 176 40
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitEntityDetailServiceTest.java
  9. 28 0
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitFacilityContractTest.java
  10. 2 2
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitFacilityCountCrossEndpointContractTest.java
  11. 12 3
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitVideoControllerTest.java
  12. 31 0
      pipe-network-service/zksy-framework/src/main/java/com/zksy/framework/config/CockpitHttpFirewallConfig.java
  13. 29 0
      pipe-network-service/zksy-framework/src/main/java/com/zksy/framework/config/TomcatConnectorConfig.java
  14. 31 0
      pipe-network-service/zksy-framework/src/main/java/com/zksy/framework/config/WebMvcUrlDecodeConfig.java
  15. 36 7
      pipe-network-service/zksy-framework/src/main/java/com/zksy/framework/config/properties/PermitAllUrlProperties.java
  16. 3 1
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/collectionRecords/CockpitCollectionRecordsService.java
  17. 2 1
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/entity/CockpitEntityCategory.java
  18. 126 24
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/entity/CockpitEntityDetailService.java
  19. 15 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/foundation/CockpitDictRow.java
  20. 36 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/foundation/CockpitFacilityContract.java
  21. 42 5
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/infrastructure/BusinessCockpitInfrastructureBaseArchivesAdapter.java
  22. 129 29
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/infrastructure/BusinessCockpitInfrastructureOperatingInformationAdapter.java
  23. 14 2
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/video/CockpitVideoService.java

+ 3 - 1
pipe-network-service/pom.xml

@@ -41,6 +41,8 @@
         <mybatis-plus.version>3.5.7</mybatis-plus.version>
         <hutool.version>5.7.14</hutool.version>
         <minioutil.version>1.0.1</minioutil.version>
+        <!-- default: skip tests during ordinary builds; pass -DskipTests=false to run them -->
+        <skipTests>true</skipTests>
     </properties>
 
     <!-- 依赖声明 -->
@@ -269,7 +271,7 @@
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-plugin</artifactId>
                 <configuration>
-                    <skipTests>true</skipTests>
+                    <skipTests>${skipTests}</skipTests>
                 </configuration>
             </plugin>
         </plugins>

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

@@ -0,0 +1,44 @@
+package com.zksy.web.controller.cockpit;
+
+import com.zksy.cockpit.foundation.CockpitDictRow;
+import com.zksy.common.core.domain.AjaxResult;
+import com.zksy.common.core.domain.entity.SysDictData;
+import com.zksy.system.service.ISysDictTypeService;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 驾驶舱域的字典透传端点:前端只读 /api/cockpit/v1,不直连管理平台。
+ * 返回 sys_dict_data 原行(dictValue/dictLabel),不在前端硬编码词表。
+ */
+@RestController
+@RequestMapping("/api/cockpit/v1/dict")
+public class CockpitDictController {
+    /** 只透传驾驶舱契约需要的字典,避免把后台任意字典暴露到公开端点。 */
+    private static final List<String> ALLOWED = Collections.singletonList("pump_station_type");
+
+    private final ISysDictTypeService dictTypeService;
+
+    public CockpitDictController(ISysDictTypeService dictTypeService) {
+        this.dictTypeService = dictTypeService;
+    }
+
+    @GetMapping("/{dictType}")
+    public ResponseEntity<AjaxResult> dictType(@PathVariable String dictType) {
+        if (!ALLOWED.contains(dictType)) {
+            return ResponseEntity.ok(AjaxResult.success(Collections.emptyList()));
+        }
+        List<SysDictData> rows = dictTypeService.selectDictDataByType(dictType);
+        List<CockpitDictRow> published = rows == null ? Collections.emptyList() : rows.stream()
+                .map(row -> new CockpitDictRow(row.getDictValue(), row.getDictLabel()))
+                .collect(Collectors.toList());
+        return ResponseEntity.ok(AjaxResult.success(published));
+    }
+}

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

@@ -1,15 +1,24 @@
 package com.zksy.web.controller.cockpit;
 
+import com.zksy.WaterSupply.WaterFireHydrantInfo.domain.WaterFireHydrantInfo;
+import com.zksy.WaterSupply.WaterFireHydrantInfo.service.IWaterFireHydrantInfoService;
+import com.zksy.WaterSupply.WaterSourceInfo.domain.WaterSourceInfo;
+import com.zksy.WaterSupply.WaterSourceInfo.service.IWaterSourceInfoService;
 import com.zksy.WaterSupply.WaterPlantInfo.domain.WaterPlantInfo;
 import com.zksy.WaterSupply.WaterPlantInfo.service.IWaterPlantInfoService;
 import com.zksy.WaterSupply.PumpStationInfo.domain.PumpStationType;
 import com.zksy.WaterSupply.PumpStationInfo.domain.PumpStationInfo;
 import com.zksy.WaterSupply.PumpStationInfo.service.IPumpStationInfoService;
+import com.zksy.WaterSupply.WaterUserInfo.domain.WaterUserInfo;
+import com.zksy.WaterSupply.WaterUserInfo.service.IWaterUserInfoService;
+import com.zksy.base.domain.ManholeBase;
 import com.zksy.base.domain.PipeNetworkBase;
+import com.zksy.base.service.ManholeBaseService;
 import com.zksy.base.service.PipeNetworkBaseService;
 import com.zksy.cockpit.foundation.CockpitPipeNetworkType;
 import com.zksy.cockpit.infrastructure.BusinessCockpitInfrastructureBaseArchivesAdapter;
 import com.zksy.cockpit.infrastructure.CockpitInfrastructureBaseArchivesSnapshot;
+import com.zksy.cockpit.infrastructure.CockpitInfrastructureBaseArchivesSnapshot.SourceFacility;
 import com.zksy.drainage.domain.DrainageGateInfo;
 import com.zksy.drainage.domain.DrainageStorageInfo;
 import com.zksy.drainage.service.DrainageGateInfoService;
@@ -38,6 +47,8 @@ class BusinessCockpitInfrastructureBaseArchivesAdapterTest {
     private PipeNetworkBaseService pipeNetworkBaseService;
     private DrainageGateInfoService gateService;
     private DrainageStorageInfoService storageService;
+    private IWaterUserInfoService waterUserService;
+    private IWaterFireHydrantInfoService hydrantService;
     private BusinessCockpitInfrastructureBaseArchivesAdapter adapter;
 
     @BeforeEach
@@ -47,10 +58,13 @@ class BusinessCockpitInfrastructureBaseArchivesAdapterTest {
         pipeNetworkBaseService = mock(PipeNetworkBaseService.class);
         gateService = mock(DrainageGateInfoService.class);
         storageService = mock(DrainageStorageInfoService.class);
+        waterUserService = mock(IWaterUserInfoService.class);
+        hydrantService = mock(IWaterFireHydrantInfoService.class);
         adapter = new BusinessCockpitInfrastructureBaseArchivesAdapter(
                 plantService, pumpStationService, pipeNetworkBaseService, gateService, storageService,
                 mock(com.zksy.WaterSupply.WaterSourceInfo.service.IWaterSourceInfoService.class),
-                mock(com.zksy.base.service.ManholeBaseService.class));
+                mock(com.zksy.base.service.ManholeBaseService.class),
+                waterUserService, hydrantService);
     }
 
     @Test
@@ -86,7 +100,7 @@ class BusinessCockpitInfrastructureBaseArchivesAdapterTest {
         CockpitInfrastructureBaseArchivesSnapshot snapshot = adapter.load();
 
         assertEquals(4, snapshot.getFacilities().size());
-        assertEquals(10, snapshot.getTypes().size());
+        assertEquals(12, snapshot.getTypes().size());
         assertEquals("DRAINAGE_STORAGE", snapshot.getTypes().get(6).getCode());
         // 设施表都没有 equipment_base.district 那种权威片区来源;本夹具的编码(PLANT-001/
         // PUMP-001/PIPE-001/DRAIN-001)都不带片区前缀,故全部如实报未分区(票 81)。
@@ -205,6 +219,79 @@ class BusinessCockpitInfrastructureBaseArchivesAdapterTest {
                 "只有三条管线应带片区");
     }
 
+    /** 九类设施来源中的用水户、消火栓必须进入正式目录;缺编码行仍按 UNCLASSIFIED 哨兵保留。 */
+    @Test
+    void includesWaterUsersAndFireHydrantsWithStableSourceKeysAndUnclassifiedRows() {
+        WaterUserInfo user = new WaterUserInfo();
+        user.setId("USER-ID-1");
+        user.setUserCode("USER-001");
+        WaterUserInfo missingCode = new WaterUserInfo();
+        missingCode.setId("USER-ID-2");
+        WaterFireHydrantInfo hydrant = new WaterFireHydrantInfo();
+        hydrant.setHydrantId("HYDRANT-ID-1");
+        hydrant.setHydrantCode("HYDRANT-001");
+
+        when(plantService.list()).thenReturn(Collections.emptyList());
+        when(pumpStationService.list()).thenReturn(Collections.emptyList());
+        when(pipeNetworkBaseService.list()).thenReturn(Collections.emptyList());
+        when(gateService.listAll()).thenReturn(Collections.emptyList());
+        when(storageService.listAll()).thenReturn(Collections.emptyList());
+        when(waterUserService.list()).thenReturn(Arrays.asList(user, missingCode));
+        when(hydrantService.list()).thenReturn(Collections.singletonList(hydrant));
+
+        CockpitInfrastructureBaseArchivesSnapshot snapshot = adapter.load();
+
+        assertEquals(12, snapshot.getTypes().size());
+        assertEquals("WATER_USER", snapshot.getTypes().get(10).getCode());
+        assertEquals("WATER_SUPPLY", snapshot.getTypes().get(10).getIndustry());
+        assertEquals("WATER_FIRE_HYDRANT", snapshot.getTypes().get(11).getCode());
+        assertEquals("WATER_SUPPLY", snapshot.getTypes().get(11).getIndustry());
+        assertEquals(3, snapshot.getFacilities().size());
+
+        SourceFacility userFacility = facility(snapshot.getFacilities(), "USER-001");
+        assertEquals("water_user_info|USER-ID-1", userFacility.getSourceKey());
+        assertEquals("WATER_USER", userFacility.getTypeCode());
+        assertNull(userFacility.getDistrict(), "用水户编码没有片区语义");
+        SourceFacility hydrantFacility = facility(snapshot.getFacilities(), "HYDRANT-001");
+        assertEquals("water_fire_hydrant_info|HYDRANT-ID-1", hydrantFacility.getSourceKey());
+        assertEquals("WATER_FIRE_HYDRANT", hydrantFacility.getTypeCode());
+        assertNull(hydrantFacility.getDistrict(), "消火栓编码没有片区语义");
+
+        SourceFacility unclassified = snapshot.getFacilities().stream()
+                .filter(item -> "FACILITY_UNCLASSIFIED".equals(item.getTypeCode()))
+                .findFirst().orElseThrow(AssertionError::new);
+        assertTrue(unclassified.getCode().startsWith("MISSING_CODE:"));
+        assertTrue(unclassified.getSourceKey().startsWith("water_user_info|"));
+    }
+
+    /** 泵站类型物理字符串与字典码 0/1 必须同等归类,避免详情页认得、统计页丢失(评审修复)。 */
+    @Test void classifiesNumericStationTypeCodesLikePhysicalValues() {
+        IWaterPlantInfoService plants = mock(IWaterPlantInfoService.class);
+        IPumpStationInfoService stations = mock(IPumpStationInfoService.class);
+        PipeNetworkBaseService pipes = mock(PipeNetworkBaseService.class);
+        DrainageGateInfoService gates = mock(DrainageGateInfoService.class);
+        DrainageStorageInfoService storages = mock(DrainageStorageInfoService.class);
+        IWaterSourceInfoService sources = mock(IWaterSourceInfoService.class);
+        ManholeBaseService manholes = mock(ManholeBaseService.class);
+        IWaterUserInfoService users = mock(IWaterUserInfoService.class);
+        IWaterFireHydrantInfoService hydrants = mock(IWaterFireHydrantInfoService.class);
+        when(plants.list()).thenReturn(Collections.emptyList());
+        PumpStationInfo supply = new PumpStationInfo(); supply.setId("S0"); supply.setStationCode("PS-0"); supply.setStationType("0");
+        PumpStationInfo drainage = new PumpStationInfo(); drainage.setId("S1"); drainage.setStationCode("PS-1"); drainage.setStationType("1");
+        when(stations.list()).thenReturn(Arrays.asList(supply, drainage));
+        when(pipes.list()).thenReturn(Collections.emptyList());
+        when(gates.listAll()).thenReturn(Collections.emptyList());
+        when(storages.listAll()).thenReturn(Collections.emptyList());
+        when(sources.list()).thenReturn(Collections.emptyList());
+        when(manholes.list()).thenReturn(Collections.emptyList());
+        when(users.list()).thenReturn(Collections.emptyList());
+        when(hydrants.list()).thenReturn(Collections.emptyList());
+        CockpitInfrastructureBaseArchivesSnapshot snapshot = new BusinessCockpitInfrastructureBaseArchivesAdapter(
+                plants, stations, pipes, gates, storages, sources, manholes, users, hydrants).load();
+        assertEquals("WATER_PUMP_STATION", facility(snapshot.getFacilities(), "PS-0").getTypeCode());
+        assertEquals("DRAINAGE_PUMP_STATION", facility(snapshot.getFacilities(), "PS-1").getTypeCode());
+        assertTrue(snapshot.getFacilities().stream().noneMatch(f -> "FACILITY_UNCLASSIFIED".equals(f.getTypeCode())));
+    }
     private static CockpitInfrastructureBaseArchivesSnapshot.SourceFacility facility(
             List<CockpitInfrastructureBaseArchivesSnapshot.SourceFacility> facilities, String code) {
         return facilities.stream()
@@ -221,4 +308,4 @@ class BusinessCockpitInfrastructureBaseArchivesAdapterTest {
         pipe.setLength(new BigDecimal(length));
         return pipe;
     }
-}
+}

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

@@ -6,12 +6,19 @@ import com.zksy.WaterSupply.WaterPlantInfo.service.IWaterPlantInfoService;
 import com.zksy.WaterSupply.PumpStationInfo.domain.PumpStationType;
 import com.zksy.WaterSupply.PumpStationInfo.domain.PumpStationInfo;
 import com.zksy.WaterSupply.PumpStationInfo.service.IPumpStationInfoService;
+import com.zksy.WaterSupply.WaterFireHydrantInfo.domain.WaterFireHydrantInfo;
+import com.zksy.WaterSupply.WaterFireHydrantInfo.service.IWaterFireHydrantInfoService;
+import com.zksy.WaterSupply.WaterSourceInfo.domain.WaterSourceInfo;
+import com.zksy.WaterSupply.WaterSourceInfo.service.IWaterSourceInfoService;
+import com.zksy.WaterSupply.WaterUserInfo.domain.WaterUserInfo;
+import com.zksy.WaterSupply.WaterUserInfo.service.IWaterUserInfoService;
 import com.zksy.base.domain.ManholeBase;
 import com.zksy.base.domain.PipeNetworkBase;
 import com.zksy.base.service.ManholeBaseService;
 import com.zksy.base.service.PipeNetworkBaseService;
 import com.zksy.cockpit.infrastructure.BusinessCockpitInfrastructureOperatingInformationAdapter;
 import com.zksy.cockpit.infrastructure.CockpitInfrastructureOperatingInformationSnapshot;
+import com.zksy.drainage.domain.DrainageGateInfo;
 import com.zksy.drainage.domain.DrainageStorageInfo;
 import com.zksy.drainage.service.DrainageGateInfoService;
 import com.zksy.drainage.service.DrainageStorageInfoService;
@@ -22,6 +29,7 @@ import java.math.BigDecimal;
 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;
@@ -162,8 +170,8 @@ class BusinessCockpitInfrastructureOperatingInformationAdapterTest {
         when(gateService.listAll()).thenReturn(Collections.emptyList());
         when(storageService.listAll()).thenReturn(Collections.emptyList());
         when(manholeBaseService.list()).thenReturn(Arrays.asList(
-                manhole("MH-001", "沅陵县窨井001", "FINE"),
-                manhole("MH-002", "沅陵县窨井002", "BROKEN")));
+                manhole("MH-001", "沅陵县窨井001", "0"),
+                manhole("MH-002", "沅陵县窨井002", "1")));
 
         CockpitInfrastructureOperatingInformationSnapshot snapshot = adapter.load();
 
@@ -174,11 +182,220 @@ class BusinessCockpitInfrastructureOperatingInformationAdapterTest {
         assertEquals("manhole_point_count", first.getMetricCode());
         assertEquals("座", first.getUnit());
         assertEquals(BigDecimal.ONE, first.getValue());
-        assertEquals("MH-001", first.getFacilityId());
+        assertEquals("ID-MH-001", first.getFacilityId()); // 主键是稳定身份;业务码在 pointCodes
         assertFalse(first.isAbnormal(), "状态正常(0)不算异常");
         assertTrue(snapshot.getMetrics().get(1).isAbnormal(), "非 0 状态如实标记为异常");
     }
 
+    /**
+     * 水厂即使没有当前供水能力,也必须下发设施实体行(外部依赖票 01)。
+     *
+     * <p>旧实现把 {@code currentCapacity == null} 当作跳过条件,前端设施点图层只从运行信息
+     * 实体行枚举,于是库里带坐标的水厂永不上图。能力值如实为 null,不拿 0 冒充。</p>
+     */
+    @Test
+    void emitsWaterPlantEntityRowWhenCurrentCapacityMissing() {
+        WaterPlantInfo plant = new WaterPlantInfo();
+        plant.setId("7");
+        plant.setPlantCode("PLANT-007");
+        plant.setPlantName("第二水厂");
+        plant.setCurrentCapacity(null);
+        plant.setDesignCapacity(new BigDecimal("12.00"));
+        plant.setStatus("0");
+        plant.setUpdateTime(LocalDateTime.parse("2026-11-18T09:00:00"));
+
+        when(plantService.list()).thenReturn(Collections.singletonList(plant));
+        when(pumpStationService.list(any(Wrapper.class))).thenReturn(Collections.emptyList());
+        when(pipeNetworkBaseService.list()).thenReturn(Collections.emptyList());
+        when(gateService.listAll()).thenReturn(Collections.emptyList());
+        when(storageService.listAll()).thenReturn(Collections.emptyList());
+        when(manholeBaseService.list()).thenReturn(Collections.emptyList());
+
+        CockpitInfrastructureOperatingInformationSnapshot snapshot = adapter.load();
+
+        assertEquals(1, snapshot.getMetrics().size(), "能力值为空不能丢弃水厂实体行");
+        CockpitInfrastructureOperatingInformationSnapshot.SourceMetric metric = snapshot.getMetrics().get(0);
+        assertEquals("water_plant_current_supply", metric.getMetricCode());
+        assertEquals("WATER_PLANT", metric.getFacilityKind());
+        assertEquals("7", metric.getFacilityId());
+        assertNull(metric.getValue(), "缺失的当前能力如实为 null");
+        assertEquals(new BigDecimal("12.00"), metric.getCapacityValue());
+        assertEquals("PLANT-007", metric.getPointCodes().get(0));
+    }
+
+    /**
+     * 主键缺失时 facilityId 如实为 null,绝不下发字符串 "null"
+     * (票 01 判据 4:实体行的 facilityId 要能用于详情查询,不出现 404/500)。
+     */
+    @Test
+    void waterPlantWithoutPrimaryKeyHasNoQueryableFacilityId() {
+        WaterPlantInfo plant = new WaterPlantInfo();
+        plant.setId(null);
+        plant.setPlantCode("PLANT-NOID");
+        plant.setPlantName("无主键水厂");
+        when(plantService.list()).thenReturn(Collections.singletonList(plant));
+        when(pumpStationService.list(any(Wrapper.class))).thenReturn(Collections.emptyList());
+        when(pipeNetworkBaseService.list()).thenReturn(Collections.emptyList());
+        when(gateService.listAll()).thenReturn(Collections.emptyList());
+        when(storageService.listAll()).thenReturn(Collections.emptyList());
+        when(manholeBaseService.list()).thenReturn(Collections.emptyList());
+
+        CockpitInfrastructureOperatingInformationSnapshot.SourceMetric metric =
+                adapter.load().getMetrics().get(0);
+        assertNull(metric.getFacilityId(), "缺主键的行不能冒充可回查的 facilityId");
+    }
+
+    /** 缺业务编码的水厂仍不产指标(没有稳定身份就无法回查详情)。 */
+    @Test
+    void skipsWaterPlantWithoutBusinessCode() {
+        WaterPlantInfo plant = new WaterPlantInfo();
+        plant.setId("8");
+        plant.setPlantName("无编号水厂");
+        plant.setCurrentCapacity(new BigDecimal("3.00"));
+        when(plantService.list()).thenReturn(Collections.singletonList(plant));
+        when(pumpStationService.list(any(Wrapper.class))).thenReturn(Collections.emptyList());
+        when(pipeNetworkBaseService.list()).thenReturn(Collections.emptyList());
+        when(gateService.listAll()).thenReturn(Collections.emptyList());
+        when(storageService.listAll()).thenReturn(Collections.emptyList());
+        when(manholeBaseService.list()).thenReturn(Collections.emptyList());
+
+        assertTrue(adapter.load().getMetrics().isEmpty());
+    }
+
+    /**
+     * 泵站即使没有设计流量,也必须下发设施实体行(外部依赖票 01);
+     * 设计流量如实为 null,不拿 0 冒充。
+     */
+    @Test
+    void emitsPumpStationEntityRowWhenDesignFlowMissing() {
+        PumpStationInfo pump = new PumpStationInfo();
+        pump.setId("11");
+        pump.setStationCode("PS-011");
+        pump.setStationName("城南加压泵站");
+        pump.setStationType(PumpStationType.WATER_SUPPLY);
+        pump.setDesignFlow(null);
+        pump.setStatus("检修");
+        pump.setUpdateTime(LocalDateTime.parse("2026-11-18T09:00:00"));
+
+        when(plantService.list()).thenReturn(Collections.emptyList());
+        when(pumpStationService.list(any(Wrapper.class))).thenReturn(Collections.singletonList(pump));
+        when(pipeNetworkBaseService.list()).thenReturn(Collections.emptyList());
+        when(gateService.listAll()).thenReturn(Collections.emptyList());
+        when(storageService.listAll()).thenReturn(Collections.emptyList());
+        when(manholeBaseService.list()).thenReturn(Collections.emptyList());
+
+        CockpitInfrastructureOperatingInformationSnapshot snapshot = adapter.load();
+
+        assertEquals(1, snapshot.getMetrics().size(), "设计流量为空不能丢弃泵站实体行");
+        CockpitInfrastructureOperatingInformationSnapshot.SourceMetric metric = snapshot.getMetrics().get(0);
+        assertEquals("water_supply_pump_station_design_flow", metric.getMetricCode());
+        assertEquals("PUMP_STATION", metric.getFacilityKind());
+        assertEquals("11", metric.getFacilityId());
+        assertNull(metric.getValue());
+        assertTrue(metric.isAbnormal(), "状态「检修」如实标记异常");
+    }
+
+    /**
+     * 九类设施必须各下发一条可枚举的实体行(外部依赖票 01)。
+     *
+     * <p>前端设施点图层唯一的实体来源就是这个端点的 {@code facilityKind + facilityId}:
+     * 少一类,图例上有这一类、图上却没有点。这里按当前库的类别清单(水厂、供水泵站、
+     * 排水泵站、水源地、闸门、调蓄设施、消火栓、用水户、窨井)各造一条,钉住九类全覆盖,
+     * 并要求每条都带可用于详情回查的稳定主键。</p>
+     */
+    @Test
+    void enumeratesEntityRowsForAllNineFacilityCategories() {
+        IWaterSourceInfoService waterSourceService = mock(IWaterSourceInfoService.class);
+        IWaterUserInfoService waterUserService = mock(IWaterUserInfoService.class);
+        IWaterFireHydrantInfoService hydrantService = mock(IWaterFireHydrantInfoService.class);
+        BusinessCockpitInfrastructureOperatingInformationAdapter fullAdapter =
+                new BusinessCockpitInfrastructureOperatingInformationAdapter(
+                        plantService, pumpStationService, pipeNetworkBaseService, gateService, storageService,
+                        manholeBaseService, waterUserService, hydrantService, waterSourceService);
+
+        WaterPlantInfo plant = new WaterPlantInfo();
+        plant.setId("1"); plant.setPlantCode("WP001"); plant.setPlantName("一水厂");
+        plant.setCurrentCapacity(null);
+        PumpStationInfo supply = new PumpStationInfo();
+        supply.setId("2"); supply.setStationCode("PS001"); supply.setStationName("供水泵站");
+        supply.setStationType(PumpStationType.WATER_SUPPLY); supply.setDesignFlow(null);
+        PumpStationInfo drainage = new PumpStationInfo();
+        drainage.setId("3"); drainage.setStationCode("PS002"); drainage.setStationName("排水泵站");
+        drainage.setStationType(PumpStationType.DRAINAGE);
+        DrainageGateInfo gate = new DrainageGateInfo();
+        gate.setFacilityId("g-1"); gate.setFacilityCode("G001"); gate.setFacilityName("闸门");
+        DrainageStorageInfo storage = new DrainageStorageInfo();
+        storage.setFacilityId("s-1"); storage.setFacilityCode("S001"); storage.setFacilityName("调蓄池");
+        WaterSourceInfo source = new WaterSourceInfo();
+        source.setId("ws-1"); source.setSourceId("WS001"); source.setSourceName("洮水水源地");
+        source.setLongitude(new BigDecimal("110.440")); source.setLatitude(new BigDecimal("28.450"));
+        WaterUserInfo user = new WaterUserInfo();
+        user.setId("u-1"); user.setUserCode("U001"); user.setUserName("自来水公司");
+        WaterFireHydrantInfo hydrant = new WaterFireHydrantInfo();
+        hydrant.setHydrantId("h-1"); hydrant.setHydrantCode("FH001"); hydrant.setHydrantName("中山路消火栓");
+        ManholeBase manhole = manhole("MH-001", "沅陵县窨井001", "0");
+
+        when(plantService.list()).thenReturn(Collections.singletonList(plant));
+        when(pumpStationService.list(any(Wrapper.class))).thenReturn(Arrays.asList(supply, drainage));
+        when(pipeNetworkBaseService.list()).thenReturn(Collections.emptyList());
+        when(gateService.listAll()).thenReturn(Collections.singletonList(gate));
+        when(storageService.listAll()).thenReturn(Collections.singletonList(storage));
+        when(manholeBaseService.list()).thenReturn(Collections.singletonList(manhole));
+        when(waterSourceService.list()).thenReturn(Collections.singletonList(source));
+        when(waterUserService.list()).thenReturn(Collections.singletonList(user));
+        when(hydrantService.list()).thenReturn(Collections.singletonList(hydrant));
+
+        List<CockpitInfrastructureOperatingInformationSnapshot.SourceMetric> metrics =
+                fullAdapter.load().getMetrics();
+
+        List<String> kinds = metrics.stream()
+                .map(CockpitInfrastructureOperatingInformationSnapshot.SourceMetric::getFacilityKind)
+                .sorted().collect(Collectors.toList());
+        assertEquals(Arrays.asList(
+                        "DRAINAGE_GATE", "DRAINAGE_STORAGE", "MANHOLE", "PUMP_STATION", "PUMP_STATION",
+                        "WATER_FIRE_HYDRANT", "WATER_PLANT", "WATER_SOURCE", "WATER_USER"),
+                kinds, "九类设施(泵站按供水/排水两条)都要有实体行,一条都不能少");
+        // 两条泵站分别落到供水/排水行业,供水泵站与排水泵站各 1 条(票 01 判据 1)。
+        assertEquals(Arrays.asList("DRAINAGE", "WATER_SUPPLY"), metrics.stream()
+                .filter(metric -> "PUMP_STATION".equals(metric.getFacilityKind()))
+                .map(CockpitInfrastructureOperatingInformationSnapshot.SourceMetric::getIndustry)
+                .sorted().collect(Collectors.toList()),
+                "供水泵站与排水泵站都要有实体行且行业归属正确");
+        for (CockpitInfrastructureOperatingInformationSnapshot.SourceMetric metric : metrics) {
+            assertTrue(metric.getFacilityId() != null && !metric.getFacilityId().trim().isEmpty()
+                            && !"null".equals(metric.getFacilityId()),
+                    metric.getFacilityKind() + " 的 facilityId 必须能用于详情回查");
+            assertTrue(Arrays.asList("WATER_PLANT", "PUMP_STATION", "WATER_SOURCE", "WATER_USER",
+                            "WATER_FIRE_HYDRANT", "DRAINAGE_GATE", "DRAINAGE_STORAGE", "MANHOLE")
+                            .contains(metric.getFacilityKind()),
+                    "facilityKind 必须是前端可枚举的设施点类别");
+        }
+        CockpitInfrastructureOperatingInformationSnapshot.SourceMetric waterSource = metrics.stream()
+                .filter(metric -> "WATER_SOURCE".equals(metric.getFacilityKind()))
+                .findFirst().orElseThrow(AssertionError::new);
+        assertEquals("ws-1", waterSource.getFacilityId(), "水源地用主键作实体身份,与详情查询同源");
+        assertEquals("WATER_SUPPLY", waterSource.getIndustry());
+        assertEquals("处", waterSource.getUnit());
+        assertEquals("洮水水源地", waterSource.getMetricName());
+        assertEquals(BigDecimal.ONE, waterSource.getValue());
+        assertEquals("WS001", waterSource.getPointCodes().get(0));
+    }
+
+    /** 水源地缺业务编号时不产实体行(与其他类别同一纪律:无稳定编码不上图)。 */
+    @Test
+    void skipsWaterSourceWithoutBusinessCode() {
+        IWaterSourceInfoService waterSourceService = mock(IWaterSourceInfoService.class);
+        BusinessCockpitInfrastructureOperatingInformationAdapter fullAdapter =
+                new BusinessCockpitInfrastructureOperatingInformationAdapter(
+                        plantService, pumpStationService, pipeNetworkBaseService, gateService, storageService,
+                        manholeBaseService, null, null, waterSourceService);
+        WaterSourceInfo source = new WaterSourceInfo();
+        source.setId("ws-2"); source.setSourceName("无编号水源地");
+        when(waterSourceService.list()).thenReturn(Collections.singletonList(source));
+
+        assertTrue(fullAdapter.load().getMetrics().isEmpty());
+    }
+
     /** 没有窨井时不产指标(不拿 0 凑数)。 */
     @Test
     void emitsNoManholeMetricWhenThereAreNone() {

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

@@ -78,7 +78,7 @@ class BusinessCockpitOverviewInfrastructureAdapterTest {
 
         CockpitOverviewInfrastructureSnapshot snapshot = adapter.load();
 
-        assertEquals(12, snapshot.getTypes().size());
+        assertEquals(14, snapshot.getTypes().size()); // 设施目录新增用水户与消火栓两类
         assertEquals("2026-09-02T09:59:50+08:00", snapshot.getUpdatedAt());
 
         long deviceCount = snapshot.getCounts().stream()

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

@@ -1,293 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.zksy.base.domain.EquipmentBase;
-import com.zksy.base.domain.EquipmentType;
-import com.zksy.base.mapper.EquipmentBaseMapper;
-import com.zksy.base.mapper.EquipmentStatusMapper;
-import com.zksy.base.mapper.EquipmentTypeMapper;
-import com.zksy.base.perception.mapper.PerceptionMapper;
-import com.zksy.base.perception.service.impl.PerceptionServiceImpl;
-import com.zksy.base.warning.mapper.EquipmentWarningTypeMapper;
-import com.zksy.cockpit.collectionRecords.CockpitCollectionRecordsService;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.springframework.test.util.ReflectionTestUtils;
-import org.springframework.test.web.servlet.MockMvc;
-import org.springframework.test.web.servlet.setup.MockMvcBuilders;
-
-import java.time.LocalDateTime;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.mock;
-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 seam + 真实Service/profile,仅数据库读取边界使用fixture。 */
-class CockpitCollectionRecordsControllerTest {
-    static final String CODE = "TC-GS-202609020001";
-    static final String ID = "internal-equipment-uuid";
-    private EquipmentBaseMapper equipmentMapper;
-    private EquipmentTypeMapper typeMapper;
-    private PerceptionMapper recordsMapper;
-    private MockMvc mvc;
-
-    @BeforeEach
-    void setup() {
-        equipmentMapper = mock(EquipmentBaseMapper.class);
-        typeMapper = mock(EquipmentTypeMapper.class);
-        recordsMapper = mock(PerceptionMapper.class);
-        EquipmentBase base = new EquipmentBase();
-        base.setEquipmentId(ID);
-        base.setEquipmentCode(CODE);
-        base.setEquipmentTypeId(10);
-        when(equipmentMapper.selectOne(any())).thenAnswer(invocation -> {
-            com.baomidou.mybatisplus.core.conditions.query.QueryWrapper<?> query = invocation.getArgument(0);
-            query.getSqlSegment();
-            return query.getParamNameValuePairs().containsValue(CODE) ? base : null;
-        });
-        when(equipmentMapper.selectById(ID)).thenReturn(base);
-        EquipmentType type = new EquipmentType();
-        type.setOrigCollTable("firefighting_pressure");
-        when(typeMapper.selectById(10)).thenReturn(type);
-        EquipmentWarningTypeMapper indicators = mock(EquipmentWarningTypeMapper.class);
-        when(indicators.selectList(any())).thenReturn(Collections.emptyList());
-        PerceptionServiceImpl profile = new PerceptionServiceImpl();
-        ReflectionTestUtils.setField(profile, "equipmentBaseMapper", equipmentMapper);
-        ReflectionTestUtils.setField(profile, "equipmentTypeMapper", typeMapper);
-        ReflectionTestUtils.setField(profile, "equipmentStatusMapper", mock(EquipmentStatusMapper.class));
-        ReflectionTestUtils.setField(profile, "perceptionMapper", recordsMapper);
-        ReflectionTestUtils.setField(profile, "equipmentWarningTypeMapper", indicators);
-        mvc = MockMvcBuilders.standaloneSetup(new CockpitCollectionRecordsController(
-                new CockpitCollectionRecordsService(equipmentMapper, profile)))
-                .setMessageConverters(new org.springframework.http.converter.json.MappingJackson2HttpMessageConverter())
-                .build();
-    }
-
-    @Test
-    void pressureRecordsExposeReferenceColumnsAndCreateTimeWithoutInternalId() throws Exception {
-        when(recordsMapper.selectLatestRecords("firefighting_pressure", "telemetering_station", CODE, 50))
-                .thenReturn(Collections.singletonList(record("2026-11-04T10:20:00", "pressure_value", 0)));
-        mvc.perform(get("/api/cockpit/v1/equipments/" + CODE + "/collection-records")
-                        .header("X-Request-Id", "collection-001"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.requestId").value("collection-001"))
-                .andExpect(jsonPath("$.data.apiVersion").value("v1"))
-                .andExpect(jsonPath("$.data.readOnly").value(true))
-                .andExpect(jsonPath("$.data.deviceCode").value(CODE))
-                .andExpect(jsonPath("$.data.state").value("READY"))
-                .andExpect(jsonPath("$.data.equipmentId").doesNotExist())
-                .andExpect(jsonPath("$.data.recordView.layout").value("wide"))
-                .andExpect(jsonPath("$.data.recordView.columns[1].key").value("pressure_value"))
-                .andExpect(jsonPath("$.data.recordView.columns[1].label").value("压力"))
-                .andExpect(jsonPath("$.data.recordView.columns[1].unit").value("MPa"))
-                .andExpect(jsonPath("$.data.recordView.columns[1].isAlarm").value(false))
-                .andExpect(jsonPath("$.data.recordView.rows[0].createTime").value("2026-11-04 10:20:00"))
-                .andExpect(jsonPath("$.data.recordView.rows[0].cells[0].value").value("0"));
-    }
-
-    @Test
-    void invalidCodeIsBadRequestWithoutReadingDatabase() throws Exception {
-        mvc.perform(get("/api/cockpit/v1/equipments/%20/collection-records")
-                        .header("X-Request-Id", "invalid-001"))
-                .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.state").value("FAILED"))
-                .andExpect(jsonPath("$.data.stateReason").value("设备编码不能为空"))
-                .andExpect(jsonPath("$.data.requestId").value("invalid-001"));
-        org.mockito.Mockito.verifyNoInteractions(equipmentMapper, recordsMapper);
-    }
-
-    @Test
-    void unknownBusinessCodeIsNotFoundNotEmpty() throws Exception {
-        org.mockito.Mockito.doReturn(null).when(equipmentMapper).selectOne(any());
-        mvc.perform(get("/api/cockpit/v1/equipments/MISSING/collection-records"))
-                .andExpect(status().isNotFound())
-                .andExpect(jsonPath("$.data.state").value("FAILED"))
-                .andExpect(jsonPath("$.data.stateReason").value("设备不存在"));
-        org.mockito.Mockito.verifyNoInteractions(recordsMapper);
-    }
-
-    @Test
-    void databaseFailureIsUnavailableNotSuccessfulEmpty() throws Exception {
-        org.mockito.Mockito.doThrow(new IllegalStateException("password secret database"))
-                .when(equipmentMapper).selectOne(any());
-        mvc.perform(get("/api/cockpit/v1/equipments/" + CODE + "/collection-records"))
-                .andExpect(status().isInternalServerError())
-                .andExpect(jsonPath("$.data.state").value("FAILED"))
-                .andExpect(jsonPath("$.data.stateReason").value("驾驶舱采集记录读取失败,暂不可用"))
-                .andExpect(jsonPath("$.data.recordView.rows").isEmpty());
-    }
-
-    @Test
-    void configuredCollectionWithNoRowsIsEmpty() throws Exception {
-        when(recordsMapper.selectLatestRecords("firefighting_pressure", "telemetering_station", CODE, 50))
-                .thenReturn(Collections.emptyList());
-        mvc.perform(get("/api/cockpit/v1/equipments/" + CODE + "/collection-records"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.state").value("EMPTY"))
-                .andExpect(jsonPath("$.data.stateReason").value("暂无采集记录"))
-                .andExpect(jsonPath("$.data.recordView.columns[0].key").value("create_time"))
-                .andExpect(jsonPath("$.data.recordView.rows").isEmpty());
-    }
-
-    @Test
-    void unsupportedCollectionTableIsUnavailableNotEmpty() throws Exception {
-        EquipmentType type = new EquipmentType();
-        type.setOrigCollTable("not_a_whitelisted_collection");
-        when(typeMapper.selectById(10)).thenReturn(type);
-        mvc.perform(get("/api/cockpit/v1/equipments/" + CODE + "/collection-records"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.state").value("UNAVAILABLE"))
-                .andExpect(jsonPath("$.data.stateReason").value("设备采集表未配置或暂不支持"))
-                .andExpect(jsonPath("$.data.recordView.rows").isEmpty());
-        org.mockito.Mockito.verifyNoInteractions(recordsMapper);
-    }
-
-    @Test
-    void missingSampleTimeAndNullValueRemainUnknownInsteadOfReportTimeOrZero() throws Exception {
-        when(recordsMapper.selectLatestRecords("firefighting_pressure", "telemetering_station", CODE, 50))
-                .thenReturn(Collections.singletonList(record(null, "pressure_value", null)));
-        mvc.perform(get("/api/cockpit/v1/equipments/" + CODE + "/collection-records"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.recordView.rows[0].createTime").value(org.hamcrest.Matchers.nullValue()))
-                .andExpect(jsonPath("$.data.recordView.rows[0].cells[0].value").value(org.hamcrest.Matchers.nullValue()))
-                .andExpect(jsonPath("$.data.recordView.rows[0].cells[0].display").value("—"));
-    }
-
-    @Test
-    void environmentHistoryKeepsOnlyWaterQualityFactorsAndAllSampleTimes() throws Exception {
-        EquipmentType type = new EquipmentType();
-        type.setOrigCollTable("e_real_time_data");
-        when(typeMapper.selectById(10)).thenReturn(type);
-        Map<String, Object> cod = record("2026-11-04T10:20:00", "hum", 0);
-        cod.put("node_id", 2);
-        cod.put("temperature", 99);
-        Map<String, Object> ammonia = record("2026-11-04T10:20:00", "hum", 2);
-        ammonia.put("node_id", 3);
-        Map<String, Object> older = record("2026-11-04T10:19:00", "hum", 7);
-        older.put("node_id", 5);
-        when(recordsMapper.selectLatestRecords("e_real_time_data", "device_id", CODE, 50))
-                .thenReturn(java.util.Arrays.asList(cod, ammonia, older));
-        mvc.perform(get("/api/cockpit/v1/equipments/" + CODE + "/collection-records"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.recordView.layout").value("long"))
-                .andExpect(jsonPath("$.data.recordView.columns.length()").value(2))
-                .andExpect(jsonPath("$.data.recordView.rows.length()").value(3))
-                .andExpect(jsonPath("$.data.recordView.rows[0].cells.length()").value(1))
-                .andExpect(jsonPath("$.data.recordView.rows[0].cells[0].key").value("indicator"))
-                .andExpect(jsonPath("$.data.recordView.rows[0].cells[0].display").value("化学需氧量(COD):0mg/L"))
-                .andExpect(jsonPath("$.data.recordView.rows[1].cells[0].display").value("氨氮:2mg/L"))
-                .andExpect(jsonPath("$.data.recordView.rows[2].createTime").value("2026-11-04 10:19:00"))
-                .andExpect(jsonPath("$.data.recordView.rows[2].cells[0].display").value("酸碱度(pH):7"));
-    }
-
-    @Test
-    void endpointCapsHistoryAtNewestFiftyCreateTimes() throws Exception {
-        java.util.List<Map<String, Object>> records = new java.util.ArrayList<>();
-        for (int minute = 0; minute < 55; minute++) {
-            records.add(record(LocalDateTime.parse("2026-11-04T10:00:00").plusMinutes(minute).toString(),
-                    "pressure_value", minute));
-        }
-        when(recordsMapper.selectLatestRecords("firefighting_pressure", "telemetering_station", CODE, 50))
-                .thenReturn(records);
-        mvc.perform(get("/api/cockpit/v1/equipments/" + CODE + "/collection-records"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.recordView.rows.length()").value(50))
-                .andExpect(jsonPath("$.data.recordView.rows[0].createTime").value("2026-11-04 10:54:00"))
-                .andExpect(jsonPath("$.data.recordView.rows[49].createTime").value("2026-11-04 10:05:00"));
-    }
-
-    @Test
-    void unknownAlarmStatusIsNotFabricatedAsNormalWhileZeroRemainsNormal() throws Exception {
-        EquipmentType type = new EquipmentType();
-        type.setOrigCollTable("jg_device_data");
-        when(typeMapper.selectById(10)).thenReturn(type);
-        Map<String, Object> record = record("2026-11-04T10:20:00", "water_infiltration_alarm_status", null);
-        record.put("water_level_alarm_status", 0);
-        record.put("battery_level", 0);
-        when(recordsMapper.selectLatestRecords("jg_device_data", "imei_card_number", CODE, 50))
-                .thenReturn(Collections.singletonList(record));
-        mvc.perform(get("/api/cockpit/v1/equipments/" + CODE + "/collection-records"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.recordView.columns[2].isAlarm").value(true))
-                .andExpect(jsonPath("$.data.recordView.rows[0].cells[1].value").value(org.hamcrest.Matchers.nullValue()))
-                .andExpect(jsonPath("$.data.recordView.rows[0].cells[1].display").value("—"))
-                .andExpect(jsonPath("$.data.recordView.rows[0].cells[1].alarm").value(false))
-                .andExpect(jsonPath("$.data.recordView.rows[0].cells[2].value").value("正常"))
-                .andExpect(jsonPath("$.data.recordView.rows[0].cells[4].value").value("0"));
-    }
-
-    @Test
-    void internalIdCannotReplaceBusinessCodeAndMutationsAreRejected() throws Exception {
-        mvc.perform(get("/api/cockpit/v1/equipments/" + ID + "/collection-records"))
-                .andExpect(status().isNotFound());
-        mvc.perform(org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post(
-                "/api/cockpit/v1/equipments/" + CODE + "/collection-records"))
-                .andExpect(status().isMethodNotAllowed());
-        org.mockito.Mockito.verifyNoInteractions(recordsMapper);
-    }
-
-    @Test
-    void noiseAudioPathAndReferenceColumnsArePassedThroughWithoutPrivateRecords() throws Exception {
-        EquipmentType type = new EquipmentType();
-        type.setOrigCollTable("noise_info");
-        when(typeMapper.selectById(10)).thenReturn(type);
-        Map<String, Object> record = record("2026-11-04T10:20:00", "filepath", "/device-audio/noise-001.wav");
-        record.put("rms", 0);
-        record.put("gain", 2);
-        record.put("center_frequency", 99);
-        when(recordsMapper.selectLatestRecords("noise_info", "encode", CODE, 50))
-                .thenReturn(Collections.singletonList(record));
-        String response = mvc.perform(get("/api/cockpit/v1/equipments/" + CODE + "/collection-records"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.recordView.columns.length()").value(5))
-                .andExpect(jsonPath("$.data.recordView.columns[4].key").value("filepath"))
-                .andExpect(jsonPath("$.data.recordView.columns[4].label").value("音频文件"))
-                .andExpect(jsonPath("$.data.recordView.rows[0].cells[0].value").value("0"))
-                .andExpect(jsonPath("$.data.recordView.rows[0].cells[3].value").value("/device-audio/noise-001.wav"))
-                .andExpect(jsonPath("$.data.base").doesNotExist())
-                .andExpect(jsonPath("$.data.records").doesNotExist())
-                .andReturn().getResponse().getContentAsString();
-        org.junit.jupiter.api.Assertions.assertFalse(response.contains("private-record-id"));
-        org.junit.jupiter.api.Assertions.assertFalse(response.contains(ID));
-    }
-
-    @Test
-    void missingLongFactorRemainsNullWithChineseDisplay() throws Exception {
-        EquipmentType type = new EquipmentType();
-        type.setOrigCollTable("e_real_time_data");
-        when(typeMapper.selectById(10)).thenReturn(type);
-        Map<String, Object> record = record(null, "hum", null);
-        record.put("node_id", 3);
-        when(recordsMapper.selectLatestRecords("e_real_time_data", "device_id", CODE, 50))
-                .thenReturn(Collections.singletonList(record));
-        mvc.perform(get("/api/cockpit/v1/equipments/" + CODE + "/collection-records"))
-                .andExpect(status().isOk())
-                .andExpect(jsonPath("$.data.recordView.rows[0].cells[0].value").value(org.hamcrest.Matchers.nullValue()))
-                .andExpect(jsonPath("$.data.recordView.rows[0].cells[0].display").value("氨氮:—"));
-    }
-
-    @Test
-    void malformedEncodingAndEmbeddedControlCharacterAreInvalidBeforeDatabaseRead() throws Exception {
-        mvc.perform(get("/api/cockpit/v1/equipments/%ZZ/collection-records"))
-                .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.stateReason").value("设备编码不合法"));
-        mvc.perform(get("/api/cockpit/v1/equipments/TC%0AGS/collection-records"))
-                .andExpect(status().isBadRequest())
-                .andExpect(jsonPath("$.data.stateReason").value("设备编码不合法"));
-        org.mockito.Mockito.verifyNoInteractions(equipmentMapper, recordsMapper);
-    }
-
-    static Map<String, Object> record(String time, String key, Object value) {
-        Map<String, Object> record = new LinkedHashMap<>();
-        record.put("create_time", time == null ? null : LocalDateTime.parse(time));
-        record.put(key, value);
-        record.put("report_time", LocalDateTime.parse("2027-01-01T00:00:00"));
-        record.put("id", "private-record-id");
-        return record;
-    }
-}

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

@@ -0,0 +1,42 @@
+package com.zksy.web.controller.cockpit;
+
+import com.zksy.common.core.domain.entity.SysDictData;
+import com.zksy.system.service.ISysDictTypeService;
+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.util.Arrays;
+
+import static org.mockito.Mockito.*;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
+
+class CockpitDictControllerTest {
+    private final ISysDictTypeService dictTypeService = mock(ISysDictTypeService.class);
+    private MockMvc mvc;
+
+    @BeforeEach void setup() { mvc = MockMvcBuilders.standaloneSetup(new CockpitDictController(dictTypeService)).build(); }
+
+    @Test void exposesPumpStationTypeDictionaryUnderCockpitDomain() throws Exception {
+        SysDictData supply = new SysDictData(); supply.setDictType("pump_station_type"); supply.setDictValue("0"); supply.setDictLabel("供水泵站");
+        SysDictData drainage = new SysDictData(); drainage.setDictType("pump_station_type"); drainage.setDictValue("1"); drainage.setDictLabel("排水泵站");
+        when(dictTypeService.selectDictDataByType("pump_station_type")).thenReturn(Arrays.asList(supply, drainage));
+        mvc.perform(get("/api/cockpit/v1/dict/pump_station_type"))
+                .andExpect(status().isOk())
+                .andExpect(jsonPath("$.code").value(200))
+                .andExpect(jsonPath("$.data[0].dictValue").value("0"))
+                .andExpect(jsonPath("$.data[0].dictLabel").value("供水泵站"))
+                .andExpect(jsonPath("$.data[1].dictValue").value("1"));
+        verify(dictTypeService).selectDictDataByType("pump_station_type");
+    }
+
+    @Test void missingDictionaryIsEmptyNotError() throws Exception {
+        when(dictTypeService.selectDictDataByType("unknown_type")).thenReturn(null);
+        mvc.perform(get("/api/cockpit/v1/dict/unknown_type"))
+                .andExpect(status().isOk())
+                .andExpect(jsonPath("$.code").value(200))
+                .andExpect(jsonPath("$.data.length()").value(0));
+    }
+}

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

@@ -1,13 +1,20 @@
 package com.zksy.web.controller.cockpit;
 
+import com.zksy.WaterSupply.WaterFireHydrantInfo.domain.WaterFireHydrantInfo;
+import com.zksy.WaterSupply.WaterFireHydrantInfo.service.IWaterFireHydrantInfoService;
 import com.zksy.WaterSupply.WaterPlantInfo.domain.WaterPlantInfo;
 import com.zksy.WaterSupply.WaterPlantInfo.service.IWaterPlantInfoService;
+import com.zksy.WaterSupply.WaterSourceInfo.domain.WaterSourceInfo;
+import com.zksy.WaterSupply.WaterSourceInfo.service.IWaterSourceInfoService;
+import com.zksy.WaterSupply.WaterUserInfo.domain.WaterUserInfo;
+import com.zksy.WaterSupply.WaterUserInfo.service.IWaterUserInfoService;
 import com.zksy.WaterSupply.PumpStationInfo.domain.PumpStationInfo;
 import com.zksy.WaterSupply.PumpStationInfo.service.IPumpStationInfoService;
 import com.zksy.base.domain.*;
 import com.zksy.base.service.*;
 import com.zksy.cockpit.entity.*;
 import com.zksy.drainage.domain.DrainageGateInfo;
+import com.zksy.drainage.domain.DrainageStorageInfo;
 import com.zksy.drainage.service.DrainageGateInfoService;
 import com.zksy.drainage.service.DrainageStorageInfoService;
 import org.junit.jupiter.api.Test;
@@ -25,7 +32,10 @@ class CockpitEntityDetailServiceTest {
     private final HazardHiddenAccountService hazards = mock(HazardHiddenAccountService.class);
     private final RiskAssessmentService risks = mock(RiskAssessmentService.class);
     private final ManholeBaseService manholes = mock(ManholeBaseService.class);
-    private final CockpitEntityDetailService service = new CockpitEntityDetailService(pipes, plants, stations, equipment, gates, storages, equipmentStatuses, hazards, risks, manholes);
+    private final IWaterUserInfoService users = mock(IWaterUserInfoService.class);
+    private final IWaterFireHydrantInfoService hydrants = mock(IWaterFireHydrantInfoService.class);
+    private final IWaterSourceInfoService waterSources = mock(IWaterSourceInfoService.class);
+    private final CockpitEntityDetailService service = new CockpitEntityDetailService(pipes, plants, stations, equipment, gates, storages, equipmentStatuses, hazards, risks, manholes, users, hydrants, waterSources);
 
     @Test void resolvesEverySupportedCategoryWithStableAttributes() {
         PipeNetworkBase pipe = new PipeNetworkBase(); pipe.setNetworkId("p1"); pipe.setNetworkCode("PN1"); pipe.setNetworkName("管网"); pipe.setMaterial("PE"); when(pipes.getById("p1")).thenReturn(pipe);
@@ -56,44 +66,170 @@ class CockpitEntityDetailServiceTest {
         assertEquals("HIGH", service.load("q", "protection-target", "r1").getAttributes().get("riskLevel"));
     }
 
-    /**
-     * 窨井详情(维护者 2026-11-16)。
-     *
-     * <p>原话:「设施台账中的窨井卡片无法展开详情,提示为『设施类别未发布,无法展开详情』」。
-     * 根因是后端枚举与 switch 都没有 MANHOLE —— 前端白名单只是第二道门。
-     * 本用例钉住:category=MANHOLE 能解析、能按 manhole_base 主键取到详情,
-     * 且井深/形状/材质/权属这些窨井专有字段如实下发。</p>
-     */
-    @Test void resolvesManholeCategoryWithItsOwnAttributes() {
-        ManholeBase manhole = new ManholeBase();
-        manhole.setManholeId("mh-1");
-        manhole.setManholeCode("YL-YJ-002");
-        manhole.setManholeName("沅陵县窨井002");
-        manhole.setManholeDepth(new java.math.BigDecimal("12.0"));
-        manhole.setManholeShape("0");
-        manhole.setMaterial("铁");
-        manhole.setOwnershipUnit("沅陵县燃气公司");
-        manhole.setLocation("龙兴路");
-        manhole.setLongitude(new java.math.BigDecimal("110.440"));
-        manhole.setLatitude(new java.math.BigDecimal("28.450"));
-        manhole.setStatus("0");
-        when(manholes.getById("mh-1")).thenReturn(manhole);
-
-        CockpitEntityDetailResponse detail = service.load("q", "MANHOLE", "mh-1");
-
-        assertEquals("MANHOLE", detail.getCategory());
-        assertEquals("YL-YJ-002", detail.getCode());
-        assertEquals("沅陵县窨井002", detail.getName());
-        assertEquals(new java.math.BigDecimal("12.0"), detail.getAttributes().get("manholeDepth"));
-        assertEquals("铁", detail.getAttributes().get("material"));
-        assertEquals("沅陵县燃气公司", detail.getAttributes().get("ownershipUnit"));
-        assertEquals(new java.math.BigDecimal("110.440"), detail.getCoordinates().getLongitude());
-        assertEquals(new java.math.BigDecimal("28.450"), detail.getCoordinates().getLatitude());
-    }
+  /**
+   * 窨井详情(维护者 2026-11-16)。
+   *
+   * <p>原话:「设施台账中的窨井卡片无法展开详情,提示为『设施类别未发布,无法展开详情』」。
+   * 根因是后端枚举与 switch 都没有 MANHOLE —— 前端白名单只是第二道门。
+   * 本用例钉住:category=MANHOLE 能解析、能按 manhole_base 主键取到详情,
+   * 且井深/形状/材质/权属这些窨井专有字段如实下发。</p>
+   */
+  @Test void resolvesManholeCategoryWithItsOwnAttributes() {
+      ManholeBase manhole = new ManholeBase();
+      manhole.setManholeId("mh-1");
+      manhole.setManholeCode("YL-YJ-002");
+      manhole.setManholeName("沅陵县窨井002");
+      manhole.setManholeDepth(new java.math.BigDecimal("12.0"));
+      manhole.setManholeShape("0");
+      manhole.setMaterial("铁");
+      manhole.setOwnershipUnit("沅陵县燃气公司");
+      manhole.setLocation("龙兴路");
+      manhole.setLongitude(new java.math.BigDecimal("110.440"));
+      manhole.setLatitude(new java.math.BigDecimal("28.450"));
+      manhole.setStatus("0");
+      when(manholes.getById("mh-1")).thenReturn(manhole);
 
-    @Test void rejectsUnknownCategoryAndMissingEntity() {
-        assertThrows(RuntimeException.class, () -> service.load("q", "OTHER", "x"));
-        assertThrows(CockpitEntityNotFoundException.class, () -> service.load("q", "PIPE_NETWORK", "missing"));
-        assertThrows(CockpitEntityNotFoundException.class, () -> service.load("q", "MANHOLE", "missing"));
-    }
+      CockpitEntityDetailResponse detail = service.load("q", "MANHOLE", "mh-1");
+
+      assertEquals("MANHOLE", detail.getCategory());
+      assertEquals("YL-YJ-002", detail.getCode());
+      assertEquals("沅陵县窨井002", detail.getName());
+      assertEquals(new java.math.BigDecimal("12.0"), detail.getAttributes().get("manholeDepth"));
+      assertEquals("铁", detail.getAttributes().get("material"));
+      assertEquals("沅陵县燃气公司", detail.getAttributes().get("ownershipUnit"));
+      assertEquals(new java.math.BigDecimal("110.440"), detail.getCoordinates().getLongitude());
+      assertEquals(new java.math.BigDecimal("28.450"), detail.getCoordinates().getLatitude());
+  }
+
+  @Test void rejectsUnknownCategoryAndMissingEntity() {
+      assertThrows(RuntimeException.class, () -> service.load("q", "OTHER", "x"));
+      assertThrows(CockpitEntityNotFoundException.class, () -> service.load("q", "PIPE_NETWORK", "missing"));
+      assertThrows(CockpitEntityNotFoundException.class, () -> service.load("q", "MANHOLE", "missing"));
+      assertThrows(CockpitEntityNotFoundException.class, () -> service.load("q", "WATER_USER", "missing"));
+      assertThrows(CockpitEntityNotFoundException.class, () -> service.load("q", "WATER_FIRE_HYDRANT", "missing"));
+  }
+
+  /** 四个新增详情类别各走自己的 loader,并下发各自真实字段与规范化状态。 */
+  @Test void resolvesFourNewDetailCategories() {
+      DrainageGateInfo gate = new DrainageGateInfo();
+      gate.setFacilityId("g-new"); gate.setFacilityCode("G-NEW"); gate.setFacilityName("排水闸门");
+      gate.setStatus("检修"); gate.setLocation("东堤");
+      when(gates.getEntityById("g-new")).thenReturn(gate);
+      CockpitEntityDetailResponse gateDetail = service.load("q", "drainage-gate", "g-new");
+      assertEquals("DRAINAGE_GATE", gateDetail.getCategory());
+      assertEquals("G-NEW", gateDetail.getCode());
+      assertEquals("1", gateDetail.getStatus());
+
+      DrainageStorageInfo storage = new DrainageStorageInfo();
+      storage.setFacilityId("s-new"); storage.setFacilityCode("S-NEW"); storage.setFacilityName("调蓄池");
+      storage.setStatus("0"); storage.setStorageCapacity(new java.math.BigDecimal("500"));
+      when(storages.getEntityById("s-new")).thenReturn(storage);
+      CockpitEntityDetailResponse storageDetail = service.load("q", "DRAINAGE_STORAGE", "s-new");
+      assertEquals("DRAINAGE_STORAGE", storageDetail.getCategory());
+      assertEquals("0", storageDetail.getStatus());
+      assertEquals(new java.math.BigDecimal("500"), storageDetail.getAttributes().get("storageCapacity"));
+
+      WaterUserInfo user = new WaterUserInfo();
+      user.setId("u-new"); user.setUserCode("USER_NEW"); user.setUserName("某用水户"); user.setUserType("居民");
+      user.setAddress("人民路1号"); user.setContactPerson("张三"); user.setContactPhone("13800138000");
+      user.setMeterNumber("M-NEW"); user.setInitialReading(new java.math.BigDecimal("0.00"));
+      user.setCurrentReading(new java.math.BigDecimal("125.50"));
+      user.setAnnualWaterConsumption(new java.math.BigDecimal("180.00")); user.setStatus("欠费"); user.setRemark("用水备注");
+      user.setLongitude(new java.math.BigDecimal("110.100")); user.setLatitude(new java.math.BigDecimal("28.100"));
+      when(users.getById("u-new")).thenReturn(user);
+      CockpitEntityDetailResponse userDetail = service.load("q", "WATER_USER", "u-new");
+      assertEquals("WATER_USER", userDetail.getCategory());
+      assertEquals("USER_NEW", userDetail.getCode());
+      assertEquals("某用水户", userDetail.getName());
+      assertEquals("1", userDetail.getStatus());
+      assertEquals("居民", userDetail.getAttributes().get("userType"));
+      assertEquals("人民路1号", userDetail.getAttributes().get("address"));
+      assertEquals("张三", userDetail.getAttributes().get("contactPerson"));
+      assertEquals("M-NEW", userDetail.getAttributes().get("meterNumber"));
+      assertEquals(new java.math.BigDecimal("180.00"), userDetail.getAttributes().get("annualWaterConsumption"));
+      assertEquals(new java.math.BigDecimal("110.100"), userDetail.getCoordinates().getLongitude());
+      assertEquals(new java.math.BigDecimal("28.100"), userDetail.getCoordinates().getLatitude());
+
+      WaterFireHydrantInfo hydrant = new WaterFireHydrantInfo();
+      hydrant.setHydrantId("h-new"); hydrant.setHydrantCode("FH-NEW"); hydrant.setHydrantName("中山路消火栓");
+      hydrant.setHydrantType("0"); hydrant.setModel("SS100"); hydrant.setInletPipeDiameter("DN100");
+      hydrant.setOutletSpec("2xDN65"); hydrant.setOwnershipUnit("自来水公司"); hydrant.setMaintenanceUnit("消防救援大队");
+      hydrant.setPrincipal("李四"); hydrant.setContactPhone("13900139000"); hydrant.setLocation("中山路");
+      hydrant.setStatus("0"); hydrant.setRemark("消火栓备注");
+      hydrant.setLongitude(new java.math.BigDecimal("110.200")); hydrant.setLatitude(new java.math.BigDecimal("28.200"));
+      when(hydrants.getById("h-new")).thenReturn(hydrant);
+      CockpitEntityDetailResponse hydrantDetail = service.load("q", "WATER_FIRE_HYDRANT", "h-new");
+      assertEquals("WATER_FIRE_HYDRANT", hydrantDetail.getCategory());
+      assertEquals("FH-NEW", hydrantDetail.getCode());
+      assertEquals("中山路消火栓", hydrantDetail.getName());
+      assertEquals("0", hydrantDetail.getStatus());
+      assertEquals("0", hydrantDetail.getAttributes().get("hydrantType"));
+      assertEquals("DN100", hydrantDetail.getAttributes().get("inletPipeDiameter"));
+      assertEquals("消防救援大队", hydrantDetail.getAttributes().get("maintenanceUnit"));
+      assertEquals("中山路", hydrantDetail.getAttributes().get("location"));
+      assertEquals(new java.math.BigDecimal("110.200"), hydrantDetail.getCoordinates().getLongitude());
+      assertEquals(new java.math.BigDecimal("28.200"), hydrantDetail.getCoordinates().getLatitude());
+  }
+
+  /**
+   * 水源地详情(外部依赖票 01)。
+   *
+   * <p>原话:「当前所有设施都带有坐标点,理应全部上图,例如水厂、泵站、水源地」。
+   * 水源地此前既没有实体行、也没有详情类别 —— 前端白名单里 detailCategory 只能留空。
+   * 本用例钉住 category=WATER_SOURCE 可解析、能按 water_source_info 主键取到经纬度,
+   * 且水源地专有字段(保护等级/水质等级/水源类型)如实下发。</p>
+   */
+  @Test void resolvesWaterSourceCategoryWithCoordinates() {
+      WaterSourceInfo source = new WaterSourceInfo();
+      source.setId("ws-1");
+      source.setSourceId("WS001");
+      source.setSourceName("洮水水源地");
+      source.setWaterType("地表水");
+      source.setProtectionLevel("一级");
+      source.setWaterQualityLevel("Ⅱ类");
+      source.setUnit("沅陵县供水公司");
+      source.setAddress("洮水镇河边");
+      source.setLongitude(new java.math.BigDecimal("110.440"));
+      source.setLatitude(new java.math.BigDecimal("28.450"));
+      source.setStatus("0");
+      when(waterSources.getById("ws-1")).thenReturn(source);
+
+      CockpitEntityDetailResponse detail = service.load("q", "WATER_SOURCE", "ws-1");
+
+      assertEquals("WATER_SOURCE", detail.getCategory());
+      assertEquals("ws-1", detail.getId());
+      assertEquals("WS001", detail.getCode());
+      assertEquals("洮水水源地", detail.getName());
+      assertEquals("0", detail.getStatus());
+      assertEquals(new java.math.BigDecimal("110.440"), detail.getCoordinates().getLongitude());
+      assertEquals(new java.math.BigDecimal("28.450"), detail.getCoordinates().getLatitude());
+      assertEquals("地表水", detail.getAttributes().get("waterType"));
+      assertEquals("一级", detail.getAttributes().get("protectionLevel"));
+      assertEquals("Ⅱ类", detail.getAttributes().get("waterQualityLevel"));
+      assertEquals("沅陵县供水公司", detail.getAttributes().get("unit"));
+  }
+
+  /** 水源地主键不存在 → 404 语义(NOT_FOUND),不是 500。 */
+  @Test void rejectsMissingWaterSource() {
+      assertThrows(CockpitEntityNotFoundException.class, () -> service.load("q", "WATER_SOURCE", "missing"));
+  }
+
+  /** 旧状态值归一为 0/1;泵站 stationType 由 water_supply/drainage 归一为字典码 0/1。 */
+  @Test void publishesNormalizedStatusAndPumpStationTypeCode() {
+      PumpStationInfo supply = new PumpStationInfo();
+      supply.setId("ps-supply"); supply.setStationCode("PS-S"); supply.setStationName("供水泵站");
+      supply.setStationType("water_supply"); supply.setStatus("0");
+      when(stations.getById("ps-supply")).thenReturn(supply);
+      CockpitEntityDetailResponse supplyDetail = service.load("q", "PUMP_STATION", "ps-supply");
+      assertEquals("0", supplyDetail.getStatus());
+      assertEquals("0", supplyDetail.getAttributes().get("stationType"));
+
+      PumpStationInfo drainage = new PumpStationInfo();
+      drainage.setId("ps-drain"); drainage.setStationCode("PS-D"); drainage.setStationName("排水泵站");
+      drainage.setStationType("drainage"); drainage.setStatus("检修");
+      when(stations.getById("ps-drain")).thenReturn(drainage);
+      CockpitEntityDetailResponse drainageDetail = service.load("q", "PUMP_STATION", "ps-drain");
+      assertEquals("1", drainageDetail.getStatus());
+      assertEquals("1", drainageDetail.getAttributes().get("stationType"));
+  }
 }

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

@@ -0,0 +1,28 @@
+package com.zksy.web.controller.cockpit;
+
+import com.zksy.cockpit.foundation.CockpitFacilityContract;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class CockpitFacilityContractTest {
+    @Test void facilityStatusPublishesOnlyZeroOrOne() {
+        assertEquals("0", CockpitFacilityContract.normalizeStatus("0"));
+        assertEquals("0", CockpitFacilityContract.normalizeStatus("NORMAL"));
+        for (String legacy : new String[]{"1", "2", "3", "欠费", "检修", "water_supply"}) {
+            assertEquals("1", CockpitFacilityContract.normalizeStatus(legacy));
+        }
+        assertNull(CockpitFacilityContract.normalizeStatus(null));
+        assertNull(CockpitFacilityContract.normalizeStatus("  "));
+        assertFalse(CockpitFacilityContract.isAbnormalStatus("0"));
+        assertTrue(CockpitFacilityContract.isAbnormalStatus("2"));
+    }
+
+    @Test void pumpStationTypePublishesDictionaryCodes() {
+        assertEquals("0", CockpitFacilityContract.pumpStationTypeCode("water_supply"));
+        assertEquals("1", CockpitFacilityContract.pumpStationTypeCode("drainage"));
+        assertEquals("0", CockpitFacilityContract.pumpStationTypeCode("0"));
+        assertEquals("1", CockpitFacilityContract.pumpStationTypeCode("1"));
+        assertNull(CockpitFacilityContract.pumpStationTypeCode("unknown"));
+    }
+}

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

@@ -80,7 +80,7 @@ class CockpitFacilityCountCrossEndpointContractTest {
         when(manholes.list()).thenReturn(Collections.singletonList(manhole));
         CockpitFacilityCatalog catalog = new BusinessCockpitInfrastructureBaseArchivesAdapter(
                 plants, stations, pipes, gates, storages, sources, manholes);
-        assertThreeEndpoints(catalog, 10, 4);
+        assertThreeEndpoints(catalog, 12, 3);
     }
 
     @Test
@@ -105,7 +105,7 @@ class CockpitFacilityCountCrossEndpointContractTest {
         Map<String, Integer> expected = new HashMap<>();
         expected.put("GAS", total == 0 ? 0 : 1);
         expected.put("WATER_SUPPLY", total == 0 ? 0 : 4);
-        expected.put("DRAINAGE", total == 0 ? 0 : 4);
+        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"));

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

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

+ 31 - 0
pipe-network-service/zksy-framework/src/main/java/com/zksy/framework/config/CockpitHttpFirewallConfig.java

@@ -0,0 +1,31 @@
+package com.zksy.framework.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.web.firewall.HttpFirewall;
+import org.springframework.security.web.firewall.StrictHttpFirewall;
+
+/**
+ * Spring Security 防火墙放宽:允许 URL 路径中被编码的斜杠(%2F)与编码百分号(%25)。
+ *
+ * <p>背景(票 120):设备编码里可能含字面斜杠(如视频监控「41010500002000000004/34020000001310000002」),
+ * 前端按 {@code /equipments/{deviceCode}/...} 取数时必须把编码百分号编码,斜杠变成 {@code %2F}。
+ * Spring Boot 默认装配的 {@link StrictHttpFirewall} **默认拒绝被编码的斜杠**({@code allowUrlEncodedSlash=false}),
+ * 在请求进入 Spring MVC 之前就以 400 拒绝——这是设备详情「整包取不到」的最后一层拦截。
+ * 这里在默认严格防火墙基础上只放开「编码斜杠」与「编码百分号」,其余严格校验保留,
+ * 使这类设备能被按编码寻址,同时不整体降级安全策略。
+ *
+ * @author zksy
+ */
+@Configuration
+public class CockpitHttpFirewallConfig {
+
+    @Bean
+    public HttpFirewall httpFirewall() {
+        StrictHttpFirewall firewall = new StrictHttpFirewall();
+        // 允许 %2F(编码斜杠)与 %25(编码百分号),其余默认严格策略保持不变
+        firewall.setAllowUrlEncodedSlash(true);
+        firewall.setAllowUrlEncodedPercent(true);
+        return firewall;
+    }
+}

+ 29 - 0
pipe-network-service/zksy-framework/src/main/java/com/zksy/framework/config/TomcatConnectorConfig.java

@@ -0,0 +1,29 @@
+package com.zksy.framework.config;
+
+import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
+import org.springframework.boot.web.server.WebServerFactoryCustomizer;
+import org.springframework.stereotype.Component;
+
+/**
+ * 允许 URL 路径中出现被编码的斜杠(%2F)。
+ *
+ * <p>背景(票 120):部分设备编码本身含字面斜杠(如视频监控「41010500002000000004/34020000001310000002」)。
+ * 前端按 {@code /equipments/{deviceCode}/...} 取数时必须把编码做百分号编码,斜杠变成 {@code %2F}。
+ * Tomcat 默认在连接器层直接以 400「encoded slash not allowed」拒绝这类请求,请求根本到不了 Controller。
+ * 这里开启 {@code encodedSolidusHandling=passthrough},让 {@code %2F} 原样(不解码)交给 Spring MVC,
+ * 配合各设备端点把路径变量写成 {@code {deviceCode:.+}}(贪婪匹配,允许解码后的斜杠不当作路径分隔符),
+ * 这类设备即可被按编码寻址。此设置只放宽「解码后的斜杠」,不改其它安全/路由语义。
+ *
+ * @author zksy
+ */
+@Component
+public class TomcatConnectorConfig implements WebServerFactoryCustomizer<TomcatServletWebServerFactory> {
+
+    @Override
+    public void customize(TomcatServletWebServerFactory factory) {
+        // Tomcat 9 用 encodedSolidusHandling=passthrough 保留 %2F 不解码(旧属性 allowEncodedSlash 在 9.x 已失效)。
+        // 配合 UrlPathHelper(urlDecode=false):%2F 作为普通字符留在单个路径段,AntPathMatcher {deviceCode} 可整段匹配,
+        // 再由 Controller 的 UriUtils.decode 还原成 '/'。
+        factory.addConnectorCustomizers(connector -> connector.setEncodedSolidusHandling("passthrough"));
+    }
+}

+ 31 - 0
pipe-network-service/zksy-framework/src/main/java/com/zksy/framework/config/WebMvcUrlDecodeConfig.java

@@ -0,0 +1,31 @@
+package com.zksy.framework.config;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+import org.springframework.web.util.UrlPathHelper;
+
+/**
+ * 票 120:设备编码含字面斜杠(视频监控等)时,前端把编码百分号编码,斜杠成 {@code %2F}。
+ *
+ * <p>本仓 **必须保持 {@code ant_path_matcher}**(springfox/Swagger 2.10.5 在 PathPatternParser 下会 NPE),
+ * 而 AntPathMatcher 无法让路径变量跨 '/'。解决办法:连接器用 {@code passthrough} 保留 {@code %2F} 不解码,
+ * 再用 {@link UrlPathHelper#setUrlDecode(boolean) urlDecode=false} 让 Spring 在**匹配阶段不做 URL 解码**——
+ * 于是 {@code %2F} 作为普通字符留在同一个路径段里,{@code {deviceCode}} 能整段匹配(值里仍是 {@code %2F})。
+ * 各驾驶舱设备 Controller 已自行 {@code UriUtils.decode} 路径变量,届时会把 {@code %2F} 还原成 '/'。
+ *
+ * <p>影响面:全局关闭「路径匹配阶段的 URL 解码」。所有路径变量在匹配时保持原始编码;本仓路径变量为
+ * 设备/点位/工单编码与 id,均为 ASCII,且驾驶舱设备端点本就自行解码,故安全。查询串解码不受影响。
+ *
+ * @author zksy
+ */
+@Configuration
+public class WebMvcUrlDecodeConfig implements WebMvcConfigurer {
+
+    @Override
+    public void configurePathMatch(PathMatchConfigurer configurer) {
+        UrlPathHelper helper = new UrlPathHelper();
+        helper.setUrlDecode(false);
+        configurer.setUrlPathHelper(helper);
+    }
+}

+ 36 - 7
pipe-network-service/zksy-framework/src/main/java/com/zksy/framework/config/properties/PermitAllUrlProperties.java

@@ -1,10 +1,11 @@
 package com.zksy.framework.config.properties;
 
 import java.util.ArrayList;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
-import java.util.Objects;
 import java.util.Optional;
+import java.util.Set;
 import java.util.regex.Pattern;
 import org.apache.commons.lang3.RegExUtils;
 import org.springframework.beans.BeansException;
@@ -16,11 +17,18 @@ import org.springframework.core.annotation.AnnotationUtils;
 import org.springframework.web.method.HandlerMethod;
 import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
 import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
+import org.springframework.web.servlet.mvc.condition.PathPatternsRequestCondition;
+import org.springframework.web.servlet.mvc.condition.PatternsRequestCondition;
 import com.zksy.common.annotation.Anonymous;
 
 /**
  * 设置Anonymous注解允许匿名访问的url
- * 
+ *
+ * <p>票 120:路径匹配策略切到 {@code PathPatternParser} 后,{@code RequestMappingInfo} 改由
+ * {@code PathPatternsRequestCondition} 承载路径({@code getPatternsCondition()} 会返回 null),
+ * 因此这里同时兼容两种条件:优先取 PathPattern,再退回 Ant 的 PatternsCondition,
+ * 避免 {@code getPatternsCondition()} 为 null 时抛 NPE。语义不变。
+ *
  * @author zksy
  */
 @Configuration
@@ -45,16 +53,37 @@ public class PermitAllUrlProperties implements InitializingBean, ApplicationCont
 
             // 获取方法上边的注解 替代path variable 为 *
             Anonymous method = AnnotationUtils.findAnnotation(handlerMethod.getMethod(), Anonymous.class);
-            Optional.ofNullable(method).ifPresent(anonymous -> Objects.requireNonNull(info.getPatternsCondition().getPatterns())
-                    .forEach(url -> urls.add(RegExUtils.replaceAll(url, PATTERN, ASTERISK))));
+            Optional.ofNullable(method).ifPresent(anonymous ->
+                    patternsOf(info).forEach(url -> urls.add(RegExUtils.replaceAll(url, PATTERN, ASTERISK))));
 
             // 获取类上边的注解, 替代path variable 为 *
             Anonymous controller = AnnotationUtils.findAnnotation(handlerMethod.getBeanType(), Anonymous.class);
-            Optional.ofNullable(controller).ifPresent(anonymous -> Objects.requireNonNull(info.getPatternsCondition().getPatterns())
-                    .forEach(url -> urls.add(RegExUtils.replaceAll(url, PATTERN, ASTERISK))));
+            Optional.ofNullable(controller).ifPresent(anonymous ->
+                    patternsOf(info).forEach(url -> urls.add(RegExUtils.replaceAll(url, PATTERN, ASTERISK))));
         });
     }
 
+    /**
+     * 取一个映射的路径模式集合,兼容 PathPatternParser 与 AntPathMatcher 两种策略。
+     * 票 120:PathPatternParser 下 getPatternsCondition() 为 null,要用 PathPatternsRequestCondition。
+     */
+    private static Set<String> patternsOf(RequestMappingInfo info)
+    {
+        PathPatternsRequestCondition pathPatterns = info.getPathPatternsCondition();
+        if (pathPatterns != null)
+        {
+            Set<String> result = new LinkedHashSet<>();
+            pathPatterns.getPatterns().forEach(pattern -> result.add(pattern.getPatternString()));
+            return result;
+        }
+        PatternsRequestCondition antPatterns = info.getPatternsCondition();
+        if (antPatterns != null && antPatterns.getPatterns() != null)
+        {
+            return new LinkedHashSet<>(antPatterns.getPatterns());
+        }
+        return new LinkedHashSet<>();
+    }
+
     @Override
     public void setApplicationContext(ApplicationContext context) throws BeansException
     {
@@ -70,4 +99,4 @@ public class PermitAllUrlProperties implements InitializingBean, ApplicationCont
     {
         this.urls = urls;
     }
-}
+}

+ 3 - 1
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/collectionRecords/CockpitCollectionRecordsService.java

@@ -31,7 +31,9 @@ public class CockpitCollectionRecordsService {
             throw new CockpitInvalidRequestException("设备编码不能为空");
         }
         deviceCode = deviceCode.trim();
-        if (deviceCode.length() > 128 || deviceCode.matches(".*[\\x00-\\x20/\\\\%].*")) {
+        // 票 120:设备编码本身可能含字面斜杠(如视频监控「41010500002000000004/34020000001310000002」),
+        // 因此校验里**不再拒绝 '/'**;仍拒绝控制字符/空白与反斜杠、百分号,防止畸形或二次编码绕过。
+        if (deviceCode.length() > 128 || deviceCode.matches(".*[\\x00-\\x20\\\\%].*")) {
             throw new CockpitInvalidRequestException("设备编码不合法");
         }
         EquipmentBase equipment = equipmentMapper.selectOne(new QueryWrapper<EquipmentBase>()

+ 2 - 1
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/entity/CockpitEntityCategory.java

@@ -5,7 +5,8 @@ import com.zksy.cockpit.foundation.CockpitInvalidRequestException;
 import java.util.Locale;
 
 public enum CockpitEntityCategory {
-    PIPE_NETWORK, WATER_PLANT, PUMP_STATION, ENGINEERING_FACILITY, MANHOLE, EMERGENCY_RESOURCE, HAZARD, PROTECTION_TARGET;
+    PIPE_NETWORK, WATER_PLANT, PUMP_STATION, WATER_SOURCE, ENGINEERING_FACILITY, DRAINAGE_GATE, DRAINAGE_STORAGE,
+    WATER_USER, WATER_FIRE_HYDRANT, MANHOLE, EMERGENCY_RESOURCE, HAZARD, PROTECTION_TARGET;
 
     public static CockpitEntityCategory parse(String value) {
         if (value == null || value.trim().isEmpty()) {

+ 126 - 24
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/entity/CockpitEntityDetailService.java

@@ -2,8 +2,14 @@ package com.zksy.cockpit.entity;
 
 import com.zksy.WaterSupply.WaterPlantInfo.domain.WaterPlantInfo;
 import com.zksy.WaterSupply.WaterPlantInfo.service.IWaterPlantInfoService;
+import com.zksy.WaterSupply.WaterSourceInfo.domain.WaterSourceInfo;
+import com.zksy.WaterSupply.WaterSourceInfo.service.IWaterSourceInfoService;
 import com.zksy.WaterSupply.PumpStationInfo.domain.PumpStationInfo;
 import com.zksy.WaterSupply.PumpStationInfo.service.IPumpStationInfoService;
+import com.zksy.WaterSupply.WaterFireHydrantInfo.domain.WaterFireHydrantInfo;
+import com.zksy.WaterSupply.WaterFireHydrantInfo.service.IWaterFireHydrantInfoService;
+import com.zksy.WaterSupply.WaterUserInfo.domain.WaterUserInfo;
+import com.zksy.WaterSupply.WaterUserInfo.service.IWaterUserInfoService;
 import com.zksy.base.domain.EquipmentBase;
 import com.zksy.base.domain.EquipmentStatus;
 import com.zksy.base.domain.HazardHiddenAccount;
@@ -17,6 +23,7 @@ import com.zksy.base.service.ManholeBaseService;
 import com.zksy.base.service.PipeNetworkBaseService;
 import com.zksy.base.service.RiskAssessmentService;
 import com.zksy.cockpit.foundation.CockpitDistrict;
+import com.zksy.cockpit.foundation.CockpitFacilityContract;
 import com.zksy.cockpit.foundation.CockpitDistrictPrefix;
 import com.zksy.cockpit.foundation.CockpitErrorCategory;
 import com.zksy.cockpit.foundation.CockpitErrorPayload;
@@ -24,6 +31,7 @@ import com.zksy.cockpit.foundation.CockpitInvalidRequestException;
 import com.zksy.drainage.domain.DrainageFacilityBase;
 import com.zksy.drainage.service.DrainageGateInfoService;
 import com.zksy.drainage.service.DrainageStorageInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.time.LocalDateTime;
@@ -45,14 +53,20 @@ public class CockpitEntityDetailService {
     private final HazardHiddenAccountService hazards;
     private final RiskAssessmentService risks;
     private final ManholeBaseService manholes;
+    private final IWaterUserInfoService users;
+    private final IWaterFireHydrantInfoService hydrants;
+    private final IWaterSourceInfoService waterSources;
 
+    @Autowired
     public CockpitEntityDetailService(PipeNetworkBaseService pipes, IWaterPlantInfoService plants,
             IPumpStationInfoService stations, EquipmentBaseService equipment,
             DrainageGateInfoService gates, DrainageStorageInfoService storages,
-            EquipmentStatusService equipmentStatuses, HazardHiddenAccountService hazards, RiskAssessmentService risks, ManholeBaseService manholes) {
+            EquipmentStatusService equipmentStatuses, HazardHiddenAccountService hazards, RiskAssessmentService risks, ManholeBaseService manholes,
+            IWaterUserInfoService users, IWaterFireHydrantInfoService hydrants, IWaterSourceInfoService waterSources) {
         this.pipes = pipes; this.plants = plants; this.stations = stations;
         this.equipment = equipment; this.gates = gates; this.storages = storages;
         this.equipmentStatuses = equipmentStatuses; this.hazards = hazards; this.risks = risks; this.manholes = manholes;
+        this.users = users; this.hydrants = hydrants; this.waterSources = waterSources;
     }
 
     public CockpitEntityDetailResponse load(String requestId, String categoryValue, String entityId) {
@@ -63,7 +77,12 @@ public class CockpitEntityDetailService {
             case PIPE_NETWORK: return pipe(requestId, id);
             case WATER_PLANT: return plant(requestId, id);
             case PUMP_STATION: return station(requestId, id);
+            case WATER_SOURCE: return waterSource(requestId, id);
             case ENGINEERING_FACILITY: return engineeringFacility(requestId, id);
+            case DRAINAGE_GATE: return drainageGate(requestId, id);
+            case DRAINAGE_STORAGE: return drainageStorage(requestId, id);
+            case WATER_USER: return waterUser(requestId, id);
+            case WATER_FIRE_HYDRANT: return waterFireHydrant(requestId, id);
             case MANHOLE: return manhole(requestId, id);
             case EMERGENCY_RESOURCE: return resource(requestId, id);
             case HAZARD: return hazard(requestId, id);
@@ -79,7 +98,7 @@ public class CockpitEntityDetailService {
         put(a,"managementUnit",v.getManagementUnit()); put(a,"lengthMeters",v.getLength()); put(a,"diameterMillimeters",v.getDiameter());
         put(a,"material",v.getMaterial()); put(a,"buildDate",v.getBuildDate()); put(a,"remark",v.getRemark());
         Integer district = CockpitDistrictPrefix.codeOf(v.getNetworkCode());
-        return response(requestId,"PIPE_NETWORK",v.getNetworkId(),v.getNetworkCode(),v.getNetworkName(),v.getStatus(),
+        return response(requestId,"PIPE_NETWORK",v.getNetworkId(),v.getNetworkCode(),v.getNetworkName(),CockpitFacilityContract.normalizeStatus(v.getStatus()),
                 v.getLocation(),district,new CockpitEntityDetailResponse.Coordinates(v.getStartLongitude(),v.getStartLatitude(),v.getEndLongitude(),v.getEndLatitude()),a,v.getUpdateTime());
     }
 
@@ -88,45 +107,85 @@ public class CockpitEntityDetailService {
         Map<String,Object> a=map(); put(a,"waterSourceType",v.getWaterSourceType()); put(a,"designCapacity",v.getDesignCapacity());
         put(a,"currentCapacity",v.getCurrentCapacity()); put(a,"treatmentProcess",v.getTreatmentProcess()); put(a,"commissionDate",v.getCommissionDate());
         put(a,"waterQualityStandard",v.getWaterQualityStandard()); put(a,"principal",v.getPrincipal()); put(a,"contactPhone",v.getContactPhone()); put(a,"remark",v.getRemark());
-        return response(requestId,"WATER_PLANT",String.valueOf(v.getId()),v.getPlantCode(),v.getPlantName(),v.getStatus(),v.getLocation(),null,
+        return response(requestId,"WATER_PLANT",String.valueOf(v.getId()),v.getPlantCode(),v.getPlantName(),CockpitFacilityContract.normalizeStatus(v.getStatus()),v.getLocation(),null,
                 new CockpitEntityDetailResponse.Coordinates(v.getLongitude(),v.getLatitude(),null,null),a,v.getUpdateTime());
     }
 
     private CockpitEntityDetailResponse station(String requestId, String id) {
         PumpStationInfo v=stations.getById(id); if(v==null) throw missing();
-        Map<String,Object>a=map(); put(a,"stationType",v.getStationType()); put(a,"pumpCount",v.getPumpCount()); put(a,"designFlow",v.getDesignFlow());
+        Map<String,Object>a=map(); put(a,"stationType",CockpitFacilityContract.pumpStationTypeCode(v.getStationType())); put(a,"pumpCount",v.getPumpCount()); put(a,"designFlow",v.getDesignFlow());
         put(a,"designHead",v.getDesignHead()); put(a,"powerCapacity",v.getPowerCapacity()); put(a,"commissionDate",v.getCommissionDate());
         put(a,"principal",v.getPrincipal()); put(a,"contactPhone",v.getContactPhone()); put(a,"remark",v.getRemark());
-        return response(requestId,"PUMP_STATION",String.valueOf(v.getId()),v.getStationCode(),v.getStationName(),v.getStatus(),v.getLocation(),null,
+        return response(requestId,"PUMP_STATION",String.valueOf(v.getId()),v.getStationCode(),v.getStationName(),CockpitFacilityContract.normalizeStatus(v.getStatus()),v.getLocation(),null,
                 new CockpitEntityDetailResponse.Coordinates(v.getLongitude(),v.getLatitude(),null,null),a,v.getUpdateTime());
     }
 
 
+    /**
+     * 水源地详情(票 01):前端设施点图层从运行信息枚举到 WATER_SOURCE 后,需要按
+     * {@code water_source_info} 主键回查经纬度上图。字段只取该表真实存在的列;
+     * 水源地编码不带片区前缀,片区如实为 null=未分区。
+     */
+    private CockpitEntityDetailResponse waterSource(String requestId, String id) {
+        WaterSourceInfo v = waterSources == null ? null : waterSources.getById(id);
+        if (v == null) throw missing();
+        Map<String,Object> a = map();
+        put(a, "sourceType", v.getSourceType());
+        put(a, "unit", v.getUnit());
+        put(a, "address", v.getAddress());
+        put(a, "waterType", v.getWaterType());
+        put(a, "protectionLevel", v.getProtectionLevel());
+        put(a, "waterQualityLevel", v.getWaterQualityLevel());
+        put(a, "protectionScope", v.getProtectionScope());
+        put(a, "reportTime", v.getReportTime());
+        put(a, "remark", v.getRemark());
+        return response(requestId, "WATER_SOURCE", v.getId(), v.getSourceId(), v.getSourceName(),
+                CockpitFacilityContract.normalizeStatus(v.getStatus()), v.getAddress(), null,
+                new CockpitEntityDetailResponse.Coordinates(v.getLongitude(), v.getLatitude(), null, null),
+                a, v.getUpdateTime());
+    }
+
     private CockpitEntityDetailResponse engineeringFacility(String requestId, String id) {
         // 闸门与调蓄设施分表存储,id 全局唯一:先查闸门,未命中再查调蓄
         com.zksy.drainage.domain.DrainageGateInfo gate = gates.getEntityById(id);
-        if (gate != null) {
-            Map<String,Object> a = drainageFacilityAttributes(gate);
-            put(a, "facilityType", "gate");
-            put(a, "designHead", gate.getDesignHead());
-            return response(requestId, "DRAINAGE_GATE", gate.getFacilityId(), gate.getFacilityCode(),
-                    gate.getFacilityName(), gate.getStatus(), gate.getLocation(), null,
-                    new CockpitEntityDetailResponse.Coordinates(gate.getLongitude(), gate.getLatitude(), null, null),
-                    a, gate.getUpdateTime());
-        }
+        if (gate != null) return gateDetail(requestId, gate);
         com.zksy.drainage.domain.DrainageStorageInfo storage = storages.getEntityById(id);
-        if (storage != null) {
-            Map<String,Object> a = drainageFacilityAttributes(storage);
-            put(a, "facilityType", "storage");
-            put(a, "storageCapacity", storage.getStorageCapacity());
-            return response(requestId, "DRAINAGE_STORAGE", storage.getFacilityId(), storage.getFacilityCode(),
-                    storage.getFacilityName(), storage.getStatus(), storage.getLocation(), null,
-                    new CockpitEntityDetailResponse.Coordinates(storage.getLongitude(), storage.getLatitude(), null, null),
-                    a, storage.getUpdateTime());
-        }
+        if (storage != null) return storageDetail(requestId, storage);
         throw missing();
     }
 
+    private CockpitEntityDetailResponse drainageGate(String requestId, String id) {
+        com.zksy.drainage.domain.DrainageGateInfo gate = gates.getEntityById(id);
+        if (gate == null) throw missing();
+        return gateDetail(requestId, gate);
+    }
+
+    private CockpitEntityDetailResponse drainageStorage(String requestId, String id) {
+        com.zksy.drainage.domain.DrainageStorageInfo storage = storages.getEntityById(id);
+        if (storage == null) throw missing();
+        return storageDetail(requestId, storage);
+    }
+
+    private CockpitEntityDetailResponse gateDetail(String requestId, com.zksy.drainage.domain.DrainageGateInfo gate) {
+        Map<String,Object> a = drainageFacilityAttributes(gate);
+        put(a, "facilityType", "gate");
+        put(a, "designHead", gate.getDesignHead());
+        return response(requestId, "DRAINAGE_GATE", gate.getFacilityId(), gate.getFacilityCode(),
+                gate.getFacilityName(), CockpitFacilityContract.normalizeStatus(gate.getStatus()), gate.getLocation(), null,
+                new CockpitEntityDetailResponse.Coordinates(gate.getLongitude(), gate.getLatitude(), null, null),
+                a, gate.getUpdateTime());
+    }
+
+    private CockpitEntityDetailResponse storageDetail(String requestId, com.zksy.drainage.domain.DrainageStorageInfo storage) {
+        Map<String,Object> a = drainageFacilityAttributes(storage);
+        put(a, "facilityType", "storage");
+        put(a, "storageCapacity", storage.getStorageCapacity());
+        return response(requestId, "DRAINAGE_STORAGE", storage.getFacilityId(), storage.getFacilityCode(),
+                storage.getFacilityName(), CockpitFacilityContract.normalizeStatus(storage.getStatus()), storage.getLocation(), null,
+                new CockpitEntityDetailResponse.Coordinates(storage.getLongitude(), storage.getLatitude(), null, null),
+                a, storage.getUpdateTime());
+    }
+
     private Map<String,Object> drainageFacilityAttributes(DrainageFacilityBase v) {
         Map<String,Object> a = map();
         put(a, "facilityLevel", v.getFacilityLevel());
@@ -139,6 +198,49 @@ public class CockpitEntityDetailService {
         return a;
     }
 
+    private CockpitEntityDetailResponse waterUser(String requestId, String id) {
+        WaterUserInfo v = users.getById(id);
+        if (v == null) throw missing();
+        Map<String,Object> a = map();
+        put(a, "userCode", v.getUserCode());
+        put(a, "userName", v.getUserName());
+        put(a, "userType", v.getUserType());
+        put(a, "address", v.getAddress());
+        put(a, "contactPerson", v.getContactPerson());
+        put(a, "contactPhone", v.getContactPhone());
+        put(a, "meterNumber", v.getMeterNumber());
+        put(a, "initialReading", v.getInitialReading());
+        put(a, "currentReading", v.getCurrentReading());
+        put(a, "annualWaterConsumption", v.getAnnualWaterConsumption());
+        put(a, "remark", v.getRemark());
+        return response(requestId, "WATER_USER", v.getId(), v.getUserCode(), v.getUserName(),
+                CockpitFacilityContract.normalizeStatus(v.getStatus()), null, null,
+                new CockpitEntityDetailResponse.Coordinates(v.getLongitude(), v.getLatitude(), null, null),
+                a, v.getUpdateTime());
+    }
+
+    private CockpitEntityDetailResponse waterFireHydrant(String requestId, String id) {
+        WaterFireHydrantInfo v = hydrants.getById(id);
+        if (v == null) throw missing();
+        Map<String,Object> a = map();
+        put(a, "hydrantCode", v.getHydrantCode());
+        put(a, "hydrantName", v.getHydrantName());
+        put(a, "hydrantType", v.getHydrantType());
+        put(a, "model", v.getModel());
+        put(a, "inletPipeDiameter", v.getInletPipeDiameter());
+        put(a, "outletSpec", v.getOutletSpec());
+        put(a, "ownershipUnit", v.getOwnershipUnit());
+        put(a, "maintenanceUnit", v.getMaintenanceUnit());
+        put(a, "principal", v.getPrincipal());
+        put(a, "contactPhone", v.getContactPhone());
+        put(a, "location", v.getLocation());
+        put(a, "remark", v.getRemark());
+        return response(requestId, "WATER_FIRE_HYDRANT", v.getHydrantId(), v.getHydrantCode(), v.getHydrantName(),
+                CockpitFacilityContract.normalizeStatus(v.getStatus()), v.getLocation(), null,
+                new CockpitEntityDetailResponse.Coordinates(v.getLongitude(), v.getLatitude(), null, null),
+                a, v.getUpdateTime());
+    }
+
 
     /**
      * 窨井详情(维护者 2026-11-16)。
@@ -157,7 +259,7 @@ public class CockpitEntityDetailService {
         put(a, "ownershipUnit", v.getOwnershipUnit());
         put(a, "remark", v.getRemark());
         return response(requestId, "MANHOLE", v.getManholeId(), v.getManholeCode(), v.getManholeName(),
-                v.getStatus(), v.getLocation(), null,
+                CockpitFacilityContract.normalizeStatus(v.getStatus()), v.getLocation(), null,
                 new CockpitEntityDetailResponse.Coordinates(v.getLongitude(), v.getLatitude(), null, null),
                 a, v.getUpdateTime());
     }

+ 15 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/foundation/CockpitDictRow.java

@@ -0,0 +1,15 @@
+package com.zksy.cockpit.foundation;
+
+/** 驾驶舱字典行:只对外发布码值与文案,不暴露后台字典的审计/样式字段。 */
+public class CockpitDictRow {
+    private final String dictValue;
+    private final String dictLabel;
+
+    public CockpitDictRow(String dictValue, String dictLabel) {
+        this.dictValue = dictValue;
+        this.dictLabel = dictLabel;
+    }
+
+    public String getDictValue() { return dictValue; }
+    public String getDictLabel() { return dictLabel; }
+}

+ 36 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/foundation/CockpitFacilityContract.java

@@ -0,0 +1,36 @@
+package com.zksy.cockpit.foundation;
+
+/**
+ * 驾驶舱设施对外的统一契约:状态只发布 0=正常 / 1=异常;泵站类型只发布字典 0/1。
+ * 后端物理列仍保留逐表旧值(停产、欠费、检修、water_supply/drainage),
+ * 统一归一只在这里做一次,避免各适配器各写一套。
+ */
+public final class CockpitFacilityContract {
+    private CockpitFacilityContract() {}
+
+    /** 旧值中仍代表正常的取值;其余非空值一律归为异常。空白值不发布,由前端如实显示未发布。 */
+    public static String normalizeStatus(String raw) {
+        String value = raw == null ? "" : raw.trim();
+        if (value.isEmpty()) return null;
+        return isNormal(value) ? "0" : "1";
+    }
+
+    public static boolean isAbnormalStatus(String raw) {
+        String value = raw == null ? "" : raw.trim();
+        return !value.isEmpty() && !isNormal(value);
+    }
+
+    /** 泵站物理类型 → sys_dict_data(pump_station_type) 的展示码。 */
+    public static String pumpStationTypeCode(String physical) {
+        if (physical == null) return null;
+        String value = physical.trim();
+        if ("0".equals(value) || "water_supply".equalsIgnoreCase(value)) return "0";
+        if ("1".equals(value) || "drainage".equalsIgnoreCase(value)) return "1";
+        return null;
+    }
+
+    private static boolean isNormal(String value) {
+        return "0".equals(value) || "NORMAL".equalsIgnoreCase(value)
+                || "RUNNING".equalsIgnoreCase(value) || "ACTIVE".equalsIgnoreCase(value);
+    }
+}

+ 42 - 5
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/infrastructure/BusinessCockpitInfrastructureBaseArchivesAdapter.java

@@ -1,5 +1,7 @@
 package com.zksy.cockpit.infrastructure;
 
+import com.zksy.WaterSupply.WaterFireHydrantInfo.domain.WaterFireHydrantInfo;
+import com.zksy.WaterSupply.WaterFireHydrantInfo.service.IWaterFireHydrantInfoService;
 import com.zksy.WaterSupply.WaterPlantInfo.domain.WaterPlantInfo;
 import com.zksy.WaterSupply.WaterPlantInfo.service.IWaterPlantInfoService;
 import com.zksy.WaterSupply.PumpStationInfo.domain.PumpStationType;
@@ -7,16 +9,20 @@ import com.zksy.WaterSupply.PumpStationInfo.domain.PumpStationInfo;
 import com.zksy.WaterSupply.PumpStationInfo.service.IPumpStationInfoService;
 import com.zksy.WaterSupply.WaterSourceInfo.domain.WaterSourceInfo;
 import com.zksy.WaterSupply.WaterSourceInfo.service.IWaterSourceInfoService;
+import com.zksy.WaterSupply.WaterUserInfo.domain.WaterUserInfo;
+import com.zksy.WaterSupply.WaterUserInfo.service.IWaterUserInfoService;
 import com.zksy.base.domain.ManholeBase;
 import com.zksy.base.domain.PipeNetworkBase;
 import com.zksy.base.service.ManholeBaseService;
 import com.zksy.base.service.PipeNetworkBaseService;
 import com.zksy.cockpit.foundation.CockpitDistrictPrefix;
+import com.zksy.cockpit.foundation.CockpitFacilityContract;
 import com.zksy.cockpit.foundation.CockpitPipeNetworkType;
 import com.zksy.drainage.domain.DrainageGateInfo;
 import com.zksy.drainage.domain.DrainageStorageInfo;
 import com.zksy.drainage.service.DrainageGateInfoService;
 import com.zksy.drainage.service.DrainageStorageInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Component;
 
@@ -34,7 +40,7 @@ import java.util.stream.Collectors;
 
 /**
  * 三个驾驶舱设施统计端点的权威设施目录(执行票 31)。
- * 包含管网、水厂、供排水泵站、排水工程设施、水源地与窨井的合法记录并集。
+ * 包含管网、水厂、供排水泵站、排水工程设施、水源地、窨井、用水户与消火栓的合法记录并集。
  * 片区只由**管线编码前缀**推出(见 {@link #districtOf}),其余设施没有可信来源、如实保持 null;
  * 未知类型或缺编码行以哨兵保留到 excluded。
  */
@@ -54,7 +60,9 @@ public class BusinessCockpitInfrastructureBaseArchivesAdapter
             type("DRAINAGE_STORAGE", "排水调蓄设施", "DRAINAGE"),
             type("DRAINAGE_PUMP_STATION", "排水泵站", "DRAINAGE"),
             type("WATER_SOURCE", "水源地", "WATER_SUPPLY"),
-            type("MANHOLE", "窨井", "MANHOLE"));
+            type("MANHOLE", "窨井", "MANHOLE"),
+            type("WATER_USER", "用水户", "WATER_SUPPLY"),
+            type("WATER_FIRE_HYDRANT", "消火栓", "WATER_SUPPLY"));
     /** 编码带片区前缀的类型:仅 {@code pipe_network_base} 的三种管线。 */
     private static final List<String> PIPE_TYPES = Arrays.asList(
             CockpitPipeNetworkType.WATER_PIPE, CockpitPipeNetworkType.GAS_PIPE, CockpitPipeNetworkType.DRAINAGE_PIPE);
@@ -66,11 +74,23 @@ public class BusinessCockpitInfrastructureBaseArchivesAdapter
     private final DrainageStorageInfoService storages;
     private final IWaterSourceInfoService sources;
     private final ManholeBaseService manholes;
+    private final IWaterUserInfoService users;
+    private final IWaterFireHydrantInfoService hydrants;
 
+    /** 兼容旧调用的构造入口;新设施来源按空集处理,不改动既有口径。 */
     public BusinessCockpitInfrastructureBaseArchivesAdapter(
             IWaterPlantInfoService plants, IPumpStationInfoService stations,
             PipeNetworkBaseService pipes, DrainageGateInfoService gates, DrainageStorageInfoService storages,
             IWaterSourceInfoService sources, ManholeBaseService manholes) {
+        this(plants, stations, pipes, gates, storages, sources, manholes, null, null);
+    }
+
+    @Autowired
+    public BusinessCockpitInfrastructureBaseArchivesAdapter(
+            IWaterPlantInfoService plants, IPumpStationInfoService stations,
+            PipeNetworkBaseService pipes, DrainageGateInfoService gates, DrainageStorageInfoService storages,
+            IWaterSourceInfoService sources, ManholeBaseService manholes,
+            IWaterUserInfoService users, IWaterFireHydrantInfoService hydrants) {
         this.plants = plants;
         this.stations = stations;
         this.pipes = pipes;
@@ -78,6 +98,8 @@ public class BusinessCockpitInfrastructureBaseArchivesAdapter
         this.storages = storages;
         this.sources = sources;
         this.manholes = manholes;
+        this.users = users;
+        this.hydrants = hydrants;
     }
 
     @Override
@@ -94,9 +116,11 @@ public class BusinessCockpitInfrastructureBaseArchivesAdapter
         for (PumpStationInfo station : safeList(stations.list())) {
             updatedAt = latest(updatedAt, station.getUpdateTime());
             updatedAt = latest(updatedAt, station.getCreateTime());
-            String stationType = trimToNull(station.getStationType());
-            String type = PumpStationType.DRAINAGE.equalsIgnoreCase(stationType) ? "DRAINAGE_PUMP_STATION"
-                    : PumpStationType.WATER_SUPPLY.equalsIgnoreCase(stationType) ? "WATER_PUMP_STATION" : UNCLASSIFIED;
+            // 泵站类型可能是物理字符串(water_supply/drainage)或字典码(0/1);共用契约归一,
+            // 避免详情页认得、统计页却归为未分类的左右分裂。
+            String stationTypeCode = CockpitFacilityContract.pumpStationTypeCode(station.getStationType());
+            String type = "1".equals(stationTypeCode) ? "DRAINAGE_PUMP_STATION"
+                    : "0".equals(stationTypeCode) ? "WATER_PUMP_STATION" : UNCLASSIFIED;
             add(facilities, key("pump_station", station.getId(), station.getStationCode()), station.getStationCode(), type, null, station.getCommissionDate(), null);
         }
         for (PipeNetworkBase pipe : safeList(pipes.list())) {
@@ -132,6 +156,19 @@ public class BusinessCockpitInfrastructureBaseArchivesAdapter
             updatedAt = latest(updatedAt, manhole.getCreateTime());
             add(facilities, key("manhole_base", manhole.getManholeId(), manhole.getManholeCode()), manhole.getManholeCode(), "MANHOLE", null, null, null);
         }
+        // 用水户/消火栓与窨井同一口径:一张业务表一种正式类型,编码用业务码而非 UUID。
+        for (WaterUserInfo user : safeList(users == null ? null : users.list())) {
+            updatedAt = latest(updatedAt, user.getUpdateTime());
+            updatedAt = latest(updatedAt, user.getCreateTime());
+            add(facilities, key("water_user_info", user.getId(), user.getUserCode()),
+                    user.getUserCode(), "WATER_USER", null, null, null);
+        }
+        for (WaterFireHydrantInfo hydrant : safeList(hydrants == null ? null : hydrants.list())) {
+            updatedAt = latest(updatedAt, hydrant.getUpdateTime());
+            updatedAt = latest(updatedAt, hydrant.getCreateTime());
+            add(facilities, key("water_fire_hydrant_info", hydrant.getHydrantId(), hydrant.getHydrantCode()),
+                    hydrant.getHydrantCode(), "WATER_FIRE_HYDRANT", null, null, null);
+        }
         return new CockpitInfrastructureBaseArchivesSnapshot(
                 updatedAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(updatedAt.atZone(BUSINESS_ZONE)),
                 TYPES, facilities);

+ 129 - 29
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/infrastructure/BusinessCockpitInfrastructureOperatingInformationAdapter.java

@@ -1,21 +1,29 @@
 package com.zksy.cockpit.infrastructure;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.zksy.WaterSupply.WaterFireHydrantInfo.domain.WaterFireHydrantInfo;
+import com.zksy.WaterSupply.WaterFireHydrantInfo.service.IWaterFireHydrantInfoService;
 import com.zksy.WaterSupply.WaterPlantInfo.domain.WaterPlantInfo;
 import com.zksy.WaterSupply.WaterPlantInfo.service.IWaterPlantInfoService;
+import com.zksy.WaterSupply.WaterSourceInfo.domain.WaterSourceInfo;
+import com.zksy.WaterSupply.WaterSourceInfo.service.IWaterSourceInfoService;
 import com.zksy.WaterSupply.PumpStationInfo.domain.PumpStationType;
 import com.zksy.WaterSupply.PumpStationInfo.domain.PumpStationInfo;
 import com.zksy.WaterSupply.PumpStationInfo.service.IPumpStationInfoService;
+import com.zksy.WaterSupply.WaterUserInfo.domain.WaterUserInfo;
+import com.zksy.WaterSupply.WaterUserInfo.service.IWaterUserInfoService;
 import com.zksy.base.domain.ManholeBase;
 import com.zksy.base.domain.PipeNetworkBase;
 import com.zksy.base.service.ManholeBaseService;
 import com.zksy.base.service.PipeNetworkBaseService;
+import com.zksy.cockpit.foundation.CockpitFacilityContract;
 import com.zksy.cockpit.foundation.CockpitPipeNetworkType;
 import com.zksy.drainage.domain.DrainageFacilityBase;
 import com.zksy.drainage.domain.DrainageGateInfo;
 import com.zksy.drainage.domain.DrainageStorageInfo;
 import com.zksy.drainage.service.DrainageGateInfoService;
 import com.zksy.drainage.service.DrainageStorageInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Component;
 
@@ -35,7 +43,7 @@ import java.util.stream.Collectors;
  *
  * <p>指标只由现有业务实体中明确存在的当前值生成。现有模型没有统一历史采样表,
  * 因此不会合成趋势点;更新时间取每条源记录的更新时间,缺失时保持空值交由契约层
- * 使用服务端时间补齐。
+ * 使用服务端时间补齐。状态只发布契约归一值(0/1/null),物理列原值不做修改。
  */
 @Component
 @Primary
@@ -51,7 +59,11 @@ public class BusinessCockpitInfrastructureOperatingInformationAdapter
     private final DrainageGateInfoService gateService;
     private final DrainageStorageInfoService storageService;
     private final ManholeBaseService manholeBaseService;
+    private final IWaterUserInfoService userService;
+    private final IWaterFireHydrantInfoService hydrantService;
+    private final IWaterSourceInfoService waterSourceService;
 
+    /** 兼容旧调用的构造入口;新设施来源按空集处理,不改动既有口径。 */
     public BusinessCockpitInfrastructureOperatingInformationAdapter(
             IWaterPlantInfoService plantService,
             IPumpStationInfoService pumpStationService,
@@ -59,20 +71,40 @@ public class BusinessCockpitInfrastructureOperatingInformationAdapter
             DrainageGateInfoService gateService,
             DrainageStorageInfoService storageService,
             ManholeBaseService manholeBaseService) {
+        this(plantService, pumpStationService, pipeNetworkBaseService, gateService, storageService,
+                manholeBaseService, null, null, null);
+    }
+
+    @Autowired
+    public BusinessCockpitInfrastructureOperatingInformationAdapter(
+            IWaterPlantInfoService plantService,
+            IPumpStationInfoService pumpStationService,
+            PipeNetworkBaseService pipeNetworkBaseService,
+            DrainageGateInfoService gateService,
+            DrainageStorageInfoService storageService,
+            ManholeBaseService manholeBaseService,
+            IWaterUserInfoService userService,
+            IWaterFireHydrantInfoService hydrantService,
+            IWaterSourceInfoService waterSourceService) {
         this.plantService = plantService;
         this.pumpStationService = pumpStationService;
         this.pipeNetworkBaseService = pipeNetworkBaseService;
         this.gateService = gateService;
         this.storageService = storageService;
         this.manholeBaseService = manholeBaseService;
+        this.userService = userService;
+        this.hydrantService = hydrantService;
+        this.waterSourceService = waterSourceService;
     }
 
     @Override
     public CockpitInfrastructureOperatingInformationSnapshot load() {
         List<CockpitInfrastructureOperatingInformationSnapshot.SourceMetric> metrics = new ArrayList<>();
         String latestUpdatedAt = null;
+        // 票 01:运行信息是前端设施点图层唯一的实体来源。水厂没有当前能力时**仍要下发实体行**
+        // (值如实为 null),否则库里带坐标的水厂永远不会上图、也不进「无地图位置」清单。
         for (WaterPlantInfo plant : safeList(plantService.list())) {
-            if (plant == null || isBlank(plant.getPlantCode()) || plant.getCurrentCapacity() == null) {
+            if (plant == null || isBlank(plant.getPlantCode())) {
                 continue;
             }
             String sampledAt = format(plant.getUpdateTime());
@@ -86,15 +118,17 @@ public class BusinessCockpitInfrastructureOperatingInformationAdapter
                     plant.getCurrentCapacity(),
                     plant.getDesignCapacity(),
                     sampledAt,
-                    abnormalStatus(plant.getStatus()),
-                    plant.getPlantCode(), String.valueOf(plant.getId()), "WATER_PLANT", plant.getStatus()));
+                    CockpitFacilityContract.isAbnormalStatus(plant.getStatus()),
+                    plant.getPlantCode(), facilityKey(plant.getId()), "WATER_PLANT",
+                    CockpitFacilityContract.normalizeStatus(plant.getStatus())));
         }
 
         for (PumpStationInfo station : safeList(pumpStationService.list(
                 new LambdaQueryWrapper<PumpStationInfo>()
                         .in(PumpStationInfo::getStationType,
-                                PumpStationType.WATER_SUPPLY, PumpStationType.DRAINAGE)))) {
-            if (station == null || isBlank(station.getStationCode()) || station.getDesignFlow() == null) {
+                                PumpStationType.WATER_SUPPLY, PumpStationType.DRAINAGE, "0", "1")))) {
+            // 票 01:泵站同水厂 —— 设计流量为空不再跳过,只保留「无业务编码不产实体行」这一条门槛。
+            if (station == null || isBlank(station.getStationCode())) {
                 continue;
             }
             String industry = pumpIndustry(station.getStationType());
@@ -112,8 +146,9 @@ public class BusinessCockpitInfrastructureOperatingInformationAdapter
                     station.getDesignFlow(),
                     null,
                     sampledAt,
-                    abnormalStatus(station.getStatus()),
-                    station.getStationCode(), String.valueOf(station.getId()), "PUMP_STATION", station.getStatus()));
+                    CockpitFacilityContract.isAbnormalStatus(station.getStatus()),
+                    station.getStationCode(), facilityKey(station.getId()), "PUMP_STATION",
+                    CockpitFacilityContract.normalizeStatus(station.getStatus())));
         }
 
         for (PipeNetworkBase pipe : safeList(pipeNetworkBaseService.list())) {
@@ -134,8 +169,9 @@ public class BusinessCockpitInfrastructureOperatingInformationAdapter
                     pipe.getLength(),
                     null,
                     sampledAt,
-                    abnormalStatus(pipe.getStatus()),
-                    pipe.getNetworkCode(), pipe.getNetworkId(), "PIPE_NETWORK", pipe.getStatus()));
+                    CockpitFacilityContract.isAbnormalStatus(pipe.getStatus()),
+                    pipe.getNetworkCode(), pipe.getNetworkId(), "PIPE_NETWORK",
+                    CockpitFacilityContract.normalizeStatus(pipe.getStatus())));
         }
 
         for (DrainageFacilityBase facility : safeList(gateService.listAll())) {
@@ -165,8 +201,73 @@ public class BusinessCockpitInfrastructureOperatingInformationAdapter
                     BigDecimal.ONE,
                     null,
                     sampledAt,
-                    abnormalStatus(manhole.getStatus()),
-                    manhole.getManholeCode(), manhole.getManholeId(), "MANHOLE", manhole.getStatus()));
+                    CockpitFacilityContract.isAbnormalStatus(manhole.getStatus()),
+                    manhole.getManholeCode(), manhole.getManholeId(), "MANHOLE",
+                    CockpitFacilityContract.normalizeStatus(manhole.getStatus())));
+        }
+
+        // 用水户/消火栓与窨井同一口径:一个设施一条指标,供前端设施台账枚举两类独立设施;
+        // 单位分别为「户」「座」,行业统一供水,状态只发布归一值。
+        for (WaterUserInfo user : safeList(userService == null ? null : userService.list())) {
+            if (user == null || isBlank(user.getUserCode())) {
+                continue;
+            }
+            String sampledAt = format(user.getUpdateTime());
+            latestUpdatedAt = latest(latestUpdatedAt, sampledAt);
+            metrics.add(metric(
+                    "water_user_point_count",
+                    isBlank(user.getUserName()) ? "用水户" : user.getUserName(),
+                    "CAPACITY",
+                    "户",
+                    "WATER_SUPPLY",
+                    BigDecimal.ONE,
+                    null,
+                    sampledAt,
+                    CockpitFacilityContract.isAbnormalStatus(user.getStatus()),
+                    user.getUserCode(), user.getId(), "WATER_USER",
+                    CockpitFacilityContract.normalizeStatus(user.getStatus())));
+        }
+        for (WaterFireHydrantInfo hydrant : safeList(hydrantService == null ? null : hydrantService.list())) {
+            if (hydrant == null || isBlank(hydrant.getHydrantCode())) {
+                continue;
+            }
+            String sampledAt = format(hydrant.getUpdateTime());
+            latestUpdatedAt = latest(latestUpdatedAt, sampledAt);
+            metrics.add(metric(
+                    "water_fire_hydrant_point_count",
+                    isBlank(hydrant.getHydrantName()) ? "消火栓" : hydrant.getHydrantName(),
+                    "CAPACITY",
+                    "座",
+                    "WATER_SUPPLY",
+                    BigDecimal.ONE,
+                    null,
+                    sampledAt,
+                    CockpitFacilityContract.isAbnormalStatus(hydrant.getStatus()),
+                    hydrant.getHydrantCode(), hydrant.getHydrantId(), "WATER_FIRE_HYDRANT",
+                    CockpitFacilityContract.normalizeStatus(hydrant.getStatus())));
+        }
+
+        // 水源地(票 01):此前本端点完全没有水源地的实体循环,图例有这一类、图上却没有点。
+        // 与用水户/消火栓同一口径:一处水源地一条实体行,值固定 1、单位「处」,行业供水。
+        for (WaterSourceInfo source : safeList(waterSourceService == null
+                ? null : waterSourceService.list())) {
+            if (source == null || isBlank(source.getSourceId())) {
+                continue;
+            }
+            String sampledAt = format(source.getUpdateTime());
+            latestUpdatedAt = latest(latestUpdatedAt, sampledAt);
+            metrics.add(metric(
+                    "water_source_point_count",
+                    isBlank(source.getSourceName()) ? "水源地" : source.getSourceName(),
+                    "CAPACITY",
+                    "处",
+                    "WATER_SUPPLY",
+                    BigDecimal.ONE,
+                    null,
+                    sampledAt,
+                    CockpitFacilityContract.isAbnormalStatus(source.getStatus()),
+                    source.getSourceId(), source.getId(), "WATER_SOURCE",
+                    CockpitFacilityContract.normalizeStatus(source.getStatus())));
         }
 
         return new CockpitInfrastructureOperatingInformationSnapshot(latestUpdatedAt, metrics);
@@ -204,22 +305,20 @@ public class BusinessCockpitInfrastructureOperatingInformationAdapter
     }
 
     private static String pumpIndustry(String stationType) {
-        if (PumpStationType.WATER_SUPPLY.equalsIgnoreCase(trimToNull(stationType))) {
-            return "WATER_SUPPLY";
-        }
-        if (PumpStationType.DRAINAGE.equalsIgnoreCase(trimToNull(stationType))) {
-            return "DRAINAGE";
-        }
+        String code = CockpitFacilityContract.pumpStationTypeCode(stationType);
+        if ("0".equals(code)) return "WATER_SUPPLY";
+        if ("1".equals(code)) return "DRAINAGE";
         return null;
     }
 
-    /** 排水设施是点要素,每个设施计 1 个点;闸门/调蓄共用实现,仅 typeCode 不同 */
+    /** 排水设施是点要素,每个设施计 1 个点;闸门/调蓄共用实现,facilityKind 按 typeCode 分开。 */
     private void addDrainageFacilityMetric(
             List<CockpitInfrastructureOperatingInformationSnapshot.SourceMetric> metrics,
             DrainageFacilityBase facility, String typeCode) {
         if (facility == null || isBlank(facility.getFacilityId())) {
             return;
         }
+        String facilityKind = "gate".equals(typeCode) ? "DRAINAGE_GATE" : "DRAINAGE_STORAGE";
         metrics.add(metric(
                 "drainage_" + typeCode + "_point_count",
                 isBlank(facility.getFacilityName()) ? "排水设施点数" : facility.getFacilityName() + "点数",
@@ -229,8 +328,17 @@ public class BusinessCockpitInfrastructureOperatingInformationAdapter
                 BigDecimal.ONE,
                 null,
                 format(facility.getUpdateTime()),
-                false,
-                facility.getFacilityId(), facility.getFacilityId(), "DRAINAGE_FACILITY", facility.getStatus()));
+                CockpitFacilityContract.isAbnormalStatus(facility.getStatus()),
+                facility.getFacilityId(), facility.getFacilityId(), facilityKind,
+                CockpitFacilityContract.normalizeStatus(facility.getStatus())));
+    }
+
+    /**
+     * 实体主键 → 可回查详情的 {@code facilityId}。票 01 起能力值为空的行也要下发,
+     * 缺主键的行没有稳定身份(详情无从寻址),如实不产实体行 —— 与「无业务编码不产行」同一条门槛。
+     */
+    private static String facilityKey(Object id) {
+        return id == null ? null : String.valueOf(id).trim();
     }
 
     /** 行业为空的未分类项用 {@code unknown_} 前缀,避免空指针并保持编码可读。 */
@@ -238,14 +346,6 @@ public class BusinessCockpitInfrastructureOperatingInformationAdapter
         return (industry == null ? "unknown" : industry.toLowerCase()) + "_" + suffix;
     }
 
-    private static boolean abnormalStatus(String status) {
-        String normalized = trimToNull(status);
-        return normalized != null && !"0".equals(normalized)
-                && !"NORMAL".equalsIgnoreCase(normalized)
-                && !"RUNNING".equalsIgnoreCase(normalized)
-                && !"ACTIVE".equalsIgnoreCase(normalized);
-    }
-
     private static String format(LocalDateTime time) {
         return time == null ? null : TIME_FORMATTER.format(time.atZone(BUSINESS_ZONE).toOffsetDateTime());
     }

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

@@ -41,9 +41,18 @@ public class CockpitVideoService {
         data.put("deviceName", device.getEquipmentName());
         data.put("typeCode", device.getEquipmentTypeId() == null ? null : device.getEquipmentTypeId().toString());
         data.put("bound", bound);
-        // playbackControl stays false until a real device confirms pause/speed/seek support.
+        // Video-specific fields the panel shows. All come from the existing binding; no new source.
+        data.put("businessCode", binding != null && binding.getDeviceCode() != null ? binding.getDeviceCode() : device.getEquipmentCode());
+        data.put("sourceType", binding == null ? null : binding.getSourceType());
+        data.put("gbDeviceId", binding == null ? null : binding.getGbDeviceId());
+        data.put("gbChannelId", binding == null ? null : binding.getGbChannelId());
+        data.put("manufacturer", device.getManufacturer());
+        data.put("location", device.getEquipmentLocation());
+        // playbackControl mirrors what the playback seam actually implements (see playback(): the same
+        // four actions). It is a seam capability, not a device confirmation: whether a camera honours
+        // pause/speed/seek is only observable in the picture.
         data.put("capabilities", Map.of("live", live, "records", records, "playback", records,
-                "playbackControl", false, "ptz", false, "ptzStopGuaranteed", false));
+                "playbackControl", records, "ptz", false, "ptzStopGuaranteed", false));
         data.put("unavailableReason", live ? null : "设备未绑定或实时视频能力未确认");
         return data;
     }
@@ -111,6 +120,9 @@ public class CockpitVideoService {
         data.put("startTime", range.getStartTime());
         data.put("endTime", range.getEndTime());
         data.put("media", media);
+        // The reused playback seam implements these four actions for a GB28181 session; the panel
+        // enables exactly this set and bounds seek by the chosen recording span on the client.
+        data.put("controls", Map.of("pause", true, "resume", true, "speed", true, "seek", true));
         return data;
     }