فهرست منبع

基础设施信息整合

zengy 2 هفته پیش
والد
کامیت
a647b75349
100فایلهای تغییر یافته به همراه3760 افزوده شده و 1506 حذف شده
  1. 1 1
      pipe-network-service/docs/adr/0007-shared-pump-station-by-type.md
  2. 35 0
      pipe-network-service/sql/check_duplicate_facility_code.sql
  3. 176 0
      pipe-network-service/sql/cleanup_gas_basic_deprecated_features.sql
  4. 43 0
      pipe-network-service/sql/drop_drainage_engineering_facility.sql
  5. 36 0
      pipe-network-service/sql/fix_water_plant_unique_code.sql
  6. 112 0
      pipe-network-service/sql/migration_facility_code_unique_and_uuid_id.sql
  7. 245 0
      pipe-network-service/sql/migration_infrastructure_menus.sql
  8. 547 0
      pipe-network-service/sql/migration_infrastructure_restructure.sql
  9. 18 0
      pipe-network-service/sql/migration_manhole_device_unique_binding.sql
  10. 19 0
      pipe-network-service/sql/migration_manhole_drop_fields_and_binding.sql
  11. 110 0
      pipe-network-service/sql/migration_menu_2070_directory.sql
  12. 0 31
      pipe-network-service/sql/migration_pipe_network_status_dict.sql
  13. 22 0
      pipe-network-service/sql/migration_water_source_code_rename.sql
  14. 27 0
      pipe-network-service/sql/migration_water_supply_facility_menu_reuse.sql
  15. 65 0
      pipe-network-service/sql/rollback_infrastructure_restructure.sql
  16. 0 24
      pipe-network-service/sql/water_supply_facility_import.sql
  17. 5 5
      pipe-network-service/sql/water_supply_facility_test_data.sql
  18. 363 0
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/WaterSupply/PumpStationInfo/PumpStationInfoController.java
  19. 0 22
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/WaterSupply/WaterFacilityExportController.java
  20. 89 0
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/WaterSupply/WaterFireHydrantInfo/WaterFireHydrantInfoController.java
  21. 4 4
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/WaterSupply/WaterPlantInfo/WaterPlantInfoController.java
  22. 0 249
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/WaterSupply/WaterPumpStation/WaterPumpStationController.java
  23. 8 8
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/WaterSupply/WaterSourceInfo/WaterSourceInfoController.java
  24. 4 4
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/WaterSupply/WaterUserInfo/WaterUserInfoController.java
  25. 179 0
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/base/InfrastructureFacilityDataController.java
  26. 89 0
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/base/ManholeInfoController.java
  27. 95 0
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/drainage/AbstractDrainageFacilityController.java
  28. 31 0
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/drainage/DrainageGateInfoController.java
  29. 0 62
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/drainage/DrainagePipeNetworkController.java
  30. 0 183
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/drainage/DrainagePumpStationController.java
  31. 31 0
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/drainage/DrainageStorageInfoController.java
  32. 0 148
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/drainage/EngineeringFacilityController.java
  33. 0 92
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/gasbasic/GasPipeNetworkController.java
  34. 37 14
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/manhole/ManholeDeviceController.java
  35. 6 3
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/WaterSupply/WaterFacilityExportControllerContractTest.java
  36. 24 20
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/BusinessCockpitInfrastructureBaseArchivesAdapterTest.java
  37. 4 2
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/BusinessCockpitInfrastructureManagementInformationAdapterTest.java
  38. 24 18
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/BusinessCockpitInfrastructureOperatingInformationAdapterTest.java
  39. 12 10
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/BusinessCockpitOverviewInfrastructureAdapterTest.java
  40. 13 10
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitEntityDetailServiceTest.java
  41. 28 21
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitFacilityCountCrossEndpointContractTest.java
  42. 0 1
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitFacilityGeometryControllerTest.java
  43. 9 7
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitPipeNetworkCrossEndpointContractTest.java
  44. 8 8
      pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/PumpStationInfo/domain/PumpStationInfo.java
  45. 1 1
      pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/PumpStationInfo/domain/PumpStationType.java
  46. 8 8
      pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/PumpStationInfo/mapper/PumpStationInfoMapper.java
  47. 8 8
      pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/PumpStationInfo/service/IPumpStationInfoService.java
  48. 21 21
      pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/PumpStationInfo/service/impl/PumpStationInfoServiceImpl.java
  49. 90 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterFireHydrantInfo/domain/WaterFireHydrantInfo.java
  50. 9 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterFireHydrantInfo/mapper/WaterFireHydrantInfoMapper.java
  51. 33 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterFireHydrantInfo/service/IWaterFireHydrantInfoService.java
  52. 75 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterFireHydrantInfo/service/impl/WaterFireHydrantInfoServiceImpl.java
  53. 4 4
      pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterPlantInfo/domain/WaterPlantInfo.java
  54. 2 2
      pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterPlantInfo/mapper/WaterPlantInfoMapper.java
  55. 2 2
      pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterPlantInfo/service/IWaterPlantInfoService.java
  56. 2 2
      pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterPlantInfo/service/impl/WaterPlantInfoServiceImpl.java
  57. 6 5
      pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterSourceInfo/domain/WaterSourceInfo.java
  58. 2 2
      pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterSourceInfo/mapper/WaterSourceInfoMapper.java
  59. 2 2
      pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterSourceInfo/service/IWaterSourceInfoService.java
  60. 2 2
      pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterSourceInfo/service/impl/WaterSourceInfoServiceImpl.java
  61. 10 18
      pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterSupplyGisMap/service/impl/WaterSupplyGisMapServiceImpl.java
  62. 4 4
      pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterUserInfo/domain/WaterUserInfo.java
  63. 2 2
      pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterUserInfo/mapper/WaterUserInfoMapper.java
  64. 2 2
      pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterUserInfo/service/IWaterUserInfoService.java
  65. 2 2
      pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterUserInfo/service/impl/WaterUserInfoServiceImpl.java
  66. 79 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/export/FireHydrantImportDTO.java
  67. 22 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/export/PumpStationInfoExportDTO.java
  68. 2 1
      pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/export/WaterPlantExportDTO.java
  69. 0 21
      pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/export/WaterPumpStationExportDTO.java
  70. 8 4
      pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/export/WaterSourceExportDTO.java
  71. 4 2
      pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/export/WaterUserExportDTO.java
  72. 38 15
      pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/importing/WaterFacilityImportService.java
  73. 4 4
      pipe-network-service/zksy-system/src/main/java/com/zksy/base/domain/ManholeBase.java
  74. 0 6
      pipe-network-service/zksy-system/src/main/java/com/zksy/base/domain/ManholeDeviceRel.java
  75. 2 7
      pipe-network-service/zksy-system/src/main/java/com/zksy/base/domain/PipeNetworkBase.java
  76. 22 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/base/dto/FacilityImportBaseDTO.java
  77. 66 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/base/dto/ManholeImportDTO.java
  78. 3 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/base/dto/ManholePageInDTO.java
  79. 85 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/base/dto/PipeNetworkFacilityImportDTO.java
  80. 238 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/base/service/InfrastructureFacilityImportService.java
  81. 2 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/base/service/ManholeBaseService.java
  82. 0 57
      pipe-network-service/zksy-system/src/main/java/com/zksy/base/service/PipeNetworkBaseService.java
  83. 9 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/base/service/impl/ManholeBaseServiceImpl.java
  84. 1 208
      pipe-network-service/zksy-system/src/main/java/com/zksy/base/service/impl/PipeNetworkBaseServiceImpl.java
  85. 40 20
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/entity/CockpitEntityDetailService.java
  86. 1 1
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/geometry/CockpitFacilityGeometryService.java
  87. 28 28
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/infrastructure/BusinessCockpitInfrastructureBaseArchivesAdapter.java
  88. 43 50
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/infrastructure/BusinessCockpitInfrastructureOperatingInformationAdapter.java
  89. 6 30
      pipe-network-service/zksy-system/src/main/java/com/zksy/drainage/domain/DrainageFacilityBase.java
  90. 18 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/drainage/domain/DrainageGateInfo.java
  91. 18 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/drainage/domain/DrainageStorageInfo.java
  92. 91 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/drainage/dto/DrainageFacilityImportBaseDTO.java
  93. 6 9
      pipe-network-service/zksy-system/src/main/java/com/zksy/drainage/dto/DrainageFacilityPageInDTO.java
  94. 29 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/drainage/dto/DrainageGateImportDTO.java
  95. 29 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/drainage/dto/DrainageStorageImportDTO.java
  96. 8 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/drainage/mapper/DrainageGateInfoMapper.java
  97. 8 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/drainage/mapper/DrainageStorageInfoMapper.java
  98. 0 9
      pipe-network-service/zksy-system/src/main/java/com/zksy/drainage/mapper/EngineeringFacilityMapper.java
  99. 37 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/drainage/service/DrainageFacilityService.java
  100. 7 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/drainage/service/DrainageGateInfoService.java

+ 1 - 1
pipe-network-service/docs/adr/0007-shared-pump-station-by-type.md

@@ -8,7 +8,7 @@ status: accepted
 
 决策:将该表改名为公用表 `app_user.pump_station`,新增 `station_type varchar(16) NOT NULL DEFAULT 'water_supply'` 作为业务归属判别列,取值 `water_supply`(供水泵站)/`drainage`(排水泵站),并以 CHECK 约束限定取值域;存量数据全部回填为 `water_supply`。
 
-- 不建立第二张平行泵站表,不复制一套排水泵站实体;Java 类名(`WaterPumpStation`)、包路径与既有 REST 路径(`/api/water/pumpStation`、`/api/drainage/pumpStation`)为兼容前端全部保留,只改表映射,不做大规模重命名。
+- 不建立第二张平行泵站表,不复制一套排水泵站实体;Java 类名(`PumpStationInfo`)、包路径与既有 REST 路径(`/api/water/pumpStation`、`/api/drainage/pumpStation`)为兼容前端全部保留,只改表映射,不做大规模重命名。
 - 每个入口必须显式限定本系统类型:供水侧的分页、回收站、GIS 一张图、统计分析、导入导出固定 `station_type='water_supply'`;排水侧固定 `station_type='drainage'`。新增记录的类型由后端按入口强制写入,更新接口不允许修改归属列。
 - 类型编码采用稳定英文业务编码(与设施类型 `source/plant/pumpStation` 风格一致),不使用易变的中文名,也不使用语义不自解释的数字。
 - 迁移与回滚脚本分别为 `sql/migration_pump_station_shared.sql`、`sql/rollback_pump_station_shared.sql`;回滚前若已存在排水记录必须先人工处置,回滚脚本内置护栏中止回滚。

+ 35 - 0
pipe-network-service/sql/check_duplicate_facility_code.sql

@@ -0,0 +1,35 @@
+-- 诊断:检查 8 张设施表的业务编码是否存在重复(只读)
+-- 若某表返回行,则 CREATE UNIQUE INDEX 会因重复键失败。
+-- 表 COALESCE(code,'<NULL>') 把 NULL 也纳入分组(PG 中 NULL 不触发唯一冲突,但空串会)。
+
+SELECT 'pipe_network_base' AS tbl, network_code AS code, count(*) AS cnt
+  FROM app_user.pipe_network_base GROUP BY network_code HAVING count(*) > 1
+UNION ALL
+SELECT 'manhole_info', manhole_code, count(*)
+  FROM app_user.manhole_info GROUP BY manhole_code HAVING count(*) > 1
+UNION ALL
+SELECT 'pump_station_info', station_code, count(*)
+  FROM app_user.pump_station_info GROUP BY station_code HAVING count(*) > 1
+UNION ALL
+SELECT 'drainage_gate_info', facility_code, count(*)
+  FROM app_user.drainage_gate_info GROUP BY facility_code HAVING count(*) > 1
+UNION ALL
+SELECT 'drainage_storage_info', facility_code, count(*)
+  FROM app_user.drainage_storage_info GROUP BY facility_code HAVING count(*) > 1
+UNION ALL
+SELECT 'water_plant_info', plant_code, count(*)
+  FROM app_user.water_plant_info GROUP BY plant_code HAVING count(*) > 1
+UNION ALL
+SELECT 'water_source_info', source_code, count(*)
+  FROM app_user.water_source_info GROUP BY source_code HAVING count(*) > 1
+UNION ALL
+SELECT 'water_user_info', user_code, count(*)
+  FROM app_user.water_user_info GROUP BY user_code HAVING count(*) > 1
+ORDER BY tbl, code;
+
+-- 若确认重复且不需要保留历史数据,直接重跑主脚本即可(主脚本已改为先清空这 4 张表)。
+-- 若需要保留数据,可用下方语句删除重复行(保留 id 最小的一条),再手工执行建索引:
+--
+-- DELETE FROM app_user.water_plant_info a
+--  USING app_user.water_plant_info b
+--  WHERE a.plant_code = b.plant_code AND a.id > b.id;

+ 176 - 0
pipe-network-service/sql/cleanup_gas_basic_deprecated_features.sql

@@ -0,0 +1,176 @@
+-- ============================================================
+-- 清理废弃功能(菜单 + 授权 + 表 + 序列)
+--
+-- A. 原 5 个废弃菜单:
+--   2092 窨井管理          basic/manhole           subSystem/basic/Manhole
+--   2152 监测异常设备列表  basic/equipmentAbnormal subSystem/basic/EquipmentAbnormal
+--   2154 管网维修记录      basic/repairRecord      subSystem/basic/RepairRecord
+--   2160 燃气管点基础数据  basic/GasPipePoint      subSystem/basic/GasPipePoint
+--   2155 燃气GIS 图        basic/gisDashboard      subSystem/basic/GisDashboard
+--
+-- B. 随「燃气管点基础数据」一并下线的「管点台账」菜单:
+--   subSystem/gas/gasBasicadata/gasPipePoint(migration_gas_pipe_point_menu.sql 已删除)
+--
+-- C. 本轮 DROP 的 3 张表(相关前后端代码已全部删除):
+--   app_user.pipe_repair_record
+--   app_user.gas_pipe_point_device_rel
+--   app_user.gas_pipe_point
+--
+-- 仍被保留功能引用、不在本次删除范围的表见 SECTION 4(默认注释)。
+--
+-- 幂等:可重复执行。执行后请重新登录(或刷新页面)让前端重新拉取菜单。
+-- 数据库:KingbaseES(PG 兼容),schema = app_user。
+-- 部署顺序:先发后端/前端代码,再执行本脚本;反序会导致查询报错「关系不存在」。
+-- ============================================================
+
+-- 前置:结束上一次失败执行遗留的 aborted 事务
+ROLLBACK;
+
+-- ------------------------------------------------------------
+-- SECTION 1:删除菜单、子菜单(按钮权限)与角色授权
+--   定位三路兜底:menu_id / component / menu_name
+--   menu_id 由运行时生成,不同环境可能不同;名称用 replace 去掉空格,
+--   精确匹配「燃气GIS图 / 燃气GIS 图」,避免误伤「燃气GIS一张图」等保留菜单。
+-- ------------------------------------------------------------
+BEGIN;
+
+SET search_path TO app_user, public;
+
+DO $$
+DECLARE
+    v_ids      bigint[];
+    v_children bigint[];
+    v_count    integer;
+BEGIN
+    SELECT array_agg(DISTINCT menu_id) INTO v_ids
+      FROM sys_menu
+     WHERE menu_id IN (2092, 2152, 2154, 2160, 2155)
+        OR component IN (
+             'subSystem/basic/Manhole',
+             'subSystem/basic/EquipmentAbnormal',
+             'subSystem/basic/RepairRecord',
+             'subSystem/basic/GasPipePoint',
+             'subSystem/basic/GisDashboard',
+             'subSystem/gas/gasBasicadata/gasPipePoint')
+        OR menu_name IN ('窨井管理', '监测异常设备列表', '管网维修记录', '燃气管点基础数据')
+        OR (menu_name = '管点台账' AND path = 'gasPipePoint')
+        OR replace(menu_name, ' ', '') = '燃气GIS图';
+
+    IF v_ids IS NULL THEN
+        RAISE NOTICE '未找到待删除菜单(可能已删除),跳过菜单清理';
+    ELSE
+        -- 收集两级子菜单(按钮 / 权限项)
+        SELECT array_agg(DISTINCT menu_id) INTO v_children
+          FROM sys_menu WHERE parent_id = ANY(v_ids);
+        IF v_children IS NOT NULL THEN
+            v_ids := array_cat(v_ids, v_children);
+            SELECT array_agg(DISTINCT menu_id) INTO v_children
+              FROM sys_menu WHERE parent_id = ANY(v_children);
+            IF v_children IS NOT NULL THEN
+                v_ids := array_cat(v_ids, v_children);
+            END IF;
+        END IF;
+
+        DELETE FROM sys_role_menu WHERE menu_id = ANY(v_ids);
+        GET DIAGNOSTICS v_count = ROW_COUNT;
+        RAISE NOTICE '已删除 sys_role_menu 授权 % 条', v_count;
+
+        -- 先删子菜单再删父菜单,避免自引用外键报错
+        DELETE FROM sys_menu WHERE menu_id = ANY(v_ids) AND parent_id = ANY(v_ids);
+        DELETE FROM sys_menu WHERE menu_id = ANY(v_ids);
+        GET DIAGNOSTICS v_count = ROW_COUNT;
+        RAISE NOTICE '已删除 sys_menu 菜单 % 条', v_count;
+    END IF;
+END
+$$;
+
+COMMIT;
+
+-- ------------------------------------------------------------
+-- SECTION 2:删除已无代码引用的 3 张业务表
+--   顺序:先关联表,后主表。
+--   pipe_repair_record:主键 repair_id 为应用生成 UUID;
+--   gas_pipe_point / gas_pipe_point_device_rel:无显式 CREATE SEQUENCE。
+-- ------------------------------------------------------------
+BEGIN;
+
+SET search_path TO app_user, public;
+
+DROP TABLE IF EXISTS app_user.pipe_repair_record;
+DROP TABLE IF EXISTS app_user.gas_pipe_point_device_rel;
+DROP TABLE IF EXISTS app_user.gas_pipe_point;
+
+COMMIT;
+
+-- ------------------------------------------------------------
+-- SECTION 3:序列清理
+--   仓库建表脚本中这几张表均未显式 CREATE SEQUENCE(主键为 UUID /
+--   Identity / auto_increment)。若现场用 serial、bigserial 或手工建过序列,
+--   下面这段会自动找出并 DROP;没有匹配序列时静默跳过。
+-- ------------------------------------------------------------
+BEGIN;
+
+DO $$
+DECLARE
+    r record;
+BEGIN
+    FOR r IN
+        SELECT n.nspname AS schema_name, c.relname AS seq_name
+          FROM pg_class c
+          JOIN pg_namespace n ON n.oid = c.relnamespace
+         WHERE c.relkind = 'S'
+           AND n.nspname = 'app_user'
+           AND (lower(c.relname) LIKE '%repair_record%'
+             OR lower(c.relname) LIKE '%gas_pipe_point%'
+             OR lower(c.relname) LIKE '%manhole%'
+             OR lower(c.relname) LIKE '%pipe_network_base%')
+    LOOP
+        EXECUTE format('DROP SEQUENCE IF EXISTS %I.%I CASCADE', r.schema_name, r.seq_name);
+        RAISE NOTICE '已删除序列 %.%', r.schema_name, r.seq_name;
+    END LOOP;
+END
+$$;
+
+COMMIT;
+
+-- ------------------------------------------------------------
+-- SECTION 4(默认注释,确认后手工启用):仍被保留模块引用的表
+--   执行前必须先下线或改造下列模块,否则运行期会直接报「关系不存在」:
+--     · manhole_info:GisController /api/gis/manholes、驾驶舱 3 个适配器
+--     · manhole_device_rel:井盖监测 /manhole/device/statistics、驾驶舱关联服务
+--     · pipe_network_base:GIS 一张图、供水/排水统计、驾驶舱、首页(核心表)
+--     · equipment_status:设备状态上报 API、Portal、驾驶舱、报警、视频服务
+--   仓库中未发现这些表的视图 / 外键 / 触发器,若现场有依赖请自行补 DROP VIEW 或 CASCADE。
+-- ------------------------------------------------------------
+/*
+BEGIN;
+
+SET search_path TO app_user, public;
+
+DROP TABLE IF EXISTS app_user.manhole_device_rel;
+DROP TABLE IF EXISTS app_user.manhole_info;
+DROP TABLE IF EXISTS app_user.pipe_network_base;
+DROP TABLE IF EXISTS app_user.equipment_status;
+
+COMMIT;
+*/
+
+-- ============================================================
+-- 执行后核对(只读):
+--   SELECT menu_id, menu_name, path, component FROM sys_menu
+--    WHERE component LIKE 'subSystem/basic/%'
+--       OR component = 'subSystem/gas/gasBasicadata/gasPipePoint'
+--    ORDER BY menu_id;
+--
+--   SELECT table_name FROM information_schema.tables
+--    WHERE table_schema = 'app_user'
+--      AND table_name IN ('pipe_repair_record', 'gas_pipe_point',
+--                         'gas_pipe_point_device_rel', 'manhole_info',
+--                         'manhole_device_rel', 'pipe_network_base',
+--                         'equipment_status')
+--    ORDER BY table_name;
+--
+--   SELECT n.nspname, c.relname FROM pg_class c
+--     JOIN pg_namespace n ON n.oid = c.relnamespace
+--    WHERE c.relkind = 'S' AND n.nspname = 'app_user';
+-- ============================================================

+ 43 - 0
pipe-network-service/sql/drop_drainage_engineering_facility.sql

@@ -0,0 +1,43 @@
+-- ============================================================
+-- 拆表收尾:删除旧表 app_user.drainage_engineering_facility
+--
+-- 前置条件(务必全部满足后再执行):
+--   1. migration_infrastructure_restructure.sql 已执行,新表存在:
+--        app_user.drainage_gate_info
+--        app_user.drainage_storage_info
+--        app_user.pump_station_info
+--   2. 后端新代码已上线:
+--        /api/drainage/gate/*      → drainage_gate_info
+--        /api/drainage/storage/*   → drainage_storage_info
+--        /api/drainage/pumpStation/* → pump_station_info(station_type=drainage)
+--   3. 前端已切接口,驾驶舱已切 Mapper。
+--
+-- 注意:
+--   · 本脚本【不迁移历史数据】(按本次约束)。旧表 drop 后,
+--     拆表前录入的闸门/调蓄/泵站台账将不再可见,新表从空表开始。
+--   · 删除不可逆,执行前请确认旧表无保留价值。
+-- ============================================================
+
+-- 前置:结束上一次失败执行遗留的 aborted 事务
+ROLLBACK;
+
+BEGIN;
+
+SET search_path TO app_user, public;
+
+-- 核对新表是否就绪(若任一行返回 0,请终止本脚本)
+SELECT count(*) AS new_table_count
+  FROM information_schema.tables
+ WHERE table_schema = 'app_user'
+   AND table_name IN ('drainage_gate_info', 'drainage_storage_info', 'pump_station_info');
+-- 期望 new_table_count = 3
+
+-- 删除旧表
+DROP TABLE IF EXISTS app_user.drainage_engineering_facility;
+
+COMMIT;
+
+-- 核对:旧表应不存在
+-- SELECT count(*) FROM information_schema.tables
+--  WHERE table_schema='app_user' AND table_name='drainage_engineering_facility';
+-- 期望 0

+ 36 - 0
pipe-network-service/sql/fix_water_plant_unique_code.sql

@@ -0,0 +1,36 @@
+-- 修复 water_plant_info.plant_code 唯一索引创建失败(KingbaseES / PostgreSQL 兼容)
+-- 表结构中 plant_code 为 varchar(64) NOT NULL,类型本身无问题;
+-- CREATE UNIQUE INDEX 失败几乎都是因为存在重复的 plant_code。
+
+-- ============================================================
+-- 步骤 1:确认重复数据(只读)
+-- ============================================================
+-- SELECT plant_code, count(*) AS cnt
+--   FROM app_user.water_plant_info
+--  GROUP BY plant_code
+-- HAVING count(*) > 1
+--  ORDER BY cnt DESC;
+
+-- ============================================================
+-- 步骤 2A:不需要保留历史数据 —— 直接清空后建索引
+-- ============================================================
+-- TRUNCATE TABLE app_user.water_plant_info RESTART IDENTITY CASCADE;
+-- CREATE UNIQUE INDEX IF NOT EXISTS uk_water_plant_info_code
+--     ON app_user.water_plant_info (plant_code);
+
+-- ============================================================
+-- 步骤 2B:需要保留历史数据 —— 先删除重复行(保留 id 最小的一条),再建索引
+-- ============================================================
+-- DELETE FROM app_user.water_plant_info a
+--  USING app_user.water_plant_info b
+--  WHERE a.plant_code = b.plant_code
+--    AND a.id > b.id;
+--
+-- CREATE UNIQUE INDEX IF NOT EXISTS uk_water_plant_info_code
+--     ON app_user.water_plant_info (plant_code);
+
+-- ============================================================
+-- 步骤 3:验证索引已生效(只读)
+-- ============================================================
+-- SELECT indexname, indexdef FROM pg_indexes
+--  WHERE schemaname = 'app_user' AND tablename = 'water_plant_info';

+ 112 - 0
pipe-network-service/sql/migration_facility_code_unique_and_uuid_id.sql

@@ -0,0 +1,112 @@
+-- 基础设施类 facility 表:业务编码唯一约束 + 主键统一 UUID(KingbaseES / PostgreSQL 兼容)
+-- 目标:
+--   1. 8 张表的业务编码列全部加唯一约束(已有唯一索引的跳过,幂等)
+--   2. 4 张仍为自增 bigint 主键的表改为 varchar(64) 应用生成 UUID:
+--      pump_station_info / water_plant_info / water_source_info / water_user_info
+--      与 manhole_info 的 ASSIGN_UUID 口径对齐
+--
+-- 涉及表与列:
+--   pipe_network_base      network_code   / network_id     (已 UUID,已唯一)
+--   manhole_info           manhole_code   / manhole_id     (已 UUID,补唯一)
+--   pump_station_info      station_code   / id             (补唯一,主键改 UUID)
+--   drainage_gate_info     facility_code  / facility_id    (已 UUID,已唯一)
+--   drainage_storage_info  facility_code  / facility_id    (已 UUID,已唯一)
+--   water_plant_info       plant_code     / id             (补唯一,主键改 UUID)
+--   water_source_info      source_code    / id             (补唯一,主键改 UUID;source_code 是业务编码不是主键)
+--   water_user_info        user_code      / id             (补唯一,主键改 UUID)
+--
+-- ⚠️ 注意事项:
+--   1. 主键类型变更是不可逆的破坏性操作,需先确认这 4 张表无历史数据依赖;
+--      脚本会 TRUNCATE 这 4 张表(不考虑历史数据),如需保留请先备份并人工迁移。
+--   2. 执行顺序:先清空并改造主键(SECTION 1),再建唯一索引(SECTION 2)。
+--      这样 4 张需改造的表在空表状态建索引,不会因历史重复编码失败。
+--   3. 不清空的 4 张表(pipe_network_base / manhole_info / 两张 drainage)若仍有重复编码,
+--      CREATE UNIQUE INDEX 仍会失败,请先执行 check_duplicate_facility_code.sql 排查。
+--   4. 主键改 varchar(64) 后,MyBatis-Plus 实体已同步为 String + IdType.ASSIGN_UUID。
+--   5. water_source_info 的业务编码列已由 source_id 改名为 source_code,
+--      执行本脚本前请先执行 migration_water_source_code_rename.sql,否则 SECTION 2 建索引会因找不到 source_code 列失败。
+-- 可重复执行;schema = app_user。
+
+-- ============================================================
+-- SECTION 1:4 张表主键 bigint/serial → varchar(64) UUID(先清空,幂等)
+-- ============================================================
+
+BEGIN;
+
+-- 说明:这 4 张表的 id 是 bigint DEFAULT nextval('..._id_seq') 的传统 serial 列,
+--       不是 IDENTITY 列,因此用 DROP DEFAULT 去掉序列默认值即可,
+--       不要使用 DROP IDENTITY(KingbaseES 对非 IDENTITY 列执行会报错)。
+
+-- 1.1 pump_station_info
+TRUNCATE TABLE app_user.pump_station_info RESTART IDENTITY CASCADE;
+ALTER TABLE app_user.pump_station_info ALTER COLUMN id DROP DEFAULT;
+ALTER TABLE app_user.pump_station_info ALTER COLUMN id TYPE varchar(64) USING id::varchar(64);
+
+-- 1.2 water_plant_info
+TRUNCATE TABLE app_user.water_plant_info RESTART IDENTITY CASCADE;
+ALTER TABLE app_user.water_plant_info ALTER COLUMN id DROP DEFAULT;
+ALTER TABLE app_user.water_plant_info ALTER COLUMN id TYPE varchar(64) USING id::varchar(64);
+
+-- 1.3 water_source_info
+TRUNCATE TABLE app_user.water_source_info RESTART IDENTITY CASCADE;
+ALTER TABLE app_user.water_source_info ALTER COLUMN id DROP DEFAULT;
+ALTER TABLE app_user.water_source_info ALTER COLUMN id TYPE varchar(64) USING id::varchar(64);
+
+-- 1.4 water_user_info
+TRUNCATE TABLE app_user.water_user_info RESTART IDENTITY CASCADE;
+ALTER TABLE app_user.water_user_info ALTER COLUMN id DROP DEFAULT;
+ALTER TABLE app_user.water_user_info ALTER COLUMN id TYPE varchar(64) USING id::varchar(64);
+
+COMMIT;
+
+-- ============================================================
+-- SECTION 2:业务编码唯一约束(幂等,清空后的表不会因重复数据失败)
+-- ============================================================
+
+-- 2.1 已有唯一索引的三张,IF NOT EXISTS 兜底
+CREATE UNIQUE INDEX IF NOT EXISTS uk_network_code
+    ON app_user.pipe_network_base (network_code);
+CREATE UNIQUE INDEX IF NOT EXISTS uk_dgi_facility_code
+    ON app_user.drainage_gate_info (facility_code);
+CREATE UNIQUE INDEX IF NOT EXISTS uk_dsi_facility_code
+    ON app_user.drainage_storage_info (facility_code);
+
+-- 2.2 补齐缺失的 5 张(water_source_info 的业务编码列已从 source_id 改为 source_code)
+CREATE UNIQUE INDEX IF NOT EXISTS uk_manhole_info_code
+    ON app_user.manhole_info (manhole_code);
+CREATE UNIQUE INDEX IF NOT EXISTS uk_pump_station_info_code
+    ON app_user.pump_station_info (station_code);
+CREATE UNIQUE INDEX IF NOT EXISTS uk_water_plant_info_code
+    ON app_user.water_plant_info (plant_code);
+CREATE UNIQUE INDEX IF NOT EXISTS uk_water_source_info_code
+    ON app_user.water_source_info (source_code);
+CREATE UNIQUE INDEX IF NOT EXISTS uk_water_user_info_code
+    ON app_user.water_user_info (user_code);
+
+-- ============================================================
+-- SECTION 3:遗留自增序列清理(存在则删,避免误用)
+-- ============================================================
+DROP SEQUENCE IF EXISTS app_user.water_pump_station_id_seq CASCADE;
+DROP SEQUENCE IF EXISTS app_user.water_plant_info_id_seq CASCADE;
+DROP SEQUENCE IF EXISTS app_user.water_source_info_id_seq CASCADE;
+DROP SEQUENCE IF EXISTS app_user.water_user_info_id_seq CASCADE;
+
+-- ============================================================
+-- 核对 SQL(只读)
+-- ============================================================
+-- SELECT t.relname AS table_name, c.relname AS index_name, a.attname AS column_name
+--   FROM pg_class t
+--   JOIN pg_index i ON i.indrelid = t.oid
+--   JOIN pg_class c ON c.oid = i.indexrelid
+--   JOIN pg_attribute a ON a.attrelid = t.oid AND a.attnum = ANY(i.indkey)
+--  WHERE t.relnamespace = 'app_user'::regnamespace AND i.indisunique
+--    AND t.relname IN ('pipe_network_base','manhole_info','pump_station_info',
+--                      'drainage_gate_info','drainage_storage_info',
+--                      'water_plant_info','water_source_info','water_user_info')
+--  ORDER BY t.relname, c.relname;
+--
+-- SELECT table_name, column_name, data_type
+--   FROM information_schema.columns
+--  WHERE table_schema = 'app_user'
+--    AND table_name IN ('pump_station_info','water_plant_info','water_source_info','water_user_info')
+--    AND column_name = 'id';

+ 245 - 0
pipe-network-service/sql/migration_infrastructure_menus.sql

@@ -0,0 +1,245 @@
+-- ============================================================
+-- 基础设施信息(menu_id=2070「管网基础设施信息」)新增 9 个菜单
+--
+-- | 菜单名称         | component                                          | 说明                        |
+-- |-----------------|----------------------------------------------------|-----------------------------|
+-- | 管道信息        | subSystem/pipeNetwork/facilities/pipeNetwork/index   | 已有页面迁移到 facilities 下 |
+-- | 窨井信息        | subSystem/pipeNetwork/facilities/manhole/index       | 已有页面迁移 + 表改造       |
+-- | 泵站信息        | subSystem/pipeNetwork/facilities/pumpStation/index  | 供排水共用,station_type 区分|
+-- | 供水-水厂信息   | subSystem/pipeNetwork/facilities/waterPlant/index   | 已有页面复用                |
+-- | 供水-水源地信息 | subSystem/pipeNetwork/facilities/waterSource/index  | 已有页面复用                |
+-- | 供水-用水户信息 | subSystem/pipeNetwork/facilities/waterUser/index    | 已有页面复用                |
+-- | 供水-消火栓信息 | subSystem/pipeNetwork/facilities/waterFireHydrant/index | 新建功能 + 新建表         |
+-- | 排水-闸门信息   | subSystem/pipeNetwork/facilities/drainageGate/index | 从 drainage_engineering_facility 拆分 |
+-- | 排水-调蓄设施信息 | subSystem/pipeNetwork/facilities/drainageStorage/index | 从 drainage_engineering_facility 拆分 |
+--
+-- 约束边界:
+--   · 本脚本只在 2070 节点下**新增**菜单,不动任何老菜单、老页面;
+--   · 老业务后续再统一改造,本脚本不涉及数据迁移。
+--
+-- 脚本形态:
+--   纯常规 SQL(KingbaseES / PG 兼容),**不含 DO $$ / 存储过程 / 匿名块**,
+--   可在 KES 控制台整段执行,也可逐条执行。
+--
+-- 重要:
+--   · component 必须写成 views 下的相对路径且**带 /index**(目录式落地),
+--     否则前端 loadView 匹配不到 → 路由组件为空 → 白屏。
+--     依据:src/store/modules/permission.js 的 import.meta.glob('./../../views/**/*.vue')。
+--   · menu_id 显式取 MAX(menu_id)+1(本库自增计数器未推进,不能省略主键)。
+--   · 幂等:按 component 判重,已存在则不重复插入、不重复授权。
+--   · 「管道信息」组件已迁移到 subSystem/pipeNetwork/facilities/pipeNetwork/index
+--     (原 assetInfo/netWorkBase 已移除),STEP 4 会把仍指向旧路径的历史菜单一并改正。
+--   · 父目录定位:menu_id=2070 → 名称「管网基础设施信息」兜底;两者都取不到时
+--     STEP 0 的 parent_menu_id 为 NULL,STEP 1/STEP 2 自动跳过(不报错、不写脏数据),
+--     此时需先确认真实 menu_id 再重跑。
+--
+-- 执行后请重新登录一次,让前端重新拉取菜单。
+-- 数据库:KingbaseES(PG 兼容),schema = app_user。
+-- ============================================================
+
+-- 前置:结束上一次失败执行遗留的 aborted 事务
+ROLLBACK;
+
+BEGIN;
+
+SET search_path TO app_user, public;
+
+-- ------------------------------------------------------------
+-- STEP 0:定位父目录「管网基础设施信息」(三路兜底,仅作核对/供后续语句复用)
+-- ------------------------------------------------------------
+SELECT COALESCE(
+         (SELECT m.menu_id FROM app_user.sys_menu m WHERE m.menu_id = 2070 LIMIT 1),
+         (SELECT m.menu_id FROM app_user.sys_menu m
+           WHERE m.menu_name = '管网基础设施信息'
+             AND m.menu_type IN ('M', 'C')
+           ORDER BY m.menu_id LIMIT 1)
+       ) AS parent_menu_id;
+
+-- ------------------------------------------------------------
+-- STEP 0.5:核对 2070 已改造为目录
+--   期望:menu_type = 'M',component = 'ParentView'(不再是管道信息页面)
+--   若 component 仍指向管道信息页面(迁移前为
+--   'subSystem/pipeNetwork/assetInfo/netWorkBase/index'),
+--   说明 2070 还没目录化:本脚本仍会插入 9 条,但 STEP 4 会把 2070 也指向
+--   新路径,出现「同一个管道信息页面两个入口」。
+--   请先执行 migration_menu_2070_directory.sql。
+-- ------------------------------------------------------------
+SELECT menu_id, menu_name, parent_id, menu_type, path, component
+  FROM app_user.sys_menu
+ WHERE menu_id = 2070;
+
+-- ------------------------------------------------------------
+-- STEP 1:新增 9 个菜单(按 component 判重,幂等)
+-- ------------------------------------------------------------
+INSERT INTO app_user.sys_menu
+    (menu_id, menu_name, parent_id, order_num, path, component, "query", route_name,
+     is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark)
+SELECT (SELECT COALESCE(MAX(menu_id), 0) FROM app_user.sys_menu) + t.rn,
+       t.menu_name,
+       t.parent_id,
+       t.order_num,
+       t.path,
+       t.component,
+       '',
+       t.route_name,
+       1,
+       0,
+       'C',
+       '0',
+       '0',
+       '',
+       t.icon,
+       'admin',
+       CURRENT_TIMESTAMP,
+       t.remark
+  FROM (
+        SELECT s.menu_name,
+               s.order_num,
+               s.path,
+               s.component,
+               s.route_name,
+               s.icon,
+               s.remark,
+               p.parent_id,
+               ROW_NUMBER() OVER (ORDER BY s.order_num, s.component) AS rn
+          FROM (VALUES
+                    ('管道信息',           1, 'facilityPipeNetwork',     'subSystem/pipeNetwork/facilities/pipeNetwork/index',       'FacilityPipeNetwork',    'tree-table', '基础设施信息-管道信息'),
+                    ('窨井信息',           2, 'facilityManhole',         'subSystem/pipeNetwork/facilities/manhole/index',            'FacilityManhole',        'guide',      '基础设施信息-窨井信息'),
+                    ('泵站信息',           3, 'facilityPumpStation',    'subSystem/pipeNetwork/facilities/pumpStation/index',       'FacilityPumpStation',   'component',  '基础设施信息-泵站信息(供水排水共用)'),
+                    ('供水-水厂信息',      4, 'facilityWaterPlant',     'subSystem/pipeNetwork/facilities/waterPlant/index',        'FacilityWaterPlant',    'build',      '基础设施信息-供水水厂'),
+                    ('供水-水源地信息',    5, 'facilityWaterSource',    'subSystem/pipeNetwork/facilities/waterSource/index',       'FacilityWaterSource',   'tree',       '基础设施信息-供水水源地'),
+                    ('供水-用水户信息',    6, 'facilityWaterUser',      'subSystem/pipeNetwork/facilities/waterUser/index',         'FacilityWaterUser',     'user',       '基础设施信息-供水用水户'),
+                    ('供水-消火栓信息',    7, 'facilityFireHydrant',    'subSystem/pipeNetwork/facilities/waterFireHydrant/index',  'FacilityFireHydrant',   'form',       '基础设施信息-供水消火栓'),
+                    ('排水-闸门信息',      8, 'facilityDrainageGate',   'subSystem/pipeNetwork/facilities/drainageGate/index',      'FacilityDrainageGate',  'form',       '基础设施信息-排水闸门'),
+                    ('排水-调蓄设施信息',  9, 'facilityDrainageStorage','subSystem/pipeNetwork/facilities/drainageStorage/index', 'FacilityDrainageStorage','table',     '基础设施信息-排水调蓄设施')
+               ) AS s(menu_name, order_num, path, component, route_name, icon, remark)
+          CROSS JOIN (
+                SELECT COALESCE(
+                         (SELECT m.menu_id FROM app_user.sys_menu m WHERE m.menu_id = 2070 LIMIT 1),
+                         (SELECT m.menu_id FROM app_user.sys_menu m
+                           WHERE m.menu_name = '管网基础设施信息'
+                             AND m.menu_type IN ('M', 'C')
+                           ORDER BY m.menu_id LIMIT 1)
+                       ) AS parent_id
+               ) p
+         WHERE p.parent_id IS NOT NULL
+           AND NOT EXISTS (SELECT 1 FROM app_user.sys_menu m WHERE m.component = s.component)
+       ) t;
+
+-- ------------------------------------------------------------
+-- STEP 2:把新菜单授权给所有已拥有 2070 的角色(跟随父级扩散)
+-- ------------------------------------------------------------
+INSERT INTO app_user.sys_role_menu (role_id, menu_id)
+SELECT DISTINCT rm.role_id, m.menu_id
+  FROM app_user.sys_role_menu rm
+  JOIN app_user.sys_menu m
+    ON m.parent_id = rm.menu_id
+ WHERE rm.menu_id = (SELECT COALESCE(
+                            (SELECT m1.menu_id FROM app_user.sys_menu m1 WHERE m1.menu_id = 2070 LIMIT 1),
+                            (SELECT m2.menu_id FROM app_user.sys_menu m2
+                              WHERE m2.menu_name = '管网基础设施信息'
+                                AND m2.menu_type IN ('M', 'C')
+                              ORDER BY m2.menu_id LIMIT 1)
+                        ))
+   AND m.component IN ('subSystem/pipeNetwork/facilities/pipeNetwork/index',
+                       'subSystem/pipeNetwork/facilities/manhole/index',
+                       'subSystem/pipeNetwork/facilities/pumpStation/index',
+                       'subSystem/pipeNetwork/facilities/waterPlant/index',
+                       'subSystem/pipeNetwork/facilities/waterSource/index',
+                       'subSystem/pipeNetwork/facilities/waterUser/index',
+                       'subSystem/pipeNetwork/facilities/waterFireHydrant/index',
+                       'subSystem/pipeNetwork/facilities/drainageGate/index',
+                       'subSystem/pipeNetwork/facilities/drainageStorage/index')
+   AND NOT EXISTS (SELECT 1 FROM app_user.sys_role_menu e
+                    WHERE e.role_id = rm.role_id AND e.menu_id = m.menu_id);
+
+-- ------------------------------------------------------------
+-- STEP 3:已存在同 component 的菜单只补齐排序/名称
+--         (不改 component、不动老菜单)
+-- ------------------------------------------------------------
+UPDATE app_user.sys_menu m
+   SET order_num = s.order_num,
+       menu_name = s.menu_name,
+       update_by = 'admin',
+       update_time = CURRENT_TIMESTAMP
+  FROM (VALUES
+          ('管道信息',           1, 'subSystem/pipeNetwork/facilities/pipeNetwork/index'),
+          ('窨井信息',           2, 'subSystem/pipeNetwork/facilities/manhole/index'),
+          ('泵站信息',           3, 'subSystem/pipeNetwork/facilities/pumpStation/index'),
+          ('供水-水厂信息',      4, 'subSystem/pipeNetwork/facilities/waterPlant/index'),
+          ('供水-水源地信息',    5, 'subSystem/pipeNetwork/facilities/waterSource/index'),
+          ('供水-用水户信息',    6, 'subSystem/pipeNetwork/facilities/waterUser/index'),
+          ('供水-消火栓信息',    7, 'subSystem/pipeNetwork/facilities/waterFireHydrant/index'),
+          ('排水-闸门信息',      8, 'subSystem/pipeNetwork/facilities/drainageGate/index'),
+          ('排水-调蓄设施信息',  9, 'subSystem/pipeNetwork/facilities/drainageStorage/index')
+       ) AS s(menu_name, order_num, component)
+ WHERE m.component = s.component
+   AND m.parent_id = (SELECT COALESCE(
+                            (SELECT m1.menu_id FROM app_user.sys_menu m1 WHERE m1.menu_id = 2070 LIMIT 1),
+                            (SELECT m2.menu_id FROM app_user.sys_menu m2
+                              WHERE m2.menu_name = '管网基础设施信息'
+                                AND m2.menu_type IN ('M', 'C')
+                              ORDER BY m2.menu_id LIMIT 1)
+                        ))
+   AND (m.order_num <> s.order_num OR m.menu_name <> s.menu_name);
+
+-- ------------------------------------------------------------
+-- STEP 4:修正历史菜单对「管道信息」旧 component 的引用
+--   管道信息页面已由 subSystem/pipeNetwork/assetInfo/netWorkBase/index
+--   迁移到 subSystem/pipeNetwork/facilities/pipeNetwork/index,
+--   现场若还有其它菜单指向旧路径,统一改到新路径(否则组件找不到 → 白屏)。
+--   前置:必须已执行 migration_menu_2070_directory.sql,
+--         否则会把 2070 目录重新指回管道信息页面。
+-- ------------------------------------------------------------
+UPDATE app_user.sys_menu
+   SET component   = 'subSystem/pipeNetwork/facilities/pipeNetwork/index',
+       update_by   = 'admin',
+       update_time = CURRENT_TIMESTAMP
+ WHERE component = 'subSystem/pipeNetwork/assetInfo/netWorkBase/index';
+
+COMMIT;
+
+-- ============================================================
+-- 执行后核对(只读):
+--   SELECT menu_id, menu_name, parent_id, order_num, path, component, visible, status
+--     FROM app_user.sys_menu
+--    WHERE parent_id = (SELECT menu_id FROM app_user.sys_menu WHERE menu_id = 2070)
+--    ORDER BY order_num, menu_id;
+--
+--   -- 组件文件必须存在,否则前端白屏(逐条核对)
+--   -- subSystem/pipeNetwork/facilities/pipeNetwork/index.vue
+--   -- subSystem/pipeNetwork/facilities/manhole/index.vue
+--   -- subSystem/pipeNetwork/facilities/pumpStation/index.vue
+--   -- subSystem/pipeNetwork/facilities/waterPlant/index.vue
+--   -- subSystem/pipeNetwork/facilities/waterSource/index.vue
+--   -- subSystem/pipeNetwork/facilities/waterUser/index.vue
+--   -- subSystem/pipeNetwork/facilities/waterFireHydrant/index.vue
+--   -- subSystem/pipeNetwork/facilities/drainageGate/index.vue
+--   -- subSystem/pipeNetwork/facilities/drainageStorage/index.vue
+--
+-- 回滚(删除本脚本新增的 9 个菜单及其授权):
+--   BEGIN;
+--   SET search_path TO app_user, public;
+--   DELETE FROM app_user.sys_role_menu WHERE menu_id IN (
+--     SELECT menu_id FROM app_user.sys_menu
+--      WHERE component IN ('subSystem/pipeNetwork/facilities/pipeNetwork/index',
+--                          'subSystem/pipeNetwork/facilities/manhole/index',
+--                          'subSystem/pipeNetwork/facilities/pumpStation/index',
+--                          'subSystem/pipeNetwork/facilities/waterPlant/index',
+--                          'subSystem/pipeNetwork/facilities/waterSource/index',
+--                          'subSystem/pipeNetwork/facilities/waterUser/index',
+--                          'subSystem/pipeNetwork/facilities/waterFireHydrant/index',
+--                          'subSystem/pipeNetwork/facilities/drainageGate/index',
+--                          'subSystem/pipeNetwork/facilities/drainageStorage/index'));
+--   DELETE FROM app_user.sys_menu WHERE component IN (
+--     'subSystem/pipeNetwork/facilities/pipeNetwork/index',
+--     'subSystem/pipeNetwork/facilities/manhole/index',
+--     'subSystem/pipeNetwork/facilities/pumpStation/index',
+--     'subSystem/pipeNetwork/facilities/waterPlant/index',
+--     'subSystem/pipeNetwork/facilities/waterSource/index',
+--     'subSystem/pipeNetwork/facilities/waterUser/index',
+--     'subSystem/pipeNetwork/facilities/waterFireHydrant/index',
+--     'subSystem/pipeNetwork/facilities/drainageGate/index',
+--     'subSystem/pipeNetwork/facilities/drainageStorage/index');
+--   COMMIT;
+-- ============================================================

+ 547 - 0
pipe-network-service/sql/migration_infrastructure_restructure.sql

@@ -0,0 +1,547 @@
+-- ============================================================
+-- 基础设施信息表结构重构(DDL + 字典)
+--
+-- 涉及已有表(7 张):
+--   pipe_network_base              管网
+--   water_plant_info               供水-水厂信息
+--   water_source_info              供水-水源地信息
+--   water_user_info                供水-用水户信息
+--   pump_station                   供水排水-泵站信息
+--   drainage_engineering_facility  排水-闸门/调蓄设施/泵站
+--   manhole_base                   窨井信息
+--
+-- 一、表更名(不搬数据,RENAME 后主键/索引/约束全部跟随)
+--   manhole_base → manhole_info
+--   pump_station → pump_station_info
+--
+-- 二、新建独立表
+--   water_fire_hydrant_info   供水消火栓信息
+--   drainage_gate_info        排水闸门信息
+--   drainage_storage_info     排水调蓄设施信息
+--
+-- 三、统一状态字段
+--   涉及:pipe_network_base / water_plant_info / water_source_info /
+--         water_user_info / pump_station_info / manhole_info /
+--         water_fire_hydrant_info / drainage_gate_info / drainage_storage_info
+--   字段:status,字典 infrastructure_status(0正常 1异常),默认值 '0'
+--
+-- 四、manhole_info 新增字段
+--   manhole_type,字典 manhole_type(0燃气窨井 1排水窨井 2供水窨井)
+--
+-- 五、字典规范
+--   除 status 外,所有下拉项一律走系统字典(sys_dict_type / sys_dict_data),
+--   禁止在代码或页面里硬编码。
+--   本次除统一状态字典外,另登记 8 类业务枚举字典(见 SECTION 5.6),
+--   码值保持页面既有取值,避免存量数据回显失效。
+--
+-- 本脚本不做历史数据迁移(不搬行、不改存量 status 取值)。
+-- 幂等:可重复执行。
+-- 数据库:KingbaseES(PG 兼容),schema = app_user。
+--
+-- ⚠️ 部署顺序:必须先发后端代码(改 @TableName 与 Mapper XML),再执行本脚本;
+--    反序(先改名表再发代码)会在运行期报「关系不存在」。
+--
+-- ⚠️ 关于 status 值域:现有各表 status 口径并不统一
+--    pipe_network_base          0正常 1异常                (字典 infrastructure_status)
+--    water_plant_info           0正常运行 1停产
+--    water_source_info          0正常 1异常
+--    water_user_info            0正常 1欠费 2停用
+--    pump_station               0正常运行 1故障停运 2检修中
+--    drainage_engineering_facility 0正常 1检修 2停用 3故障 (字典 drainage_facility_status)
+--    manhole_base               口径未定义(无字典、无取值说明)
+--    本次统一为 infrastructure_status(0正常 1异常),但**不迁移存量值**:
+--    存量 '2'、'3' 等值在新口径下没有对应含义。旧字典一律保留(前端仍在用)。
+--    若确认要归一,见 SECTION 6 默认注释的归一语句(需业务确认后手工启用)。
+-- ============================================================
+
+-- 前置:结束上一次失败执行遗留的 aborted 事务
+ROLLBACK;
+
+-- ------------------------------------------------------------
+-- SECTION 1:表更名(RENAME,不动数据)
+-- ------------------------------------------------------------
+BEGIN;
+
+SET search_path TO app_user, public;
+
+ALTER TABLE IF EXISTS app_user.manhole_base RENAME TO manhole_info;
+ALTER TABLE IF EXISTS app_user.pump_station RENAME TO pump_station_info;
+
+-- 自增序列改名(纯 SQL,IF EXISTS 幂等)
+--   说明:序列与表名解耦,表 RENAME 后列上的 DEFAULT nextval 仍然生效,
+--         不改序列名不影响功能,这里只做命名统一。
+--         KES 由 MySQL 迁移而来,序列名可能是下列任一种,按实际存在者执行即可;
+--         若都不存在,用文末的核对查询查出真实名称后手工 ALTER SEQUENCE。
+ALTER SEQUENCE IF EXISTS app_user.pump_station_id_seq             RENAME TO pump_station_info_id_seq;
+ALTER SEQUENCE IF EXISTS app_user.pump_station_seq                RENAME TO pump_station_info_seq;
+ALTER SEQUENCE IF EXISTS app_user.pump_station_auto_increment     RENAME TO pump_station_info_auto_increment;
+ALTER SEQUENCE IF EXISTS app_user.manhole_base_id_seq             RENAME TO manhole_info_id_seq;
+ALTER SEQUENCE IF EXISTS app_user.manhole_base_seq                RENAME TO manhole_info_seq;
+ALTER SEQUENCE IF EXISTS app_user.manhole_base_auto_increment     RENAME TO manhole_info_auto_increment;
+
+-- 序列名核对(只读):若仍返回旧名序列,按结果手工改名
+--   SELECT c.relname AS seq_name
+--     FROM pg_class c
+--     JOIN pg_namespace n ON n.oid = c.relnamespace
+--    WHERE c.relkind = 'S'
+--      AND n.nspname = 'app_user'
+--      AND (c.relname LIKE '%pump_station%' OR c.relname LIKE '%manhole%')
+--    ORDER BY c.relname;
+
+COMMIT;
+
+-- ------------------------------------------------------------
+-- SECTION 2:manhole_info 新增 manhole_type
+-- ------------------------------------------------------------
+BEGIN;
+
+SET search_path TO app_user, public;
+
+ALTER TABLE app_user.manhole_info ADD COLUMN IF NOT EXISTS manhole_type varchar(8) DEFAULT '0';
+COMMENT ON COLUMN app_user.manhole_info.manhole_type IS '窨井类型(字典 manhole_type:0燃气窨井 1排水窨井 2供水窨井)';
+
+COMMIT;
+
+-- ------------------------------------------------------------
+-- SECTION 3:统一 status 字段口径(0正常 1异常,默认 0)
+--   只改注释与默认值,不动存量取值。
+-- ------------------------------------------------------------
+BEGIN;
+
+SET search_path TO app_user, public;
+
+-- 管网
+ALTER TABLE app_user.pipe_network_base ALTER COLUMN status SET DEFAULT '0';
+COMMENT ON COLUMN app_user.pipe_network_base.status IS '状态(字典 infrastructure_status:0正常 1异常)';
+
+-- 供水三件套
+ALTER TABLE app_user.water_plant_info ALTER COLUMN status SET DEFAULT '0';
+COMMENT ON COLUMN app_user.water_plant_info.status IS '状态(字典 infrastructure_status:0正常 1异常)';
+
+ALTER TABLE app_user.water_source_info ALTER COLUMN status SET DEFAULT '0';
+COMMENT ON COLUMN app_user.water_source_info.status IS '状态(字典 infrastructure_status:0正常 1异常)';
+
+ALTER TABLE app_user.water_user_info ALTER COLUMN status SET DEFAULT '0';
+COMMENT ON COLUMN app_user.water_user_info.status IS '状态(字典 infrastructure_status:0正常 1异常)';
+
+-- 泵站(更名后)
+ALTER TABLE app_user.pump_station_info ALTER COLUMN status SET DEFAULT '0';
+COMMENT ON COLUMN app_user.pump_station_info.status IS '状态(字典 infrastructure_status:0正常 1异常)';
+
+-- 窨井(更名后)
+ALTER TABLE app_user.manhole_info ALTER COLUMN status SET DEFAULT '0';
+COMMENT ON COLUMN app_user.manhole_info.status IS '状态(字典 infrastructure_status:0正常 1异常)';
+
+COMMIT;
+
+-- ------------------------------------------------------------
+-- SECTION 4:新建 3 张独立表
+--   通用字段规范(所有基础设施表统一):
+--     主键 <entity>_id varchar(64)      应用生成 UUID
+--     业务编码 <entity>_code varchar(64) 唯一
+--     审计字段 create_by/create_time/update_by/update_time
+--     逻辑删除 del_flag char(1) 默认 '0'(0正常 2删除)
+--     坐标 longitude/latitude numeric(12,8),WGS84
+--     位置描述 location varchar(500)
+-- ------------------------------------------------------------
+BEGIN;
+
+SET search_path TO app_user, public;
+
+-- 4.1 供水消火栓信息
+CREATE TABLE IF NOT EXISTS app_user.water_fire_hydrant_info (
+    hydrant_id       varchar(64)   NOT NULL,
+    hydrant_code     varchar(64),
+    hydrant_name     varchar(200)  NOT NULL,
+    hydrant_type     varchar(8)    NOT NULL DEFAULT '0',
+    model            varchar(128),
+    inlet_pipe_diameter varchar(32),
+    outlet_spec      varchar(64),
+    ownership_unit   varchar(200),
+    maintenance_unit varchar(200),
+    principal        varchar(64),
+    contact_phone    varchar(32),
+    location         varchar(500),
+    longitude        numeric(12, 8),
+    latitude         numeric(12, 8),
+    status           varchar(8)    NOT NULL DEFAULT '0',
+    remark           varchar(500),
+    create_by        varchar(64),
+    create_time      timestamp,
+    update_by        varchar(64),
+    update_time      timestamp,
+    del_flag         char(1)       DEFAULT '0',
+    CONSTRAINT pk_water_fire_hydrant_info PRIMARY KEY (hydrant_id)
+);
+COMMENT ON TABLE app_user.water_fire_hydrant_info IS '供水消火栓信息表';
+COMMENT ON COLUMN app_user.water_fire_hydrant_info.hydrant_id IS '消火栓ID(主键)';
+COMMENT ON COLUMN app_user.water_fire_hydrant_info.hydrant_code IS '消火栓编号';
+COMMENT ON COLUMN app_user.water_fire_hydrant_info.hydrant_name IS '消火栓名称';
+COMMENT ON COLUMN app_user.water_fire_hydrant_info.hydrant_type IS '消火栓类型(字典 water_fire_hydrant_type:0市政室外消火栓 1小区室外消火栓 2室内消火栓)';
+COMMENT ON COLUMN app_user.water_fire_hydrant_info.model IS '型号';
+COMMENT ON COLUMN app_user.water_fire_hydrant_info.inlet_pipe_diameter IS '进水主管管径';
+COMMENT ON COLUMN app_user.water_fire_hydrant_info.outlet_spec IS '出水口规格';
+COMMENT ON COLUMN app_user.water_fire_hydrant_info.ownership_unit IS '产权单位';
+COMMENT ON COLUMN app_user.water_fire_hydrant_info.maintenance_unit IS '管护单位';
+COMMENT ON COLUMN app_user.water_fire_hydrant_info.principal IS '责任人';
+COMMENT ON COLUMN app_user.water_fire_hydrant_info.contact_phone IS '联系电话';
+COMMENT ON COLUMN app_user.water_fire_hydrant_info.location IS '位置描述';
+COMMENT ON COLUMN app_user.water_fire_hydrant_info.longitude IS 'WGS84 经度';
+COMMENT ON COLUMN app_user.water_fire_hydrant_info.latitude IS 'WGS84 纬度';
+COMMENT ON COLUMN app_user.water_fire_hydrant_info.status IS '状态(字典 infrastructure_status:0正常 1异常)';
+COMMENT ON COLUMN app_user.water_fire_hydrant_info.remark IS '备注';
+COMMENT ON COLUMN app_user.water_fire_hydrant_info.create_by IS '创建人';
+COMMENT ON COLUMN app_user.water_fire_hydrant_info.create_time IS '创建时间';
+COMMENT ON COLUMN app_user.water_fire_hydrant_info.update_by IS '更新人';
+COMMENT ON COLUMN app_user.water_fire_hydrant_info.update_time IS '更新时间';
+COMMENT ON COLUMN app_user.water_fire_hydrant_info.del_flag IS '删除标志(0正常 2删除)';
+CREATE UNIQUE INDEX IF NOT EXISTS uk_wfh_hydrant_code ON app_user.water_fire_hydrant_info (hydrant_code);
+CREATE INDEX IF NOT EXISTS idx_wfh_type ON app_user.water_fire_hydrant_info (hydrant_type);
+CREATE INDEX IF NOT EXISTS idx_wfh_status ON app_user.water_fire_hydrant_info (status);
+
+-- 4.2 排水闸门信息(自 drainage_engineering_facility 拆分)
+CREATE TABLE IF NOT EXISTS app_user.drainage_gate_info (
+    facility_id      varchar(64)   NOT NULL,
+    facility_code    varchar(64),
+    facility_name    varchar(200)  NOT NULL,
+    facility_level   varchar(8),
+    management_unit  varchar(200),
+    location         varchar(500),
+    longitude        numeric(12, 8),
+    latitude         numeric(12, 8),
+    status           varchar(8)    NOT NULL DEFAULT '0',
+    build_date       date,
+    design_flow      numeric(12, 2),
+    design_head      numeric(10, 2),
+    equipment_id     varchar(500),
+    remark           varchar(500),
+    create_by        varchar(64),
+    create_time      timestamp,
+    update_by        varchar(64),
+    update_time      timestamp,
+    del_flag         char(1)       DEFAULT '0',
+    CONSTRAINT pk_drainage_gate_info PRIMARY KEY (facility_id)
+);
+COMMENT ON TABLE app_user.drainage_gate_info IS '排水闸门信息表(自 drainage_engineering_facility 拆分)';
+COMMENT ON COLUMN app_user.drainage_gate_info.facility_id IS '闸门ID(主键)';
+COMMENT ON COLUMN app_user.drainage_gate_info.facility_code IS '闸门编号';
+COMMENT ON COLUMN app_user.drainage_gate_info.facility_name IS '闸门名称';
+COMMENT ON COLUMN app_user.drainage_gate_info.facility_level IS '设施等级(字典 drainage_facility_level)';
+COMMENT ON COLUMN app_user.drainage_gate_info.management_unit IS '管理单位';
+COMMENT ON COLUMN app_user.drainage_gate_info.location IS '位置描述';
+COMMENT ON COLUMN app_user.drainage_gate_info.longitude IS 'WGS84 经度';
+COMMENT ON COLUMN app_user.drainage_gate_info.latitude IS 'WGS84 纬度';
+COMMENT ON COLUMN app_user.drainage_gate_info.status IS '状态(字典 infrastructure_status:0正常 1异常)';
+COMMENT ON COLUMN app_user.drainage_gate_info.build_date IS '建设日期';
+COMMENT ON COLUMN app_user.drainage_gate_info.design_flow IS '设计流量(m³/s)';
+COMMENT ON COLUMN app_user.drainage_gate_info.design_head IS '设计水头(m)';
+COMMENT ON COLUMN app_user.drainage_gate_info.equipment_id IS '关联设备ID(多个逗号分隔)';
+COMMENT ON COLUMN app_user.drainage_gate_info.remark IS '备注';
+COMMENT ON COLUMN app_user.drainage_gate_info.create_by IS '创建人';
+COMMENT ON COLUMN app_user.drainage_gate_info.create_time IS '创建时间';
+COMMENT ON COLUMN app_user.drainage_gate_info.update_by IS '更新人';
+COMMENT ON COLUMN app_user.drainage_gate_info.update_time IS '更新时间';
+COMMENT ON COLUMN app_user.drainage_gate_info.del_flag IS '删除标志(0正常 2删除)';
+CREATE UNIQUE INDEX IF NOT EXISTS uk_dgi_facility_code ON app_user.drainage_gate_info (facility_code);
+CREATE INDEX IF NOT EXISTS idx_dgi_level ON app_user.drainage_gate_info (facility_level);
+CREATE INDEX IF NOT EXISTS idx_dgi_status ON app_user.drainage_gate_info (status);
+CREATE INDEX IF NOT EXISTS idx_dgi_management_unit ON app_user.drainage_gate_info (management_unit);
+
+-- 4.3 排水调蓄设施信息(自 drainage_engineering_facility 拆分)
+CREATE TABLE IF NOT EXISTS app_user.drainage_storage_info (
+    facility_id      varchar(64)   NOT NULL,
+    facility_code    varchar(64),
+    facility_name    varchar(200)  NOT NULL,
+    facility_level   varchar(8),
+    management_unit  varchar(200),
+    location         varchar(500),
+    longitude        numeric(12, 8),
+    latitude         numeric(12, 8),
+    status           varchar(8)    NOT NULL DEFAULT '0',
+    build_date       date,
+    storage_capacity numeric(14, 2),
+    design_flow      numeric(12, 2),
+    equipment_id     varchar(500),
+    remark           varchar(500),
+    create_by        varchar(64),
+    create_time      timestamp,
+    update_by        varchar(64),
+    update_time      timestamp,
+    del_flag         char(1)       DEFAULT '0',
+    CONSTRAINT pk_drainage_storage_info PRIMARY KEY (facility_id)
+);
+COMMENT ON TABLE app_user.drainage_storage_info IS '排水调蓄设施信息表(自 drainage_engineering_facility 拆分)';
+COMMENT ON COLUMN app_user.drainage_storage_info.facility_id IS '调蓄设施ID(主键)';
+COMMENT ON COLUMN app_user.drainage_storage_info.facility_code IS '调蓄设施编号';
+COMMENT ON COLUMN app_user.drainage_storage_info.facility_name IS '调蓄设施名称';
+COMMENT ON COLUMN app_user.drainage_storage_info.facility_level IS '设施等级(字典 drainage_facility_level)';
+COMMENT ON COLUMN app_user.drainage_storage_info.management_unit IS '管理单位';
+COMMENT ON COLUMN app_user.drainage_storage_info.location IS '位置描述';
+COMMENT ON COLUMN app_user.drainage_storage_info.longitude IS 'WGS84 经度';
+COMMENT ON COLUMN app_user.drainage_storage_info.latitude IS 'WGS84 纬度';
+COMMENT ON COLUMN app_user.drainage_storage_info.status IS '状态(字典 infrastructure_status:0正常 1异常)';
+COMMENT ON COLUMN app_user.drainage_storage_info.build_date IS '建设日期';
+COMMENT ON COLUMN app_user.drainage_storage_info.storage_capacity IS '调蓄容积(m³)';
+COMMENT ON COLUMN app_user.drainage_storage_info.design_flow IS '设计流量(m³/s)';
+COMMENT ON COLUMN app_user.drainage_storage_info.equipment_id IS '关联设备ID(多个逗号分隔)';
+COMMENT ON COLUMN app_user.drainage_storage_info.remark IS '备注';
+COMMENT ON COLUMN app_user.drainage_storage_info.create_by IS '创建人';
+COMMENT ON COLUMN app_user.drainage_storage_info.create_time IS '创建时间';
+COMMENT ON COLUMN app_user.drainage_storage_info.update_by IS '更新人';
+COMMENT ON COLUMN app_user.drainage_storage_info.update_time IS '更新时间';
+COMMENT ON COLUMN app_user.drainage_storage_info.del_flag IS '删除标志(0正常 2删除)';
+CREATE UNIQUE INDEX IF NOT EXISTS uk_dsi_facility_code ON app_user.drainage_storage_info (facility_code);
+CREATE INDEX IF NOT EXISTS idx_dsi_level ON app_user.drainage_storage_info (facility_level);
+CREATE INDEX IF NOT EXISTS idx_dsi_status ON app_user.drainage_storage_info (status);
+CREATE INDEX IF NOT EXISTS idx_dsi_management_unit ON app_user.drainage_storage_info (management_unit);
+
+COMMIT;
+
+-- ------------------------------------------------------------
+-- SECTION 5:系统字典登记
+--   除 status 外,所有下拉项走系统字典;status 也统一用 infrastructure_status。
+--   本库为 KES MySQL 兼容自增,dict_id / dict_code 必须显式指定,否则撞主键。
+-- ------------------------------------------------------------
+BEGIN;
+
+SET search_path TO app_user, public;
+
+-- 5.1 基础设施统一状态:0正常 1异常
+INSERT INTO app_user.sys_dict_type
+    (dict_id, dict_name, dict_type, status, create_by, create_time, remark)
+SELECT (SELECT COALESCE(MAX(dict_id), 0) FROM app_user.sys_dict_type) + 1,
+       '基础设施状态', 'infrastructure_status', '0', 'admin', CURRENT_TIMESTAMP,
+       '基础设施统一状态:0正常 1异常'
+ WHERE NOT EXISTS (SELECT 1 FROM app_user.sys_dict_type WHERE dict_type = 'infrastructure_status');
+
+UPDATE app_user.sys_dict_type
+   SET dict_name = '基础设施状态', status = '0', update_by = 'admin',
+       update_time = CURRENT_TIMESTAMP, remark = '基础设施统一状态:0正常 1异常'
+ WHERE dict_type = 'infrastructure_status';
+
+DELETE FROM app_user.sys_dict_data WHERE dict_type = 'infrastructure_status';
+INSERT INTO app_user.sys_dict_data
+    (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class,
+     is_default, status, create_by, create_time, remark)
+SELECT (SELECT COALESCE(MAX(dict_code), 0) FROM app_user.sys_dict_data) + v.rn,
+       v.dict_sort, v.dict_label, v.dict_value, 'infrastructure_status',
+       '', v.list_class, v.is_default, '0', 'admin', CURRENT_TIMESTAMP, v.remark
+  FROM (VALUES
+        (1, 1, '正常', '0', 'success', 'Y', '基础设施状态:正常'),
+        (2, 2, '异常', '1', 'danger',  'N', '基础设施状态:异常')
+       ) AS v(rn, dict_sort, dict_label, dict_value, list_class, is_default, remark)
+ ORDER BY v.rn;
+
+-- 5.2 窨井类型:0燃气窨井 1排水窨井 2供水窨井
+INSERT INTO app_user.sys_dict_type
+    (dict_id, dict_name, dict_type, status, create_by, create_time, remark)
+SELECT (SELECT COALESCE(MAX(dict_id), 0) FROM app_user.sys_dict_type) + 1,
+       '窨井类型', 'manhole_type', '0', 'admin', CURRENT_TIMESTAMP,
+       '窨井类型:0燃气窨井 1排水窨井 2供水窨井'
+ WHERE NOT EXISTS (SELECT 1 FROM app_user.sys_dict_type WHERE dict_type = 'manhole_type');
+
+UPDATE app_user.sys_dict_type
+   SET dict_name = '窨井类型', status = '0', update_by = 'admin',
+       update_time = CURRENT_TIMESTAMP, remark = '窨井类型:0燃气窨井 1排水窨井 2供水窨井'
+ WHERE dict_type = 'manhole_type';
+
+DELETE FROM app_user.sys_dict_data WHERE dict_type = 'manhole_type';
+INSERT INTO app_user.sys_dict_data
+    (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class,
+     is_default, status, create_by, create_time, remark)
+SELECT (SELECT COALESCE(MAX(dict_code), 0) FROM app_user.sys_dict_data) + v.rn,
+       v.dict_sort, v.dict_label, v.dict_value, 'manhole_type',
+       '', v.list_class, v.is_default, '0', 'admin', CURRENT_TIMESTAMP, v.remark
+  FROM (VALUES
+        (1, 1, '燃气窨井', '0', 'primary', 'Y', '窨井类型:燃气窨井'),
+        (2, 2, '排水窨井', '1', 'success', 'N', '窨井类型:排水窨井'),
+        (3, 3, '供水窨井', '2', 'warning', 'N', '窨井类型:供水窨井')
+       ) AS v(rn, dict_sort, dict_label, dict_value, list_class, is_default, remark)
+ ORDER BY v.rn;
+
+-- 5.3 供水消火栓类型:0市政室外消火栓 1小区室外消火栓 2室内消火栓
+INSERT INTO app_user.sys_dict_type
+    (dict_id, dict_name, dict_type, status, create_by, create_time, remark)
+SELECT (SELECT COALESCE(MAX(dict_id), 0) FROM app_user.sys_dict_type) + 1,
+       '消火栓类型', 'water_fire_hydrant_type', '0', 'admin', CURRENT_TIMESTAMP,
+       '消火栓类型:0市政室外消火栓 1小区室外消火栓 2室内消火栓'
+ WHERE NOT EXISTS (SELECT 1 FROM app_user.sys_dict_type WHERE dict_type = 'water_fire_hydrant_type');
+
+UPDATE app_user.sys_dict_type
+   SET dict_name = '消火栓类型', status = '0', update_by = 'admin',
+       update_time = CURRENT_TIMESTAMP, remark = '消火栓类型:0市政室外消火栓 1小区室外消火栓 2室内消火栓'
+ WHERE dict_type = 'water_fire_hydrant_type';
+
+DELETE FROM app_user.sys_dict_data WHERE dict_type = 'water_fire_hydrant_type';
+INSERT INTO app_user.sys_dict_data
+    (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class,
+     is_default, status, create_by, create_time, remark)
+SELECT (SELECT COALESCE(MAX(dict_code), 0) FROM app_user.sys_dict_data) + v.rn,
+       v.dict_sort, v.dict_label, v.dict_value, 'water_fire_hydrant_type',
+       '', v.list_class, v.is_default, '0', 'admin', CURRENT_TIMESTAMP, v.remark
+  FROM (VALUES
+        (1, 1, '市政室外消火栓', '0', 'danger',  'Y', '消火栓类型:市政室外消火栓'),
+        (2, 2, '小区室外消火栓', '1', 'warning', 'N', '消火栓类型:小区室外消火栓'),
+        (3, 3, '室内消火栓',     '2', 'primary', 'N', '消火栓类型:室内消火栓')
+       ) AS v(rn, dict_sort, dict_label, dict_value, list_class, is_default, remark)
+ ORDER BY v.rn;
+
+-- 5.4 排水设施等级(闸门 / 调蓄设施共用)
+INSERT INTO app_user.sys_dict_type
+    (dict_id, dict_name, dict_type, status, create_by, create_time, remark)
+SELECT (SELECT COALESCE(MAX(dict_id), 0) FROM app_user.sys_dict_type) + 1,
+       '排水设施等级', 'drainage_facility_level', '0', 'admin', CURRENT_TIMESTAMP,
+       '排水设施等级:0一级 1二级 2三级'
+ WHERE NOT EXISTS (SELECT 1 FROM app_user.sys_dict_type WHERE dict_type = 'drainage_facility_level');
+
+UPDATE app_user.sys_dict_type
+   SET dict_name = '排水设施等级', status = '0', update_by = 'admin',
+       update_time = CURRENT_TIMESTAMP, remark = '排水设施等级:0一级 1二级 2三级'
+ WHERE dict_type = 'drainage_facility_level';
+
+DELETE FROM app_user.sys_dict_data WHERE dict_type = 'drainage_facility_level';
+INSERT INTO app_user.sys_dict_data
+    (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class,
+     is_default, status, create_by, create_time, remark)
+SELECT (SELECT COALESCE(MAX(dict_code), 0) FROM app_user.sys_dict_data) + v.rn,
+       v.dict_sort, v.dict_label, v.dict_value, 'drainage_facility_level',
+       '', v.list_class, v.is_default, '0', 'admin', CURRENT_TIMESTAMP, v.remark
+  FROM (VALUES
+        (1, 1, '一级', '0', 'danger',  'Y', '排水设施等级:一级'),
+        (2, 2, '二级', '1', 'warning', 'N', '排水设施等级:二级'),
+        (3, 3, '三级', '2', 'info',    'N', '排水设施等级:三级')
+       ) AS v(rn, dict_sort, dict_label, dict_value, list_class, is_default, remark)
+ ORDER BY v.rn;
+
+-- 5.5 泵站类型(展示字典:0 供水泵站 / 1 排水泵站)
+--   注意值域边界:本字典 dict_value 为展示口径 0/1;
+--   pump_station_info.station_type 的物理值仍沿用 water_supply / drainage,
+--   受 ck_pump_station_type CHECK 约束、PumpStationType 常量及驾驶舱映射共同约束,
+--   本次不做存量数据迁移,二者由调用方按映射关系转换(0↔water_supply,1↔drainage)。
+INSERT INTO app_user.sys_dict_type
+    (dict_id, dict_name, dict_type, status, create_by, create_time, remark)
+SELECT (SELECT COALESCE(MAX(dict_id), 0) FROM app_user.sys_dict_type) + 1,
+       '泵站类型', 'pump_station_type', '0', 'admin', CURRENT_TIMESTAMP,
+       '泵站类型:0 供水泵站 / 1 排水泵站'
+ WHERE NOT EXISTS (SELECT 1 FROM app_user.sys_dict_type WHERE dict_type = 'pump_station_type');
+
+UPDATE app_user.sys_dict_type
+   SET dict_name = '泵站类型', status = '0', update_by = 'admin',
+       update_time = CURRENT_TIMESTAMP, remark = '泵站类型:0 供水泵站 / 1 排水泵站'
+ WHERE dict_type = 'pump_station_type';
+
+DELETE FROM app_user.sys_dict_data WHERE dict_type = 'pump_station_type';
+INSERT INTO app_user.sys_dict_data
+    (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class,
+     is_default, status, create_by, create_time, remark)
+SELECT (SELECT COALESCE(MAX(dict_code), 0) FROM app_user.sys_dict_data) + v.rn,
+       v.dict_sort, v.dict_label, v.dict_value, 'pump_station_type',
+       '', v.list_class, v.is_default, '0', 'admin', CURRENT_TIMESTAMP, v.remark
+  FROM (VALUES
+        (1, 1, '供水泵站', '0', 'primary', 'Y', '泵站类型:供水泵站'),
+        (2, 2, '排水泵站', '1', 'success', 'N', '泵站类型:排水泵站')
+       ) AS v(rn, dict_sort, dict_label, dict_value, list_class, is_default, remark)
+ ORDER BY v.rn;
+
+-- 5.6 业务枚举字典(原前端硬编码下拉项字典化)
+--   为保证存量数据不失效,dict_value 一律保持页面既有取值:
+--     · 中文值字段(水源类型/保护等级/水质等级/用水户类型)保持中文码值;
+--     · 状态类按各表既有口径分别登记,不强行并入 infrastructure_status。
+INSERT INTO app_user.sys_dict_type
+    (dict_id, dict_name, dict_type, status, create_by, create_time, remark)
+SELECT (SELECT COALESCE(MAX(dict_id), 0) FROM app_user.sys_dict_type) + ROW_NUMBER() OVER (ORDER BY d.dict_type),
+       d.dict_name, d.dict_type, '0', 'admin', CURRENT_TIMESTAMP, d.remark
+  FROM (VALUES
+        ('水厂状态', 'water_plant_status', '水厂状态:0正常 1停产'),
+        ('用水户状态', 'water_user_status', '用水户状态:0正常 1欠费 2停用'),
+        ('管网设施类型', 'pipe_network_facility_type', '管网设施类型:0燃气 1排水 2供水'),
+        ('水源类型', 'water_source_type', '水源类型:地表水/地下水'),
+        ('水源保护等级', 'water_source_protection_level', '水源保护等级:一级/二级/准保护区'),
+        ('水质等级', 'water_quality_grade', '水质等级:Ⅰ类~Ⅴ类'),
+        ('用水户类型', 'water_user_type', '用水户类型:居民/工业/商业/行政事业')
+       ) AS d(dict_name, dict_type, remark)
+ WHERE NOT EXISTS (SELECT 1 FROM app_user.sys_dict_type t WHERE t.dict_type = d.dict_type);
+
+DELETE FROM app_user.sys_dict_data WHERE dict_type IN (
+    'water_plant_status', 'water_user_status', 'pipe_network_facility_type',
+    'water_source_type', 'water_source_protection_level', 'water_quality_grade', 'water_user_type');
+
+INSERT INTO app_user.sys_dict_data
+    (dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class,
+     is_default, status, create_by, create_time, remark)
+SELECT (SELECT COALESCE(MAX(dict_code), 0) FROM app_user.sys_dict_data) + v.rn,
+       v.dict_sort, v.dict_label, v.dict_value, v.dict_type, '', v.list_class,
+       v.is_default, '0', 'admin', CURRENT_TIMESTAMP, v.remark
+  FROM (VALUES
+        (1, 1, '正常', '0', 'water_plant_status', 'success', 'Y', '水厂状态:正常'),
+        (2, 2, '停产', '1', 'water_plant_status', 'danger', 'N', '水厂状态:停产'),
+        (3, 1, '正常', '0', 'water_user_status', 'success', 'Y', '用水户状态:正常'),
+        (4, 2, '欠费', '1', 'water_user_status', 'warning', 'N', '用水户状态:欠费'),
+        (5, 3, '停用', '2', 'water_user_status', 'danger', 'N', '用水户状态:停用'),
+        (6, 1, '燃气设施', '0', 'pipe_network_facility_type', 'primary', 'Y', '管网设施类型:燃气设施'),
+        (7, 2, '排水设施', '1', 'pipe_network_facility_type', 'success', 'N', '管网设施类型:排水设施'),
+        (8, 3, '供水设施', '2', 'pipe_network_facility_type', 'info', 'N', '管网设施类型:供水设施'),
+        (12, 1, '地表水', '地表水', 'water_source_type', 'info', 'Y', '水源类型:地表水'),
+        (13, 2, '地下水', '地下水', 'water_source_type', 'primary', 'N', '水源类型:地下水'),
+        (14, 1, '一级', '一级', 'water_source_protection_level', 'danger', 'Y', '水源保护等级:一级'),
+        (15, 2, '二级', '二级', 'water_source_protection_level', 'warning', 'N', '水源保护等级:二级'),
+        (16, 3, '准保护区', '准保护区', 'water_source_protection_level', 'info', 'N', '水源保护等级:准保护区'),
+        (17, 1, 'Ⅰ类', 'Ⅰ类', 'water_quality_grade', 'success', 'Y', '水质等级:Ⅰ类'),
+        (18, 2, 'Ⅱ类', 'Ⅱ类', 'water_quality_grade', 'success', 'N', '水质等级:Ⅱ类'),
+        (19, 3, 'Ⅲ类', 'Ⅲ类', 'water_quality_grade', 'info', 'N', '水质等级:Ⅲ类'),
+        (20, 4, 'Ⅳ类', 'Ⅳ类', 'water_quality_grade', 'warning', 'N', '水质等级:Ⅳ类'),
+        (21, 5, 'Ⅴ类', 'Ⅴ类', 'water_quality_grade', 'danger', 'N', '水质等级:Ⅴ类'),
+        (22, 1, '居民', '居民', 'water_user_type', 'info', 'Y', '用水户类型:居民'),
+        (23, 2, '工业', '工业', 'water_user_type', 'primary', 'N', '用水户类型:工业'),
+        (24, 3, '商业', '商业', 'water_user_type', 'success', 'N', '用水户类型:商业'),
+        (25, 4, '行政事业', '行政事业', 'water_user_type', 'warning', 'N', '用水户类型:行政事业')
+       ) AS v(rn, dict_sort, dict_label, dict_value, dict_type, list_class, is_default, remark)
+ ORDER BY v.rn;
+
+COMMIT;
+
+-- ------------------------------------------------------------
+-- SECTION 6(默认注释,需业务确认后手工启用):status 存量值归一
+--   把非 '0' 的存量状态统一归到 '1 异常'。本次默认不执行。
+--   注意:water_user_info 的 '1欠费 / 2停用'、
+--   drainage_engineering_facility 的 '1检修 / 2停用 / 3故障' 语义各不相同,
+--   归一前请确认业务上确实可以一律视为「异常」。
+-- ------------------------------------------------------------
+/*
+BEGIN;
+
+SET search_path TO app_user, public;
+
+UPDATE app_user.pipe_network_base            SET status = '1' WHERE status IS NOT NULL AND status <> '0';
+UPDATE app_user.water_plant_info             SET status = '1' WHERE status IS NOT NULL AND status <> '0';
+UPDATE app_user.water_source_info            SET status = '1' WHERE status IS NOT NULL AND status <> '0';
+UPDATE app_user.water_user_info              SET status = '1' WHERE status IS NOT NULL AND status <> '0';
+UPDATE app_user.pump_station_info             SET status = '1' WHERE status IS NOT NULL AND status <> '0';
+UPDATE app_user.manhole_info                 SET status = '1' WHERE status IS NOT NULL AND status <> '0';
+
+COMMIT;
+*/
+
+-- ============================================================
+-- 执行后核对(只读):
+--   SELECT table_name FROM information_schema.tables
+--    WHERE table_schema = 'app_user'
+--      AND table_name IN ('manhole_info', 'pump_station_info',
+--                         'water_fire_hydrant_info', 'drainage_gate_info',
+--                         'drainage_storage_info')
+--    ORDER BY table_name;
+--
+--   SELECT column_name, data_type, column_default
+--     FROM information_schema.columns
+--    WHERE table_schema = 'app_user' AND table_name = 'manhole_info'
+--      AND column_name IN ('manhole_type', 'status');
+--
+--   SELECT dict_type, dict_label, dict_value FROM app_user.sys_dict_data
+--    WHERE dict_type IN ('infrastructure_status', 'manhole_type',
+--                         'water_fire_hydrant_type', 'drainage_facility_level',
+--                         'pump_station_type', 'water_plant_status', 'water_user_status',
+--                         'pipe_network_facility_type',
+--                         'water_source_type', 'water_source_protection_level',
+--                         'water_quality_grade', 'water_user_type')
+--    ORDER BY dict_type, dict_sort;
+-- ============================================================

+ 18 - 0
pipe-network-service/sql/migration_manhole_device_unique_binding.sql

@@ -0,0 +1,18 @@
+-- 窨井设备绑定唯一性:一个设备只能被一个窨井绑定
+-- KingbaseES / PostgreSQL 兼容,可重复执行
+BEGIN;
+
+-- 1. 清理历史重复绑定:同一 equipment_id 仅保留最早创建的一条
+DELETE FROM app_user.manhole_device_rel a
+ USING app_user.manhole_device_rel b
+ WHERE a.equipment_id = b.equipment_id
+   AND (
+        a.create_time > b.create_time
+        OR (a.create_time = b.create_time AND a.rel_id > b.rel_id)
+       );
+
+-- 2. 增加唯一索引,从数据库层面阻止重复绑定
+CREATE UNIQUE INDEX IF NOT EXISTS uk_manhole_device_rel_equipment_id
+    ON app_user.manhole_device_rel (equipment_id);
+
+COMMIT;

+ 19 - 0
pipe-network-service/sql/migration_manhole_drop_fields_and_binding.sql

@@ -0,0 +1,19 @@
+-- 窨井信息设施化改造:删除冗余字段(KingbaseES / PostgreSQL 兼容)
+-- 1. manhole_info.network_id:窨井不再关联管网,改为独立设施;设备绑定走 manhole_device_rel
+-- 2. manhole_device_rel.equipment_name / equipment_type:冗余字段,展示统一从 equipment_base 联查
+--
+-- ⚠️ 破坏性操作:执行前确认无需保留这两列数据;可重复执行。
+-- schema = app_user。
+
+-- 1. manhole_info 去掉 network_id
+ALTER TABLE app_user.manhole_info DROP COLUMN IF EXISTS network_id;
+
+-- 2. manhole_device_rel 去掉冗余展示字段
+ALTER TABLE app_user.manhole_device_rel DROP COLUMN IF EXISTS equipment_name;
+ALTER TABLE app_user.manhole_device_rel DROP COLUMN IF EXISTS equipment_type;
+
+-- 核对(只读):
+-- SELECT table_name, column_name FROM information_schema.columns
+--  WHERE table_schema = 'app_user'
+--    AND ((table_name = 'manhole_info' AND column_name = 'network_id')
+--      OR (table_name = 'manhole_device_rel' AND column_name IN ('equipment_name','equipment_type')));

+ 110 - 0
pipe-network-service/sql/migration_menu_2070_directory.sql

@@ -0,0 +1,110 @@
+-- ============================================================
+-- 菜单 2070「基础信息管理」由普通菜单(C)改造为目录(M)
+--
+-- 现状(改造前):
+--   menu_id   = 2070
+--   menu_name = 基础信息管理
+--   parent_id = 2069
+--   path      = netWorkBase
+--   component = subSystem/pipeNetwork/assetInfo/netWorkBase/index   ← 管道信息页面
+--   menu_type = C(普通菜单)
+--
+-- 目标(改造后):
+--   menu_type = M(目录)
+--   component = ParentView(后端 getComponent 识别为嵌套路由容器;
+--              写空也会被后端兜底转成 ParentView)
+--   perms     = NULL(目录不需要权限标识)
+--   path      = netWorkBase 保持不变(URL 前缀不变)
+--
+-- 为什么必须先执行本脚本:
+--   2070 原本是 C 类型菜单,component 指向管道信息页面。该页面已从
+--   subSystem/pipeNetwork/assetInfo/netWorkBase/index 迁移到
+--   subSystem/pipeNetwork/facilities/pipeNetwork/index,并成为 2070 的第一个子菜单。
+--   若先执行菜单脚本 migration_infrastructure_menus.sql,其 STEP 4 会把 2070 的
+--   component 也改成新路径 → 2070(C 类型)与子菜单同时指向管道信息页面,
+--   出现「同一个页面两个入口」。先做目录化改造可避免该中间态。
+--   另外 2070 自身要承载 9 个子菜单,menu_type 必须由 'C' 改为 'M'。
+--
+-- 影响提示:
+--   · 改造后 2070 不再是可点击页面,变为可展开目录;
+--     管道信息页面入口变为 2070 下的第一个子菜单。
+--   · 原访问地址 …/netWorkBase 变为目录页;
+--     管道信息的新地址为 …/netWorkBase/facilityPipeNetwork
+--     (父 path netWorkBase + 子 path facilityPipeNetwork)。
+--     外部书签/已发出去的旧链接需要同步更新。
+--
+-- 幂等:可重复执行。
+-- 数据库:KingbaseES(PG 兼容),schema = app_user。
+-- 执行顺序:本脚本 → migration_infrastructure_menus.sql → 重新登录刷新菜单。
+-- ============================================================
+
+-- 前置:结束上一次失败执行遗留的 aborted 事务
+ROLLBACK;
+
+BEGIN;
+
+SET search_path TO app_user, public;
+
+-- ------------------------------------------------------------
+-- STEP 1:2070 改为目录(M + ParentView)
+-- ------------------------------------------------------------
+UPDATE app_user.sys_menu
+   SET menu_type    = 'M',
+       component   = 'ParentView',
+       perms       = NULL,
+       is_frame    = 1,
+       is_cache    = 0,
+       visible     = '0',
+       status      = '0',
+       update_by   = 'admin',
+       update_time = CURRENT_TIMESTAMP
+ WHERE menu_id = 2070;
+
+-- ------------------------------------------------------------
+-- STEP 2:目录名称 / 路由名(按需启用,默认保留原名)
+--   菜单名改成「管网基础设施信息」更贴合新定位;
+--   route_name 改成英文可避免与子菜单 route_name 混淆。
+-- ------------------------------------------------------------
+-- UPDATE app_user.sys_menu
+--    SET menu_name = '管网基础设施信息',
+--        route_name = 'NetWorkBase',
+--        update_by = 'admin',
+--        update_time = CURRENT_TIMESTAMP
+--  WHERE menu_id = 2070;
+
+-- ------------------------------------------------------------
+-- STEP 3:核对 2070 现状(只读)
+--   期望:menu_type = M,component = ParentView,perms 为空
+-- ------------------------------------------------------------
+SELECT menu_id, menu_name, parent_id, menu_type, path, component, perms, route_name, visible, status
+  FROM app_user.sys_menu
+ WHERE menu_id = 2070;
+
+-- ------------------------------------------------------------
+-- STEP 4:核对 2070 下是否还有遗留子菜单(改造前应是 0 条)
+--   若有子菜单,说明原 2070 并非叶子菜单,需先确认其去留再执行菜单脚本。
+-- ------------------------------------------------------------
+SELECT menu_id, menu_name, menu_type, path, component
+  FROM app_user.sys_menu
+ WHERE parent_id = 2070
+ ORDER BY order_num, menu_id;
+
+COMMIT;
+
+-- ============================================================
+-- 回滚(把 2070 改回普通菜单,管道信息回到 2070 自身):
+--   BEGIN;
+--   SET search_path TO app_user, public;
+--   UPDATE app_user.sys_menu
+--      SET menu_type    = 'C',
+--          component   = 'subSystem/pipeNetwork/facilities/pipeNetwork/index',
+--          perms       = NULL,
+--          update_by   = 'admin',
+--          update_time = CURRENT_TIMESTAMP
+--    WHERE menu_id = 2070;
+--   COMMIT;
+--
+--   注意:回滚前必须先删除 2070 下的 9 个子菜单(见
+--        migration_infrastructure_menus.sql 末尾的注释段),否则会出现
+--        「同一个管道信息页面被两个菜单指向」的重复入口。
+-- ============================================================

+ 0 - 31
pipe-network-service/sql/migration_pipe_network_status_dict.sql

@@ -1,31 +0,0 @@
--- 管网状态字典对齐(KingbaseES)
--- 目的:管网状态以当前数据库口径为准 —— 0-正常 / 1-维护中 / 2-异常(三值域,不新增第四个取值)。
--- 说明:旧字典只有“0正常 / 1异常”两项,导致“维护中(1)”在页面上被当成异常(红色)。
---      本脚本只重写 pipe_network_status 字典定义,不改动表结构、也不改动业务数据;
---      脚本幂等,可重复执行。
-BEGIN;
-
--- 1. 字典类型(幂等登记)
-INSERT INTO app_user.sys_dict_type (dict_name, dict_type, status, create_by, create_time, remark)
-SELECT '管网状态', 'pipe_network_status', '0', 'admin', CURRENT_TIMESTAMP, '管网状态:0正常 1维护中 2异常'
- WHERE NOT EXISTS (SELECT 1 FROM app_user.sys_dict_type WHERE dict_type = 'pipe_network_status');
-
-UPDATE app_user.sys_dict_type
-   SET dict_name = '管网状态',
-       status = '0',
-       update_by = 'admin',
-       update_time = CURRENT_TIMESTAMP,
-       remark = '管网状态:0正常 1维护中 2异常'
- WHERE dict_type = 'pipe_network_status';
-
--- 2. 字典数据(幂等重写为三值域)
-DELETE FROM app_user.sys_dict_data WHERE dict_type = 'pipe_network_status';
-
-INSERT INTO app_user.sys_dict_data
-    (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark)
-VALUES
-    (1, '正常',   '0', 'pipe_network_status', '', 'success', 'Y', '0', 'admin', CURRENT_TIMESTAMP, '管网状态:正常'),
-    (2, '维护中', '1', 'pipe_network_status', '', 'warning', 'N', '0', 'admin', CURRENT_TIMESTAMP, '管网状态:维护中'),
-    (3, '异常',   '2', 'pipe_network_status', '', 'danger',  'N', '0', 'admin', CURRENT_TIMESTAMP, '管网状态:异常');
-
-COMMIT;

+ 22 - 0
pipe-network-service/sql/migration_water_source_code_rename.sql

@@ -0,0 +1,22 @@
+-- 水源地业务编码列改名:source_id → source_code(KingbaseES / PostgreSQL 兼容)
+-- 背景:8 张设施表的业务编码列统一为 xxx_code,water_source_info 原为 source_id,
+--       本脚本把它改成 source_code,与其它表对齐。
+-- Java 实体属性仍叫 sourceId,通过 @TableField("source_code") 映射,前端 API 不变。
+-- 可重复执行;schema = app_user。
+
+DO $$
+BEGIN
+    IF EXISTS (
+        SELECT 1 FROM information_schema.columns
+         WHERE table_schema = 'app_user'
+           AND table_name = 'water_source_info'
+           AND column_name = 'source_id'
+    ) THEN
+        ALTER TABLE app_user.water_source_info RENAME COLUMN source_id TO source_code;
+    END IF;
+END $$;
+
+-- 核对(只读):
+-- SELECT column_name, data_type FROM information_schema.columns
+--  WHERE table_schema = 'app_user' AND table_name = 'water_source_info'
+--    AND column_name IN ('source_code','source_id');

+ 27 - 0
pipe-network-service/sql/migration_water_supply_facility_menu_reuse.sql

@@ -0,0 +1,27 @@
+-- 供水 / 燃气 / 排水设施查询菜单复用管网基础设施公共页面
+-- 2091、2128、2182 通过 sys_menu.query 固定 networkType;2187 固定 stationType
+-- 其余目标页本身调用对应业务接口,无需额外 query
+-- KingbaseES / PostgreSQL 兼容,可重复执行
+
+UPDATE app_user.sys_menu
+   SET component = CASE menu_id
+         WHEN 2091 THEN 'subSystem/pipeNetwork/facilities/pipeNetwork/index'
+         WHEN 2128 THEN 'subSystem/pipeNetwork/facilities/pipeNetwork/index'
+         WHEN 2182 THEN 'subSystem/pipeNetwork/facilities/pipeNetwork/index'
+         WHEN 2187 THEN 'subSystem/pipeNetwork/facilities/pumpStation/index'
+         WHEN 2188 THEN 'subSystem/pipeNetwork/facilities/waterPlant/index'
+         WHEN 2189 THEN 'subSystem/pipeNetwork/facilities/waterSource/index'
+         WHEN 2190 THEN 'subSystem/pipeNetwork/facilities/waterUser/index'
+       END,
+       "query" = CASE menu_id
+         WHEN 2091 THEN '{"networkType":"0"}'
+         WHEN 2128 THEN '{"networkType":"1"}'
+         WHEN 2182 THEN '{"networkType":"2"}'
+         WHEN 2187 THEN '{"stationType":"0"}'
+         WHEN 2188 THEN ''
+         WHEN 2189 THEN ''
+         WHEN 2190 THEN ''
+       END,
+       update_by = 'admin',
+       update_time = CURRENT_TIMESTAMP
+ WHERE menu_id IN (2091, 2128, 2182, 2187, 2188, 2189, 2190);

+ 65 - 0
pipe-network-service/sql/rollback_infrastructure_restructure.sql

@@ -0,0 +1,65 @@
+-- ============================================================
+-- 回滚:基础设施信息表结构重构
+--   对应 migration_infrastructure_restructure.sql
+--
+-- 回滚动作:
+--   1. 删除新建的 3 张表(water_fire_hydrant_info / drainage_gate_info / drainage_storage_info)
+--   2. 删除 manhole_info 新增的 manhole_type 列
+--   3. 表名改回:manhole_info → manhole_base,pump_station_info → pump_station
+--   4. 删除本次登记的字典
+--
+-- 前置条件:本次新建的 3 张表内已有业务数据时不可回滚(数据会丢失),
+--    请先确认表内数据已迁走或可丢弃。
+--
+-- 表名回滚后,必须同步回退代码:
+--    · ManholeBase 的 @TableName 改回 manhole_base
+--    · PumpStationInfo 的 @TableName 改回 pump_station
+--    · PumpStationInfoMapper.xml / WaterSupplyGisMapMapper.xml /
+--      PipeNetworkStatisticsMapper.xml 中的 app_user.pump_station_info 改回 app_user.pump_station
+--
+-- 幂等:可重复执行。
+-- 数据库:KingbaseES(PG 兼容),schema = app_user。
+-- ============================================================
+
+ROLLBACK;
+
+BEGIN;
+
+SET search_path TO app_user, public;
+
+-- 1. 删除新建的 3 张表
+DROP TABLE IF EXISTS app_user.water_fire_hydrant_info;
+DROP TABLE IF EXISTS app_user.drainage_gate_info;
+DROP TABLE IF EXISTS app_user.drainage_storage_info;
+
+-- 2. 删除 manhole_type 列
+ALTER TABLE IF EXISTS app_user.manhole_info DROP COLUMN IF EXISTS manhole_type;
+
+-- 3. 表名改回
+ALTER TABLE IF EXISTS app_user.manhole_info RENAME TO manhole_base;
+ALTER TABLE IF EXISTS app_user.pump_station_info RENAME TO pump_station;
+
+-- 4. 删除本次登记的字典
+DELETE FROM app_user.sys_dict_data WHERE dict_type IN (
+    'infrastructure_status', 'manhole_type',
+    'water_fire_hydrant_type', 'drainage_facility_level', 'pump_station_type',
+    'water_plant_status', 'water_user_status', 'pipe_network_facility_type',
+    'water_source_type', 'water_source_protection_level', 'water_quality_grade', 'water_user_type'
+);
+DELETE FROM app_user.sys_dict_type WHERE dict_type IN (
+    'infrastructure_status', 'manhole_type',
+    'water_fire_hydrant_type', 'drainage_facility_level', 'pump_station_type',
+    'water_plant_status', 'water_user_status', 'pipe_network_facility_type',
+    'water_source_type', 'water_source_protection_level', 'water_quality_grade', 'water_user_type'
+);
+
+COMMIT;
+
+-- 执行后核对(只读):
+--   SELECT table_name FROM information_schema.tables
+--    WHERE table_schema = 'app_user'
+--      AND table_name IN ('manhole_base', 'pump_station',
+--                         'water_fire_hydrant_info', 'drainage_gate_info',
+--                         'drainage_storage_info');
+--
+-- 菜单回滚见 migration_infrastructure_menus.sql 末尾的注释段。

+ 0 - 24
pipe-network-service/sql/water_supply_facility_import.sql

@@ -1,24 +0,0 @@
--- 供水设施 Excel 批量导入按钮权限(KingbaseES / PostgreSQL 兼容)
--- 可重复执行;只补充导入按钮权限,不修改页面菜单和既有权限。
-
-DO $$
-BEGIN
-    INSERT INTO app_user.sys_menu (
-        menu_name, parent_id, order_num, path, component, is_frame, is_cache,
-        menu_type, visible, status, perms, icon, create_by, create_time, remark
-    )
-    SELECT
-        v.menu_name, page_menu.menu_id, 30, '', '', '1', '0',
-        'F', '0', '0', v.perms, '#', 'admin', now(), '供水设施 Excel 批量导入'
-    FROM (VALUES
-        ('水源地导入', 'waterSupply/facility/source', 'waterSupply:waterSource:import'),
-        ('水厂导入', 'waterSupply/facility/plant', 'waterSupply:waterPlant:import'),
-        ('泵站导入', 'waterSupply/facility/pumpStation', 'waterSupply:waterPumpStation:import'),
-        ('管网导入', 'waterSupply/facility/pipe', 'waterSupply:waterPipe:import'),
-        ('用水户导入', 'waterSupply/facility/user', 'waterSupply:waterUser:import')
-    ) AS v(menu_name, parent_component, perms)
-    JOIN app_user.sys_menu page_menu ON page_menu.component = v.parent_component
-    WHERE NOT EXISTS (
-        SELECT 1 FROM app_user.sys_menu existing WHERE existing.perms = v.perms
-    );
-END $$;

+ 5 - 5
pipe-network-service/sql/water_supply_facility_test_data.sql

@@ -22,7 +22,7 @@ BEGIN;
 -- 0. 清理本脚本历史数据
 -- ------------------------------------------------------------
 DELETE FROM app_user.water_source_info
- WHERE source_id LIKE 'GIS-TEST-%';
+ WHERE source_code LIKE 'GIS-TEST-%';
 DELETE FROM app_user.water_plant_info
  WHERE plant_code LIKE 'GIS-TEST-%';
 DELETE FROM app_user.pump_station
@@ -38,7 +38,7 @@ DELETE FROM app_user.water_user_info
 -- 1. 水源地:2 个坐标完整 + 1 个缺失坐标
 -- ------------------------------------------------------------
 INSERT INTO app_user.water_source_info
-    (source_id, source_name, source_type, unit, address, water_type,
+    (source_code, source_name, source_type, unit, address, water_type,
      protection_level, water_quality_level, protection_scope, report_time,
      status, remark, del_flag, create_by, create_time, longitude, latitude)
 VALUES
@@ -148,7 +148,7 @@ COMMIT;
 -- 预期:source=3/完整2,plant=2/完整1,pumpStation=2/完整1,pipe=4/完整3,user=5/完整4。
 SELECT 'source' facility_type, COUNT(*) total_count,
        COALESCE(SUM(CASE WHEN longitude IS NOT NULL AND latitude IS NOT NULL THEN 1 ELSE 0 END), 0) geo_complete_count
-  FROM app_user.water_source_info WHERE source_id LIKE 'GIS-TEST-%'
+  FROM app_user.water_source_info WHERE source_code LIKE 'GIS-TEST-%'
 UNION ALL
 SELECT 'plant', COUNT(*), COALESCE(SUM(CASE WHEN longitude IS NOT NULL AND latitude IS NOT NULL THEN 1 ELSE 0 END), 0)
   FROM app_user.water_plant_info WHERE plant_code LIKE 'GIS-TEST-%'
@@ -164,7 +164,7 @@ SELECT 'user', COUNT(*), COALESCE(SUM(CASE WHEN longitude IS NOT NULL AND latitu
   FROM app_user.water_user_info WHERE user_code LIKE 'GIS-TEST-%';
 
 -- 详情接口 ID 查询:将结果中的 id 填入 /waterSupply/gis/map/detail/{facilityType}/{id}。
-SELECT 'source' facility_type, id, source_id code FROM app_user.water_source_info WHERE source_id LIKE 'GIS-TEST-%' ORDER BY source_id;
+SELECT 'source' facility_type, id, source_code code FROM app_user.water_source_info WHERE source_code LIKE 'GIS-TEST-%' ORDER BY source_code;
 SELECT 'plant' facility_type, id, plant_code code FROM app_user.water_plant_info WHERE plant_code LIKE 'GIS-TEST-%' ORDER BY plant_code;
 SELECT 'pumpStation' facility_type, id, station_code code FROM app_user.pump_station WHERE station_code LIKE 'GIS-TEST-%' AND station_type = 'water_supply' ORDER BY station_code;
 SELECT 'pipe' facility_type, network_id id, network_code code FROM app_user.pipe_network_base WHERE network_code LIKE 'GIS-TEST-%' AND network_type = '2' ORDER BY network_code;
@@ -173,7 +173,7 @@ SELECT 'user' facility_type, id, user_code code FROM app_user.water_user_info WH
 -- ============================================================
 -- 清理脚本(测试完成后手动执行)
 -- ============================================================
--- DELETE FROM app_user.water_source_info WHERE source_id LIKE 'GIS-TEST-%';
+-- DELETE FROM app_user.water_source_info WHERE source_code LIKE 'GIS-TEST-%';
 -- DELETE FROM app_user.water_plant_info WHERE plant_code LIKE 'GIS-TEST-%';
 -- DELETE FROM app_user.pump_station WHERE station_code LIKE 'GIS-TEST-%' AND station_type = 'water_supply';
 -- DELETE FROM app_user.pipe_network_base WHERE network_code LIKE 'GIS-TEST-%' AND network_type = '2';

+ 363 - 0
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/WaterSupply/PumpStationInfo/PumpStationInfoController.java

@@ -0,0 +1,363 @@
+package com.zksy.web.controller.WaterSupply.PumpStationInfo;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.zksy.WaterSupply.PumpStationInfo.domain.PumpStationInfo;
+import com.zksy.WaterSupply.PumpStationInfo.domain.PumpStationType;
+import com.zksy.WaterSupply.PumpStationInfo.service.IPumpStationInfoService;
+import com.zksy.WaterSupply.export.PumpStationInfoExportDTO;
+import com.zksy.WaterSupply.importing.WaterFacilityImportService;
+import com.zksy.common.annotation.Log;
+import com.zksy.common.core.domain.AjaxResult;
+import com.zksy.common.enums.BusinessType;
+import com.zksy.common.utils.SecurityUtils;
+import com.zksy.common.utils.poi.ExcelUtil;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.YearMonth;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * 泵站信息统一入口(供水 / 排水公用)。
+ *
+ * <p>供水、排水泵站共用同一张表 {@code pump_station_info} 与同一个 Service,
+ * 仅以 {@code station_type} 区分归属。因此只保留这一个 Controller,
+ * 通过 {@code @RequestMapping} 同时映射供水与排水两个 URL 前缀:
+ * <ul>
+ *   <li>{@code /api/water/pumpStation/*}   → water_supply</li>
+ *   <li>{@code /api/drainage/pumpStation/*} → drainage</li>
+ * </ul>
+ * 归属由当前请求 URI 自动判定(见 {@link #stationType()}),前端两套 URL 均无需改动。</p>
+ */
+@RestController
+@RequestMapping({"/api/water/pumpStation", "/api/drainage/pumpStation"})
+@Api(tags = "泵站信息数据接口(供水/排水公用)")
+public class PumpStationInfoController {
+
+    private static final Logger log = LoggerFactory.getLogger(PumpStationInfoController.class);
+
+    @Autowired
+    private IPumpStationInfoService pumpStationService;
+
+    @Autowired
+    private WaterFacilityImportService importService;
+
+    private boolean hasText(String value) {
+        return StringUtils.hasText(value);
+    }
+
+    /** 排水入口 URI 含 /drainage/,其余按供水处理。 */
+    private boolean isDrainage() {
+        ServletRequestAttributes attrs = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+        String uri = attrs == null ? "" : attrs.getRequest().getRequestURI();
+        return uri.contains("/drainage/");
+    }
+
+    private String stationType() {
+        return isDrainage() ? PumpStationType.DRAINAGE : PumpStationType.WATER_SUPPLY;
+    }
+
+    /**
+     * 前端展示字典 0=供水 / 1=排水,库内物理值 water_supply / drainage。
+     * 菜单 sys_menu.query.stationType 为空时返回 null,表示不限类型。
+     */
+    private String resolveStationTypeFilter(String stationType) {
+        if (!hasText(stationType)) {
+            return null;
+        }
+        String value = stationType.trim();
+        if ("0".equals(value) || PumpStationType.WATER_SUPPLY.equals(value)) {
+            return PumpStationType.WATER_SUPPLY;
+        }
+        if ("1".equals(value) || PumpStationType.DRAINAGE.equals(value)) {
+            return PumpStationType.DRAINAGE;
+        }
+        return null;
+    }
+
+    /** 出库展示时把物理类型转回前端字典值 0/1,保证表单下拉可回显。 */
+    private String displayStationType(String stationType) {
+        if (PumpStationType.WATER_SUPPLY.equals(stationType)) {
+            return "0";
+        }
+        if (PumpStationType.DRAINAGE.equals(stationType)) {
+            return "1";
+        }
+        return stationType;
+    }
+
+    private void maskStationTypeForDisplay(PumpStationInfo item) {
+        if (item != null) {
+            item.setStationType(displayStationType(item.getStationType()));
+        }
+    }
+
+    private String ownerLabel() {
+        return isDrainage() ? "排水" : "供水";
+    }
+
+    private String sheetName() {
+        return isDrainage() ? "排水泵站信息" : "泵站信息";
+    }
+
+    private String currentUser() {
+        try {
+            return SecurityUtils.getUsername();
+        } catch (Exception e) {
+            return "system";
+        }
+    }
+
+    // -------------------------- 公共 CRUD --------------------------
+
+    @GetMapping("/page")
+    public AjaxResult queryPage(
+            @RequestParam(defaultValue = "1") Integer pageNum,
+            @RequestParam(defaultValue = "10") Integer pageSize,
+            @RequestParam(required = false) String stationCode,
+            @RequestParam(required = false) String stationName,
+            @RequestParam(required = false) String status,
+            @RequestParam(required = false) String principal,
+            @RequestParam(required = false) String stationType,
+            @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime startTime,
+            @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime endTime) {
+        Page<PumpStationInfo> page = new Page<>(pageNum, pageSize);
+        String typeFilter = resolveStationTypeFilter(stationType);
+        LambdaQueryWrapper<PumpStationInfo> wrapper = new LambdaQueryWrapper<PumpStationInfo>()
+                .eq(typeFilter != null, PumpStationInfo::getStationType, typeFilter)
+                .like(hasText(stationCode), PumpStationInfo::getStationCode, stationCode)
+                .like(hasText(stationName), PumpStationInfo::getStationName, stationName)
+                .eq(hasText(status), PumpStationInfo::getStatus, status)
+                .like(hasText(principal), PumpStationInfo::getPrincipal, principal)
+                .ge(startTime != null, PumpStationInfo::getCreateTime, startTime)
+                .le(endTime != null, PumpStationInfo::getCreateTime, endTime)
+                .orderByDesc(PumpStationInfo::getCreateTime);
+        IPage<PumpStationInfo> result = pumpStationService.page(page, wrapper);
+        result.getRecords().forEach(this::maskStationTypeForDisplay);
+        return AjaxResult.success(result);
+    }
+
+    @GetMapping("/list")
+    public AjaxResult list(
+            @RequestParam(required = false) String stationName,
+            @RequestParam(required = false) String status,
+            @RequestParam(required = false) String stationType) {
+        String typeFilter = resolveStationTypeFilter(stationType);
+        List<PumpStationInfo> rows = pumpStationService.list(new LambdaQueryWrapper<PumpStationInfo>()
+                .eq(typeFilter != null, PumpStationInfo::getStationType, typeFilter)
+                .like(hasText(stationName), PumpStationInfo::getStationName, stationName)
+                .eq(hasText(status), PumpStationInfo::getStatus, status)
+                .orderByDesc(PumpStationInfo::getCreateTime));
+        rows.forEach(this::maskStationTypeForDisplay);
+        return AjaxResult.success(rows);
+    }
+
+    @GetMapping("/monthlyStats")
+    public AjaxResult monthlyStats(
+            @RequestParam String ids,
+            @RequestParam(required = false) String sinceDate,
+            @RequestParam(required = false) String stationType) {
+        if (!hasText(ids)) {
+            return AjaxResult.success(Collections.emptyList());
+        }
+        List<String> idList = Arrays.stream(ids.split(","))
+                .map(String::trim)
+                .filter(s -> !s.isEmpty())
+                .collect(Collectors.toList());
+        if (idList.isEmpty()) {
+            return AjaxResult.success(Collections.emptyList());
+        }
+        String typeFilter = resolveStationTypeFilter(stationType);
+        List<PumpStationInfo> stations = pumpStationService.list(
+                new LambdaQueryWrapper<PumpStationInfo>()
+                        .in(PumpStationInfo::getId, idList)
+                        .eq(typeFilter != null, PumpStationInfo::getStationType, typeFilter));
+
+        YearMonth sinceMonth = null;
+        if (hasText(sinceDate)) {
+            try {
+                sinceMonth = YearMonth.from(LocalDate.parse(sinceDate));
+            } catch (Exception ignored) {
+                // 起始月份格式非法时忽略,按全部月份统计
+            }
+        }
+
+        YearMonth now = YearMonth.now();
+        DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM");
+        List<Map<String, Object>> result = new ArrayList<>();
+        for (int i = 2; i >= 0; i--) {
+            YearMonth ym = now.minusMonths(i);
+            double totalFlow = 0;
+            double totalHead = 0;
+            int count = 0;
+            if (sinceMonth == null || !ym.isBefore(sinceMonth)) {
+                for (PumpStationInfo s : stations) {
+                    totalFlow += s.getDesignFlow() != null ? s.getDesignFlow().doubleValue() : 0;
+                    totalHead += s.getDesignHead() != null ? s.getDesignHead().doubleValue() : 0;
+                    count++;
+                }
+            }
+            Map<String, Object> item = new LinkedHashMap<>();
+            item.put("month", ym.format(fmt));
+            item.put("designFlow", totalFlow);
+            item.put("designHead", totalHead);
+            item.put("stationCount", count);
+            result.add(item);
+        }
+        return AjaxResult.success(result);
+    }
+
+    @GetMapping("/{id}")
+    public AjaxResult getById(@PathVariable String id) {
+        PumpStationInfo data = pumpStationService.getById(id);
+        if (data == null) {
+            return AjaxResult.warn("未找到泵站信息");
+        }
+        maskStationTypeForDisplay(data);
+        return AjaxResult.success(data);
+    }
+
+    @PostMapping
+    public AjaxResult add(@RequestBody PumpStationInfo pumpStation) {
+        pumpStation.setDelFlag("0");
+        pumpStation.setStationType(stationType());
+        pumpStation.setCreateBy(currentUser());
+        pumpStation.setCreateTime(LocalDateTime.now());
+        return pumpStationService.save(pumpStation)
+                ? AjaxResult.success("新增成功")
+                : AjaxResult.error("新增失败");
+    }
+
+    @PutMapping
+    public AjaxResult update(@RequestBody PumpStationInfo pumpStation) {
+        String id = pumpStation.getId();
+        if (id == null) {
+            return AjaxResult.error("缺少泵站ID,无法修改");
+        }
+        pumpStation.setDelFlag(null);
+        pumpStation.setStationType(null);
+        pumpStation.setCreateBy(null);
+        pumpStation.setCreateTime(null);
+        pumpStation.setUpdateBy(currentUser());
+        pumpStation.setUpdateTime(LocalDateTime.now());
+        return pumpStationService.updateById(pumpStation)
+                ? AjaxResult.success("修改成功")
+                : AjaxResult.error("修改失败");
+    }
+
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable String[] ids) {
+        boolean result = pumpStationService.remove(new LambdaQueryWrapper<PumpStationInfo>()
+                .in(PumpStationInfo::getId, Arrays.asList(ids)));
+        return result
+                ? AjaxResult.success("删除成功,已移入回收站,共删除 " + ids.length + " 条数据")
+                : AjaxResult.error("删除失败");
+    }
+
+    // -------------------------- 回收站(供水侧语义,Mapper 按 water_supply 过滤) --------------------------
+
+    @GetMapping("/recycle/list")
+    @ApiOperation(value = "查询回收站数据")
+    public AjaxResult recycleList(
+            @RequestParam(defaultValue = "1") Integer pageNum,
+            @RequestParam(defaultValue = "10") Integer pageSize,
+            @RequestParam(required = false) String stationCode,
+            @RequestParam(required = false) String stationName,
+            @RequestParam(required = false) String status,
+            @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime startTime,
+            @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime endTime) {
+        Page<PumpStationInfo> page = new Page<>(pageNum, pageSize);
+        return AjaxResult.success(pumpStationService.queryDeletedPage(page, stationCode, stationName, status, startTime, endTime));
+    }
+
+    @PostMapping("/recycle/restore/{ids}")
+    @ApiOperation(value = "批量恢复已删除数据")
+    public AjaxResult restore(@PathVariable String[] ids) {
+        return pumpStationService.restoreByIds(Arrays.asList(ids), currentUser())
+                ? AjaxResult.success("恢复成功,共恢复 " + ids.length + " 条数据")
+                : AjaxResult.error("恢复失败");
+    }
+
+    @DeleteMapping("/recycle/delete/{ids}")
+    @ApiOperation(value = "批量彻底删除数据(不可恢复)")
+    public AjaxResult deletePhysically(@PathVariable String[] ids) {
+        return pumpStationService.deleteByIdsPhysically(Arrays.asList(ids))
+                ? AjaxResult.success("彻底删除成功,共删除 " + ids.length + " 条数据")
+                : AjaxResult.error("彻底删除失败");
+    }
+
+    // -------------------------- 导入导出 --------------------------
+
+    @GetMapping("/export")
+    @ApiOperation(value = "导出泵站信息")
+    @Log(title = "导出泵站信息", businessType = BusinessType.EXPORT)
+    public void export(HttpServletResponse response,
+                       @RequestParam(required = false) String stationType) {
+        checkWaterPermiIfNeeded("waterSupply:waterPumpStation:export");
+        String typeFilter = resolveStationTypeFilter(stationType);
+        List<PumpStationInfo> rows = pumpStationService.list(
+                new LambdaQueryWrapper<PumpStationInfo>()
+                        .eq(typeFilter != null, PumpStationInfo::getStationType, typeFilter)
+                        .orderByDesc(PumpStationInfo::getCreateTime));
+        new ExcelUtil<>(PumpStationInfoExportDTO.class).exportExcel(response,
+                rows.stream().map(PumpStationInfoExportDTO::from).collect(Collectors.toList()), sheetName());
+    }
+
+    @PostMapping("/importData")
+    @ApiOperation(value = "导入泵站信息")
+    @Log(title = "导入泵站信息", businessType = BusinessType.IMPORT)
+    public AjaxResult importData(@RequestParam("file") MultipartFile file,
+                                 @RequestParam(defaultValue = "false") boolean updateSupport) throws Exception {
+        checkWaterPermiIfNeeded("waterSupply:waterPumpStation:import");
+        List<PumpStationInfoExportDTO> rows = new ExcelUtil<PumpStationInfoExportDTO>(
+                PumpStationInfoExportDTO.class).importExcel(file.getInputStream());
+        String message = isDrainage()
+                ? importService.importDrainagePumps(rows, updateSupport, currentUser())
+                : importService.importPumps(rows, updateSupport, currentUser());
+        return AjaxResult.success(message);
+    }
+
+    @PostMapping("/importTemplate")
+    @ApiOperation(value = "泵站信息导入模板")
+    public void importTemplate(HttpServletResponse response) {
+        checkWaterPermiIfNeeded("waterSupply:waterPumpStation:import");
+        new ExcelUtil<PumpStationInfoExportDTO>(PumpStationInfoExportDTO.class)
+                .importTemplateExcel(response, sheetName());
+    }
+
+    /** 供水侧导入导出沿用原权限串;排水入口保持宽松(原为匿名访问)。 */
+    private void checkWaterPermiIfNeeded(String permission) {
+        if (!isDrainage() && !SecurityUtils.hasPermi(permission)) {
+            throw new org.springframework.security.access.AccessDeniedException("没有权限,请联系管理员授权");
+        }
+    }
+}

+ 0 - 22
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/WaterSupply/WaterFacilityExportController.java

@@ -3,8 +3,6 @@ package com.zksy.web.controller.WaterSupply;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.zksy.WaterSupply.WaterPlantInfo.domain.WaterPlantInfo;
 import com.zksy.WaterSupply.WaterPlantInfo.service.IWaterPlantInfoService;
-import com.zksy.WaterSupply.WaterPumpStation.domain.WaterPumpStation;
-import com.zksy.WaterSupply.WaterPumpStation.service.IWaterPumpStationService;
 import com.zksy.WaterSupply.WaterSourceInfo.domain.WaterSourceInfo;
 import com.zksy.WaterSupply.WaterSourceInfo.service.IWaterSourceInfoService;
 import com.zksy.WaterSupply.WaterUserInfo.domain.WaterUserInfo;
@@ -36,7 +34,6 @@ import java.util.stream.Collectors;
 public class WaterFacilityExportController {
     @Resource private IWaterSourceInfoService sourceService;
     @Resource private IWaterPlantInfoService plantService;
-    @Resource private IWaterPumpStationService pumpService;
     @Resource private IWaterUserInfoService userService;
     @Resource private WaterFacilityImportService importService;
 
@@ -60,14 +57,6 @@ public class WaterFacilityExportController {
         new ExcelUtil<>(WaterPlantExportDTO.class).exportExcel(response, page.getRecords().stream().map(WaterPlantExportDTO::from).collect(Collectors.toList()), "水厂信息");
     }
 
-    @GetMapping("/pumpStation/export")
-    @Log(title = "导出泵站信息", businessType = BusinessType.EXPORT)
-    @PreAuthorize("@ss.hasPermi('waterSupply:waterPumpStation:export')")
-    public void pumpExport(HttpServletResponse response, @RequestParam(required = false) String stationCode, @RequestParam(required = false) String stationName, @RequestParam(required = false) String status, @RequestParam(required = false) String principal, @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime startTime, @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime endTime) {
-        var page = pumpService.queryPage(new Page<WaterPumpStation>(1, Integer.MAX_VALUE), stationCode, stationName, status, principal, startTime, endTime);
-        new ExcelUtil<>(WaterPumpStationExportDTO.class).exportExcel(response, page.getRecords().stream().map(WaterPumpStationExportDTO::from).collect(Collectors.toList()), "泵站信息");
-    }
-
     @GetMapping("/userInfo/export")
     @Log(title = "导出用水户信息", businessType = BusinessType.EXPORT)
     @PreAuthorize("@ss.hasPermi('waterSupply:waterUser:export')")
@@ -98,17 +87,6 @@ public class WaterFacilityExportController {
     @PreAuthorize("@ss.hasPermi('waterSupply:waterPlant:import')")
     public void plantImportTemplate(HttpServletResponse response) { new ExcelUtil<WaterPlantExportDTO>(WaterPlantExportDTO.class).importTemplateExcel(response, "水厂信息"); }
 
-    @PostMapping("/pumpStation/importData")
-    @Log(title = "导入泵站信息", businessType = BusinessType.IMPORT)
-    @PreAuthorize("@ss.hasPermi('waterSupply:waterPumpStation:import')")
-    public AjaxResult pumpImportData(@RequestParam("file") MultipartFile file, @RequestParam(defaultValue = "false") boolean updateSupport) throws Exception {
-        return AjaxResult.success(importService.importPumps(new ExcelUtil<WaterPumpStationExportDTO>(WaterPumpStationExportDTO.class).importExcel(file.getInputStream()), updateSupport, operator()));
-    }
-
-    @PostMapping("/pumpStation/importTemplate")
-    @PreAuthorize("@ss.hasPermi('waterSupply:waterPumpStation:import')")
-    public void pumpImportTemplate(HttpServletResponse response) { new ExcelUtil<WaterPumpStationExportDTO>(WaterPumpStationExportDTO.class).importTemplateExcel(response, "泵站信息"); }
-
     @PostMapping("/userInfo/importData")
     @Log(title = "导入用水户信息", businessType = BusinessType.IMPORT)
     @PreAuthorize("@ss.hasPermi('waterSupply:waterUser:import')")

+ 89 - 0
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/WaterSupply/WaterFireHydrantInfo/WaterFireHydrantInfoController.java

@@ -0,0 +1,89 @@
+package com.zksy.web.controller.WaterSupply.WaterFireHydrantInfo;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.zksy.WaterSupply.WaterFireHydrantInfo.domain.WaterFireHydrantInfo;
+import com.zksy.WaterSupply.WaterFireHydrantInfo.service.IWaterFireHydrantInfoService;
+import com.zksy.common.annotation.Log;
+import com.zksy.common.core.domain.AjaxResult;
+import com.zksy.common.enums.BusinessType;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 供水消火栓信息管理接口。
+ *
+ * <p>数据表:{@code app_user.water_fire_hydrant_info}。
+ * 消火栓类型取字典 {@code water_fire_hydrant_type},状态取字典 {@code infrastructure_status}。
+ */
+@Slf4j
+@RestController
+@RequestMapping("/api/water/fireHydrant")
+@Api(tags = "供水管网-消火栓信息数据接口")
+public class WaterFireHydrantInfoController {
+
+    @Autowired
+    private IWaterFireHydrantInfoService fireHydrantInfoService;
+
+    @GetMapping("/page")
+    @ApiOperation("分页查询消火栓")
+    public AjaxResult queryPage(
+            @ApiParam(value = "页码", defaultValue = "1") @RequestParam(defaultValue = "1") Integer pageNum,
+            @ApiParam(value = "每页大小", defaultValue = "10") @RequestParam(defaultValue = "10") Integer pageSize,
+            @ApiParam(value = "消火栓编号") @RequestParam(required = false) String hydrantCode,
+            @ApiParam(value = "消火栓名称") @RequestParam(required = false) String hydrantName,
+            @ApiParam(value = "消火栓类型(字典 water_fire_hydrant_type)") @RequestParam(required = false) String hydrantType,
+            @ApiParam(value = "状态(字典 infrastructure_status)") @RequestParam(required = false) String status) {
+        try {
+            Page<WaterFireHydrantInfo> page = new Page<>(pageNum, pageSize);
+            return AjaxResult.success("查询成功", fireHydrantInfoService.queryPage(page, hydrantCode, hydrantName, hydrantType, status));
+        } catch (Exception e) {
+            log.error("分页查询消火栓异常", e);
+            return AjaxResult.error("查询失败:" + e.getMessage());
+        }
+    }
+
+    @GetMapping("/{id}")
+    @ApiOperation("查询消火栓详情")
+    public AjaxResult getById(@PathVariable String id) {
+        WaterFireHydrantInfo entity = fireHydrantInfoService.getById(id);
+        return entity != null ? AjaxResult.success(entity) : AjaxResult.error("消火栓信息不存在");
+    }
+
+    @PostMapping
+    @ApiOperation("新增消火栓")
+    @Log(title = "新增消火栓信息", businessType = BusinessType.INSERT)
+    public AjaxResult save(@RequestBody WaterFireHydrantInfo entity) {
+        boolean saved = fireHydrantInfoService.saveWithCheck(entity);
+        return saved ? AjaxResult.success("新增成功") : AjaxResult.error("新增失败");
+    }
+
+    @PutMapping
+    @ApiOperation("修改消火栓")
+    @Log(title = "修改消火栓信息", businessType = BusinessType.UPDATE)
+    public AjaxResult update(@RequestBody WaterFireHydrantInfo entity) {
+        boolean updated = fireHydrantInfoService.updateWithCheck(entity);
+        return updated ? AjaxResult.success("修改成功") : AjaxResult.error("修改失败");
+    }
+
+    @DeleteMapping("/{id}")
+    @ApiOperation("删除消火栓")
+    @Log(title = "删除消火栓信息", businessType = BusinessType.DELETE)
+    public AjaxResult deleteById(@PathVariable String id) {
+        boolean deleted = fireHydrantInfoService.removeById(id);
+        return deleted ? AjaxResult.success("删除成功") : AjaxResult.error("删除失败");
+    }
+
+    @DeleteMapping("/batch")
+    @ApiOperation("批量删除消火栓")
+    @Log(title = "批量删除消火栓信息", businessType = BusinessType.DELETE)
+    public AjaxResult deleteBatch(@RequestBody List<String> ids) {
+        boolean deleted = fireHydrantInfoService.removeByIds(ids);
+        return deleted ? AjaxResult.success("批量删除成功") : AjaxResult.error("批量删除失败");
+    }
+}

+ 4 - 4
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/WaterSupply/WaterPlantInfo/WaterPlantInfoController.java

@@ -67,7 +67,7 @@ public class WaterPlantInfoController {
             @ApiResponse(code = 500, message = "服务器内部错误,查询失败", response = AjaxResult.class)
     })
     public AjaxResult getById(
-            @ApiParam(value = "水厂ID", required = true, example = "1") @PathVariable Long id) {
+            @ApiParam(value = "水厂ID", required = true, example = "UUID") @PathVariable String id) {
         try {
             WaterPlantInfo data = waterPlantInfoService.getById(id);
             return data == null ? AjaxResult.warn("未找到该水厂信息") : AjaxResult.success("查询成功", data);
@@ -138,7 +138,7 @@ public class WaterPlantInfoController {
             @ApiResponse(code = 500, message = "服务器内部错误,修改失败", response = AjaxResult.class)
     })
     public AjaxResult remove(
-            @ApiParam(value = "水厂ID数组,多个用逗号分隔", required = true, example = "1,2,3") @PathVariable Long[] ids) {
+            @ApiParam(value = "水厂ID数组,多个用逗号分隔", required = true, example = "UUID1,UUID2") @PathVariable String[] ids) {
         try {
             log.info("开始删除水厂数据,ids: {}", (Object) ids);
             boolean result = waterPlantInfoService.removeByIds(List.of(ids));
@@ -184,7 +184,7 @@ public class WaterPlantInfoController {
             @ApiResponse(code = 500, message = "服务器内部错误,恢复失败", response = AjaxResult.class)
     })
     public AjaxResult restore(
-            @ApiParam(value = "水厂ID数组,多个用逗号分隔", required = true, example = "3,4") @PathVariable Long[] ids) {
+            @ApiParam(value = "水厂ID数组,多个用逗号分隔", required = true, example = "UUID1,UUID2") @PathVariable String[] ids) {
         try {
             log.info("开始恢复水厂数据,ids: {}", (Object) ids);
             String updateBy = "system";
@@ -212,7 +212,7 @@ public class WaterPlantInfoController {
             @ApiResponse(code = 500, message = "服务器内部错误,恢复失败", response = AjaxResult.class)
     })
     public AjaxResult deletePhysically(
-            @ApiParam(value = "水厂ID数组,多个用逗号分隔", required = true, example = "5") @PathVariable Long[] ids) {
+            @ApiParam(value = "水厂ID数组,多个用逗号分隔", required = true, example = "UUID") @PathVariable String[] ids) {
         try {
             log.info("开始彻底删除水厂数据,ids: {}", (Object) ids);
             boolean result = waterPlantInfoService.deleteByIdsPhysically(List.of(ids));

+ 0 - 249
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/WaterSupply/WaterPumpStation/WaterPumpStationController.java

@@ -1,249 +0,0 @@
-package com.zksy.web.controller.WaterSupply.WaterPumpStation;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.zksy.WaterSupply.WaterPumpStation.domain.PumpStationType;
-import com.zksy.WaterSupply.WaterPumpStation.domain.WaterPumpStation;
-import com.zksy.WaterSupply.WaterPumpStation.service.IWaterPumpStationService;
-import com.zksy.common.core.domain.AjaxResult;
-import com.zksy.common.utils.SecurityUtils;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.format.annotation.DateTimeFormat;
-import org.springframework.web.bind.annotation.*;
-
-import java.time.LocalDateTime;
-import java.util.List;
-
-/**
- * 泵站信息管理接口
- */
-@RestController
-@RequestMapping("/api/water/pumpStation")
-@Api(tags = "供水管网-泵站信息数据接口")
-public class WaterPumpStationController {
-
-    private static final Logger log = LoggerFactory.getLogger(WaterPumpStationController.class);
-
-    @Autowired
-    private IWaterPumpStationService pumpStationService;
-
-    // -------------------------- 基础CRUD接口 --------------------------
-    @GetMapping("/page")
-    @ApiOperation(value = "分页查询泵站数据", notes = "支持按泵站编号、名称、状态、负责人、时间范围模糊查询")
-    @ApiResponses({
-            @ApiResponse(code = 200, message = "查询成功", response = AjaxResult.class),
-            @ApiResponse(code = 500, message = "服务器内部错误,查询失败", response = AjaxResult.class)
-    })
-    public AjaxResult queryPage(
-            @ApiParam(value = "页码", defaultValue = "1") @RequestParam(defaultValue = "1") Integer pageNum,
-            @ApiParam(value = "每页大小", defaultValue = "10") @RequestParam(defaultValue = "10") Integer pageSize,
-            @ApiParam(value = "泵站编号") @RequestParam(required = false) String stationCode,
-            @ApiParam(value = "泵站名称") @RequestParam(required = false) String stationName,
-            @ApiParam(value = "运行状态(0正常 1故障 2检修)") @RequestParam(required = false) String status,
-            @ApiParam(value = "负责人") @RequestParam(required = false) String principal,
-            @ApiParam(value = "开始时间(格式:yyyy-MM-dd HH:mm:ss)", example = "2026-01-01 00:00:00") @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime startTime,
-            @ApiParam(value = "结束时间(格式:yyyy-MM-dd HH:mm:ss)", example = "2026-12-31 23:59:59") @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime endTime) {
-        try {
-            Page<WaterPumpStation> page = new Page<>(pageNum, pageSize);
-            IPage<WaterPumpStation> resultPage = pumpStationService.queryPage(page, stationCode, stationName, status, principal, startTime, endTime);
-            return AjaxResult.success("查询成功", resultPage);
-        } catch (Exception e) {
-            log.error("分页查询泵站数据异常", e);
-            return AjaxResult.error("查询失败:" + e.getMessage());
-        }
-    }
-
-    @GetMapping("/{id}")
-    @ApiOperation(value = "根据ID查询泵站详情", notes = "传入泵站ID获取完整信息")
-    @ApiResponses({
-            @ApiResponse(code = 200, message = "查询成功", response = AjaxResult.class),
-            @ApiResponse(code = 404, message = "未找到指定ID的泵站信息", response = AjaxResult.class),
-            @ApiResponse(code = 500, message = "服务器内部错误,查询失败", response = AjaxResult.class)
-    })
-    public AjaxResult getById(
-            @ApiParam(value = "泵站ID", required = true, example = "1") @PathVariable Long id) {
-        try {
-            WaterPumpStation data = pumpStationService.getOne(new LambdaQueryWrapper<WaterPumpStation>()
-                    .eq(WaterPumpStation::getId, id)
-                    .eq(WaterPumpStation::getStationType, PumpStationType.WATER_SUPPLY));
-            return data == null ? AjaxResult.warn("未找到该泵站信息") : AjaxResult.success("查询成功", data);
-        } catch (Exception e) {
-            log.error("查询泵站详情异常", e);
-            return AjaxResult.error("查询失败:" + e.getMessage());
-        }
-    }
-
-    @PostMapping
-    @ApiOperation(value = "新增泵站信息", notes = "传入泵站实体对象进行新增")
-    @ApiResponses({
-            @ApiResponse(code = 200, message = "新增成功", response = AjaxResult.class),
-            @ApiResponse(code = 400, message = "请求参数错误", response = AjaxResult.class),
-            @ApiResponse(code = 500, message = "服务器内部错误,新增失败", response = AjaxResult.class)
-    })
-    public AjaxResult add(@RequestBody WaterPumpStation pumpStation) {
-        try {
-            pumpStation.setDelFlag("0");
-            // 供水入口强制归属为供水泵站,忽略前端传入的类型
-            pumpStation.setStationType(PumpStationType.WATER_SUPPLY);
-            try {
-                pumpStation.setCreateBy(SecurityUtils.getUsername());
-            } catch (Exception e) {
-                pumpStation.setCreateBy("system");
-            }
-            pumpStation.setCreateTime(LocalDateTime.now());
-            boolean result = pumpStationService.save(pumpStation);
-            return result ? AjaxResult.success("新增成功") : AjaxResult.error("新增失败");
-        } catch (Exception e) {
-            log.error("新增泵站信息异常", e);
-            return AjaxResult.error("新增失败:" + e.getMessage());
-        }
-    }
-
-    @PutMapping
-    @ApiOperation(value = "修改泵站信息", notes = "传入泵站实体对象进行修改,仅更新非空字段")
-    @ApiResponses({
-            @ApiResponse(code = 200, message = "修改成功", response = AjaxResult.class),
-            @ApiResponse(code = 400, message = "请求参数错误", response = AjaxResult.class),
-            @ApiResponse(code = 500, message = "服务器内部错误,修改失败", response = AjaxResult.class)
-    })
-    public AjaxResult update(@RequestBody WaterPumpStation pumpStation) {
-        try {
-            // —— C:归属门禁,供水入口只能改 water_supply 记录 ——
-            Long id = pumpStation.getId();
-            if (id == null) {
-                return AjaxResult.error("缺少泵站ID,无法修改");
-            }
-            WaterPumpStation owned = pumpStationService.getOne(new LambdaQueryWrapper<WaterPumpStation>()
-                    .eq(WaterPumpStation::getId, id)
-                    .eq(WaterPumpStation::getStationType, PumpStationType.WATER_SUPPLY));
-            if (owned == null) {
-                log.warn("供水入口拒绝修改非供水泵站,id={}", id);
-                return AjaxResult.error("未找到供水泵站,禁止修改");
-            }
-
-            // 禁止修改关键字段
-            pumpStation.setDelFlag(null);
-            pumpStation.setStationType(null);
-            pumpStation.setCreateBy(null);
-            pumpStation.setCreateTime(null);
-
-            try {
-                pumpStation.setUpdateBy(SecurityUtils.getUsername());
-            } catch (Exception e) {
-                pumpStation.setUpdateBy("system");
-            }
-            pumpStation.setUpdateTime(LocalDateTime.now());
-
-            boolean result = pumpStationService.updateById(pumpStation);
-            return result ? AjaxResult.success("修改成功") : AjaxResult.error("修改失败");
-        } catch (Exception e) {
-            log.error("修改泵站信息异常", e);
-            return AjaxResult.error("修改失败:" + e.getMessage());
-        }
-    }
-
-    @DeleteMapping("/{ids}")
-    @ApiOperation(value = "批量逻辑删除泵站信息", notes = "多个ID用逗号分隔,逻辑删除(移入回收站),不物理删除数据")
-    @ApiResponses({
-            @ApiResponse(code = 200, message = "修改成功", response = AjaxResult.class),
-            @ApiResponse(code = 400, message = "请求参数错误", response = AjaxResult.class),
-            @ApiResponse(code = 500, message = "服务器内部错误,修改失败", response = AjaxResult.class)
-    })
-    public AjaxResult remove(
-            @ApiParam(value = "泵站ID数组,多个用逗号分隔", required = true, example = "1,2,3") @PathVariable Long[] ids) {
-        try {
-            log.info("开始删除泵站数据,ids: {}", (Object) ids);
-            boolean result = pumpStationService.remove(new LambdaQueryWrapper<WaterPumpStation>()
-                    .in(WaterPumpStation::getId, List.of(ids))
-                    .eq(WaterPumpStation::getStationType, PumpStationType.WATER_SUPPLY));
-            return result
-                    ? AjaxResult.success("删除成功,已移入回收站,共删除 " + ids.length + " 条数据")
-                    : AjaxResult.error("删除失败");
-        } catch (Exception e) {
-            log.error("删除泵站数据异常", e);
-            return AjaxResult.error("删除失败:" + e.getMessage());
-        }
-    }
-
-    // -------------------------- 回收站接口 --------------------------
-    @GetMapping("/recycle/list")
-    @ApiOperation(value = "查询回收站数据", notes = "分页查询已删除的泵站数据,支持筛选和时间范围")
-    @ApiResponses({
-            @ApiResponse(code = 200, message = "查询成功", response = AjaxResult.class),
-            @ApiResponse(code = 500, message = "服务器内部错误,查询失败", response = AjaxResult.class)
-    })
-    public AjaxResult recycleList(
-            @ApiParam(value = "页码", defaultValue = "1") @RequestParam(defaultValue = "1") Integer pageNum,
-            @ApiParam(value = "每页大小", defaultValue = "10") @RequestParam(defaultValue = "10") Integer pageSize,
-            @ApiParam(value = "泵站编号") @RequestParam(required = false) String stationCode,
-            @ApiParam(value = "泵站名称") @RequestParam(required = false) String stationName,
-            @ApiParam(value = "运行状态(0正常 1故障 2检修)") @RequestParam(required = false) String status,
-            @ApiParam(value = "开始时间(格式:yyyy-MM-dd HH:mm:ss)", example = "2026-01-01 00:00:00") @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime startTime,
-            @ApiParam(value = "结束时间(格式:yyyy-MM-dd HH:mm:ss)", example = "2026-12-31 23:59:59") @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime endTime) {
-        try {
-            Page<WaterPumpStation> page = new Page<>(pageNum, pageSize);
-            IPage<WaterPumpStation> resultPage = pumpStationService.queryDeletedPage(page, stationCode, stationName, status, startTime, endTime);
-            return AjaxResult.success("查询成功", resultPage);
-        } catch (Exception e) {
-            log.error("查询回收站数据异常", e);
-            return AjaxResult.error("查询失败:" + e.getMessage());
-        }
-    }
-
-    @PostMapping("/recycle/restore/{ids}")
-    @ApiOperation(value = "批量恢复已删除数据", notes = "多个ID用逗号分隔,将数据从回收站恢复为正常状态")
-    @ApiResponses({
-            @ApiResponse(code = 200, message = "恢复成功", response = AjaxResult.class),
-            @ApiResponse(code = 400, message = "请选择要恢复的数据", response = AjaxResult.class),
-            @ApiResponse(code = 500, message = "服务器内部错误,恢复失败", response = AjaxResult.class)
-    })
-    public AjaxResult restore(
-            @ApiParam(value = "泵站ID数组,多个用逗号分隔", required = true, example = "3,4") @PathVariable Long[] ids) {
-        try {
-            log.info("开始恢复泵站数据,ids: {}", (Object) ids);
-            String updateBy = "system";
-            try {
-                updateBy = SecurityUtils.getUsername();
-            } catch (Exception e) {
-                log.warn("未获取到登录用户,使用默认值system");
-            }
-
-            boolean result = pumpStationService.restoreByIds(List.of(ids), updateBy);
-            return result
-                    ? AjaxResult.success("恢复成功,共恢复 " + ids.length + " 条数据")
-                    : AjaxResult.error("恢复失败");
-        } catch (Exception e) {
-            log.error("恢复数据异常", e);
-            return AjaxResult.error("恢复失败:" + e.getMessage());
-        }
-    }
-
-    @DeleteMapping("/recycle/delete/{ids}")
-    @ApiOperation(value = "批量彻底删除数据(不可恢复)", notes = "多个ID用逗号分隔,物理删除数据库中的数据,谨慎使用")
-    @ApiResponses({
-            @ApiResponse(code = 200, message = "恢复成功", response = AjaxResult.class),
-            @ApiResponse(code = 400, message = "请选择要恢复的数据", response = AjaxResult.class),
-            @ApiResponse(code = 500, message = "服务器内部错误,恢复失败", response = AjaxResult.class)
-    })
-    public AjaxResult deletePhysically(
-            @ApiParam(value = "泵站ID数组,多个用逗号分隔", required = true, example = "5") @PathVariable Long[] ids) {
-        try {
-            log.info("开始彻底删除泵站数据,ids: {}", (Object) ids);
-            boolean result = pumpStationService.deleteByIdsPhysically(List.of(ids));
-            return result
-                    ? AjaxResult.success("彻底删除成功,共删除 " + ids.length + " 条数据")
-                    : AjaxResult.error("彻底删除失败");
-        } catch (Exception e) {
-            log.error("彻底删除数据异常", e);
-            return AjaxResult.error("彻底删除失败:" + e.getMessage());
-        }
-    }
-}

+ 8 - 8
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/WaterSupply/WaterSourceInfo/WaterSourceInfoController.java

@@ -34,7 +34,7 @@ public class WaterSourceInfoController {
 
     // -------------------------- 基础CRUD接口 --------------------------
     @GetMapping("/page")
-    @ApiOperation(value = "分页查询水源地数据", notes = "支持按水源地ID、名称、状态、所属单位、时间范围模糊查询")
+    @ApiOperation(value = "分页查询水源地数据", notes = "支持按水源地编号、名称、状态、所属单位、时间范围模糊查询")
     @ApiResponses({
             @ApiResponse(code = 200, message = "查询成功", response = AjaxResult.class),
             @ApiResponse(code = 500, message = "服务器内部错误,查询失败", response = AjaxResult.class)
@@ -42,7 +42,7 @@ public class WaterSourceInfoController {
     public AjaxResult queryPage(
             @ApiParam(value = "页码", defaultValue = "1") @RequestParam(defaultValue = "1") Integer pageNum,
             @ApiParam(value = "每页大小", defaultValue = "10") @RequestParam(defaultValue = "10") Integer pageSize,
-            @ApiParam(value = "水源地ID") @RequestParam(required = false) String sourceId,
+            @ApiParam(value = "水源地编号") @RequestParam(required = false) String sourceId,
             @ApiParam(value = "水源地名称") @RequestParam(required = false) String sourceName,
             @ApiParam(value = "状态(0正常 1异常)") @RequestParam(required = false) String status,
             @ApiParam(value = "所属单位") @RequestParam(required = false) String unit,
@@ -59,14 +59,14 @@ public class WaterSourceInfoController {
     }
 
     @GetMapping("/{id}")
-    @ApiOperation(value = "根据ID查询水源地详情", notes = "传入水源地ID获取完整信息")
+    @ApiOperation(value = "根据ID查询水源地详情", notes = "传入水源地编号获取完整信息")
     @ApiResponses({
             @ApiResponse(code = 200, message = "查询成功", response = AjaxResult.class),
             @ApiResponse(code = 404, message = "未找到指定ID的水源地信息", response = AjaxResult.class),
             @ApiResponse(code = 500, message = "服务器内部错误,查询失败", response = AjaxResult.class)
     })
     public AjaxResult getById(
-            @ApiParam(value = "水源地ID", required = true, example = "0") @PathVariable Long id) {
+            @ApiParam(value = "水源地编号", required = true, example = "UUID") @PathVariable String id) {
         try {
             WaterSourceInfo data = waterSourceInfoService.getById(id);
             return data == null ? AjaxResult.warn("未找到该水源地信息") : AjaxResult.success("查询成功", data);
@@ -136,7 +136,7 @@ public class WaterSourceInfoController {
             @ApiResponse(code = 500, message = "服务器内部错误,删除失败", response = AjaxResult.class)
     })
     public AjaxResult remove(
-            @ApiParam(value = "水源地ID数组,多个用逗号分隔", required = true, example = "1,2,3") @PathVariable Long[] ids) {
+            @ApiParam(value = "水源地编号数组,多个用逗号分隔", required = true, example = "UUID1,UUID2") @PathVariable String[] ids) {
         try {
             log.info("开始删除水源地数据,ids: {}", (Object) ids);
             boolean result = waterSourceInfoService.removeByIds(List.of(ids));
@@ -159,7 +159,7 @@ public class WaterSourceInfoController {
     public AjaxResult recycleList(
             @ApiParam(value = "页码", defaultValue = "1") @RequestParam(defaultValue = "1") Integer pageNum,
             @ApiParam(value = "每页大小", defaultValue = "10") @RequestParam(defaultValue = "10") Integer pageSize,
-            @ApiParam(value = "水源地ID") @RequestParam(required = false) String sourceId,
+            @ApiParam(value = "水源地编号") @RequestParam(required = false) String sourceId,
             @ApiParam(value = "水源地名称") @RequestParam(required = false) String sourceName,
             @ApiParam(value = "状态(0正常 1异常)") @RequestParam(required = false) String status,
             @ApiParam(value = "开始时间(格式:yyyy-MM-dd HH:mm:ss)", example = "2025-01-01 00:00:00") @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime startTime,
@@ -182,7 +182,7 @@ public class WaterSourceInfoController {
             @ApiResponse(code = 500, message = "服务器内部错误,恢复失败", response = AjaxResult.class)
     })
     public AjaxResult restore(
-            @ApiParam(value = "水源地ID数组,多个用逗号分隔", required = true, example = "3,4") @PathVariable Long[] ids) {
+            @ApiParam(value = "水源地编号数组,多个用逗号分隔", required = true, example = "UUID1,UUID2") @PathVariable String[] ids) {
         try {
             log.info("开始恢复水源地数据,ids: {}", (Object) ids);
             String updateBy = "system";
@@ -210,7 +210,7 @@ public class WaterSourceInfoController {
             @ApiResponse(code = 500, message = "服务器内部错误,删除失败", response = AjaxResult.class)
     })
     public AjaxResult deletePhysically(
-            @ApiParam(value = "水源地ID数组,多个用逗号分隔", required = true, example = "5") @PathVariable Long[] ids) {
+            @ApiParam(value = "水源地编号数组,多个用逗号分隔", required = true, example = "UUID") @PathVariable String[] ids) {
         try {
             log.info("开始彻底删除水源地数据,ids: {}", (Object) ids);
             boolean result = waterSourceInfoService.deleteByIdsPhysically(List.of(ids));

+ 4 - 4
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/WaterSupply/WaterUserInfo/WaterUserInfoController.java

@@ -66,7 +66,7 @@ public class WaterUserInfoController {
             @ApiResponse(code = 500, message = "服务器内部错误,查询失败", response = AjaxResult.class)
     })
     public AjaxResult getById(
-            @ApiParam(value = "用水户ID", required = true, example = "0") @PathVariable Long id) {
+            @ApiParam(value = "用水户ID", required = true, example = "UUID") @PathVariable String id) {
         try {
             WaterUserInfo data = waterUserInfoService.getById(id);
             return data == null ? AjaxResult.warn("未找到该用水户信息") : AjaxResult.success("查询成功", data);
@@ -137,7 +137,7 @@ public class WaterUserInfoController {
             @ApiResponse(code = 500, message = "服务器内部错误,删除失败", response = AjaxResult.class)
     })
     public AjaxResult remove(
-            @ApiParam(value = "用水户ID数组,多个用逗号分隔", required = true, example = "1,2,3") @PathVariable Long[] ids) {
+            @ApiParam(value = "用水户ID数组,多个用逗号分隔", required = true, example = "UUID1,UUID2") @PathVariable String[] ids) {
         try {
             log.info("开始删除用水户数据,ids: {}", (Object) ids);
             boolean result = waterUserInfoService.removeByIds(List.of(ids));
@@ -183,7 +183,7 @@ public class WaterUserInfoController {
             @ApiResponse(code = 500, message = "服务器内部错误,恢复失败", response = AjaxResult.class)
     })
     public AjaxResult restore(
-            @ApiParam(value = "用水户ID数组,多个用逗号分隔", required = true, example = "3,4") @PathVariable Long[] ids) {
+            @ApiParam(value = "用水户ID数组,多个用逗号分隔", required = true, example = "UUID1,UUID2") @PathVariable String[] ids) {
         try {
             log.info("开始恢复用水户数据,ids: {}", (Object) ids);
             String updateBy = "system";
@@ -211,7 +211,7 @@ public class WaterUserInfoController {
             @ApiResponse(code = 500, message = "服务器内部错误,删除失败", response = AjaxResult.class)
     })
     public AjaxResult deletePhysically(
-            @ApiParam(value = "用水户ID数组,多个用逗号分隔", required = true, example = "5") @PathVariable Long[] ids) {
+            @ApiParam(value = "用水户ID数组,多个用逗号分隔", required = true, example = "UUID") @PathVariable String[] ids) {
         try {
             log.info("开始彻底删除用水户数据,ids: {}", (Object) ids);
             boolean result = waterUserInfoService.deleteByIdsPhysically(List.of(ids));

+ 179 - 0
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/base/InfrastructureFacilityDataController.java

@@ -0,0 +1,179 @@
+package com.zksy.web.controller.base;
+
+import com.zksy.WaterSupply.WaterFireHydrantInfo.domain.WaterFireHydrantInfo;
+import com.zksy.WaterSupply.WaterFireHydrantInfo.service.IWaterFireHydrantInfoService;
+import com.zksy.WaterSupply.export.FireHydrantImportDTO;
+import com.zksy.base.domain.ManholeBase;
+import com.zksy.base.domain.PipeNetworkBase;
+import com.zksy.base.dto.ManholeImportDTO;
+import com.zksy.base.dto.PipeNetworkFacilityImportDTO;
+import com.zksy.base.service.InfrastructureFacilityImportService;
+import com.zksy.base.service.ManholeBaseService;
+import com.zksy.base.service.PipeNetworkBaseService;
+import com.zksy.common.annotation.Log;
+import com.zksy.common.core.domain.AjaxResult;
+import com.zksy.common.enums.BusinessType;
+import com.zksy.common.utils.SecurityUtils;
+import com.zksy.common.utils.poi.ExcelUtil;
+import com.zksy.drainage.domain.DrainageGateInfo;
+import com.zksy.drainage.domain.DrainageStorageInfo;
+import com.zksy.drainage.dto.DrainageGateImportDTO;
+import com.zksy.drainage.dto.DrainageStorageImportDTO;
+import com.zksy.drainage.service.DrainageGateInfoService;
+import com.zksy.drainage.service.DrainageStorageInfoService;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 基础设施档案统一导入/导出端点。
+ *
+ * <p>覆盖管网基础、窨井、消火栓、排水闸门、排水调蓄五类。模板列来自各 {@code XxxImportDTO}
+ * 的 {@code @Excel} 注解;字典列用 {@code comboReadDict} 生成中文下拉,导入时由 ExcelUtil
+ * 按 dictType 反向转换成码值,保证“模板下拉中文、库里存码值”。</p>
+ */
+@RestController
+@RequestMapping("/api/infrastructure")
+public class InfrastructureFacilityDataController {
+
+    @Resource private ManholeBaseService manholeService;
+    @Resource private PipeNetworkBaseService pipeNetworkService;
+    @Resource private IWaterFireHydrantInfoService fireHydrantService;
+    @Resource private DrainageGateInfoService gateService;
+    @Resource private DrainageStorageInfoService storageService;
+    @Resource private InfrastructureFacilityImportService importService;
+
+    private String operator() {
+        return SecurityUtils.getUsername();
+    }
+
+    // ==================== 管网基础信息 ====================
+
+    @GetMapping("/pipeNetwork/export")
+    @Log(title = "导出管网基础信息", businessType = BusinessType.EXPORT)
+    public void exportNetworks(HttpServletResponse response) {
+        List<PipeNetworkBase> rows = pipeNetworkService.list();
+        new ExcelUtil<>(PipeNetworkFacilityImportDTO.class).exportExcel(response,
+                rows.stream().map(PipeNetworkFacilityImportDTO::from).collect(Collectors.toList()), "管网基础信息");
+    }
+
+    @PostMapping("/pipeNetwork/importData")
+    @Log(title = "导入管网基础信息", businessType = BusinessType.IMPORT)
+    public AjaxResult importNetworkData(@RequestParam("file") MultipartFile file,
+                                        @RequestParam(defaultValue = "false") boolean updateSupport) throws Exception {
+        return AjaxResult.success(importService.importNetworks(
+                new ExcelUtil<PipeNetworkFacilityImportDTO>(PipeNetworkFacilityImportDTO.class)
+                        .importExcel(file.getInputStream()), updateSupport, operator()));
+    }
+
+    @PostMapping("/pipeNetwork/importTemplate")
+    public void networkImportTemplate(HttpServletResponse response) {
+        new ExcelUtil<PipeNetworkFacilityImportDTO>(PipeNetworkFacilityImportDTO.class)
+                .importTemplateExcel(response, "管网基础信息");
+    }
+
+    // ==================== 窨井信息 ====================
+
+    @GetMapping("/manhole/export")
+    @Log(title = "导出窨井信息", businessType = BusinessType.EXPORT)
+    public void exportManholes(HttpServletResponse response) {
+        List<ManholeBase> rows = manholeService.list();
+        new ExcelUtil<>(ManholeImportDTO.class).exportExcel(response,
+                rows.stream().map(ManholeImportDTO::from).collect(Collectors.toList()), "窨井信息");
+    }
+
+    @PostMapping("/manhole/importData")
+    @Log(title = "导入窨井信息", businessType = BusinessType.IMPORT)
+    public AjaxResult importManholeData(@RequestParam("file") MultipartFile file,
+                                        @RequestParam(defaultValue = "false") boolean updateSupport) throws Exception {
+        return AjaxResult.success(importService.importManholes(
+                new ExcelUtil<ManholeImportDTO>(ManholeImportDTO.class)
+                        .importExcel(file.getInputStream()), updateSupport, operator()));
+    }
+
+    @PostMapping("/manhole/importTemplate")
+    public void manholeImportTemplate(HttpServletResponse response) {
+        new ExcelUtil<ManholeImportDTO>(ManholeImportDTO.class).importTemplateExcel(response, "窨井信息");
+    }
+
+    // ==================== 消火栓信息 ====================
+
+    @GetMapping("/fireHydrant/export")
+    @Log(title = "导出消火栓信息", businessType = BusinessType.EXPORT)
+    public void exportFireHydrants(HttpServletResponse response) {
+        List<WaterFireHydrantInfo> rows = fireHydrantService.list();
+        new ExcelUtil<>(FireHydrantImportDTO.class).exportExcel(response,
+                rows.stream().map(FireHydrantImportDTO::from).collect(Collectors.toList()), "消火栓信息");
+    }
+
+    @PostMapping("/fireHydrant/importData")
+    @Log(title = "导入消火栓信息", businessType = BusinessType.IMPORT)
+    public AjaxResult importFireHydrantData(@RequestParam("file") MultipartFile file,
+                                            @RequestParam(defaultValue = "false") boolean updateSupport) throws Exception {
+        return AjaxResult.success(importService.importFireHydrants(
+                new ExcelUtil<FireHydrantImportDTO>(FireHydrantImportDTO.class)
+                        .importExcel(file.getInputStream()), updateSupport, operator()));
+    }
+
+    @PostMapping("/fireHydrant/importTemplate")
+    public void fireHydrantImportTemplate(HttpServletResponse response) {
+        new ExcelUtil<FireHydrantImportDTO>(FireHydrantImportDTO.class).importTemplateExcel(response, "消火栓信息");
+    }
+
+    // ==================== 排水闸门信息 ====================
+
+    @GetMapping("/gate/export")
+    @Log(title = "导出排水闸门信息", businessType = BusinessType.EXPORT)
+    public void exportGates(HttpServletResponse response) {
+        List<DrainageGateInfo> rows = gateService.listAll();
+        new ExcelUtil<>(DrainageGateImportDTO.class).exportExcel(response,
+                rows.stream().map(DrainageGateImportDTO::from).collect(Collectors.toList()), "排水闸门信息");
+    }
+
+    @PostMapping("/gate/importData")
+    @Log(title = "导入排水闸门信息", businessType = BusinessType.IMPORT)
+    public AjaxResult importGateData(@RequestParam("file") MultipartFile file,
+                                     @RequestParam(defaultValue = "false") boolean updateSupport) throws Exception {
+        return AjaxResult.success(importService.importGates(
+                new ExcelUtil<DrainageGateImportDTO>(DrainageGateImportDTO.class)
+                        .importExcel(file.getInputStream()), updateSupport, operator()));
+    }
+
+    @PostMapping("/gate/importTemplate")
+    public void gateImportTemplate(HttpServletResponse response) {
+        new ExcelUtil<DrainageGateImportDTO>(DrainageGateImportDTO.class).importTemplateExcel(response, "排水闸门信息");
+    }
+
+    // ==================== 排水调蓄设施信息 ====================
+
+    @GetMapping("/storage/export")
+    @Log(title = "导出排水调蓄设施信息", businessType = BusinessType.EXPORT)
+    public void exportStorages(HttpServletResponse response) {
+        List<DrainageStorageInfo> rows = storageService.listAll();
+        new ExcelUtil<>(DrainageStorageImportDTO.class).exportExcel(response,
+                rows.stream().map(DrainageStorageImportDTO::from).collect(Collectors.toList()), "排水调蓄设施信息");
+    }
+
+    @PostMapping("/storage/importData")
+    @Log(title = "导入排水调蓄设施信息", businessType = BusinessType.IMPORT)
+    public AjaxResult importStorageData(@RequestParam("file") MultipartFile file,
+                                        @RequestParam(defaultValue = "false") boolean updateSupport) throws Exception {
+        return AjaxResult.success(importService.importStorages(
+                new ExcelUtil<DrainageStorageImportDTO>(DrainageStorageImportDTO.class)
+                        .importExcel(file.getInputStream()), updateSupport, operator()));
+    }
+
+    @PostMapping("/storage/importTemplate")
+    public void storageImportTemplate(HttpServletResponse response) {
+        new ExcelUtil<DrainageStorageImportDTO>(DrainageStorageImportDTO.class)
+                .importTemplateExcel(response, "排水调蓄设施信息");
+    }
+}

+ 89 - 0
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/base/ManholeInfoController.java

@@ -0,0 +1,89 @@
+package com.zksy.web.controller.base;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.zksy.base.domain.ManholeBase;
+import com.zksy.base.dto.ManholePageInDTO;
+import com.zksy.base.service.ManholeBaseService;
+import com.zksy.common.annotation.Anonymous;
+import com.zksy.common.annotation.Log;
+import com.zksy.common.core.domain.AjaxResult;
+import com.zksy.common.enums.BusinessType;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 窨井信息(基础设施档案)
+ *
+ * <p>数据表:{@code app_user.manhole_info}(原 manhole_base 改名而来)。
+ * 状态取字典 {@code infrastructure_status}(0正常 1异常),
+ * 窨井类型取字典 {@code manhole_type}(0燃气窨井 1排水窨井 2供水窨井)。
+ */
+@Slf4j
+@RestController
+@RequestMapping("/api/manhole-info")
+@Api(tags = "基础设施-窨井信息")
+public class ManholeInfoController {
+
+    @Autowired
+    private ManholeBaseService service;
+
+    @GetMapping("/findByPage")
+    @ApiOperation("窨井分页查询")
+    @Anonymous
+    public AjaxResult findByPage(ManholePageInDTO dto) {
+        Page<ManholeBase> page = service.findByPage(dto);
+        return AjaxResult.success(page);
+    }
+
+    @GetMapping("/getById/{id}")
+    @ApiOperation("根据ID查询窨井")
+    @Anonymous
+    public AjaxResult getById(@PathVariable String id) {
+        ManholeBase entity = service.getById(id);
+        return entity != null ? AjaxResult.success(entity) : AjaxResult.error("窨井信息不存在");
+    }
+
+    @GetMapping("/options")
+    @ApiOperation("窨井下拉选项")
+    @Anonymous
+    public AjaxResult options() {
+        return AjaxResult.success(service.getOptions());
+    }
+
+    @PostMapping("/save")
+    @ApiOperation("新增窨井")
+    @Log(title = "新增窨井信息", businessType = BusinessType.INSERT)
+    public AjaxResult save(@RequestBody ManholeBase entity) {
+        boolean saved = service.saveWithCheck(entity);
+        return saved ? AjaxResult.success("新增成功") : AjaxResult.error("新增失败");
+    }
+
+    @PutMapping("/updateById")
+    @ApiOperation("修改窨井")
+    @Log(title = "修改窨井信息", businessType = BusinessType.UPDATE)
+    public AjaxResult updateById(@RequestBody ManholeBase entity) {
+        boolean updated = service.updateWithCheck(entity);
+        return updated ? AjaxResult.success("修改成功") : AjaxResult.error("修改失败");
+    }
+
+    @DeleteMapping("/deleteById")
+    @ApiOperation("删除窨井")
+    @Log(title = "删除窨井信息", businessType = BusinessType.DELETE)
+    public AjaxResult deleteById(@RequestParam String id) {
+        boolean deleted = service.removeWithCheck(id);
+        return deleted ? AjaxResult.success("删除成功") : AjaxResult.error("删除失败");
+    }
+
+    @DeleteMapping("/deleteBatch")
+    @ApiOperation("批量删除窨井")
+    @Log(title = "批量删除窨井信息", businessType = BusinessType.DELETE)
+    public AjaxResult deleteBatch(@RequestBody List<String> ids) {
+        boolean deleted = service.removeByIds(ids);
+        return deleted ? AjaxResult.success("批量删除成功") : AjaxResult.error("批量删除失败");
+    }
+}

+ 95 - 0
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/drainage/AbstractDrainageFacilityController.java

@@ -0,0 +1,95 @@
+package com.zksy.web.controller.drainage;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.zksy.common.annotation.Log;
+import com.zksy.common.core.domain.AjaxResult;
+import com.zksy.common.enums.BusinessType;
+import com.zksy.drainage.domain.DrainageFacilityBase;
+import com.zksy.drainage.dto.DrainageFacilityPageInDTO;
+import com.zksy.drainage.service.DrainageFacilityService;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 排水设施(闸门 / 调蓄设施)通用 Controller。
+ * 具体设施只需继承并提供 service 与中文名称,端点不重复实现。
+ */
+public abstract class AbstractDrainageFacilityController<T extends DrainageFacilityBase> {
+
+    protected abstract DrainageFacilityService<T> service();
+
+    /** 实体中文名,用于日志标题 */
+    protected abstract String label();
+
+    @GetMapping("/page")
+    @ApiOperation(value = "分页查询")
+    public Page<T> page(DrainageFacilityPageInDTO dto) {
+        return service().findByPage(dto);
+    }
+
+    @GetMapping("/map")
+    @ApiOperation(value = "地图数据(带坐标)")
+    public AjaxResult map(DrainageFacilityPageInDTO dto) {
+        return AjaxResult.success(service().listForMap(dto));
+    }
+
+    @GetMapping("/filterOptions")
+    @ApiOperation(value = "筛选下拉项")
+    public AjaxResult filterOptions() {
+        return AjaxResult.success(service().getFilterOptions());
+    }
+
+    @GetMapping("/{id}")
+    @ApiOperation(value = "详情")
+    public AjaxResult getById(@PathVariable String id) {
+        T entity = service().getEntityById(id);
+        return entity == null ? AjaxResult.error(label() + "不存在") : AjaxResult.success(entity);
+    }
+
+    @GetMapping("/list")
+    @ApiOperation(value = "全部列表")
+    public AjaxResult list() {
+        return AjaxResult.success(service().listAll());
+    }
+
+    @PostMapping
+    @ApiOperation(value = "新增")
+    @Log(title = "排水设施", businessType = BusinessType.INSERT)
+    @Transactional
+    public AjaxResult save(@RequestBody T entity) {
+        return service().saveEntity(entity) ? AjaxResult.success("新增成功") : AjaxResult.error("新增失败");
+    }
+
+    @PutMapping
+    @ApiOperation(value = "修改")
+    @Log(title = "排水设施", businessType = BusinessType.UPDATE)
+    @Transactional
+    public AjaxResult update(@RequestBody T entity) {
+        return service().updateEntity(entity) ? AjaxResult.success("修改成功") : AjaxResult.error("修改失败");
+    }
+
+    @DeleteMapping("/{id}")
+    @ApiOperation(value = "删除")
+    @Log(title = "排水设施", businessType = BusinessType.DELETE)
+    @Transactional
+    public AjaxResult deleteById(@PathVariable String id) {
+        return service().removeEntity(id) ? AjaxResult.success("删除成功") : AjaxResult.error("删除失败");
+    }
+
+    @DeleteMapping("/batch")
+    @ApiOperation(value = "批量删除")
+    @Log(title = "排水设施", businessType = BusinessType.DELETE)
+    @Transactional
+    public AjaxResult deleteBatch(@RequestBody List<String> ids) {
+        return service().removeBatchEntity(ids) ? AjaxResult.success("批量删除成功") : AjaxResult.error("批量删除失败");
+    }
+}

+ 31 - 0
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/drainage/DrainageGateInfoController.java

@@ -0,0 +1,31 @@
+package com.zksy.web.controller.drainage;
+
+import com.zksy.common.annotation.Anonymous;
+import com.zksy.drainage.domain.DrainageGateInfo;
+import com.zksy.drainage.service.DrainageFacilityService;
+import com.zksy.drainage.service.DrainageGateInfoService;
+import io.swagger.annotations.Api;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/** 排水闸门管理 */
+@Anonymous
+@RestController
+@RequestMapping("/api/drainage/gate")
+@Api(tags = "排水闸门管理")
+public class DrainageGateInfoController extends AbstractDrainageFacilityController<DrainageGateInfo> {
+
+    @Autowired
+    private DrainageGateInfoService gateService;
+
+    @Override
+    protected DrainageFacilityService<DrainageGateInfo> service() {
+        return gateService;
+    }
+
+    @Override
+    protected String label() {
+        return "排水闸门";
+    }
+}

+ 0 - 62
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/drainage/DrainagePipeNetworkController.java

@@ -1,62 +0,0 @@
-package com.zksy.web.controller.drainage;
-
-import com.zksy.base.domain.PipeNetworkBase;
-import com.zksy.base.dto.PipeNetworkPageInDTO;
-import com.zksy.base.service.PipeNetworkBaseService;
-import com.zksy.common.annotation.Anonymous;
-import com.zksy.common.core.domain.AjaxResult;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-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;
-
-/**
- * 排水管网基础数据管理
- * <p>数据源统一为 pipe_network_base,且强制 network_type=1(排水设施)。</p>
- * <p>排水管网数据由外部导入维护,本模块只提供查询能力:分页列表、地图数据、详情。</p>
- */
-@Slf4j
-@RestController
-@RequestMapping("/api/drainage/pipeNetworkBase")
-@Api(tags = "排水管网基础数据管理")
-public class DrainagePipeNetworkController {
-
-    @Autowired
-    private PipeNetworkBaseService pipeNetworkBaseService;
-
-    @Anonymous
-    @GetMapping("/page")
-    @ApiOperation(value = "排水管网分页查询")
-    public AjaxResult page(PipeNetworkPageInDTO dto) {
-        return AjaxResult.success(pipeNetworkBaseService.queryDrainageByPage(dto));
-    }
-
-    @Anonymous
-    @GetMapping("/map")
-    @ApiOperation(value = "排水管网地图数据(不分页,按筛选条件返回带坐标的记录)")
-    public AjaxResult map(PipeNetworkPageInDTO dto) {
-        return AjaxResult.success(pipeNetworkBaseService.listDrainageForMap(dto));
-    }
-
-    @Anonymous
-    @GetMapping("/filterOptions")
-    @ApiOperation(value = "排水管网筛选下拉项(材质、管养单位)")
-    public AjaxResult filterOptions() {
-        return AjaxResult.success(pipeNetworkBaseService.getDrainageFilterOptions());
-    }
-
-    @Anonymous
-    @GetMapping("/{id}")
-    @ApiOperation(value = "排水管网详情")
-    public AjaxResult getById(@PathVariable String id) {
-        PipeNetworkBase entity = pipeNetworkBaseService.getDrainageById(id);
-        if (entity == null) {
-            return AjaxResult.error("该排水管网不存在");
-        }
-        return AjaxResult.success(entity);
-    }
-}

+ 0 - 183
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/drainage/DrainagePumpStationController.java

@@ -1,183 +0,0 @@
-package com.zksy.web.controller.drainage;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.zksy.WaterSupply.WaterPumpStation.domain.PumpStationType;
-import com.zksy.WaterSupply.WaterPumpStation.domain.WaterPumpStation;
-import com.zksy.WaterSupply.WaterPumpStation.service.IWaterPumpStationService;
-import com.zksy.common.annotation.Anonymous;
-import com.zksy.common.core.domain.AjaxResult;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.util.StringUtils;
-import org.springframework.web.bind.annotation.*;
-
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.YearMonth;
-import java.time.format.DateTimeFormatter;
-import java.util.*;
-import java.util.stream.Collectors;
-
-/**
- * 排水系统-泵站数据接口
- */
-@Anonymous
-@RestController
-@RequestMapping("/api/drainage/pumpStation")
-@Api(tags = "排水系统-泵站数据接口")
-public class DrainagePumpStationController {
-
-    @Autowired
-    private IWaterPumpStationService waterPumpStationService;
-
-    /**
-     * 分页查询泵站列表
-     */
-    @GetMapping("/page")
-    @ApiOperation(value = "分页查询泵站列表")
-    public AjaxResult page(
-            @ApiParam("页码") @RequestParam(defaultValue = "1") Integer pageNum,
-            @ApiParam("每页条数") @RequestParam(defaultValue = "10") Integer pageSize,
-            @ApiParam("泵站名称") @RequestParam(required = false) String stationName,
-            @ApiParam("泵站编号") @RequestParam(required = false) String stationCode,
-            @ApiParam("运行状态") @RequestParam(required = false) String status) {
-
-        Page<WaterPumpStation> page = new Page<>(pageNum, pageSize);
-        LambdaQueryWrapper<WaterPumpStation> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(WaterPumpStation::getStationType, PumpStationType.DRAINAGE);
-
-        if (StringUtils.hasText(stationName)) {
-            wrapper.like(WaterPumpStation::getStationName, stationName);
-        }
-        if (StringUtils.hasText(stationCode)) {
-            wrapper.eq(WaterPumpStation::getStationCode, stationCode);
-        }
-        if (StringUtils.hasText(status)) {
-            wrapper.eq(WaterPumpStation::getStatus, status);
-        }
-        wrapper.eq(WaterPumpStation::getDelFlag, "0");
-        wrapper.orderByDesc(WaterPumpStation::getCreateTime);
-
-        Page<WaterPumpStation> result = waterPumpStationService.page(page, wrapper);
-        return AjaxResult.success(result);
-    }
-
-    /**
-     * 查询所有泵站(不分页)
-     */
-    @GetMapping("/list")
-    @ApiOperation(value = "查询所有泵站列表(不分页)")
-    public AjaxResult list(
-            @ApiParam("泵站名称") @RequestParam(required = false) String stationName,
-            @ApiParam("运行状态") @RequestParam(required = false) String status) {
-
-        LambdaQueryWrapper<WaterPumpStation> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(WaterPumpStation::getStationType, PumpStationType.DRAINAGE);
-        if (StringUtils.hasText(stationName)) {
-            wrapper.like(WaterPumpStation::getStationName, stationName);
-        }
-        if (StringUtils.hasText(status)) {
-            wrapper.eq(WaterPumpStation::getStatus, status);
-        }
-        wrapper.eq(WaterPumpStation::getDelFlag, "0");
-        wrapper.orderByDesc(WaterPumpStation::getCreateTime);
-
-        List<WaterPumpStation> list = waterPumpStationService.list(wrapper);
-        return AjaxResult.success(list);
-    }
-
-    /**
-     * 根据ID查询泵站详情
-     */
-    @GetMapping("/{id}")
-    @ApiOperation(value = "根据ID查询泵站详情")
-    public AjaxResult getById(@PathVariable Long id) {
-        WaterPumpStation station = waterPumpStationService.getOne(
-                new LambdaQueryWrapper<WaterPumpStation>()
-                        .eq(WaterPumpStation::getId, id)
-                        .eq(WaterPumpStation::getStationType, PumpStationType.DRAINAGE));
-        if (station == null) {
-            return AjaxResult.error("泵站不存在");
-        }
-        return AjaxResult.success(station);
-    }
-
-    /**
-     * 泵站月度统计(近三个月),按泵站ID列表查询
-     * 返回每个月内已关联的泵站的设计流量和设计扬程汇总
-     * sinceDate: 关联起始日期(yyyy-MM-dd),只统计该日期所在月份及之后的数据
-     */
-    @GetMapping("/monthlyStats")
-    @ApiOperation(value = "泵站近三个月月度统计")
-    public AjaxResult monthlyStats(
-            @ApiParam("泵站ID列表,逗号分隔") @RequestParam String ids,
-            @ApiParam("关联起始日期yyyy-MM-dd") @RequestParam(required = false) String sinceDate) {
-
-        if (!StringUtils.hasText(ids)) {
-            return AjaxResult.success(Collections.emptyList());
-        }
-
-        // 解析ID列表
-        List<Long> idList = Arrays.stream(ids.split(","))
-                .map(String::trim)
-                .filter(s -> !s.isEmpty())
-                .map(Long::parseLong)
-                .collect(Collectors.toList());
-
-        if (idList.isEmpty()) {
-            return AjaxResult.success(Collections.emptyList());
-        }
-
-        // 查询这些泵站
-        List<WaterPumpStation> stations = waterPumpStationService.list(
-                new LambdaQueryWrapper<WaterPumpStation>()
-                        .in(WaterPumpStation::getId, idList)
-                        .eq(WaterPumpStation::getStationType, PumpStationType.DRAINAGE));
-
-        // 解析关联起始月份
-        YearMonth sinceMonth = null;
-        if (StringUtils.hasText(sinceDate)) {
-            try {
-                LocalDate sd = LocalDate.parse(sinceDate);
-                sinceMonth = YearMonth.from(sd);
-            } catch (Exception e) {
-                // 忽略解析失败
-            }
-        }
-
-        // 计算近三个月
-        YearMonth now = YearMonth.now();
-        DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM");
-        List<Map<String, Object>> result = new ArrayList<>();
-
-        for (int i = 2; i >= 0; i--) {
-            YearMonth ym = now.minusMonths(i);
-            String month = ym.format(fmt);
-
-            double totalFlow = 0;
-            double totalHead = 0;
-            int count = 0;
-
-            // 如果指定了sinceDate,该月份早于sinceDate所在月则数据为0
-            if (sinceMonth == null || !ym.isBefore(sinceMonth)) {
-                for (WaterPumpStation s : stations) {
-                    totalFlow += s.getDesignFlow() != null ? s.getDesignFlow().doubleValue() : 0;
-                    totalHead += s.getDesignHead() != null ? s.getDesignHead().doubleValue() : 0;
-                    count++;
-                }
-            }
-
-            Map<String, Object> item = new LinkedHashMap<>();
-            item.put("month", month);
-            item.put("designFlow", totalFlow);
-            item.put("designHead", totalHead);
-            item.put("stationCount", count);
-            result.add(item);
-        }
-
-        return AjaxResult.success(result);
-    }
-}

+ 31 - 0
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/drainage/DrainageStorageInfoController.java

@@ -0,0 +1,31 @@
+package com.zksy.web.controller.drainage;
+
+import com.zksy.common.annotation.Anonymous;
+import com.zksy.drainage.domain.DrainageStorageInfo;
+import com.zksy.drainage.service.DrainageFacilityService;
+import com.zksy.drainage.service.DrainageStorageInfoService;
+import io.swagger.annotations.Api;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/** 排水调蓄设施管理 */
+@Anonymous
+@RestController
+@RequestMapping("/api/drainage/storage")
+@Api(tags = "排水调蓄设施管理")
+public class DrainageStorageInfoController extends AbstractDrainageFacilityController<DrainageStorageInfo> {
+
+    @Autowired
+    private DrainageStorageInfoService storageService;
+
+    @Override
+    protected DrainageFacilityService<DrainageStorageInfo> service() {
+        return storageService;
+    }
+
+    @Override
+    protected String label() {
+        return "排水调蓄设施";
+    }
+}

+ 0 - 148
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/drainage/EngineeringFacilityController.java

@@ -1,148 +0,0 @@
-package com.zksy.web.controller.drainage;
-
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.zksy.common.annotation.Anonymous;
-import com.zksy.common.annotation.Log;
-import com.zksy.common.core.domain.AjaxResult;
-import com.zksy.common.enums.BusinessType;
-import com.zksy.drainage.domain.EngineeringFacility;
-import com.zksy.drainage.dto.EngineeringFacilityPageInDTO;
-import com.zksy.drainage.service.EngineeringFacilityService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * 工程设施基础数据管理(闸门 / 调蓄设施 / 泵站)
- * <p>页面侧为只读:查询、筛选、详情与 GIS 叠加展示;
- * 写接口保留供数据导入/后台维护,字段口径与 drainage_engineering_facility 一致。</p>
- */
-@Slf4j
-@RestController
-@RequestMapping("/api/drainage/facility")
-@Api(tags = "工程设施基础数据管理")
-public class EngineeringFacilityController {
-
-    @Autowired
-    private EngineeringFacilityService service;
-
-    @Anonymous
-    @GetMapping("/page")
-    @ApiOperation(value = "工程设施分页查询")
-    public Page<EngineeringFacility> page(EngineeringFacilityPageInDTO dto) {
-        return service.findByPage(dto);
-    }
-
-    @Anonymous
-    @GetMapping("/map")
-    @ApiOperation(value = "工程设施地图数据(不分页,仅返回带坐标的记录)")
-    public AjaxResult map(EngineeringFacilityPageInDTO dto) {
-        return AjaxResult.success(service.listForMap(dto));
-    }
-
-    @Anonymous
-    @GetMapping("/filterOptions")
-    @ApiOperation(value = "工程设施筛选下拉项")
-    public AjaxResult filterOptions() {
-        return AjaxResult.success(service.getFilterOptions());
-    }
-
-    @Anonymous
-    @GetMapping("/{id}")
-    @ApiOperation(value = "查询工程设施详情")
-    public AjaxResult getById(@PathVariable String id) {
-        EngineeringFacility entity = service.getById(id);
-        if (entity == null) {
-            return AjaxResult.error("该工程设施不存在");
-        }
-        return AjaxResult.success(entity);
-    }
-
-    @Anonymous
-    @GetMapping("/list")
-    @ApiOperation(value = "查询所有工程设施")
-    public AjaxResult list() {
-        return AjaxResult.success(service.list());
-    }
-
-    @Anonymous
-    @PostMapping
-    @ApiOperation(value = "新增工程设施")
-    @Log(title = "新增工程设施", businessType = BusinessType.INSERT)
-    @Transactional
-    public AjaxResult save(@RequestBody EngineeringFacility entity) {
-        boolean saved = service.saveEntity(entity);
-        return saved ? AjaxResult.success("新增成功") : AjaxResult.error("新增失败");
-    }
-
-    @Anonymous
-    @PutMapping
-    @ApiOperation(value = "修改工程设施")
-    @Log(title = "修改工程设施", businessType = BusinessType.UPDATE)
-    @Transactional
-    public AjaxResult update(@RequestBody EngineeringFacility entity) {
-        boolean updated = service.updateEntity(entity);
-        return updated ? AjaxResult.success("修改成功") : AjaxResult.error("修改失败");
-    }
-
-    @Anonymous
-    @DeleteMapping("/{id}")
-    @ApiOperation(value = "删除工程设施")
-    @Log(title = "删除工程设施", businessType = BusinessType.DELETE)
-    @Transactional
-    public AjaxResult deleteById(@PathVariable String id) {
-        boolean deleted = service.removeEntity(id);
-        return deleted ? AjaxResult.success("删除成功") : AjaxResult.error("删除失败");
-    }
-
-    @Anonymous
-    @DeleteMapping("/batch")
-    @ApiOperation(value = "批量删除工程设施")
-    @Log(title = "批量删除工程设施", businessType = BusinessType.DELETE)
-    @Transactional
-    public AjaxResult deleteBatch(@RequestBody List<String> ids) {
-        boolean deleted = service.removeBatchEntity(ids);
-        return deleted ? AjaxResult.success("批量删除成功") : AjaxResult.error("批量删除失败");
-    }
-
-    @Anonymous
-    @PostMapping("/bindEquipment")
-    @ApiOperation(value = "绑定设备到工程设施")
-    public AjaxResult bindEquipment(@RequestBody Map<String, Object> params) {
-        String facilityId = (String) params.get("partitionId");
-        @SuppressWarnings("unchecked")
-        List<String> equipmentIds = (List<String>) params.get("equipmentIds");
-        if (facilityId == null || equipmentIds == null || equipmentIds.isEmpty()) {
-            return AjaxResult.error("参数不完整");
-        }
-        boolean success = service.bindEquipment(facilityId, equipmentIds);
-        return success ? AjaxResult.success() : AjaxResult.error("绑定失败");
-    }
-
-    @Anonymous
-    @PostMapping("/bindPumpStation")
-    @ApiOperation(value = "工程设施关联泵站")
-    public AjaxResult bindPumpStation(@RequestBody Map<String, Object> params) {
-        String facilityId = (String) params.get("partitionId");
-        @SuppressWarnings("unchecked")
-        List<String> pumpStationIds = (List<String>) params.get("equipmentIds");
-        if (facilityId == null || pumpStationIds == null || pumpStationIds.isEmpty()) {
-            return AjaxResult.error("参数不完整");
-        }
-        boolean success = service.bindPumpStation(facilityId, pumpStationIds);
-        return success ? AjaxResult.success("关联成功") : AjaxResult.error("关联失败");
-    }
-}

+ 0 - 92
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/gasbasic/GasPipeNetworkController.java

@@ -1,92 +0,0 @@
-package com.zksy.web.controller.gasbasic;
-
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.zksy.base.domain.PipeNetworkBase;
-import com.zksy.base.dto.PipeNetworkExportDTO;
-import com.zksy.base.dto.PipeNetworkPageInDTO;
-import com.zksy.base.service.PipeNetworkBaseService;
-import com.zksy.common.annotation.Anonymous;
-import com.zksy.common.annotation.Log;
-import com.zksy.common.core.domain.AjaxResult;
-import com.zksy.common.enums.BusinessType;
-import com.zksy.common.utils.poi.ExcelUtil;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletResponse;
-import java.util.List;
-
-@Slf4j
-@RestController
-@RequestMapping("/api/pipe-network")
-@Api(tags = "燃气管网基础数据")
-public class GasPipeNetworkController {
-
-    @Autowired
-    private PipeNetworkBaseService service;
-
-    @GetMapping("/findByPage")
-    @ApiOperation("管网分页查询")
-    @Anonymous
-    public AjaxResult findByPage(PipeNetworkPageInDTO dto) {
-        // 燃气模块:仅查询 network_type=0 的燃气设施
-        Page<PipeNetworkBase> page = service.queryGasByPage(dto);
-        return AjaxResult.success(page);
-    }
-
-    @GetMapping("/getById/{id}")
-    @ApiOperation("根据ID查询管网")
-    @Anonymous
-    public AjaxResult getById(@PathVariable String id) {
-        // 燃气模块:仅查询 network_type=0 的燃气设施
-        PipeNetworkBase entity = service.getGasById(id);
-        return entity != null ? AjaxResult.success(entity) : AjaxResult.error("管网信息不存在");
-    }
-
-    @GetMapping("/options")
-    @ApiOperation("管网下拉选项")
-    @Anonymous
-    public AjaxResult options() {
-        // 燃气模块:仅查询 network_type=0 的燃气设施
-        return AjaxResult.success(service.getGasOptions());
-    }
-
-    @PostMapping("/save")
-    @ApiOperation("新增管网")
-    @Log(title = "新增管网基础数据", businessType = BusinessType.INSERT)
-    public AjaxResult save(@RequestBody PipeNetworkBase entity) {
-        boolean saved = service.save(entity);
-        return saved ? AjaxResult.success("新增成功", saved) : AjaxResult.error("新增失败");
-    }
-
-    @PutMapping("/updateById")
-    @ApiOperation("修改管网")
-    @Log(title = "修改管网基础数据", businessType = BusinessType.UPDATE)
-    public AjaxResult updateById(@RequestBody PipeNetworkBase entity) {
-        boolean updated = service.updateWithCheck(entity);
-        return updated ? AjaxResult.success("修改成功", updated) : AjaxResult.error("修改失败");
-    }
-
-    @DeleteMapping("/deleteById")
-    @ApiOperation("删除管网")
-    @Log(title = "删除管网基础数据", businessType = BusinessType.DELETE)
-    public AjaxResult deleteById(@RequestParam String id) {
-        boolean deleted = service.removeById(id);
-        return deleted ? AjaxResult.success("删除成功") : AjaxResult.error("删除失败");
-    }
-
-    @GetMapping("/export")
-    @ApiOperation("导出Excel")
-    @Anonymous
-    public void exportData(HttpServletResponse response,
-                           PipeNetworkPageInDTO dto,
-                           @RequestParam(required = false) List<String> networkIds) {
-        // 燃气模块:仅查询 network_type=0 的燃气设施;networkIds 非空时只导出勾选记录
-        List<PipeNetworkExportDTO> list = service.exportGasData(dto, networkIds);
-        ExcelUtil<PipeNetworkExportDTO> util = new ExcelUtil<>(PipeNetworkExportDTO.class);
-        util.exportExcel(response, list, "燃气管网数据");
-    }
-}

+ 37 - 14
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/manhole/ManholeDeviceController.java

@@ -104,8 +104,10 @@ public class ManholeDeviceController extends BaseController
             @RequestParam(value = "excludeIds", required = false) String excludeIds)
     {
         LambdaQueryWrapper<EquipmentBase> queryWrapper = new LambdaQueryWrapper<>();
-        // 排除窨井类型设备(5=供水窨井, 9=排水窨井, 10=燃气窨井)
-        queryWrapper.notIn(EquipmentBase::getEquipmentTypeId, new String[]{"5", "9", "10"});
+        // 仅查询窨井设备大类(equipment_type.parent_id=4,含历史编码 5/9/10)
+        List<EquipmentType> allTypes = equipmentTypeService.list();
+        List<Integer> allowedTypeIds = com.zksy.base.util.ManholeDeviceTypes.resolveTypeIds(allTypes);
+        queryWrapper.in(EquipmentBase::getEquipmentTypeId, allowedTypeIds);
         if (StringUtils.isNotBlank(keyword)) {
             queryWrapper.and(w -> w
                     .like(EquipmentBase::getEquipmentCode, keyword)
@@ -178,6 +180,27 @@ public class ManholeDeviceController extends BaseController
         return AjaxResult2.success(result);
     }
 
+    /**
+     * 查询所有已绑定窨井的设备ID(一个设备只能绑定一个窨井)
+     */
+    @Anonymous
+    @GetMapping(value = "/rel/boundEquipmentIds")
+    @ApiOperation(value = "查询所有已绑定窨井的设备ID")
+    public AjaxResult2<List<Map<String, Object>>> listBoundEquipmentIds()
+    {
+        List<ManholeDeviceRel> relList = manholeDeviceRelMapper.selectList(
+                new LambdaQueryWrapper<ManholeDeviceRel>()
+                        .select(ManholeDeviceRel::getEquipmentId, ManholeDeviceRel::getManholeId));
+        List<Map<String, Object>> result = new ArrayList<>();
+        for (ManholeDeviceRel rel : relList) {
+            Map<String, Object> item = new HashMap<>();
+            item.put("equipmentId", rel.getEquipmentId());
+            item.put("manholeId", rel.getManholeId());
+            result.add(item);
+        }
+        return AjaxResult2.success(result);
+    }
+
     /**
      * 新增窨井井下设备关联
      */
@@ -194,23 +217,24 @@ public class ManholeDeviceController extends BaseController
         if (manholeId.equals(equipmentId)) {
             return AjaxResult.error("不能关联自身");
         }
-        // 检查是否已存在关联
-        Long count = manholeDeviceRelMapper.selectCount(
+        // 一个设备只能被一个窨井绑定(无论当前窨井还是其他窨井)
+        Long boundCount = manholeDeviceRelMapper.selectCount(
                 new LambdaQueryWrapper<ManholeDeviceRel>()
-                        .eq(ManholeDeviceRel::getManholeId, manholeId)
                         .eq(ManholeDeviceRel::getEquipmentId, equipmentId));
-        if (count > 0) {
-            return AjaxResult.error("该设备已关联,请勿重复关联");
+        if (boundCount > 0) {
+            return AjaxResult.error("该设备已绑定到窨井,一个设备只能绑定一个窨井");
         }
-        // 查询设备名称和类型(冗余存储)
+        // 只允许绑定窨井设备大类(equipment_type.parent_id=4,含历史编码 5/9/10)
+        List<EquipmentType> allTypes = equipmentTypeService.list();
+        List<Integer> allowedTypeIds = com.zksy.base.util.ManholeDeviceTypes.resolveTypeIds(allTypes);
         EquipmentBase equipment = equipmentBaseMapper.selectById(equipmentId);
+        if (equipment == null || equipment.getEquipmentTypeId() == null
+                || !allowedTypeIds.contains(equipment.getEquipmentTypeId())) {
+            return AjaxResult.error("只能绑定窨井设备(设备类型根类 parent_id=4)");
+        }
         ManholeDeviceRel rel = new ManholeDeviceRel();
         rel.setManholeId(manholeId);
         rel.setEquipmentId(equipmentId);
-        if (equipment != null) {
-            rel.setEquipmentName(equipment.getEquipmentName());
-            rel.setEquipmentType(equipment.getEquipmentTypeId() == null ? null : String.valueOf(equipment.getEquipmentTypeId()));
-        }
         rel.setCreateTime(LocalDateTime.now());
         boolean result = manholeDeviceRelMapper.insert(rel) > 0;
         return result ? AjaxResult.success("关联成功", result)
@@ -278,10 +302,9 @@ public class ManholeDeviceController extends BaseController
             Map<String, Object> item = new HashMap<>();
             item.put("relId", rel.getRelId());
             item.put("equipmentId", rel.getEquipmentId());
-            item.put("equipmentName", rel.getEquipmentName());
-            item.put("equipmentType", rel.getEquipmentType());
             EquipmentBase eq = equipmentMap.get(rel.getEquipmentId());
             if (eq != null) {
+                item.put("equipmentName", eq.getEquipmentName());
                 item.put("equipmentCode", eq.getEquipmentCode());
                 item.put("equipmentLocation", eq.getEquipmentLocation());
                 item.put("equipmentTypeId", eq.getEquipmentTypeId());

+ 6 - 3
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/WaterSupply/WaterFacilityExportControllerContractTest.java

@@ -1,5 +1,6 @@
 package com.zksy.web.controller.WaterSupply;
 
+import com.zksy.web.controller.WaterSupply.PumpStationInfo.PumpStationInfoController;
 import org.junit.jupiter.api.Test;
 import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -19,15 +20,17 @@ class WaterFacilityExportControllerContractTest {
         assertPostMapping(WaterFacilityExportController.class, "sourceImportTemplate", "/sourceInfo/importTemplate");
         assertPostMapping(WaterFacilityExportController.class, "plantImportData", "/plantInfo/importData");
         assertPostMapping(WaterFacilityExportController.class, "plantImportTemplate", "/plantInfo/importTemplate");
-        assertPostMapping(WaterFacilityExportController.class, "pumpImportData", "/pumpStation/importData");
-        assertPostMapping(WaterFacilityExportController.class, "pumpImportTemplate", "/pumpStation/importTemplate");
+        // 泵站导入端点已收敛到 PumpStationInfoController(供水/排水公用同一入口)
+        assertPostMapping(PumpStationInfoController.class, "importData", "/importData");
+        assertPostMapping(PumpStationInfoController.class, "importTemplate", "/importTemplate");
         assertPostMapping(WaterFacilityExportController.class, "userImportData", "/userInfo/importData");
         assertPostMapping(WaterFacilityExportController.class, "userImportTemplate", "/userInfo/importTemplate");
     }
 
     @Test
     void allFacilityExportsUseTheFrontendDateTimeContract() {
-        for (String methodName : new String[]{"sourceExport", "plantExport", "pumpExport", "userExport"}) {
+        // 泵站导出已移至 PumpStationInfoController,不再带时间范围参数
+        for (String methodName : new String[]{"sourceExport", "plantExport", "userExport"}) {
             Method method = Arrays.stream(WaterFacilityExportController.class.getDeclaredMethods())
                     .filter(candidate -> candidate.getName().equals(methodName))
                     .findFirst()

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

@@ -2,16 +2,18 @@ package com.zksy.web.controller.cockpit;
 
 import com.zksy.WaterSupply.WaterPlantInfo.domain.WaterPlantInfo;
 import com.zksy.WaterSupply.WaterPlantInfo.service.IWaterPlantInfoService;
-import com.zksy.WaterSupply.WaterPumpStation.domain.PumpStationType;
-import com.zksy.WaterSupply.WaterPumpStation.domain.WaterPumpStation;
-import com.zksy.WaterSupply.WaterPumpStation.service.IWaterPumpStationService;
+import com.zksy.WaterSupply.PumpStationInfo.domain.PumpStationType;
+import com.zksy.WaterSupply.PumpStationInfo.domain.PumpStationInfo;
+import com.zksy.WaterSupply.PumpStationInfo.service.IPumpStationInfoService;
 import com.zksy.base.domain.PipeNetworkBase;
 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.drainage.domain.EngineeringFacility;
-import com.zksy.drainage.service.EngineeringFacilityService;
+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.BeforeEach;
 import org.junit.jupiter.api.Test;
 
@@ -32,19 +34,21 @@ import static org.mockito.Mockito.when;
 class BusinessCockpitInfrastructureBaseArchivesAdapterTest {
 
     private IWaterPlantInfoService plantService;
-    private IWaterPumpStationService pumpStationService;
+    private IPumpStationInfoService pumpStationService;
     private PipeNetworkBaseService pipeNetworkBaseService;
-    private EngineeringFacilityService engineeringFacilityService;
+    private DrainageGateInfoService gateService;
+    private DrainageStorageInfoService storageService;
     private BusinessCockpitInfrastructureBaseArchivesAdapter adapter;
 
     @BeforeEach
     void setUp() {
         plantService = mock(IWaterPlantInfoService.class);
-        pumpStationService = mock(IWaterPumpStationService.class);
+        pumpStationService = mock(IPumpStationInfoService.class);
         pipeNetworkBaseService = mock(PipeNetworkBaseService.class);
-        engineeringFacilityService = mock(EngineeringFacilityService.class);
+        gateService = mock(DrainageGateInfoService.class);
+        storageService = mock(DrainageStorageInfoService.class);
         adapter = new BusinessCockpitInfrastructureBaseArchivesAdapter(
-                plantService, pumpStationService, pipeNetworkBaseService, engineeringFacilityService,
+                plantService, pumpStationService, pipeNetworkBaseService, gateService, storageService,
                 mock(com.zksy.WaterSupply.WaterSourceInfo.service.IWaterSourceInfoService.class),
                 mock(com.zksy.base.service.ManholeBaseService.class));
     }
@@ -56,7 +60,7 @@ class BusinessCockpitInfrastructureBaseArchivesAdapterTest {
         plant.setPlantName("第一水厂");
         plant.setCommissionDate(LocalDate.of(2022, 1, 2));
 
-        WaterPumpStation pump = new WaterPumpStation();
+        PumpStationInfo pump = new PumpStationInfo();
         pump.setStationCode("PUMP-001");
         pump.setStationName("城北泵站");
         pump.setStationType(PumpStationType.WATER_SUPPLY);
@@ -69,16 +73,15 @@ class BusinessCockpitInfrastructureBaseArchivesAdapterTest {
         pipe.setLength(new BigDecimal("2500"));
         pipe.setBuildDate(java.sql.Date.valueOf(LocalDate.of(2010, 3, 4)));
 
-        EngineeringFacility drainage = new EngineeringFacility();
+        DrainageStorageInfo drainage = new DrainageStorageInfo();
         drainage.setFacilityId("DRAIN-001");
         drainage.setFacilityName("一号调蓄池");
         drainage.setLocation("CB");
-        drainage.setFacilityType("1");
 
         when(plantService.list()).thenReturn(Collections.singletonList(plant));
         when(pumpStationService.list()).thenReturn(Collections.singletonList(pump));
         when(pipeNetworkBaseService.list()).thenReturn(Collections.singletonList(pipe));
-        when(engineeringFacilityService.list()).thenReturn(Collections.singletonList(drainage));
+        when(storageService.listAll()).thenReturn(Collections.singletonList(drainage));
 
         CockpitInfrastructureBaseArchivesSnapshot snapshot = adapter.load();
 
@@ -123,7 +126,8 @@ class BusinessCockpitInfrastructureBaseArchivesAdapterTest {
         when(plantService.list()).thenReturn(Collections.emptyList());
         when(pumpStationService.list()).thenReturn(Collections.emptyList());
         when(pipeNetworkBaseService.list()).thenReturn(Arrays.asList(drainage, gas, unknown));
-        when(engineeringFacilityService.list()).thenReturn(Collections.emptyList());
+        when(gateService.listAll()).thenReturn(Collections.emptyList());
+        when(storageService.listAll()).thenReturn(Collections.emptyList());
 
         CockpitInfrastructureBaseArchivesSnapshot snapshot = adapter.load();
 
@@ -147,7 +151,8 @@ class BusinessCockpitInfrastructureBaseArchivesAdapterTest {
         when(plantService.list()).thenReturn(Collections.emptyList());
         when(pumpStationService.list()).thenReturn(Collections.emptyList());
         when(pipeNetworkBaseService.list()).thenReturn(Arrays.asList(gas, drainage, water));
-        when(engineeringFacilityService.list()).thenReturn(Collections.emptyList());
+        when(gateService.listAll()).thenReturn(Collections.emptyList());
+        when(storageService.listAll()).thenReturn(Collections.emptyList());
 
         CockpitInfrastructureBaseArchivesSnapshot snapshot = adapter.load();
 
@@ -172,13 +177,12 @@ class BusinessCockpitInfrastructureBaseArchivesAdapterTest {
     void derivesDistrictFromPipeCodePrefixOnlyAndNeverFromOtherFacilityTypes() {
         WaterPlantInfo plant = new WaterPlantInfo();
         plant.setPlantCode("WP001");
-        WaterPumpStation pump = new WaterPumpStation();
+        PumpStationInfo pump = new PumpStationInfo();
         pump.setStationCode("PS001");
         pump.setStationType(PumpStationType.WATER_SUPPLY);
-        EngineeringFacility drainage = new EngineeringFacility();
+        DrainageStorageInfo drainage = new DrainageStorageInfo();
         // 反例:facilityId 是 UUID(十六进制),cb 开头;它没有片区语义,必须留 null。
         drainage.setFacilityId("cb1234a2e4406485d85ce1b0db51427");
-        drainage.setFacilityType("2");
 
         when(plantService.list()).thenReturn(Collections.singletonList(plant));
         when(pumpStationService.list()).thenReturn(Collections.singletonList(pump));
@@ -186,7 +190,7 @@ class BusinessCockpitInfrastructureBaseArchivesAdapterTest {
                 pipe("CNWS202609080732", "城南排水管线", "1", "1000"),
                 pipe("cbGC202609080001", "城北供水管线", "2", "1500"),
                 pipe("TCRQ202609080001", "太常燃气管线", "0", "500")));
-        when(engineeringFacilityService.list()).thenReturn(Collections.singletonList(drainage));
+        when(storageService.listAll()).thenReturn(Collections.singletonList(drainage));
 
         List<CockpitInfrastructureBaseArchivesSnapshot.SourceFacility> facilities = adapter.load().getFacilities();
 

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

@@ -47,8 +47,10 @@ class BusinessCockpitInfrastructureManagementInformationAdapterTest {
                 equipmentTypeService,
                 new BusinessCockpitInfrastructureBaseArchivesAdapter(
                         mock(com.zksy.WaterSupply.WaterPlantInfo.service.IWaterPlantInfoService.class),
-                        mock(com.zksy.WaterSupply.WaterPumpStation.service.IWaterPumpStationService.class),
-                        pipeNetworkBaseService, mock(com.zksy.drainage.service.EngineeringFacilityService.class),
+                        mock(com.zksy.WaterSupply.PumpStationInfo.service.IPumpStationInfoService.class),
+                        pipeNetworkBaseService,
+                        mock(com.zksy.drainage.service.DrainageGateInfoService.class),
+                        mock(com.zksy.drainage.service.DrainageStorageInfoService.class),
                         waterSourceInfoService, manholeBaseService));
     }
 

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

@@ -3,17 +3,18 @@ package com.zksy.web.controller.cockpit;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.zksy.WaterSupply.WaterPlantInfo.domain.WaterPlantInfo;
 import com.zksy.WaterSupply.WaterPlantInfo.service.IWaterPlantInfoService;
-import com.zksy.WaterSupply.WaterPumpStation.domain.PumpStationType;
-import com.zksy.WaterSupply.WaterPumpStation.domain.WaterPumpStation;
-import com.zksy.WaterSupply.WaterPumpStation.service.IWaterPumpStationService;
+import com.zksy.WaterSupply.PumpStationInfo.domain.PumpStationType;
+import com.zksy.WaterSupply.PumpStationInfo.domain.PumpStationInfo;
+import com.zksy.WaterSupply.PumpStationInfo.service.IPumpStationInfoService;
 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.EngineeringFacility;
-import com.zksy.drainage.service.EngineeringFacilityService;
+import com.zksy.drainage.domain.DrainageStorageInfo;
+import com.zksy.drainage.service.DrainageGateInfoService;
+import com.zksy.drainage.service.DrainageStorageInfoService;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
@@ -34,21 +35,23 @@ import static org.mockito.Mockito.when;
 class BusinessCockpitInfrastructureOperatingInformationAdapterTest {
 
     private IWaterPlantInfoService plantService;
-    private IWaterPumpStationService pumpStationService;
+    private IPumpStationInfoService pumpStationService;
     private PipeNetworkBaseService pipeNetworkBaseService;
-    private EngineeringFacilityService engineeringFacilityService;
+    private DrainageGateInfoService gateService;
+    private DrainageStorageInfoService storageService;
     private ManholeBaseService manholeBaseService;
     private BusinessCockpitInfrastructureOperatingInformationAdapter adapter;
 
     @BeforeEach
     void setUp() {
         plantService = mock(IWaterPlantInfoService.class);
-        pumpStationService = mock(IWaterPumpStationService.class);
+        pumpStationService = mock(IPumpStationInfoService.class);
         pipeNetworkBaseService = mock(PipeNetworkBaseService.class);
-        engineeringFacilityService = mock(EngineeringFacilityService.class);
+        gateService = mock(DrainageGateInfoService.class);
+        storageService = mock(DrainageStorageInfoService.class);
         manholeBaseService = mock(ManholeBaseService.class);
         adapter = new BusinessCockpitInfrastructureOperatingInformationAdapter(
-                plantService, pumpStationService, pipeNetworkBaseService, engineeringFacilityService,
+                plantService, pumpStationService, pipeNetworkBaseService, gateService, storageService,
                 manholeBaseService);
     }
 
@@ -62,7 +65,7 @@ class BusinessCockpitInfrastructureOperatingInformationAdapterTest {
         plant.setStatus("0");
         plant.setUpdateTime(LocalDateTime.parse("2026-09-02T09:59:50"));
 
-        WaterPumpStation pump = new WaterPumpStation();
+        PumpStationInfo pump = new PumpStationInfo();
         pump.setStationCode("PUMP-001");
         pump.setStationName("城北泵站");
         pump.setStationType(PumpStationType.WATER_SUPPLY);
@@ -77,16 +80,15 @@ class BusinessCockpitInfrastructureOperatingInformationAdapterTest {
         pipe.setLength(new BigDecimal("2500"));
         pipe.setUpdateTime(LocalDateTime.parse("2026-09-02T09:57:00"));
 
-        EngineeringFacility facility = new EngineeringFacility();
+        DrainageStorageInfo facility = new DrainageStorageInfo();
         facility.setFacilityId("DRAIN-001");
         facility.setFacilityName("一号调蓄池");
-        facility.setFacilityType("1");
         facility.setUpdateTime(LocalDateTime.parse("2026-09-02T09:56:00"));
 
         when(plantService.list()).thenReturn(Collections.singletonList(plant));
         when(pumpStationService.list(any(Wrapper.class))).thenReturn(Collections.singletonList(pump));
         when(pipeNetworkBaseService.list()).thenReturn(Collections.singletonList(pipe));
-        when(engineeringFacilityService.list()).thenReturn(Collections.singletonList(facility));
+        when(storageService.listAll()).thenReturn(Collections.singletonList(facility));
 
         CockpitInfrastructureOperatingInformationSnapshot snapshot = adapter.load();
 
@@ -128,7 +130,8 @@ class BusinessCockpitInfrastructureOperatingInformationAdapterTest {
         when(plantService.list()).thenReturn(Collections.emptyList());
         when(pumpStationService.list(any(Wrapper.class))).thenReturn(Collections.emptyList());
         when(pipeNetworkBaseService.list()).thenReturn(Arrays.asList(drainage, gas, unknown));
-        when(engineeringFacilityService.list()).thenReturn(Collections.emptyList());
+        when(gateService.listAll()).thenReturn(Collections.emptyList());
+        when(storageService.listAll()).thenReturn(Collections.emptyList());
 
         CockpitInfrastructureOperatingInformationSnapshot snapshot = adapter.load();
 
@@ -156,7 +159,8 @@ class BusinessCockpitInfrastructureOperatingInformationAdapterTest {
         when(plantService.list()).thenReturn(Collections.emptyList());
         when(pumpStationService.list(any(Wrapper.class))).thenReturn(Collections.emptyList());
         when(pipeNetworkBaseService.list()).thenReturn(Collections.emptyList());
-        when(engineeringFacilityService.list()).thenReturn(Collections.emptyList());
+        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")));
@@ -181,7 +185,8 @@ class BusinessCockpitInfrastructureOperatingInformationAdapterTest {
         when(plantService.list()).thenReturn(Collections.emptyList());
         when(pumpStationService.list(any(Wrapper.class))).thenReturn(Collections.emptyList());
         when(pipeNetworkBaseService.list()).thenReturn(Collections.emptyList());
-        when(engineeringFacilityService.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();
@@ -197,7 +202,8 @@ class BusinessCockpitInfrastructureOperatingInformationAdapterTest {
                 pipe("P-GAS", "燃气管线", "0", "500"),
                 pipe("P-DRAIN", "排水管线", "1", "1000"),
                 pipe("P-WATER", "供水管线", "2", "1500")));
-        when(engineeringFacilityService.list()).thenReturn(Collections.emptyList());
+        when(gateService.listAll()).thenReturn(Collections.emptyList());
+        when(storageService.listAll()).thenReturn(Collections.emptyList());
 
         CockpitInfrastructureOperatingInformationSnapshot snapshot = adapter.load();
 

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

@@ -2,9 +2,9 @@ package com.zksy.web.controller.cockpit;
 
 import com.zksy.WaterSupply.WaterPlantInfo.domain.WaterPlantInfo;
 import com.zksy.WaterSupply.WaterPlantInfo.service.IWaterPlantInfoService;
-import com.zksy.WaterSupply.WaterPumpStation.domain.PumpStationType;
-import com.zksy.WaterSupply.WaterPumpStation.domain.WaterPumpStation;
-import com.zksy.WaterSupply.WaterPumpStation.service.IWaterPumpStationService;
+import com.zksy.WaterSupply.PumpStationInfo.domain.PumpStationType;
+import com.zksy.WaterSupply.PumpStationInfo.domain.PumpStationInfo;
+import com.zksy.WaterSupply.PumpStationInfo.service.IPumpStationInfoService;
 import com.zksy.base.domain.EquipmentBase;
 import com.zksy.base.domain.EquipmentType;
 import com.zksy.base.domain.PipeNetworkBase;
@@ -14,7 +14,8 @@ import com.zksy.base.service.PipeNetworkBaseService;
 import com.zksy.cockpit.infrastructure.BusinessCockpitInfrastructureBaseArchivesAdapter;
 import com.zksy.cockpit.infrastructure.CockpitFacilityCatalog;
 import com.zksy.cockpit.overview.BusinessCockpitOverviewInfrastructureAdapter;
-import com.zksy.drainage.service.EngineeringFacilityService;
+import com.zksy.drainage.service.DrainageGateInfoService;
+import com.zksy.drainage.service.DrainageStorageInfoService;
 import com.zksy.cockpit.overview.CockpitOverviewInfrastructureSnapshot;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
@@ -38,7 +39,7 @@ class BusinessCockpitOverviewInfrastructureAdapterTest {
     private EquipmentBaseService equipmentBaseService;
     private PipeNetworkBaseService pipeNetworkBaseService;
     private IWaterPlantInfoService plantService;
-    private IWaterPumpStationService pumpStationService;
+    private IPumpStationInfoService pumpStationService;
     private BusinessCockpitOverviewInfrastructureAdapter adapter;
 
     @BeforeEach
@@ -47,9 +48,10 @@ class BusinessCockpitOverviewInfrastructureAdapterTest {
         equipmentBaseService = mock(EquipmentBaseService.class);
         pipeNetworkBaseService = mock(PipeNetworkBaseService.class);
         plantService = mock(IWaterPlantInfoService.class);
-        pumpStationService = mock(IWaterPumpStationService.class);
+        pumpStationService = mock(IPumpStationInfoService.class);
         CockpitFacilityCatalog catalog = new BusinessCockpitInfrastructureBaseArchivesAdapter(
-                plantService, pumpStationService, pipeNetworkBaseService, mock(EngineeringFacilityService.class),
+                plantService, pumpStationService, pipeNetworkBaseService,
+                mock(DrainageGateInfoService.class), mock(DrainageStorageInfoService.class),
                 mock(com.zksy.WaterSupply.WaterSourceInfo.service.IWaterSourceInfoService.class),
                 mock(com.zksy.base.service.ManholeBaseService.class));
         adapter = new BusinessCockpitOverviewInfrastructureAdapter(equipmentTypeService, equipmentBaseService, catalog);
@@ -146,13 +148,13 @@ class BusinessCockpitOverviewInfrastructureAdapterTest {
         plant.setUpdateTime(LocalDateTime.parse("2026-09-03T08:00:00"));
         when(plantService.list()).thenReturn(Collections.singletonList(plant));
 
-        WaterPumpStation water = new WaterPumpStation();
+        PumpStationInfo water = new PumpStationInfo();
         water.setStationCode("PS-1");
         water.setStationType(PumpStationType.WATER_SUPPLY);
-        WaterPumpStation drainage = new WaterPumpStation();
+        PumpStationInfo drainage = new PumpStationInfo();
         drainage.setStationCode("PS-2");
         drainage.setStationType(PumpStationType.DRAINAGE);
-        WaterPumpStation unclassified = new WaterPumpStation();
+        PumpStationInfo unclassified = new PumpStationInfo();
         unclassified.setStationCode("PS-3");
         unclassified.setStationType("unknown");
         when(pumpStationService.list()).thenReturn(Arrays.asList(water, drainage, unclassified));

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

@@ -2,13 +2,14 @@ package com.zksy.web.controller.cockpit;
 
 import com.zksy.WaterSupply.WaterPlantInfo.domain.WaterPlantInfo;
 import com.zksy.WaterSupply.WaterPlantInfo.service.IWaterPlantInfoService;
-import com.zksy.WaterSupply.WaterPumpStation.domain.WaterPumpStation;
-import com.zksy.WaterSupply.WaterPumpStation.service.IWaterPumpStationService;
+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.EngineeringFacility;
-import com.zksy.drainage.service.EngineeringFacilityService;
+import com.zksy.drainage.domain.DrainageGateInfo;
+import com.zksy.drainage.service.DrainageGateInfoService;
+import com.zksy.drainage.service.DrainageStorageInfoService;
 import org.junit.jupiter.api.Test;
 import static org.junit.jupiter.api.Assertions.*;
 import static org.mockito.Mockito.*;
@@ -16,20 +17,21 @@ import static org.mockito.Mockito.*;
 class CockpitEntityDetailServiceTest {
     private final PipeNetworkBaseService pipes = mock(PipeNetworkBaseService.class);
     private final IWaterPlantInfoService plants = mock(IWaterPlantInfoService.class);
-    private final IWaterPumpStationService stations = mock(IWaterPumpStationService.class);
+    private final IPumpStationInfoService stations = mock(IPumpStationInfoService.class);
     private final EquipmentBaseService equipment = mock(EquipmentBaseService.class);
-    private final EngineeringFacilityService engineering = mock(EngineeringFacilityService.class);
+    private final DrainageGateInfoService gates = mock(DrainageGateInfoService.class);
+    private final DrainageStorageInfoService storages = mock(DrainageStorageInfoService.class);
     private final EquipmentStatusService equipmentStatuses = mock(EquipmentStatusService.class);
     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, engineering, equipmentStatuses, hazards, risks, manholes);
+    private final CockpitEntityDetailService service = new CockpitEntityDetailService(pipes, plants, stations, equipment, gates, storages, equipmentStatuses, hazards, risks, manholes);
 
     @Test void resolvesEverySupportedCategoryWithStableAttributes() {
         PipeNetworkBase pipe = new PipeNetworkBase(); pipe.setNetworkId("p1"); pipe.setNetworkCode("PN1"); pipe.setNetworkName("管网"); pipe.setMaterial("PE"); when(pipes.getById("p1")).thenReturn(pipe);
-        WaterPlantInfo plant = new WaterPlantInfo(); plant.setId(2L); plant.setPlantCode("WP1"); plant.setPlantName("水厂"); plant.setTreatmentProcess("过滤"); when(plants.getById("2")).thenReturn(plant);
-        WaterPumpStation station = new WaterPumpStation(); station.setId(3L); station.setStationCode("PS1"); station.setStationName("泵站"); station.setPumpCount(2); when(stations.getById("3")).thenReturn(station);
-        EngineeringFacility engineeringFacility = new EngineeringFacility(); engineeringFacility.setFacilityId("f1"); engineeringFacility.setFacilityCode("EF1"); engineeringFacility.setFacilityName("排水闸门"); engineeringFacility.setDesignFlow(new java.math.BigDecimal("3.5")); engineeringFacility.setEquipmentId("d1,d2"); when(engineering.getById("f1")).thenReturn(engineeringFacility);
+        WaterPlantInfo plant = new WaterPlantInfo(); plant.setId("2"); plant.setPlantCode("WP1"); plant.setPlantName("水厂"); plant.setTreatmentProcess("过滤"); when(plants.getById("2")).thenReturn(plant);
+        PumpStationInfo station = new PumpStationInfo(); station.setId("3"); station.setStationCode("PS1"); station.setStationName("泵站"); station.setPumpCount(2); when(stations.getById("3")).thenReturn(station);
+        DrainageGateInfo gate = new DrainageGateInfo(); gate.setFacilityId("f1"); gate.setFacilityCode("EF1"); gate.setFacilityName("排水闸门"); gate.setDesignFlow(new java.math.BigDecimal("3.5")); gate.setEquipmentId("d1,d2"); when(gates.getEntityById("f1")).thenReturn(gate);
         EquipmentBase linked = new EquipmentBase(); linked.setEquipmentId("d1"); linked.setEquipmentCode("D-1"); linked.setEquipmentName("闸门控制器"); linked.setEquipmentLocation("城南"); when(equipment.getById("d1")).thenReturn(linked);
         EquipmentStatus linkedStatus = new EquipmentStatus(); linkedStatus.setEquipmentId("d1"); linkedStatus.setOnlineStatus(1); linkedStatus.setAlarmStatus(0); when(equipmentStatuses.getByDeviceCode("D-1")).thenReturn(linkedStatus);
         EquipmentBase resource = new EquipmentBase(); resource.setEquipmentId("e1"); resource.setEquipmentCode("ER1"); resource.setEquipmentName("资源"); resource.setEquipmentModel("M1"); when(equipment.getById("e1")).thenReturn(resource);
@@ -40,6 +42,7 @@ class CockpitEntityDetailServiceTest {
         assertEquals("过滤", service.load("q", "WATER_PLANT", "2").getAttributes().get("treatmentProcess"));
         assertEquals(2, service.load("q", "PUMP_STATION", "3").getAttributes().get("pumpCount"));
         CockpitEntityDetailResponse engineeringDetail = service.load("q", "ENGINEERING_FACILITY", "f1");
+        assertEquals("DRAINAGE_GATE", engineeringDetail.getCategory());
         assertEquals(new java.math.BigDecimal("3.5"), engineeringDetail.getAttributes().get("designFlow"));
         java.util.List<?> linkedDevices = (java.util.List<?>) engineeringDetail.getAttributes().get("devices");
         assertEquals(1, linkedDevices.size());

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

@@ -4,9 +4,9 @@ import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.zksy.WaterSupply.WaterPlantInfo.domain.WaterPlantInfo;
 import com.zksy.WaterSupply.WaterPlantInfo.service.IWaterPlantInfoService;
-import com.zksy.WaterSupply.WaterPumpStation.domain.PumpStationType;
-import com.zksy.WaterSupply.WaterPumpStation.domain.WaterPumpStation;
-import com.zksy.WaterSupply.WaterPumpStation.service.IWaterPumpStationService;
+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.WaterSourceInfo.domain.WaterSourceInfo;
 import com.zksy.WaterSupply.WaterSourceInfo.service.IWaterSourceInfoService;
 import com.zksy.base.domain.ManholeBase;
@@ -14,8 +14,10 @@ import com.zksy.base.domain.PipeNetworkBase;
 import com.zksy.base.service.*;
 import com.zksy.cockpit.infrastructure.*;
 import com.zksy.cockpit.overview.*;
-import com.zksy.drainage.domain.EngineeringFacility;
-import com.zksy.drainage.service.EngineeringFacilityService;
+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;
 
 import java.math.BigDecimal;
@@ -40,39 +42,44 @@ class CockpitFacilityCountCrossEndpointContractTest {
     @Test
     void allLegalFacilityTablesShareTotalsIndustriesAndDistrictSums() {
         IWaterPlantInfoService plants = mock(IWaterPlantInfoService.class);
-        IWaterPumpStationService stations = mock(IWaterPumpStationService.class);
+        IPumpStationInfoService stations = mock(IPumpStationInfoService.class);
         PipeNetworkBaseService pipes = mock(PipeNetworkBaseService.class);
-        EngineeringFacilityService engineering = mock(EngineeringFacilityService.class);
+        DrainageGateInfoService gates = mock(DrainageGateInfoService.class);
+        DrainageStorageInfoService storages = mock(DrainageStorageInfoService.class);
         IWaterSourceInfoService sources = mock(IWaterSourceInfoService.class);
         ManholeBaseService manholes = mock(ManholeBaseService.class);
         WaterPlantInfo plant = new WaterPlantInfo();
         plant.setPlantCode("SHARED-CODE");
         plant.setCommissionDate(LocalDate.of(2030, 1, 1));
-        WaterPumpStation water = station("WATER-PUMP", PumpStationType.WATER_SUPPLY);
-        WaterPumpStation drainage = station("DRAIN-PUMP", PumpStationType.DRAINAGE);
-        WaterPumpStation unknownStation = station("UNKNOWN-PUMP", "unknown");
+        PumpStationInfo water = station("WATER-PUMP", PumpStationType.WATER_SUPPLY);
+        PumpStationInfo drainage = station("DRAIN-PUMP", PumpStationType.DRAINAGE);
+        PumpStationInfo unknownStation = station("UNKNOWN-PUMP", "unknown");
         WaterSourceInfo source = new WaterSourceInfo();
         source.setSourceId("SHARED-CODE"); // 跨类型同码是不同设施,不能由管理信息误去重。
         ManholeBase manhole = new ManholeBase();
         manhole.setManholeCode("MH-1");
-        EngineeringFacility gate = new EngineeringFacility();
+        DrainageGateInfo gate = new DrainageGateInfo();
         gate.setFacilityId("GATE-1");
-        gate.setFacilityType("0");
-        EngineeringFacility pump = new EngineeringFacility();
-        pump.setFacilityId("ENGINEERING-PUMP");
-        pump.setFacilityType("2");
-        EngineeringFacility unknown = new EngineeringFacility();
+        gate.setFacilityCode("GATE-1");
+        DrainageStorageInfo storage = new DrainageStorageInfo();
+        storage.setFacilityId("STORAGE-1");
+        storage.setFacilityCode("STORAGE-1");
+        DrainageStorageInfo storagePump = new DrainageStorageInfo();
+        storagePump.setFacilityId("ENGINEERING-PUMP");
+        storagePump.setFacilityCode("ENGINEERING-PUMP");
+        DrainageGateInfo unknown = new DrainageGateInfo();
         unknown.setFacilityId("UNKNOWN-1");
-        unknown.setFacilityType("unclassified");
+        unknown.setFacilityCode(null); // 缺编码 → 计入 excluded.unknownTypeCount
         WaterPlantInfo missingCode = new WaterPlantInfo();
         when(plants.list()).thenReturn(Arrays.asList(plant, missingCode));
         when(stations.list()).thenReturn(Arrays.asList(water, drainage, unknownStation));
         when(pipes.list()).thenReturn(Arrays.asList(pipe("GAS", "0"), pipe("DRAIN", "1"), pipe("WATER", "2"), pipe("UNKNOWN", "99")));
-        when(engineering.list()).thenReturn(Arrays.asList(gate, pump, unknown));
+        when(gates.listAll()).thenReturn(Arrays.asList(gate, unknown));
+        when(storages.listAll()).thenReturn(Arrays.asList(storage, storagePump));
         when(sources.list()).thenReturn(Collections.singletonList(source));
         when(manholes.list()).thenReturn(Collections.singletonList(manhole));
         CockpitFacilityCatalog catalog = new BusinessCockpitInfrastructureBaseArchivesAdapter(
-                plants, stations, pipes, engineering, sources, manholes);
+                plants, stations, pipes, gates, storages, sources, manholes);
         assertThreeEndpoints(catalog, 10, 4);
     }
 
@@ -127,8 +134,8 @@ class CockpitFacilityCountCrossEndpointContractTest {
         return result;
     }
 
-    private static WaterPumpStation station(String code, String type) {
-        WaterPumpStation station = new WaterPumpStation();
+    private static PumpStationInfo station(String code, String type) {
+        PumpStationInfo station = new PumpStationInfo();
         station.setStationCode(code);
         station.setStationType(type);
         return station;

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

@@ -111,7 +111,6 @@ class CockpitFacilityGeometryControllerTest {
         com.zksy.base.domain.ManholeBase well = new com.zksy.base.domain.ManholeBase();
         well.setManholeId("well-1");
         well.setManholeCode("MH-001");
-        well.setNetworkId("gas-line");
         well.setLongitude(new BigDecimal("110.440"));
         well.setLatitude(new BigDecimal("28.450"));
         when(networks.list()).thenReturn(Collections.singletonList(line));

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

@@ -3,8 +3,8 @@ package com.zksy.web.controller.cockpit;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.zksy.WaterSupply.WaterPlantInfo.service.IWaterPlantInfoService;
-import com.zksy.WaterSupply.WaterPumpStation.domain.WaterPumpStation;
-import com.zksy.WaterSupply.WaterPumpStation.service.IWaterPumpStationService;
+import com.zksy.WaterSupply.PumpStationInfo.domain.PumpStationInfo;
+import com.zksy.WaterSupply.PumpStationInfo.service.IPumpStationInfoService;
 import com.zksy.WaterSupply.WaterSourceInfo.service.IWaterSourceInfoService;
 import com.zksy.base.domain.PipeNetworkBase;
 import com.zksy.base.service.EquipmentBaseService;
@@ -21,7 +21,8 @@ import com.zksy.cockpit.infrastructure.CockpitInfrastructureManagementInformatio
 import com.zksy.cockpit.infrastructure.CockpitInfrastructureOperatingInformationService;
 import com.zksy.cockpit.overview.BusinessCockpitOverviewInfrastructureAdapter;
 import com.zksy.cockpit.overview.CockpitOverviewInfrastructureService;
-import com.zksy.drainage.service.EngineeringFacilityService;
+import com.zksy.drainage.service.DrainageGateInfoService;
+import com.zksy.drainage.service.DrainageStorageInfoService;
 
 
 import org.junit.jupiter.api.BeforeAll;
@@ -70,13 +71,14 @@ class CockpitPipeNetworkCrossEndpointContractTest {
         }
         when(pipes.list()).thenReturn(source);
         IWaterPlantInfoService plants = mock(IWaterPlantInfoService.class);
-        IWaterPumpStationService stations = mock(IWaterPumpStationService.class);
-        EngineeringFacilityService engineering = mock(EngineeringFacilityService.class);
+        IPumpStationInfoService stations = mock(IPumpStationInfoService.class);
+        DrainageGateInfoService gates = mock(DrainageGateInfoService.class);
+        DrainageStorageInfoService storages = mock(DrainageStorageInfoService.class);
         EquipmentTypeService equipmentTypes = mock(EquipmentTypeService.class);
         EquipmentBaseService equipment = mock(EquipmentBaseService.class);
 
         com.zksy.cockpit.infrastructure.CockpitFacilityCatalog catalog =
-                new BusinessCockpitInfrastructureBaseArchivesAdapter(plants, stations, pipes, engineering,
+                new BusinessCockpitInfrastructureBaseArchivesAdapter(plants, stations, pipes, gates, storages,
                         mock(IWaterSourceInfoService.class), mock(ManholeBaseService.class));
         // 只替换表读取;类型解析、未知计数、行业归属与响应构造全部走真实代码。
         JsonNode archives = JSON.valueToTree(new CockpitInfrastructureBaseArchivesService(
@@ -86,7 +88,7 @@ class CockpitPipeNetworkCrossEndpointContractTest {
                 new BusinessCockpitInfrastructureManagementInformationAdapter(equipment, equipmentTypes, catalog),
                 CLOCK).load("management", null, null));
         JsonNode operating = JSON.valueToTree(new CockpitInfrastructureOperatingInformationService(
-                new BusinessCockpitInfrastructureOperatingInformationAdapter(plants, stations, pipes, engineering,
+                new BusinessCockpitInfrastructureOperatingInformationAdapter(plants, stations, pipes, gates, storages,
                         mock(ManholeBaseService.class)),
                 CLOCK, 60).load("operating", null, null, null, null));
         JsonNode overview = JSON.valueToTree(new CockpitOverviewInfrastructureService(

+ 8 - 8
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterPumpStation/domain/WaterPumpStation.java → pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/PumpStationInfo/domain/PumpStationInfo.java

@@ -1,4 +1,4 @@
-package com.zksy.WaterSupply.WaterPumpStation.domain;
+package com.zksy.WaterSupply.PumpStationInfo.domain;
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
@@ -18,21 +18,21 @@ import java.time.LocalDateTime;
  * 泵站信息实体(公用泵站表:供水/排水共用,按 stationType 区分归属)
  */
 @Data
-@TableName(value = "pump_station", schema = "app_user")
+@TableName(value = "pump_station_info", schema = "app_user")
 @ApiModel(
-        value = "WaterPumpStation",
+        value = "PumpStationInfo",
         description = "公用泵站信息对象,通过 stationType 区分供水泵站(water_supply)与排水泵站(drainage)"
 )
-public class WaterPumpStation {
+public class PumpStationInfo {
 
     @ApiModelProperty(
             value = "主键ID",
-            example = "0",
+            example = "b7a2c1d0e5f34b6a8c9d0e1f2a3b4c5d",
             position = 1,
-            notes = "数据库自增主键,新增时不需要传入"
+            notes = "应用生成 UUID 主键,新增时不需要传入"
     )
-    @TableId(type = IdType.AUTO)
-    private Long id;
+    @TableId(value = "id", type = IdType.ASSIGN_UUID)
+    private String id;
 
     @ApiModelProperty(
             value = "泵站编号",

+ 1 - 1
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterPumpStation/domain/PumpStationType.java → pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/PumpStationInfo/domain/PumpStationType.java

@@ -1,4 +1,4 @@
-package com.zksy.WaterSupply.WaterPumpStation.domain;
+package com.zksy.WaterSupply.PumpStationInfo.domain;
 
 /**
  * 公用泵站信息表 pump_station 的业务归属类型。

+ 8 - 8
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterPumpStation/mapper/WaterPumpStationMapper.java → pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/PumpStationInfo/mapper/PumpStationInfoMapper.java

@@ -1,19 +1,19 @@
-package com.zksy.WaterSupply.WaterPumpStation.mapper;
+package com.zksy.WaterSupply.PumpStationInfo.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.zksy.WaterSupply.WaterPumpStation.domain.WaterPumpStation;
+import com.zksy.WaterSupply.PumpStationInfo.domain.PumpStationInfo;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Update;
 
 import java.time.LocalDateTime;
 import java.util.List;
 
-public interface WaterPumpStationMapper extends BaseMapper<WaterPumpStation> {
+public interface PumpStationInfoMapper extends BaseMapper<PumpStationInfo> {
 
     /**
      * 条件查询泵站列表
      */
-    List<WaterPumpStation> selectStationList(
+    List<PumpStationInfo> selectStationList(
             @Param("stationCode") String stationCode,
             @Param("stationName") String stationName,
             @Param("status") String status,
@@ -24,7 +24,7 @@ public interface WaterPumpStationMapper extends BaseMapper<WaterPumpStation> {
     /**
      * 查询已删除的泵站数据
      */
-    List<WaterPumpStation> selectDeletedList(
+    List<PumpStationInfo> selectDeletedList(
             @Param("stationCode") String stationCode,
             @Param("stationName") String stationName,
             @Param("status") String status,
@@ -34,10 +34,10 @@ public interface WaterPumpStationMapper extends BaseMapper<WaterPumpStation> {
     /**
      * 批量恢复已删除数据
      */
-    int restoreByIds(@Param("ids") List<Long> ids, @Param("updateBy") String updateBy);
+    int restoreByIds(@Param("ids") List<String> ids, @Param("updateBy") String updateBy);
 
     /**
      * 批量彻底物理删除数据
      */
-    int deleteByIdsPhysically(@Param("ids") List<Long> ids);
-}
+    int deleteByIdsPhysically(@Param("ids") List<String> ids);
+}

+ 8 - 8
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterPumpStation/service/IWaterPumpStationService.java → pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/PumpStationInfo/service/IPumpStationInfoService.java

@@ -1,19 +1,19 @@
-package com.zksy.WaterSupply.WaterPumpStation.service;
+package com.zksy.WaterSupply.PumpStationInfo.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.zksy.WaterSupply.WaterPumpStation.domain.WaterPumpStation;
+import com.zksy.WaterSupply.PumpStationInfo.domain.PumpStationInfo;
 
 import java.time.LocalDateTime;
 import java.util.List;
 
-public interface IWaterPumpStationService extends IService<WaterPumpStation> {
+public interface IPumpStationInfoService extends IService<PumpStationInfo> {
 
     /**
      * 分页查询泵站数据
      */
-    IPage<WaterPumpStation> queryPage(Page<WaterPumpStation> page,
+    IPage<PumpStationInfo> queryPage(Page<PumpStationInfo> page,
                                       String stationCode,
                                       String stationName,
                                       String status,
@@ -24,7 +24,7 @@ public interface IWaterPumpStationService extends IService<WaterPumpStation> {
     /**
      * 分页查询回收站数据
      */
-    IPage<WaterPumpStation> queryDeletedPage(Page<WaterPumpStation> page,
+    IPage<PumpStationInfo> queryDeletedPage(Page<PumpStationInfo> page,
                                              String stationCode,
                                              String stationName,
                                              String status,
@@ -34,10 +34,10 @@ public interface IWaterPumpStationService extends IService<WaterPumpStation> {
     /**
      * 批量恢复已删除数据
      */
-    boolean restoreByIds(List<Long> ids, String updateBy);
+    boolean restoreByIds(List<String> ids, String updateBy);
 
     /**
      * 批量彻底物理删除数据
      */
-    boolean deleteByIdsPhysically(List<Long> ids);
-}
+    boolean deleteByIdsPhysically(List<String> ids);
+}

+ 21 - 21
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterPumpStation/service/impl/WaterPumpStationServiceImpl.java → pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/PumpStationInfo/service/impl/PumpStationInfoServiceImpl.java

@@ -1,57 +1,57 @@
-package com.zksy.WaterSupply.WaterPumpStation.service.impl;
+package com.zksy.WaterSupply.PumpStationInfo.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.zksy.WaterSupply.WaterPumpStation.domain.PumpStationType;
-import com.zksy.WaterSupply.WaterPumpStation.domain.WaterPumpStation;
-import com.zksy.WaterSupply.WaterPumpStation.mapper.WaterPumpStationMapper;
-import com.zksy.WaterSupply.WaterPumpStation.service.IWaterPumpStationService;
+import com.zksy.WaterSupply.PumpStationInfo.domain.PumpStationType;
+import com.zksy.WaterSupply.PumpStationInfo.domain.PumpStationInfo;
+import com.zksy.WaterSupply.PumpStationInfo.mapper.PumpStationInfoMapper;
+import com.zksy.WaterSupply.PumpStationInfo.service.IPumpStationInfoService;
 import org.springframework.stereotype.Service;
 
 import java.time.LocalDateTime;
 import java.util.List;
 
 @Service
-public class WaterPumpStationServiceImpl extends ServiceImpl<WaterPumpStationMapper, WaterPumpStation>
-        implements IWaterPumpStationService {
+public class PumpStationInfoServiceImpl extends ServiceImpl<PumpStationInfoMapper, PumpStationInfo>
+        implements IPumpStationInfoService {
 
     @Override
-    public IPage<WaterPumpStation> queryPage(Page<WaterPumpStation> page,
+    public IPage<PumpStationInfo> queryPage(Page<PumpStationInfo> page,
                                              String stationCode,
                                              String stationName,
                                              String status,
                                              String principal,
                                              LocalDateTime startTime,
                                              LocalDateTime endTime) {
-        LambdaQueryWrapper<WaterPumpStation> query = new LambdaQueryWrapper<WaterPumpStation>()
-                .eq(WaterPumpStation::getStationType, PumpStationType.WATER_SUPPLY)
-                .like(stationCode != null && !stationCode.isEmpty(), WaterPumpStation::getStationCode, stationCode)
-                .like(stationName != null && !stationName.isEmpty(), WaterPumpStation::getStationName, stationName)
-                .eq(status != null && !status.isEmpty(), WaterPumpStation::getStatus, status)
-                .like(principal != null && !principal.isEmpty(), WaterPumpStation::getPrincipal, principal)
-                .ge(startTime != null, WaterPumpStation::getCreateTime, startTime)
-                .le(endTime != null, WaterPumpStation::getCreateTime, endTime)
-                .orderByDesc(WaterPumpStation::getCreateTime);
+        LambdaQueryWrapper<PumpStationInfo> query = new LambdaQueryWrapper<PumpStationInfo>()
+                .eq(PumpStationInfo::getStationType, PumpStationType.WATER_SUPPLY)
+                .like(stationCode != null && !stationCode.isEmpty(), PumpStationInfo::getStationCode, stationCode)
+                .like(stationName != null && !stationName.isEmpty(), PumpStationInfo::getStationName, stationName)
+                .eq(status != null && !status.isEmpty(), PumpStationInfo::getStatus, status)
+                .like(principal != null && !principal.isEmpty(), PumpStationInfo::getPrincipal, principal)
+                .ge(startTime != null, PumpStationInfo::getCreateTime, startTime)
+                .le(endTime != null, PumpStationInfo::getCreateTime, endTime)
+                .orderByDesc(PumpStationInfo::getCreateTime);
         return baseMapper.selectPage(page, query);
     }
 
     @Override
-    public IPage<WaterPumpStation> queryDeletedPage(Page<WaterPumpStation> page,
+    public IPage<PumpStationInfo> queryDeletedPage(Page<PumpStationInfo> page,
                                                     String stationCode,
                                                     String stationName,
                                                     String status,
                                                     LocalDateTime startTime,
                                                     LocalDateTime endTime) {
-        List<WaterPumpStation> list = baseMapper.selectDeletedList(stationCode, stationName, status, startTime, endTime);
+        List<PumpStationInfo> list = baseMapper.selectDeletedList(stationCode, stationName, status, startTime, endTime);
         page.setRecords(list);
         page.setTotal(list.size());
         return page;
     }
 
     @Override
-    public boolean restoreByIds(List<Long> ids, String updateBy) {
+    public boolean restoreByIds(List<String> ids, String updateBy) {
         if (ids == null || ids.isEmpty()) {
             return false;
         }
@@ -59,7 +59,7 @@ public class WaterPumpStationServiceImpl extends ServiceImpl<WaterPumpStationMap
     }
 
     @Override
-    public boolean deleteByIdsPhysically(List<Long> ids) {
+    public boolean deleteByIdsPhysically(List<String> ids) {
         if (ids == null || ids.isEmpty()) {
             return false;
         }

+ 90 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterFireHydrantInfo/domain/WaterFireHydrantInfo.java

@@ -0,0 +1,90 @@
+package com.zksy.WaterSupply.WaterFireHydrantInfo.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+/**
+ * 供水消火栓信息
+ *
+ * <p>数据表:{@code app_user.water_fire_hydrant_info}。
+ * 类型取字典 {@code water_fire_hydrant_type},状态取字典 {@code infrastructure_status}。
+ */
+@Data
+@TableName(value = "water_fire_hydrant_info", schema = "app_user")
+public class WaterFireHydrantInfo {
+
+    @TableId(value = "hydrant_id", type = IdType.ASSIGN_UUID)
+    @ApiModelProperty("消火栓ID")
+    private String hydrantId;
+
+    @ApiModelProperty("消火栓编号")
+    private String hydrantCode;
+
+    @ApiModelProperty("消火栓名称")
+    private String hydrantName;
+
+    @ApiModelProperty("消火栓类型(字典 water_fire_hydrant_type:0市政室外消火栓 1小区室外消火栓 2室内消火栓)")
+    private String hydrantType;
+
+    @ApiModelProperty("型号")
+    private String model;
+
+    @ApiModelProperty("进水主管管径")
+    private String inletPipeDiameter;
+
+    @ApiModelProperty("出水口规格")
+    private String outletSpec;
+
+    @ApiModelProperty("产权单位")
+    private String ownershipUnit;
+
+    @ApiModelProperty("管护单位")
+    private String maintenanceUnit;
+
+    @ApiModelProperty("责任人")
+    private String principal;
+
+    @ApiModelProperty("联系电话")
+    private String contactPhone;
+
+    @ApiModelProperty("位置描述")
+    private String location;
+
+    @ApiModelProperty("经度")
+    private BigDecimal longitude;
+
+    @ApiModelProperty("纬度")
+    private BigDecimal latitude;
+
+    @ApiModelProperty("状态(字典 infrastructure_status:0正常 1异常)")
+    private String status;
+
+    @ApiModelProperty("备注")
+    private String remark;
+
+    @ApiModelProperty("创建人")
+    private String createBy;
+
+    @ApiModelProperty("创建时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private LocalDateTime createTime;
+
+    @ApiModelProperty("更新人")
+    private String updateBy;
+
+    @ApiModelProperty("更新时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private LocalDateTime updateTime;
+
+    @TableLogic(value = "0", delval = "2")
+    @ApiModelProperty("删除标志(0正常 2删除)")
+    private String delFlag;
+}

+ 9 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterFireHydrantInfo/mapper/WaterFireHydrantInfoMapper.java

@@ -0,0 +1,9 @@
+package com.zksy.WaterSupply.WaterFireHydrantInfo.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zksy.WaterSupply.WaterFireHydrantInfo.domain.WaterFireHydrantInfo;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface WaterFireHydrantInfoMapper extends BaseMapper<WaterFireHydrantInfo> {
+}

+ 33 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterFireHydrantInfo/service/IWaterFireHydrantInfoService.java

@@ -0,0 +1,33 @@
+package com.zksy.WaterSupply.WaterFireHydrantInfo.service;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.zksy.WaterSupply.WaterFireHydrantInfo.domain.WaterFireHydrantInfo;
+
+/**
+ * 供水消火栓信息服务
+ */
+public interface IWaterFireHydrantInfoService extends IService<WaterFireHydrantInfo> {
+
+    /**
+     * 分页查询消火栓。
+     *
+     * @param page        分页参数
+     * @param hydrantCode 消火栓编号(模糊)
+     * @param hydrantName 消火栓名称(模糊)
+     * @param hydrantType 消火栓类型(字典 water_fire_hydrant_type)
+     * @param status      状态(字典 infrastructure_status)
+     */
+    Page<WaterFireHydrantInfo> queryPage(Page<WaterFireHydrantInfo> page, String hydrantCode, String hydrantName,
+                                         String hydrantType, String status);
+
+    /**
+     * 新增消火栓:校验编号唯一,补齐默认值与审计字段。
+     */
+    boolean saveWithCheck(WaterFireHydrantInfo entity);
+
+    /**
+     * 修改消火栓:校验编号唯一(排除自身)。
+     */
+    boolean updateWithCheck(WaterFireHydrantInfo entity);
+}

+ 75 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterFireHydrantInfo/service/impl/WaterFireHydrantInfoServiceImpl.java

@@ -0,0 +1,75 @@
+package com.zksy.WaterSupply.WaterFireHydrantInfo.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.zksy.WaterSupply.WaterFireHydrantInfo.domain.WaterFireHydrantInfo;
+import com.zksy.WaterSupply.WaterFireHydrantInfo.mapper.WaterFireHydrantInfoMapper;
+import com.zksy.WaterSupply.WaterFireHydrantInfo.service.IWaterFireHydrantInfoService;
+import com.zksy.common.exception.ServiceException;
+import com.zksy.common.utils.SecurityUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDateTime;
+
+@Slf4j
+@Service
+public class WaterFireHydrantInfoServiceImpl
+        extends ServiceImpl<WaterFireHydrantInfoMapper, WaterFireHydrantInfo>
+        implements IWaterFireHydrantInfoService {
+
+    @Override
+    public Page<WaterFireHydrantInfo> queryPage(Page<WaterFireHydrantInfo> page, String hydrantCode,
+                                                 String hydrantName, String hydrantType, String status) {
+        LambdaQueryWrapper<WaterFireHydrantInfo> wrapper = new LambdaQueryWrapper<>();
+        wrapper.like(isNotBlank(hydrantCode), WaterFireHydrantInfo::getHydrantCode, hydrantCode);
+        wrapper.like(isNotBlank(hydrantName), WaterFireHydrantInfo::getHydrantName, hydrantName);
+        wrapper.eq(isNotBlank(hydrantType), WaterFireHydrantInfo::getHydrantType, hydrantType);
+        wrapper.eq(isNotBlank(status), WaterFireHydrantInfo::getStatus, status);
+        wrapper.orderByDesc(WaterFireHydrantInfo::getCreateTime);
+        return this.page(page, wrapper);
+    }
+
+    @Override
+    public boolean saveWithCheck(WaterFireHydrantInfo entity) {
+        if (isNotBlank(entity.getHydrantCode())) {
+            LambdaQueryWrapper<WaterFireHydrantInfo> wrapper = new LambdaQueryWrapper<>();
+            wrapper.eq(WaterFireHydrantInfo::getHydrantCode, entity.getHydrantCode());
+            if (this.count(wrapper) > 0) {
+                throw new ServiceException("消火栓编号已存在:" + entity.getHydrantCode());
+            }
+        }
+        if (!isNotBlank(entity.getStatus())) {
+            entity.setStatus("0");
+        }
+        if (!isNotBlank(entity.getHydrantType())) {
+            entity.setHydrantType("0");
+        }
+        entity.setCreateBy(SecurityUtils.getUsername());
+        entity.setCreateTime(LocalDateTime.now());
+        return this.save(entity);
+    }
+
+    @Override
+    public boolean updateWithCheck(WaterFireHydrantInfo entity) {
+        if (this.getById(entity.getHydrantId()) == null) {
+            throw new ServiceException("消火栓信息不存在:" + entity.getHydrantId());
+        }
+        if (isNotBlank(entity.getHydrantCode())) {
+            LambdaQueryWrapper<WaterFireHydrantInfo> wrapper = new LambdaQueryWrapper<>();
+            wrapper.eq(WaterFireHydrantInfo::getHydrantCode, entity.getHydrantCode())
+                    .ne(WaterFireHydrantInfo::getHydrantId, entity.getHydrantId());
+            if (this.count(wrapper) > 0) {
+                throw new ServiceException("消火栓编号已被使用:" + entity.getHydrantCode());
+            }
+        }
+        entity.setUpdateBy(SecurityUtils.getUsername());
+        entity.setUpdateTime(LocalDateTime.now());
+        return this.updateById(entity);
+    }
+
+    private boolean isNotBlank(String value) {
+        return value != null && !value.trim().isEmpty();
+    }
+}

+ 4 - 4
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterPlantInfo/domain/WaterPlantInfo.java

@@ -27,12 +27,12 @@ public class WaterPlantInfo {
 
     @ApiModelProperty(
             value = "主键ID",
-            example = "0",
+            example = "b7a2c1d0e5f34b6a8c9d0e1f2a3b4c5d",
             position = 1,
-            notes = "数据库自增主键,新增时不需要传入"
+            notes = "应用生成 UUID 主键,新增时不需要传入"
     )
-    @TableId(type = IdType.AUTO)
-    private Long id;
+    @TableId(value = "id", type = IdType.ASSIGN_UUID)
+    private String id;
 
     @ApiModelProperty(
             value = "水厂编号",

+ 2 - 2
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterPlantInfo/mapper/WaterPlantInfoMapper.java

@@ -33,10 +33,10 @@ public interface WaterPlantInfoMapper extends BaseMapper<WaterPlantInfo> {
     /**
      * 批量恢复已删除数据
      */
-    int restoreByIds(@Param("ids") List<Long> ids, @Param("updateBy") String updateBy);
+    int restoreByIds(@Param("ids") List<String> ids, @Param("updateBy") String updateBy);
 
     /**
      * 批量彻底物理删除数据
      */
-    int deleteByIdsPhysically(@Param("ids") List<Long> ids);
+    int deleteByIdsPhysically(@Param("ids") List<String> ids);
 }

+ 2 - 2
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterPlantInfo/service/IWaterPlantInfoService.java

@@ -34,10 +34,10 @@ public interface IWaterPlantInfoService extends IService<WaterPlantInfo> {
     /**
      * 批量恢复已删除数据
      */
-    boolean restoreByIds(List<Long> ids, String updateBy);
+    boolean restoreByIds(List<String> ids, String updateBy);
 
     /**
      * 批量彻底物理删除数据
      */
-    boolean deleteByIdsPhysically(List<Long> ids);
+    boolean deleteByIdsPhysically(List<String> ids);
 }

+ 2 - 2
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterPlantInfo/service/impl/WaterPlantInfoServiceImpl.java

@@ -49,7 +49,7 @@ public class WaterPlantInfoServiceImpl extends ServiceImpl<WaterPlantInfoMapper,
     }
 
     @Override
-    public boolean restoreByIds(List<Long> ids, String updateBy) {
+    public boolean restoreByIds(List<String> ids, String updateBy) {
         if (ids == null || ids.isEmpty()) {
             return false;
         }
@@ -57,7 +57,7 @@ public class WaterPlantInfoServiceImpl extends ServiceImpl<WaterPlantInfoMapper,
     }
 
     @Override
-    public boolean deleteByIdsPhysically(List<Long> ids) {
+    public boolean deleteByIdsPhysically(List<String> ids) {
         if (ids == null || ids.isEmpty()) {
             return false;
         }

+ 6 - 5
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterSourceInfo/domain/WaterSourceInfo.java

@@ -27,19 +27,20 @@ public class WaterSourceInfo {
 
     @ApiModelProperty(
             value = "主键ID",
-            example = "0",
+            example = "b7a2c1d0e5f34b6a8c9d0e1f2a3b4c5d",
             position = 1,
-            notes = "数据库自增主键,新增时不需要传入"
+            notes = "应用生成 UUID 主键,新增时不需要传入"
     )
-    @TableId(type = IdType.AUTO)
-    private Long id;
+    @TableId(value = "id", type = IdType.ASSIGN_UUID)
+    private String id;
 
     @ApiModelProperty(
-            value = "水源地ID",
+            value = "水源地编号(source_id,对应数据库列 source_code)",
             example = "SOURCE_XX",
             required = true,
             position = 2
     )
+    @TableField("source_code")
     private String sourceId;
 
     @ApiModelProperty(

+ 2 - 2
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterSourceInfo/mapper/WaterSourceInfoMapper.java

@@ -24,7 +24,7 @@ public interface WaterSourceInfoMapper extends BaseMapper<WaterSourceInfo> {
             @Param("startTime") LocalDateTime startTime,
             @Param("endTime") LocalDateTime endTime);
 
-    int restoreByIds(@Param("ids") List<Long> ids, @Param("updateBy") String updateBy);
+    int restoreByIds(@Param("ids") List<String> ids, @Param("updateBy") String updateBy);
 
-    int deleteByIdsPhysically(@Param("ids") List<Long> ids);
+    int deleteByIdsPhysically(@Param("ids") List<String> ids);
 }

+ 2 - 2
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterSourceInfo/service/IWaterSourceInfoService.java

@@ -25,7 +25,7 @@ public interface IWaterSourceInfoService extends IService<WaterSourceInfo> {
                                             LocalDateTime startTime,
                                             LocalDateTime endTime);
 
-    boolean restoreByIds(List<Long> ids, String updateBy);
+    boolean restoreByIds(List<String> ids, String updateBy);
 
-    boolean deleteByIdsPhysically(List<Long> ids);
+    boolean deleteByIdsPhysically(List<String> ids);
 }

+ 2 - 2
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterSourceInfo/service/impl/WaterSourceInfoServiceImpl.java

@@ -49,13 +49,13 @@ public class WaterSourceInfoServiceImpl extends ServiceImpl<WaterSourceInfoMappe
     }
 
     @Override
-    public boolean restoreByIds(List<Long> ids, String updateBy) {
+    public boolean restoreByIds(List<String> ids, String updateBy) {
         if (ids == null || ids.isEmpty()) return false;
         return baseMapper.restoreByIds(ids, updateBy) > 0;
     }
 
     @Override
-    public boolean deleteByIdsPhysically(List<Long> ids) {
+    public boolean deleteByIdsPhysically(List<String> ids) {
         if (ids == null || ids.isEmpty()) return false;
         return baseMapper.deleteByIdsPhysically(ids) > 0;
     }

+ 10 - 18
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterSupplyGisMap/service/impl/WaterSupplyGisMapServiceImpl.java

@@ -2,9 +2,9 @@ package com.zksy.WaterSupply.WaterSupplyGisMap.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.zksy.WaterSupply.WaterPlantInfo.service.IWaterPlantInfoService;
-import com.zksy.WaterSupply.WaterPumpStation.domain.PumpStationType;
-import com.zksy.WaterSupply.WaterPumpStation.domain.WaterPumpStation;
-import com.zksy.WaterSupply.WaterPumpStation.service.IWaterPumpStationService;
+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.WaterSourceInfo.service.IWaterSourceInfoService;
 import com.zksy.WaterSupply.WaterSupplyGisMap.dto.GisFeatureCollectionDTO;
 import com.zksy.WaterSupply.WaterSupplyGisMap.dto.GisFeatureDTO;
@@ -33,7 +33,7 @@ public class WaterSupplyGisMapServiceImpl implements WaterSupplyGisMapService {
     @Resource private WaterSupplyGisMapMapper mapper;
     @Resource private IWaterSourceInfoService sourceService;
     @Resource private IWaterPlantInfoService plantService;
-    @Resource private IWaterPumpStationService pumpStationService;
+    @Resource private IPumpStationInfoService pumpStationService;
     /** 管网设施的唯一数据源:统一管网表 pipe_network_base(network_type = '2' 为供水设施)。 */
     @Resource private PipeNetworkBaseService pipeNetworkBaseService;
     @Resource private IWaterUserInfoService userService;
@@ -55,22 +55,14 @@ public class WaterSupplyGisMapServiceImpl implements WaterSupplyGisMapService {
     public Object getDetail(String facilityType, String id) {
         if (!SUPPORTED_TYPES.contains(facilityType)) throw new IllegalArgumentException("不支持的设施类型:" + facilityType);
         switch (facilityType) {
-            case "source": return sourceService.getById(numericId(facilityType, id));
-            case "plant": return plantService.getById(numericId(facilityType, id));
-            case "pumpStation": return pumpStationService.getOne(new LambdaQueryWrapper<WaterPumpStation>()
-                    .eq(WaterPumpStation::getId, numericId(facilityType, id))
-                    .eq(WaterPumpStation::getStationType, PumpStationType.WATER_SUPPLY));
+            case "source": return sourceService.getById(id);
+            case "plant": return plantService.getById(id);
+            case "pumpStation": return pumpStationService.getOne(new LambdaQueryWrapper<PumpStationInfo>()
+                    .eq(PumpStationInfo::getId, id)
+                    .eq(PumpStationInfo::getStationType, PumpStationType.WATER_SUPPLY));
             // 管网主键是 pipe_network_base.network_id,旧独立管网表已退场(#53)。
             case "pipe": return pipeNetworkBaseService.getById(id);
-            default: return userService.getById(numericId(facilityType, id));
-        }
-    }
-
-    private Long numericId(String facilityType, String id) {
-        try {
-            return Long.valueOf(id);
-        } catch (NumberFormatException e) {
-            throw new IllegalArgumentException("设施主键格式不正确:" + facilityType + "/" + id);
+            default: return userService.getById(id);
         }
     }
 

+ 4 - 4
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterUserInfo/domain/WaterUserInfo.java

@@ -26,12 +26,12 @@ public class WaterUserInfo {
 
     @ApiModelProperty(
             value = "主键ID",
-            example = "0",
+            example = "b7a2c1d0e5f34b6a8c9d0e1f2a3b4c5d",
             position = 1,
-            notes = "数据库自增主键,新增时不需要传入"
+            notes = "应用生成 UUID 主键,新增时不需要传入"
     )
-    @TableId(type = IdType.AUTO)
-    private Long id;
+    @TableId(value = "id", type = IdType.ASSIGN_UUID)
+    private String id;
 
     @ApiModelProperty(
             value = "用水户编号",

+ 2 - 2
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterUserInfo/mapper/WaterUserInfoMapper.java

@@ -23,7 +23,7 @@ public interface WaterUserInfoMapper extends BaseMapper<WaterUserInfo> {
             @Param("startTime") LocalDateTime startTime,
             @Param("endTime") LocalDateTime endTime);
 
-    int restoreByIds(@Param("ids") List<Long> ids, @Param("updateBy") String updateBy);
+    int restoreByIds(@Param("ids") List<String> ids, @Param("updateBy") String updateBy);
 
-    int deleteByIdsPhysically(@Param("ids") List<Long> ids);
+    int deleteByIdsPhysically(@Param("ids") List<String> ids);
 }

+ 2 - 2
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterUserInfo/service/IWaterUserInfoService.java

@@ -24,7 +24,7 @@ public interface IWaterUserInfoService extends IService<WaterUserInfo> {
                                           LocalDateTime startTime,
                                           LocalDateTime endTime);
 
-    boolean restoreByIds(List<Long> ids, String updateBy);
+    boolean restoreByIds(List<String> ids, String updateBy);
 
-    boolean deleteByIdsPhysically(List<Long> ids);
+    boolean deleteByIdsPhysically(List<String> ids);
 }

+ 2 - 2
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterUserInfo/service/impl/WaterUserInfoServiceImpl.java

@@ -48,13 +48,13 @@ public class WaterUserInfoServiceImpl extends ServiceImpl<WaterUserInfoMapper, W
     }
 
     @Override
-    public boolean restoreByIds(List<Long> ids, String updateBy) {
+    public boolean restoreByIds(List<String> ids, String updateBy) {
         if (ids == null || ids.isEmpty()) return false;
         return baseMapper.restoreByIds(ids, updateBy) > 0;
     }
 
     @Override
-    public boolean deleteByIdsPhysically(List<Long> ids) {
+    public boolean deleteByIdsPhysically(List<String> ids) {
         if (ids == null || ids.isEmpty()) return false;
         return baseMapper.deleteByIdsPhysically(ids) > 0;
     }

+ 79 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/export/FireHydrantImportDTO.java

@@ -0,0 +1,79 @@
+package com.zksy.WaterSupply.export;
+
+import com.zksy.WaterSupply.WaterFireHydrantInfo.domain.WaterFireHydrantInfo;
+import com.zksy.base.dto.FacilityImportBaseDTO;
+import com.zksy.common.annotation.Excel;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * 供水消火栓信息(app_user.water_fire_hydrant_info)Excel 导入/导出列定义。
+ * 字典:water_fire_hydrant_type、infrastructure_status。
+ */
+@Data
+public class FireHydrantImportDTO extends FacilityImportBaseDTO {
+
+    @Excel(name = "*消火栓编号", sort = 1, width = 20)
+    private String hydrantCode;
+
+    @Excel(name = "*消火栓名称", sort = 2, width = 22)
+    private String hydrantName;
+
+    @Excel(name = "消火栓类型", sort = 3, width = 24,
+            dictType = "water_fire_hydrant_type", comboReadDict = true,
+            prompt = "请从下拉框选择消火栓类型")
+    private String hydrantType;
+
+    @Excel(name = "状态", sort = 4, width = 12,
+            dictType = "infrastructure_status", comboReadDict = true,
+            prompt = "请从下拉框选择状态")
+    private String status;
+
+    @Excel(name = "型号", sort = 5, width = 16)
+    private String model;
+
+    @Excel(name = "进水主管管径", sort = 6, width = 16)
+    private String inletPipeDiameter;
+
+    @Excel(name = "出水口规格", sort = 7, width = 16)
+    private String outletSpec;
+
+    @Excel(name = "产权单位", sort = 8, width = 24)
+    private String ownershipUnit;
+
+    @Excel(name = "管护单位", sort = 9, width = 24)
+    private String maintenanceUnit;
+
+    @Excel(name = "责任人", sort = 10, width = 14)
+    private String principal;
+
+    @Excel(name = "联系电话", sort = 11, width = 18)
+    private String contactPhone;
+
+    @Excel(name = "经度", sort = 91, width = 14)
+    private BigDecimal longitude;
+
+    @Excel(name = "纬度", sort = 92, width = 14)
+    private BigDecimal latitude;
+
+    public static FireHydrantImportDTO from(WaterFireHydrantInfo value) {
+        FireHydrantImportDTO dto = new FireHydrantImportDTO();
+        dto.setHydrantCode(value.getHydrantCode());
+        dto.setHydrantName(value.getHydrantName());
+        dto.setHydrantType(value.getHydrantType());
+        dto.setStatus(value.getStatus());
+        dto.setModel(value.getModel());
+        dto.setInletPipeDiameter(value.getInletPipeDiameter());
+        dto.setOutletSpec(value.getOutletSpec());
+        dto.setOwnershipUnit(value.getOwnershipUnit());
+        dto.setMaintenanceUnit(value.getMaintenanceUnit());
+        dto.setPrincipal(value.getPrincipal());
+        dto.setContactPhone(value.getContactPhone());
+        dto.setLocation(value.getLocation());
+        dto.setLongitude(value.getLongitude());
+        dto.setLatitude(value.getLatitude());
+        dto.setRemark(value.getRemark());
+        return dto;
+    }
+}

+ 22 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/export/PumpStationInfoExportDTO.java

@@ -0,0 +1,22 @@
+package com.zksy.WaterSupply.export;
+
+import com.zksy.WaterSupply.PumpStationInfo.domain.PumpStationInfo;
+import com.zksy.common.annotation.Excel;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class PumpStationInfoExportDTO {
+    @Excel(name = "泵站编号") private String stationCode;
+    @Excel(name = "泵站名称") private String stationName;
+    @Excel(name = "位置") private String location;
+    @Excel(name = "泵数量") private Integer pumpCount;
+    @Excel(name = "设计流量") private BigDecimal designFlow;
+    @Excel(name = "设计扬程") private BigDecimal designHead;
+    @Excel(name = "状态", dictType = "infrastructure_status", comboReadDict = true,
+            prompt = "请从下拉框选择运行状态") private String status;
+    @Excel(name = "经度") private BigDecimal longitude;
+    @Excel(name = "纬度") private BigDecimal latitude;
+    public static PumpStationInfoExportDTO from(PumpStationInfo value) { PumpStationInfoExportDTO dto = new PumpStationInfoExportDTO(); dto.stationCode=value.getStationCode(); dto.stationName=value.getStationName(); dto.location=value.getLocation(); dto.pumpCount=value.getPumpCount(); dto.designFlow=value.getDesignFlow(); dto.designHead=value.getDesignHead(); dto.status=value.getStatus(); dto.longitude=value.getLongitude(); dto.latitude=value.getLatitude(); return dto; }
+}

+ 2 - 1
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/export/WaterPlantExportDTO.java

@@ -13,7 +13,8 @@ public class WaterPlantExportDTO {
     @Excel(name = "位置") private String location;
     @Excel(name = "设计能力") private BigDecimal designCapacity;
     @Excel(name = "当前能力") private BigDecimal currentCapacity;
-    @Excel(name = "状态") private String status;
+    @Excel(name = "状态", dictType = "water_plant_status", comboReadDict = true,
+            prompt = "请从下拉框选择运行状态") private String status;
     @Excel(name = "经度") private BigDecimal longitude;
     @Excel(name = "纬度") private BigDecimal latitude;
     public static WaterPlantExportDTO from(WaterPlantInfo value) { WaterPlantExportDTO dto = new WaterPlantExportDTO(); dto.plantCode=value.getPlantCode(); dto.plantName=value.getPlantName(); dto.location=value.getLocation(); dto.designCapacity=value.getDesignCapacity(); dto.currentCapacity=value.getCurrentCapacity(); dto.status=value.getStatus(); dto.longitude=value.getLongitude(); dto.latitude=value.getLatitude(); return dto; }

+ 0 - 21
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/export/WaterPumpStationExportDTO.java

@@ -1,21 +0,0 @@
-package com.zksy.WaterSupply.export;
-
-import com.zksy.WaterSupply.WaterPumpStation.domain.WaterPumpStation;
-import com.zksy.common.annotation.Excel;
-import lombok.Data;
-
-import java.math.BigDecimal;
-
-@Data
-public class WaterPumpStationExportDTO {
-    @Excel(name = "泵站编号") private String stationCode;
-    @Excel(name = "泵站名称") private String stationName;
-    @Excel(name = "位置") private String location;
-    @Excel(name = "泵数量") private Integer pumpCount;
-    @Excel(name = "设计流量") private BigDecimal designFlow;
-    @Excel(name = "设计扬程") private BigDecimal designHead;
-    @Excel(name = "状态") private String status;
-    @Excel(name = "经度") private BigDecimal longitude;
-    @Excel(name = "纬度") private BigDecimal latitude;
-    public static WaterPumpStationExportDTO from(WaterPumpStation value) { WaterPumpStationExportDTO dto = new WaterPumpStationExportDTO(); dto.stationCode=value.getStationCode(); dto.stationName=value.getStationName(); dto.location=value.getLocation(); dto.pumpCount=value.getPumpCount(); dto.designFlow=value.getDesignFlow(); dto.designHead=value.getDesignHead(); dto.status=value.getStatus(); dto.longitude=value.getLongitude(); dto.latitude=value.getLatitude(); return dto; }
-}

+ 8 - 4
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/export/WaterSourceExportDTO.java

@@ -10,10 +10,14 @@ import java.math.BigDecimal;
 public class WaterSourceExportDTO {
     @Excel(name = "水源地编号") private String sourceId;
     @Excel(name = "水源地名称") private String sourceName;
-    @Excel(name = "水源类型") private String waterType;
-    @Excel(name = "水质等级") private String waterQualityLevel;
-    @Excel(name = "保护等级") private String protectionLevel;
-    @Excel(name = "状态") private String status;
+    @Excel(name = "水源类型", dictType = "water_source_type", comboReadDict = true,
+            prompt = "请从下拉框选择水源类型") private String waterType;
+    @Excel(name = "水质等级", dictType = "water_quality_grade", comboReadDict = true,
+            prompt = "请从下拉框选择水质等级") private String waterQualityLevel;
+    @Excel(name = "保护等级", dictType = "water_source_protection_level", comboReadDict = true,
+            prompt = "请从下拉框选择保护等级") private String protectionLevel;
+    @Excel(name = "状态", dictType = "infrastructure_status", comboReadDict = true,
+            prompt = "请从下拉框选择状态") private String status;
     @Excel(name = "经度") private BigDecimal longitude;
     @Excel(name = "纬度") private BigDecimal latitude;
     public static WaterSourceExportDTO from(WaterSourceInfo value) { WaterSourceExportDTO dto = new WaterSourceExportDTO(); dto.sourceId=value.getSourceId(); dto.sourceName=value.getSourceName(); dto.waterType=value.getWaterType(); dto.waterQualityLevel=value.getWaterQualityLevel(); dto.protectionLevel=value.getProtectionLevel(); dto.status=value.getStatus(); dto.longitude=value.getLongitude(); dto.latitude=value.getLatitude(); return dto; }

+ 4 - 2
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/export/WaterUserExportDTO.java

@@ -10,10 +10,12 @@ import java.math.BigDecimal;
 public class WaterUserExportDTO {
     @Excel(name = "用水户编号") private String userCode;
     @Excel(name = "用水户名称") private String userName;
-    @Excel(name = "用水户类型") private String userType;
+    @Excel(name = "用水户类型", dictType = "water_user_type", comboReadDict = true,
+            prompt = "请从下拉框选择用水户类型") private String userType;
     @Excel(name = "地址") private String address;
     @Excel(name = "年用水量") private BigDecimal annualWaterConsumption;
-    @Excel(name = "状态") private String status;
+    @Excel(name = "状态", dictType = "water_user_status", comboReadDict = true,
+            prompt = "请从下拉框选择用水户状态") private String status;
     @Excel(name = "经度") private BigDecimal longitude;
     @Excel(name = "纬度") private BigDecimal latitude;
     public static WaterUserExportDTO from(WaterUserInfo value) { WaterUserExportDTO dto = new WaterUserExportDTO(); dto.userCode=value.getUserCode(); dto.userName=value.getUserName(); dto.userType=value.getUserType(); dto.address=value.getAddress(); dto.annualWaterConsumption=value.getAnnualWaterConsumption(); dto.status=value.getStatus(); dto.longitude=value.getLongitude(); dto.latitude=value.getLatitude(); return dto; }

+ 38 - 15
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/importing/WaterFacilityImportService.java

@@ -4,15 +4,15 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.zksy.WaterSupply.WaterPlantInfo.domain.WaterPlantInfo;
 import com.zksy.WaterSupply.WaterPlantInfo.service.IWaterPlantInfoService;
-import com.zksy.WaterSupply.WaterPumpStation.domain.PumpStationType;
-import com.zksy.WaterSupply.WaterPumpStation.domain.WaterPumpStation;
-import com.zksy.WaterSupply.WaterPumpStation.service.IWaterPumpStationService;
+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.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.export.WaterPlantExportDTO;
-import com.zksy.WaterSupply.export.WaterPumpStationExportDTO;
+import com.zksy.WaterSupply.export.PumpStationInfoExportDTO;
 import com.zksy.WaterSupply.export.WaterSourceExportDTO;
 import com.zksy.WaterSupply.export.WaterUserExportDTO;
 import org.springframework.beans.BeanUtils;
@@ -36,12 +36,12 @@ import java.util.function.Supplier;
 public class WaterFacilityImportService {
     private final IWaterSourceInfoService sourceService;
     private final IWaterPlantInfoService plantService;
-    private final IWaterPumpStationService pumpService;
+    private final IPumpStationInfoService pumpService;
     private final IWaterUserInfoService userService;
 
     public WaterFacilityImportService(IWaterSourceInfoService sourceService,
                                       IWaterPlantInfoService plantService,
-                                      IWaterPumpStationService pumpService,
+                                      IPumpStationInfoService pumpService,
                                       IWaterUserInfoService userService) {
         this.sourceService = sourceService;
         this.plantService = plantService;
@@ -69,18 +69,41 @@ public class WaterFacilityImportService {
                 this::preparePlant), "水厂数据");
     }
 
-    public String importPumps(List<WaterPumpStationExportDTO> rows, boolean updateSupport, String operator) {
-        return importRows(rows, updateSupport, operator, new ImportPlan<WaterPumpStation, WaterPumpStationExportDTO>(
-                WaterPumpStationExportDTO::getStationCode,
-                code -> pumpService.getOne(Wrappers.<WaterPumpStation>lambdaQuery()
-                        .eq(WaterPumpStation::getStationCode, code)
-                        .eq(WaterPumpStation::getStationType, PumpStationType.WATER_SUPPLY), false),
-                WaterPumpStation::new,
+    public String importPumps(List<PumpStationInfoExportDTO> rows, boolean updateSupport, String operator) {
+        return importRows(rows, updateSupport, operator, new ImportPlan<PumpStationInfo, PumpStationInfoExportDTO>(
+                PumpStationInfoExportDTO::getStationCode,
+                code -> pumpService.getOne(Wrappers.<PumpStationInfo>lambdaQuery()
+                        .eq(PumpStationInfo::getStationCode, code)
+                        .eq(PumpStationInfo::getStationType, PumpStationType.WATER_SUPPLY), false),
+                PumpStationInfo::new,
                 (row, entity) -> BeanUtils.copyProperties(row, entity),
                 pumpService,
                 this::preparePump), "泵站数据");
     }
 
+    public String importDrainagePumps(List<PumpStationInfoExportDTO> rows, boolean updateSupport, String operator) {
+        return importRows(rows, updateSupport, operator, new ImportPlan<PumpStationInfo, PumpStationInfoExportDTO>(
+                PumpStationInfoExportDTO::getStationCode,
+                code -> pumpService.getOne(Wrappers.<PumpStationInfo>lambdaQuery()
+                        .eq(PumpStationInfo::getStationCode, code)
+                        .eq(PumpStationInfo::getStationType, PumpStationType.DRAINAGE), false),
+                PumpStationInfo::new,
+                (row, entity) -> BeanUtils.copyProperties(row, entity),
+                pumpService,
+                (entity, update, who, now) -> {
+                    if (update) {
+                        entity.setUpdateBy(who);
+                        entity.setUpdateTime(now);
+                        return;
+                    }
+                    entity.setStationType(PumpStationType.DRAINAGE);
+                    entity.setDelFlag("0");
+                    entity.setCreateBy(who);
+                    entity.setCreateTime(now);
+                    if (entity.getStatus() == null) entity.setStatus("0");
+                }), "排水泵站数据");
+    }
+
     public String importUsers(List<WaterUserExportDTO> rows, boolean updateSupport, String operator) {
         return importRows(rows, updateSupport, operator, new ImportPlan<WaterUserInfo, WaterUserExportDTO>(
                 WaterUserExportDTO::getUserCode,
@@ -121,7 +144,7 @@ public class WaterFacilityImportService {
         initialize(value, operator, now);
     }
 
-    private void preparePump(WaterPumpStation value, boolean update, String operator, LocalDateTime now) {
+    private void preparePump(PumpStationInfo value, boolean update, String operator, LocalDateTime now) {
         if (update) { value.setUpdateBy(operator); value.setUpdateTime(now); return; }
         initialize(value, operator, now);
     }
@@ -141,7 +164,7 @@ public class WaterFacilityImportService {
         if (value.getStatus() == null) value.setStatus("0");
     }
 
-    private void initialize(WaterPumpStation value, String operator, LocalDateTime now) {
+    private void initialize(PumpStationInfo value, String operator, LocalDateTime now) {
         value.setStationType(PumpStationType.WATER_SUPPLY);
         value.setDelFlag("0"); value.setCreateBy(operator); value.setCreateTime(now);
         if (value.getStatus() == null) value.setStatus("0");

+ 4 - 4
pipe-network-service/zksy-system/src/main/java/com/zksy/base/domain/ManholeBase.java

@@ -19,7 +19,7 @@ import java.time.LocalDateTime;
 @Data
 @AllArgsConstructor
 @NoArgsConstructor
-@TableName(value = "manhole_base", schema = "app_user")
+@TableName(value = "manhole_info", schema = "app_user")
 public class ManholeBase {
 
     @TableId(value = "manhole_id", type = IdType.ASSIGN_UUID)
@@ -32,9 +32,6 @@ public class ManholeBase {
     @ApiModelProperty("窨井名称")
     private String manholeName;
 
-    @ApiModelProperty("关联管网设施ID")
-    private String networkId;
-
     @ApiModelProperty("位置描述")
     private String location;
 
@@ -56,6 +53,9 @@ public class ManholeBase {
     @ApiModelProperty("权属单位")
     private String ownershipUnit;
 
+    @ApiModelProperty("窨井类型(字典 manhole_type:0燃气窨井 1排水窨井 2供水窨井)")
+    private String manholeType;
+
     @ApiModelProperty("状态")
     private String status;
 

+ 0 - 6
pipe-network-service/zksy-system/src/main/java/com/zksy/base/domain/ManholeDeviceRel.java

@@ -31,12 +31,6 @@ public class ManholeDeviceRel {
     @ApiModelProperty("设备ID")
     private String equipmentId;
 
-    @ApiModelProperty("设备名称(冗余字段,便于列表展示)")
-    private String equipmentName;
-
-    @ApiModelProperty("设备类型(冗余字段)")
-    private String equipmentType;
-
     @ApiModelProperty("创建时间")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private LocalDateTime createTime;

+ 2 - 7
pipe-network-service/zksy-system/src/main/java/com/zksy/base/domain/PipeNetworkBase.java

@@ -63,15 +63,10 @@ public class PipeNetworkBase {
     @ApiModelProperty("设施名称")
     private String networkName;
 
-    @ApiModelProperty("设施类型(0=燃气设施)")
+    @ApiModelProperty("设施类型")
     private String networkType;
 
-    /**
-     * 等级
-     *
-     * 燃气/供水为压力等级;排水口径下该列用于区分排水管道:0=污水 1=雨水(见库表注释)。
-     */
-    @ApiModelProperty("等级(燃气/供水为压力等级;排水为雨污类型:0=污水 1=雨水)")
+    @ApiModelProperty("排水管类型 0=污水 1=雨水)")
     private String networkLevel;
 
     @ApiModelProperty("管养单位")

+ 22 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/base/dto/FacilityImportBaseDTO.java

@@ -0,0 +1,22 @@
+package com.zksy.base.dto;
+
+import com.zksy.common.annotation.Excel;
+import lombok.Data;
+
+/**
+ * 基础设施 Excel 导入公共列。
+ *
+ * <p>所有设施导入模板共有的位置、坐标、备注列放在此处;
+ * 子类通过 {@code @Excel(sort=...)} 排好业务列顺序,模板表头按 sort 升序生成。
+ * 字典列统一用 {@code dictType + comboReadDict=true}:模板给出中文下拉,
+ * 导入时由 ExcelUtil 反向把中文标签转换成库里存的码值。</p>
+ */
+@Data
+public abstract class FacilityImportBaseDTO {
+
+    @Excel(name = "位置描述", sort = 90, width = 30)
+    private String location;
+
+    @Excel(name = "备注", sort = 94, width = 30)
+    private String remark;
+}

+ 66 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/base/dto/ManholeImportDTO.java

@@ -0,0 +1,66 @@
+package com.zksy.base.dto;
+
+import com.zksy.base.domain.ManholeBase;
+import com.zksy.common.annotation.Excel;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * 窨井信息(app_user.manhole_info)Excel 导入/导出列定义。
+ * 字典:manhole_type、infrastructure_status。
+ */
+@Data
+public class ManholeImportDTO extends FacilityImportBaseDTO {
+
+    @Excel(name = "*窨井编码", sort = 1, width = 20)
+    private String manholeCode;
+
+    @Excel(name = "*窨井名称", sort = 2, width = 22)
+    private String manholeName;
+
+    @Excel(name = "窨井类型", sort = 3, width = 18,
+            dictType = "manhole_type", comboReadDict = true,
+            prompt = "请从下拉框选择窨井类型")
+    private String manholeType;
+
+    @Excel(name = "状态", sort = 4, width = 12,
+            dictType = "infrastructure_status", comboReadDict = true,
+            prompt = "请从下拉框选择状态")
+    private String status;
+
+    @Excel(name = "井深(米)", sort = 6, width = 14)
+    private BigDecimal manholeDepth;
+
+    @Excel(name = "形状", sort = 7, width = 14)
+    private String manholeShape;
+
+    @Excel(name = "材质", sort = 8, width = 14)
+    private String material;
+
+    @Excel(name = "权属单位", sort = 9, width = 24)
+    private String ownershipUnit;
+
+    @Excel(name = "经度", sort = 91, width = 14)
+    private BigDecimal longitude;
+
+    @Excel(name = "纬度", sort = 92, width = 14)
+    private BigDecimal latitude;
+
+    public static ManholeImportDTO from(ManholeBase value) {
+        ManholeImportDTO dto = new ManholeImportDTO();
+        dto.setManholeCode(value.getManholeCode());
+        dto.setManholeName(value.getManholeName());
+        dto.setManholeType(value.getManholeType());
+        dto.setStatus(value.getStatus());
+        dto.setManholeDepth(value.getManholeDepth());
+        dto.setManholeShape(value.getManholeShape());
+        dto.setMaterial(value.getMaterial());
+        dto.setOwnershipUnit(value.getOwnershipUnit());
+        dto.setLocation(value.getLocation());
+        dto.setLongitude(value.getLongitude());
+        dto.setLatitude(value.getLatitude());
+        dto.setRemark(value.getRemark());
+        return dto;
+    }
+}

+ 3 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/base/dto/ManholePageInDTO.java

@@ -20,6 +20,9 @@ public class ManholePageInDTO implements Serializable {
     @ApiModelProperty(value = "状态")
     private String status;
 
+    @ApiModelProperty(value = "窨井类型(字典 manhole_type:0燃气窨井 1排水窨井 2供水窨井)")
+    private String manholeType;
+
     @ApiModelProperty(value = "当前记录起始索引", required = true)
     private Long pageNum;
 

+ 85 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/base/dto/PipeNetworkFacilityImportDTO.java

@@ -0,0 +1,85 @@
+package com.zksy.base.dto;
+
+import com.zksy.base.domain.PipeNetworkBase;
+import com.zksy.common.annotation.Excel;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 管网基础信息(app_user.pipe_network_base)Excel 导入/导出列定义。
+ * 字典:pipe_network_facility_type、infrastructure_status。
+ *
+ * <p>设施类型按模板下拉选择的中文标签导入,由 ExcelUtil 依 dictType 反向转成库内码值。</p>
+ */
+@Data
+public class PipeNetworkFacilityImportDTO extends FacilityImportBaseDTO {
+
+    @Excel(name = "*设施编码", sort = 1, width = 20)
+    private String networkCode;
+
+    @Excel(name = "*设施名称", sort = 2, width = 22)
+    private String networkName;
+
+    @Excel(name = "设施类型", sort = 3, width = 16,
+            dictType = "pipe_network_facility_type", comboReadDict = true,
+            prompt = "请从下拉框选择设施类型")
+    private String networkType;
+
+    @Excel(name = "等级", sort = 4, width = 14)
+    private String networkLevel;
+
+    @Excel(name = "管养单位", sort = 5, width = 24)
+    private String managementUnit;
+
+    @Excel(name = "材质", sort = 6, width = 14)
+    private String material;
+
+    @Excel(name = "长度(m)", sort = 7, width = 14)
+    private BigDecimal length;
+
+    @Excel(name = "管径(mm)", sort = 8, width = 14)
+    private BigDecimal diameter;
+
+    @Excel(name = "建设日期", sort = 9, width = 14, dateFormat = "yyyy-MM-dd")
+    private Date buildDate;
+
+    @Excel(name = "状态", sort = 10, width = 12,
+            dictType = "infrastructure_status", comboReadDict = true,
+            prompt = "请从下拉框选择状态")
+    private String status;
+
+    @Excel(name = "起点经度", sort = 11, width = 14)
+    private BigDecimal startLongitude;
+
+    @Excel(name = "起点纬度", sort = 12, width = 14)
+    private BigDecimal startLatitude;
+
+    @Excel(name = "终点经度", sort = 13, width = 14)
+    private BigDecimal endLongitude;
+
+    @Excel(name = "终点纬度", sort = 14, width = 14)
+    private BigDecimal endLatitude;
+
+    public static PipeNetworkFacilityImportDTO from(PipeNetworkBase value) {
+        PipeNetworkFacilityImportDTO dto = new PipeNetworkFacilityImportDTO();
+        dto.setNetworkCode(value.getNetworkCode());
+        dto.setNetworkName(value.getNetworkName());
+        dto.setNetworkType(value.getNetworkType());
+        dto.setNetworkLevel(value.getNetworkLevel());
+        dto.setManagementUnit(value.getManagementUnit());
+        dto.setMaterial(value.getMaterial());
+        dto.setLength(value.getLength());
+        dto.setDiameter(value.getDiameter());
+        dto.setBuildDate(value.getBuildDate());
+        dto.setStatus(value.getStatus());
+        dto.setStartLongitude(value.getStartLongitude());
+        dto.setStartLatitude(value.getStartLatitude());
+        dto.setEndLongitude(value.getEndLongitude());
+        dto.setEndLatitude(value.getEndLatitude());
+        dto.setLocation(value.getLocation());
+        dto.setRemark(value.getRemark());
+        return dto;
+    }
+}

+ 238 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/base/service/InfrastructureFacilityImportService.java

@@ -0,0 +1,238 @@
+package com.zksy.base.service;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.zksy.WaterSupply.WaterFireHydrantInfo.domain.WaterFireHydrantInfo;
+import com.zksy.WaterSupply.WaterFireHydrantInfo.service.IWaterFireHydrantInfoService;
+import com.zksy.WaterSupply.export.FireHydrantImportDTO;
+import com.zksy.base.domain.ManholeBase;
+import com.zksy.base.domain.PipeNetworkBase;
+import com.zksy.base.dto.ManholeImportDTO;
+import com.zksy.base.dto.PipeNetworkFacilityImportDTO;
+import com.zksy.drainage.domain.DrainageGateInfo;
+import com.zksy.drainage.domain.DrainageStorageInfo;
+import com.zksy.drainage.dto.DrainageGateImportDTO;
+import com.zksy.drainage.dto.DrainageStorageImportDTO;
+import com.zksy.drainage.service.DrainageGateInfoService;
+import com.zksy.drainage.service.DrainageStorageInfoService;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.time.LocalDateTime;
+import java.util.List;
+import java.util.function.BiConsumer;
+import java.util.function.Function;
+import java.util.function.Supplier;
+
+/**
+ * 基础设施档案 Excel 导入统一适配器。
+ *
+ * <p>覆盖管网/窨井/消火栓/排水闸门/排水调蓄五类设施。与供水设施导入一致:
+ * 业务编码为空的行跳过;编码已存在且未勾选“更新已存在”时跳过;落库时补齐审计字段。</p>
+ */
+@Transactional(rollbackFor = Exception.class)
+@Service
+public class InfrastructureFacilityImportService {
+
+    private final ManholeBaseService manholeService;
+    private final PipeNetworkBaseService pipeNetworkService;
+    private final IWaterFireHydrantInfoService fireHydrantService;
+    private final DrainageGateInfoService gateService;
+    private final DrainageStorageInfoService storageService;
+
+    public InfrastructureFacilityImportService(ManholeBaseService manholeService,
+                                               PipeNetworkBaseService pipeNetworkService,
+                                               IWaterFireHydrantInfoService fireHydrantService,
+                                               DrainageGateInfoService gateService,
+                                               DrainageStorageInfoService storageService) {
+        this.manholeService = manholeService;
+        this.pipeNetworkService = pipeNetworkService;
+        this.fireHydrantService = fireHydrantService;
+        this.gateService = gateService;
+        this.storageService = storageService;
+    }
+
+    public String importManholes(List<ManholeImportDTO> rows, boolean updateSupport, String operator) {
+        return importRows(rows, updateSupport, operator, new ImportPlan<ManholeBase, ManholeImportDTO>(
+                ManholeImportDTO::getManholeCode,
+                code -> manholeService.getOne(Wrappers.<ManholeBase>lambdaQuery()
+                        .eq(ManholeBase::getManholeCode, code), false),
+                ManholeBase::new,
+                (row, entity) -> {
+                    entity.setManholeCode(row.getManholeCode());
+                    entity.setManholeName(row.getManholeName());
+                    entity.setManholeType(row.getManholeType());
+                    entity.setStatus(row.getStatus());
+                    entity.setManholeDepth(row.getManholeDepth());
+                    entity.setManholeShape(row.getManholeShape());
+                    entity.setMaterial(row.getMaterial());
+                    entity.setOwnershipUnit(row.getOwnershipUnit());
+                    entity.setLocation(row.getLocation());
+                    entity.setLongitude(row.getLongitude());
+                    entity.setLatitude(row.getLatitude());
+                    entity.setRemark(row.getRemark());
+                },
+                manholeService,
+                (entity, update, who, now) -> {
+                    if (!update) {
+                        entity.setDelFlag("0");
+                        entity.setCreateTime(now);
+                        if (entity.getStatus() == null) entity.setStatus("0");
+                    }
+                }), "窨井数据");
+    }
+
+    public String importNetworks(List<PipeNetworkFacilityImportDTO> rows, boolean updateSupport, String operator) {
+        return importRows(rows, updateSupport, operator, new ImportPlan<PipeNetworkBase, PipeNetworkFacilityImportDTO>(
+                PipeNetworkFacilityImportDTO::getNetworkCode,
+                code -> pipeNetworkService.getOne(Wrappers.<PipeNetworkBase>lambdaQuery()
+                        .eq(PipeNetworkBase::getNetworkCode, code), false),
+                PipeNetworkBase::new,
+                (row, entity) -> {
+                    entity.setNetworkCode(row.getNetworkCode());
+                    entity.setNetworkName(row.getNetworkName());
+                    entity.setNetworkType(row.getNetworkType());
+                    entity.setNetworkLevel(row.getNetworkLevel());
+                    entity.setManagementUnit(row.getManagementUnit());
+                    entity.setMaterial(row.getMaterial());
+                    entity.setLength(row.getLength());
+                    entity.setDiameter(row.getDiameter());
+                    entity.setBuildDate(row.getBuildDate());
+                    entity.setStatus(row.getStatus());
+                    entity.setStartLongitude(row.getStartLongitude());
+                    entity.setStartLatitude(row.getStartLatitude());
+                    entity.setEndLongitude(row.getEndLongitude());
+                    entity.setEndLatitude(row.getEndLatitude());
+                    entity.setLocation(row.getLocation());
+                    entity.setRemark(row.getRemark());
+                },
+                pipeNetworkService,
+                (entity, update, who, now) -> {
+                    if (update) {
+                        entity.setUpdateBy(who);
+                    } else {
+                        entity.setDelFlag("0");
+                        entity.setCreateBy(who);
+                        entity.setCreateTime(now);
+                        if (entity.getStatus() == null) entity.setStatus("0");
+                        if (entity.getNetworkType() == null) entity.setNetworkType("0");
+                    }
+                }), "管网设施数据");
+    }
+
+    public String importFireHydrants(List<FireHydrantImportDTO> rows, boolean updateSupport, String operator) {
+        return importRows(rows, updateSupport, operator, new ImportPlan<WaterFireHydrantInfo, FireHydrantImportDTO>(
+                FireHydrantImportDTO::getHydrantCode,
+                code -> fireHydrantService.getOne(Wrappers.<WaterFireHydrantInfo>lambdaQuery()
+                        .eq(WaterFireHydrantInfo::getHydrantCode, code), false),
+                WaterFireHydrantInfo::new,
+                (row, entity) -> {
+                    entity.setHydrantCode(row.getHydrantCode());
+                    entity.setHydrantName(row.getHydrantName());
+                    entity.setHydrantType(row.getHydrantType());
+                    entity.setStatus(row.getStatus());
+                    entity.setModel(row.getModel());
+                    entity.setInletPipeDiameter(row.getInletPipeDiameter());
+                    entity.setOutletSpec(row.getOutletSpec());
+                    entity.setOwnershipUnit(row.getOwnershipUnit());
+                    entity.setMaintenanceUnit(row.getMaintenanceUnit());
+                    entity.setPrincipal(row.getPrincipal());
+                    entity.setContactPhone(row.getContactPhone());
+                    entity.setLocation(row.getLocation());
+                    entity.setLongitude(row.getLongitude());
+                    entity.setLatitude(row.getLatitude());
+                    entity.setRemark(row.getRemark());
+                },
+                fireHydrantService,
+                (entity, update, who, now) -> {
+                    if (update) {
+                        entity.setUpdateBy(who);
+                    } else {
+                        entity.setDelFlag("0");
+                        entity.setCreateBy(who);
+                        entity.setCreateTime(now);
+                        if (entity.getStatus() == null) entity.setStatus("0");
+                    }
+                }), "消火栓数据");
+    }
+
+    public String importGates(List<DrainageGateImportDTO> rows, boolean updateSupport, String operator) {
+        return importRows(rows, updateSupport, operator, new ImportPlan<DrainageGateInfo, DrainageGateImportDTO>(
+                DrainageGateImportDTO::getFacilityCode,
+                code -> gateService.getEntityByCode(code),
+                DrainageGateInfo::new,
+                DrainageGateImportDTO::applyTo,
+                gateService,
+                (entity, update, who, now) -> prepareDrainage(entity, update, who, now)), "排水闸门数据");
+    }
+
+    public String importStorages(List<DrainageStorageImportDTO> rows, boolean updateSupport, String operator) {
+        return importRows(rows, updateSupport, operator, new ImportPlan<DrainageStorageInfo, DrainageStorageImportDTO>(
+                DrainageStorageImportDTO::getFacilityCode,
+                code -> storageService.getEntityByCode(code),
+                DrainageStorageInfo::new,
+                DrainageStorageImportDTO::applyTo,
+                storageService,
+                (entity, update, who, now) -> prepareDrainage(entity, update, who, now)), "排水调蓄设施数据");
+    }
+
+    private void prepareDrainage(com.zksy.drainage.domain.DrainageFacilityBase entity,
+                                 boolean update, String operator, LocalDateTime now) {
+        if (update) {
+            entity.setUpdateBy(operator);
+        } else {
+            entity.setDelFlag("0");
+            entity.setCreateBy(operator);
+            entity.setCreateTime(now);
+            if (entity.getStatus() == null) entity.setStatus("0");
+        }
+    }
+
+    private <T, R> String importRows(List<R> rows, boolean updateSupport, String operator,
+                                     ImportPlan<T, R> plan, String noun) {
+        int count = 0;
+        LocalDateTime now = LocalDateTime.now();
+        for (R row : rows) {
+            String code = plan.code.apply(row);
+            if (code == null || code.trim().isEmpty()) continue;
+            T entity = plan.existing.apply(code.trim());
+            boolean update = entity != null;
+            if (update && !updateSupport) continue;
+            if (entity == null) entity = plan.factory.get();
+            plan.copier.accept(row, entity);
+            plan.preparer.prepare(entity, update, operator, now);
+            boolean persisted = update ? plan.service.updateById(entity) : plan.service.save(entity);
+            if (!persisted) throw new IllegalStateException(noun + "保存失败");
+            count++;
+        }
+        return "成功导入 " + count + " 条" + noun;
+    }
+
+    @FunctionalInterface
+    private interface AuditPreparer<T> {
+        void prepare(T entity, boolean update, String operator, LocalDateTime now);
+    }
+
+    private static final class ImportPlan<T, R> {
+        private final Function<R, String> code;
+        private final Function<String, T> existing;
+        private final Supplier<T> factory;
+        private final BiConsumer<R, T> copier;
+        private final IService<T> service;
+        private final AuditPreparer<T> preparer;
+
+        private ImportPlan(Function<R, String> code,
+                           Function<String, T> existing,
+                           Supplier<T> factory,
+                           BiConsumer<R, T> copier,
+                           IService<T> service,
+                           AuditPreparer<T> preparer) {
+            this.code = code;
+            this.existing = existing;
+            this.factory = factory;
+            this.copier = copier;
+            this.service = service;
+            this.preparer = preparer;
+        }
+    }
+}

+ 2 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/base/service/ManholeBaseService.java

@@ -16,4 +16,6 @@ public interface ManholeBaseService extends IService<ManholeBase> {
     boolean saveWithCheck(ManholeBase entity);
 
     boolean updateWithCheck(ManholeBase entity);
+
+    boolean removeWithCheck(String manholeId);
 }

+ 0 - 57
pipe-network-service/zksy-system/src/main/java/com/zksy/base/service/PipeNetworkBaseService.java

@@ -7,7 +7,6 @@ import com.zksy.base.dto.PipeNetworkExportDTO;
 import com.zksy.base.dto.PipeNetworkPageInDTO;
 
 import java.util.List;
-import java.util.Map;
 
 public interface PipeNetworkBaseService extends IService<PipeNetworkBase> {
 
@@ -16,62 +15,6 @@ public interface PipeNetworkBaseService extends IService<PipeNetworkBase> {
                                       String networkCode, String networkName,
                                       String networkType, String status);
 
-    /* ==================== 燃气模块专用查询(强制 network_type=0) ==================== */
-
-    /**
-     * 燃气设施分页查询
-     * <p>仅查询 network_type=0 的燃气设施</p>
-     */
-    Page<PipeNetworkBase> queryGasByPage(PipeNetworkPageInDTO dto);
-
-    /**
-     * 按ID查询燃气设施
-     * <p>仅查询 network_type=0 的燃气设施,非燃气设施返回 null</p>
-     */
-    PipeNetworkBase getGasById(String networkId);
-
-    /**
-     * 燃气设施下拉选项
-     * <p>仅查询 network_type=0 的燃气设施</p>
-     */
-    List<PipeNetworkBase> getGasOptions();
-
-    /**
-     * 燃气设施导出数据
-     *
-     * 仅查询 network_type=0 的燃气设施。networkIds 非空时按主键导出勾选记录,
-     * 否则按 dto 中的筛选条件导出全部匹配记录。
-     *
-     * @param dto        筛选条件,可为空
-     * @param networkIds 勾选的管网主键,可为空
-     * @return 导出数据
-     */
-    List<PipeNetworkExportDTO> exportGasData(PipeNetworkPageInDTO dto, List<String> networkIds);
-
-    /* ==================== 排水模块专用查询(强制 network_type=1) ==================== */
-
-    /**
-     * 排水设施分页查询(支持编码/名称/等级/管养单位/材质/状态/位置/建设日期区间/管径区间)
-     * <p>仅查询 network_type=1 的排水设施</p>
-     */
-    Page<PipeNetworkBase> queryDrainageByPage(PipeNetworkPageInDTO dto);
-
-    /**
-     * 按ID查询排水设施
-     * <p>仅查询 network_type=1 的排水设施,非排水设施返回 null</p>
-     */
-    PipeNetworkBase getDrainageById(String networkId);
-
-    /**
-     * 排水设施地图数据(不分页,仅返回起终点至少一端有坐标的记录)
-     * <p>筛选条件与分页查询一致,用于按筛选结果绘制管网</p>
-     */
-    List<PipeNetworkBase> listDrainageForMap(PipeNetworkPageInDTO dto);
-
-    /**
-     * 排水设施筛选下拉项(材质、管养单位去重值)
-     */
-    Map<String, List<String>> getDrainageFilterOptions();
     boolean saveWithCheck(PipeNetworkBase entity);
 
     boolean saveBatchWithCheck(List<PipeNetworkBase> entityList);

+ 9 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/base/service/impl/ManholeBaseServiceImpl.java

@@ -26,6 +26,7 @@ public class ManholeBaseServiceImpl extends ServiceImpl<ManholeBaseMapper, Manho
         wrapper.like(dto.getManholeName() != null && !dto.getManholeName().isEmpty(), ManholeBase::getManholeName, dto.getManholeName());
         wrapper.like(dto.getManholeCode() != null && !dto.getManholeCode().isEmpty(), ManholeBase::getManholeCode, dto.getManholeCode());
         wrapper.eq(dto.getStatus() != null && !dto.getStatus().isEmpty(), ManholeBase::getStatus, dto.getStatus());
+        wrapper.eq(dto.getManholeType() != null && !dto.getManholeType().isEmpty(), ManholeBase::getManholeType, dto.getManholeType());
         wrapper.orderByDesc(ManholeBase::getCreateTime);
         return this.page(page, wrapper);
     }
@@ -62,4 +63,12 @@ public class ManholeBaseServiceImpl extends ServiceImpl<ManholeBaseMapper, Manho
         }
         return this.updateById(entity);
     }
+
+    @Override
+    public boolean removeWithCheck(String manholeId) {
+        if (this.getById(manholeId) == null) {
+            throw new ServiceException("窨井信息不存在:" + manholeId);
+        }
+        return this.removeById(manholeId);
+    }
 }

+ 1 - 208
pipe-network-service/zksy-system/src/main/java/com/zksy/base/service/impl/PipeNetworkBaseServiceImpl.java

@@ -1,7 +1,6 @@
 package com.zksy.base.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -20,12 +19,10 @@ import org.springframework.transaction.annotation.Transactional;
 
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
-import java.util.Objects;
 import java.util.Set;
 import java.util.stream.Collectors;
 
@@ -177,210 +174,6 @@ public class PipeNetworkBaseServiceImpl extends ServiceImpl<PipeNetworkBaseMappe
         return buildExportList(this.list(wrapper));
     }
 
-    /* ==================== 燃气模块专用查询(强制 network_type=0) ==================== */
-
-    @Override
-    public Page<PipeNetworkBase> queryGasByPage(PipeNetworkPageInDTO dto) {
-        Page<PipeNetworkBase> page = new Page<>(dto.getPageNum(), dto.getPageSize());
-        return this.page(page, buildGasWrapper(dto));
-    }
-
-    @Override
-    public PipeNetworkBase getGasById(String networkId) {
-        if (networkId == null || networkId.isEmpty()) {
-            return null;
-        }
-        LambdaQueryWrapper<PipeNetworkBase> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(PipeNetworkBase::getNetworkId, networkId);
-        // 燃气模块只允许查询燃气设施
-        wrapper.eq(PipeNetworkBase::getNetworkType, PipeNetworkBase.NETWORK_TYPE_GAS);
-        return this.getOne(wrapper, false);
-    }
-
-    @Override
-    public List<PipeNetworkBase> getGasOptions() {
-        LambdaQueryWrapper<PipeNetworkBase> wrapper = new LambdaQueryWrapper<>();
-        wrapper.select(PipeNetworkBase::getNetworkId, PipeNetworkBase::getNetworkName, PipeNetworkBase::getNetworkCode);
-        // 燃气模块只允许查询燃气设施
-        wrapper.eq(PipeNetworkBase::getNetworkType, PipeNetworkBase.NETWORK_TYPE_GAS);
-        wrapper.orderByAsc(PipeNetworkBase::getNetworkName);
-        return this.list(wrapper);
-    }
-
-    /**
-     * 构建燃气管网查询条件
-     *
-     * 燃气模块只查询燃气设施,其余条件为空时忽略。
-     */
-    private LambdaQueryWrapper<PipeNetworkBase> buildGasWrapper(PipeNetworkPageInDTO dto) {
-        PipeNetworkPageInDTO query = dto == null ? new PipeNetworkPageInDTO() : dto;
-        LambdaQueryWrapper<PipeNetworkBase> wrapper = new LambdaQueryWrapper<>();
-        // 燃气模块只允许查询燃气设施
-        wrapper.eq(PipeNetworkBase::getNetworkType, PipeNetworkBase.NETWORK_TYPE_GAS);
-        wrapper.like(query.getNetworkName() != null && !query.getNetworkName().isEmpty(), PipeNetworkBase::getNetworkName, query.getNetworkName());
-        wrapper.like(query.getManagementUnit() != null && !query.getManagementUnit().isEmpty(), PipeNetworkBase::getManagementUnit, query.getManagementUnit());
-        wrapper.eq(query.getNetworkLevel() != null && !query.getNetworkLevel().isEmpty(), PipeNetworkBase::getNetworkLevel, query.getNetworkLevel());
-        wrapper.like(query.getMaterial() != null && !query.getMaterial().isEmpty(), PipeNetworkBase::getMaterial, query.getMaterial());
-        wrapper.eq(query.getStatus() != null && !query.getStatus().isEmpty(), PipeNetworkBase::getStatus, query.getStatus());
-        wrapper.orderByDesc(PipeNetworkBase::getCreateTime);
-        return wrapper;
-    }
-
-    @Override
-    public List<PipeNetworkExportDTO> exportGasData(PipeNetworkPageInDTO dto, List<String> networkIds) {
-        LambdaQueryWrapper<PipeNetworkBase> wrapper;
-        if (networkIds != null && !networkIds.isEmpty()) {
-            // 勾选导出:以勾选的主键为准,仍限制在燃气范围内
-            wrapper = new LambdaQueryWrapper<>();
-            wrapper.eq(PipeNetworkBase::getNetworkType, PipeNetworkBase.NETWORK_TYPE_GAS);
-            wrapper.in(PipeNetworkBase::getNetworkId, networkIds);
-            wrapper.orderByDesc(PipeNetworkBase::getCreateTime);
-        } else {
-            wrapper = buildGasWrapper(dto);
-        }
-        return buildExportList(this.list(wrapper));
-    }
-
-    /* ==================== 排水模块专用查询(强制 network_type=1) ==================== */
-
-    @Override
-    public Page<PipeNetworkBase> queryDrainageByPage(PipeNetworkPageInDTO dto) {
-        long pageNum = dto.getPageNum() == null ? 1L : dto.getPageNum();
-        long pageSize = dto.getPageSize() == null ? 10L : dto.getPageSize();
-        Page<PipeNetworkBase> page = this.page(new Page<>(pageNum, pageSize), buildDrainageWrapper(dto));
-        fillSewageTypes(page.getRecords());
-        return page;
-    }
-
-    @Override
-    public PipeNetworkBase getDrainageById(String networkId) {
-        if (networkId == null || networkId.isEmpty()) {
-            return null;
-        }
-        LambdaQueryWrapper<PipeNetworkBase> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(PipeNetworkBase::getNetworkId, networkId);
-        // 排水模块只允许查询排水设施
-        wrapper.eq(PipeNetworkBase::getNetworkType, PipeNetworkBase.NETWORK_TYPE_DRAINAGE);
-        PipeNetworkBase entity = this.getOne(wrapper, false);
-        if (entity != null) {
-            entity.fillSewageType();
-        }
-        return entity;
-    }
-
-    @Override
-    public List<PipeNetworkBase> listDrainageForMap(PipeNetworkPageInDTO dto) {
-        LambdaQueryWrapper<PipeNetworkBase> wrapper = buildDrainageWrapper(dto);
-        // 起终点至少一端有坐标才返回,避免前端拿到无法绘制的空几何
-        wrapper.and(w -> w
-                .and(s -> s.isNotNull(PipeNetworkBase::getStartLongitude)
-                        .isNotNull(PipeNetworkBase::getStartLatitude))
-                .or()
-                .and(e -> e.isNotNull(PipeNetworkBase::getEndLongitude)
-                        .isNotNull(PipeNetworkBase::getEndLatitude)));
-        List<PipeNetworkBase> list = this.list(wrapper);
-        fillSewageTypes(list);
-        return list;
-    }
-
-    /**
-     * 批量填充雨污类型(取 network_level:0=污水 1=雨水),不修改数据库
-     */
-    private static void fillSewageTypes(List<PipeNetworkBase> list) {
-        if (CollectionUtils.isEmpty(list)) {
-            return;
-        }
-        list.forEach(PipeNetworkBase::fillSewageType);
-    }
-
-    /**
-     * 排水设施筛选下拉项(材质、管养单位去重值)
-     */
-    @Override
-    public Map<String, List<String>> getDrainageFilterOptions() {
-        Map<String, List<String>> options = new HashMap<>();
-        options.put("materials", distinctDrainageColumn("material"));
-        options.put("managementUnits", distinctDrainageColumn("management_unit"));
-        return options;
-    }
-
-    /**
-     * 取排水设施某列的去重非空值
-     * <p>列名仅由内部常量传入,不接受外部输入</p>
-     */
-    private List<String> distinctDrainageColumn(String column) {
-        QueryWrapper<PipeNetworkBase> wrapper = new QueryWrapper<>();
-        wrapper.select("DISTINCT " + column)
-                .eq("network_type", PipeNetworkBase.NETWORK_TYPE_DRAINAGE)
-                .isNotNull(column)
-                .ne(column, "")
-                .orderByAsc(column);
-        return this.listObjs(wrapper, obj -> obj == null ? null : obj.toString())
-                .stream()
-                .filter(Objects::nonNull)
-                .collect(Collectors.toList());
-    }
-
-    /**
-     * 排水设施查询条件(强制 network_type=1,分页与地图共用)
-     */
-    private LambdaQueryWrapper<PipeNetworkBase> buildDrainageWrapper(PipeNetworkPageInDTO dto) {
-        LambdaQueryWrapper<PipeNetworkBase> wrapper = new LambdaQueryWrapper<>();
-        // 排水模块只允许查询排水设施
-        wrapper.eq(PipeNetworkBase::getNetworkType, PipeNetworkBase.NETWORK_TYPE_DRAINAGE);
-        wrapper.like(hasText(dto.getNetworkCode()), PipeNetworkBase::getNetworkCode, dto.getNetworkCode());
-        wrapper.like(hasText(dto.getNetworkName()), PipeNetworkBase::getNetworkName, dto.getNetworkName());
-        wrapper.eq(hasText(dto.getNetworkLevel()), PipeNetworkBase::getNetworkLevel, dto.getNetworkLevel());
-        wrapper.like(hasText(dto.getManagementUnit()), PipeNetworkBase::getManagementUnit, dto.getManagementUnit());
-        wrapper.like(hasText(dto.getMaterial()), PipeNetworkBase::getMaterial, dto.getMaterial());
-        wrapper.eq(hasText(dto.getStatus()), PipeNetworkBase::getStatus, dto.getStatus());
-        wrapper.like(hasText(dto.getLocation()), PipeNetworkBase::getLocation, dto.getLocation());
-        applySewageTypeCondition(wrapper, dto.getSewageType());
-
-        Date buildStart = parseDate(dto.getBuildDateStart());
-        Date buildEnd = parseDate(dto.getBuildDateEnd());
-        wrapper.ge(buildStart != null, PipeNetworkBase::getBuildDate, buildStart);
-        wrapper.le(buildEnd != null, PipeNetworkBase::getBuildDate, buildEnd);
-        wrapper.ge(dto.getDiameterMin() != null, PipeNetworkBase::getDiameter, dto.getDiameterMin());
-        wrapper.le(dto.getDiameterMax() != null, PipeNetworkBase::getDiameter, dto.getDiameterMax());
-
-        wrapper.orderByDesc(PipeNetworkBase::getCreateTime);
-        return wrapper;
-    }
-
-    private static boolean hasText(String value) {
-        return value != null && !value.trim().isEmpty();
-    }
-
-    /**
-     * 追加雨污类型筛选条件
-     *
-     * 排水口径下 network_level 即雨污类型(0=污水 1=雨水),直接等值匹配,不做任何文本猜测。
-     */
-    private void applySewageTypeCondition(LambdaQueryWrapper<PipeNetworkBase> wrapper, String sewageType) {
-        if (!hasText(sewageType)) {
-            return;
-        }
-        String value = sewageType.trim();
-        if (PipeNetworkBase.SEWAGE_TYPE_SEWAGE.equals(value) || PipeNetworkBase.SEWAGE_TYPE_RAIN.equals(value)) {
-            wrapper.eq(PipeNetworkBase::getNetworkLevel, value);
-        }
-    }
-
-    /**
-     * 解析 yyyy-MM-dd,格式非法时返回 null(视为不按该端筛选)
-     */
-    private static Date parseDate(String value) {
-        if (!hasText(value)) {
-            return null;
-        }
-        try {
-            return java.sql.Date.valueOf(value.trim().substring(0, 10));
-        } catch (RuntimeException e) {
-            log.warn("排水管网查询忽略非法日期参数:{}", value);
-            return null;
-        }
-    }
 
     /**
      * 管网设施列表转导出DTO
@@ -390,7 +183,7 @@ public class PipeNetworkBaseServiceImpl extends ServiceImpl<PipeNetworkBaseMappe
     private List<PipeNetworkExportDTO> buildExportList(List<PipeNetworkBase> list) {
         Map<String, String> typeLabels = dictLabels("pipe_network_type");
         Map<String, String> levelLabels = dictLabels("pipe_network_level");
-        Map<String, String> statusLabels = dictLabels("pipe_network_status");
+        Map<String, String> statusLabels = dictLabels("infrastructure_status");
         List<PipeNetworkExportDTO> result = new ArrayList<>(list.size());
         for (PipeNetworkBase entity : list) {
             PipeNetworkExportDTO dto = new PipeNetworkExportDTO();

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

@@ -2,8 +2,8 @@ package com.zksy.cockpit.entity;
 
 import com.zksy.WaterSupply.WaterPlantInfo.domain.WaterPlantInfo;
 import com.zksy.WaterSupply.WaterPlantInfo.service.IWaterPlantInfoService;
-import com.zksy.WaterSupply.WaterPumpStation.domain.WaterPumpStation;
-import com.zksy.WaterSupply.WaterPumpStation.service.IWaterPumpStationService;
+import com.zksy.WaterSupply.PumpStationInfo.domain.PumpStationInfo;
+import com.zksy.WaterSupply.PumpStationInfo.service.IPumpStationInfoService;
 import com.zksy.base.domain.EquipmentBase;
 import com.zksy.base.domain.EquipmentStatus;
 import com.zksy.base.domain.HazardHiddenAccount;
@@ -21,8 +21,9 @@ import com.zksy.cockpit.foundation.CockpitDistrictPrefix;
 import com.zksy.cockpit.foundation.CockpitErrorCategory;
 import com.zksy.cockpit.foundation.CockpitErrorPayload;
 import com.zksy.cockpit.foundation.CockpitInvalidRequestException;
-import com.zksy.drainage.domain.EngineeringFacility;
-import com.zksy.drainage.service.EngineeringFacilityService;
+import com.zksy.drainage.domain.DrainageFacilityBase;
+import com.zksy.drainage.service.DrainageGateInfoService;
+import com.zksy.drainage.service.DrainageStorageInfoService;
 import org.springframework.stereotype.Service;
 
 import java.time.LocalDateTime;
@@ -36,19 +37,22 @@ public class CockpitEntityDetailService {
     private static final ZoneId BUSINESS_ZONE = ZoneId.of("Asia/Shanghai");
     private final PipeNetworkBaseService pipes;
     private final IWaterPlantInfoService plants;
-    private final IWaterPumpStationService stations;
+    private final IPumpStationInfoService stations;
     private final EquipmentBaseService equipment;
-    private final EngineeringFacilityService engineeringFacilities;
+    private final DrainageGateInfoService gates;
+    private final DrainageStorageInfoService storages;
     private final EquipmentStatusService equipmentStatuses;
     private final HazardHiddenAccountService hazards;
     private final RiskAssessmentService risks;
     private final ManholeBaseService manholes;
 
     public CockpitEntityDetailService(PipeNetworkBaseService pipes, IWaterPlantInfoService plants,
-            IWaterPumpStationService stations, EquipmentBaseService equipment,
-            EngineeringFacilityService engineeringFacilities, EquipmentStatusService equipmentStatuses, HazardHiddenAccountService hazards, RiskAssessmentService risks, ManholeBaseService manholes) {
+            IPumpStationInfoService stations, EquipmentBaseService equipment,
+            DrainageGateInfoService gates, DrainageStorageInfoService storages,
+            EquipmentStatusService equipmentStatuses, HazardHiddenAccountService hazards, RiskAssessmentService risks, ManholeBaseService manholes) {
         this.pipes = pipes; this.plants = plants; this.stations = stations;
-        this.equipment = equipment; this.engineeringFacilities = engineeringFacilities; this.equipmentStatuses = equipmentStatuses; this.hazards = hazards; this.risks = risks; this.manholes = manholes;
+        this.equipment = equipment; this.gates = gates; this.storages = storages;
+        this.equipmentStatuses = equipmentStatuses; this.hazards = hazards; this.risks = risks; this.manholes = manholes;
     }
 
     public CockpitEntityDetailResponse load(String requestId, String categoryValue, String entityId) {
@@ -89,7 +93,7 @@ public class CockpitEntityDetailService {
     }
 
     private CockpitEntityDetailResponse station(String requestId, String id) {
-        WaterPumpStation v=stations.getById(id); if(v==null) throw missing();
+        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());
         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());
@@ -99,23 +103,40 @@ public class CockpitEntityDetailService {
 
 
     private CockpitEntityDetailResponse engineeringFacility(String requestId, String id) {
-        EngineeringFacility v = engineeringFacilities.getById(id);
-        if (v == null) throw missing();
+        // 闸门与调蓄设施分表存储,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());
+        }
+        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());
+        }
+        throw missing();
+    }
+
+    private Map<String,Object> drainageFacilityAttributes(DrainageFacilityBase v) {
         Map<String,Object> a = map();
-        put(a, "facilityType", v.getFacilityType());
         put(a, "facilityLevel", v.getFacilityLevel());
         put(a, "managementUnit", v.getManagementUnit());
         put(a, "buildDate", v.getBuildDate());
         put(a, "designFlow", v.getDesignFlow());
-        put(a, "designHead", v.getDesignHead());
-        put(a, "storageCapacity", v.getStorageCapacity());
         put(a, "equipmentIds", v.getEquipmentId());
         put(a, "devices", linkedDevices(v.getEquipmentId()));
         put(a, "remark", v.getRemark());
-        return response(requestId, "ENGINEERING_FACILITY", v.getFacilityId(), v.getFacilityCode(),
-                v.getFacilityName(), v.getStatus(), v.getLocation(), null,
-                new CockpitEntityDetailResponse.Coordinates(v.getLongitude(), v.getLatitude(), null, null),
-                a, v.getUpdateTime());
+        return a;
     }
 
 
@@ -134,7 +155,6 @@ public class CockpitEntityDetailService {
         put(a, "manholeShape", v.getManholeShape());
         put(a, "material", v.getMaterial());
         put(a, "ownershipUnit", v.getOwnershipUnit());
-        put(a, "networkId", v.getNetworkId());
         put(a, "remark", v.getRemark());
         return response(requestId, "MANHOLE", v.getManholeId(), v.getManholeCode(), v.getManholeName(),
                 v.getStatus(), v.getLocation(), null,

+ 1 - 1
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/geometry/CockpitFacilityGeometryService.java

@@ -58,7 +58,7 @@ public class CockpitFacilityGeometryService {
             for (ManholeBase manhole : Objects.requireNonNull(manholes.list())) {
                 features.add(feature("manhole_base", manhole.getManholeId(), manhole.getManholeCode(),
                         manhole.getManholeName(), "MANHOLE", "MANHOLE", null, null, null,
-                        manhole.getNetworkId(), null, null, "Point",
+                        null, null, null, "Point",
                         Collections.singletonList(pair(manhole.getLongitude(), manhole.getLatitude()))));
             }
             List<Coverage> coverage = new ArrayList<>();

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

@@ -2,9 +2,9 @@ package com.zksy.cockpit.infrastructure;
 
 import com.zksy.WaterSupply.WaterPlantInfo.domain.WaterPlantInfo;
 import com.zksy.WaterSupply.WaterPlantInfo.service.IWaterPlantInfoService;
-import com.zksy.WaterSupply.WaterPumpStation.domain.PumpStationType;
-import com.zksy.WaterSupply.WaterPumpStation.domain.WaterPumpStation;
-import com.zksy.WaterSupply.WaterPumpStation.service.IWaterPumpStationService;
+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.WaterSourceInfo.domain.WaterSourceInfo;
 import com.zksy.WaterSupply.WaterSourceInfo.service.IWaterSourceInfoService;
 import com.zksy.base.domain.ManholeBase;
@@ -13,8 +13,10 @@ import com.zksy.base.service.ManholeBaseService;
 import com.zksy.base.service.PipeNetworkBaseService;
 import com.zksy.cockpit.foundation.CockpitDistrictPrefix;
 import com.zksy.cockpit.foundation.CockpitPipeNetworkType;
-import com.zksy.drainage.domain.EngineeringFacility;
-import com.zksy.drainage.service.EngineeringFacilityService;
+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.context.annotation.Primary;
 import org.springframework.stereotype.Component;
 
@@ -58,20 +60,22 @@ public class BusinessCockpitInfrastructureBaseArchivesAdapter
             CockpitPipeNetworkType.WATER_PIPE, CockpitPipeNetworkType.GAS_PIPE, CockpitPipeNetworkType.DRAINAGE_PIPE);
 
     private final IWaterPlantInfoService plants;
-    private final IWaterPumpStationService stations;
+    private final IPumpStationInfoService stations;
     private final PipeNetworkBaseService pipes;
-    private final EngineeringFacilityService engineering;
+    private final DrainageGateInfoService gates;
+    private final DrainageStorageInfoService storages;
     private final IWaterSourceInfoService sources;
     private final ManholeBaseService manholes;
 
     public BusinessCockpitInfrastructureBaseArchivesAdapter(
-            IWaterPlantInfoService plants, IWaterPumpStationService stations,
-            PipeNetworkBaseService pipes, EngineeringFacilityService engineering,
+            IWaterPlantInfoService plants, IPumpStationInfoService stations,
+            PipeNetworkBaseService pipes, DrainageGateInfoService gates, DrainageStorageInfoService storages,
             IWaterSourceInfoService sources, ManholeBaseService manholes) {
         this.plants = plants;
         this.stations = stations;
         this.pipes = pipes;
-        this.engineering = engineering;
+        this.gates = gates;
+        this.storages = storages;
         this.sources = sources;
         this.manholes = manholes;
     }
@@ -87,7 +91,7 @@ public class BusinessCockpitInfrastructureBaseArchivesAdapter
         }
         // 驾驶舱跨行业统计读取共用表全集,按 station_type 分类;未知归属显式 excluded。
         // 不用于供水/排水管理入口(其强制归属过滤规则仍保持 ADR-0007)。
-        for (WaterPumpStation station : safeList(stations.list())) {
+        for (PumpStationInfo station : safeList(stations.list())) {
             updatedAt = latest(updatedAt, station.getUpdateTime());
             updatedAt = latest(updatedAt, station.getCreateTime());
             String stationType = trimToNull(station.getStationType());
@@ -104,13 +108,19 @@ public class BusinessCockpitInfrastructureBaseArchivesAdapter
             add(facilities, key("pipe_network_base", pipe.getNetworkId(), pipe.getNetworkCode()), pipe.getNetworkCode(), CockpitPipeNetworkType.typeCodeOf(pipe.getNetworkType()),
                     lengthKm, null, builtAt, trimToNull(pipe.getNetworkLevel()));
         }
-        for (EngineeringFacility facility : safeList(engineering.list())) {
-            updatedAt = latest(updatedAt, facility.getUpdateTime());
-            updatedAt = latest(updatedAt, facility.getCreateTime());
-            // 保留现有工程设施年限映射;本票只统一设施范围,不裁定建设日期来源。
-            add(facilities, key("drainage_engineering_facility", facility.getFacilityId(), facility.getFacilityCode()),
-                    facility.getFacilityId(), drainageType(facility.getFacilityType()), null, null,
-                    facility.getCreateTime() == null ? null : facility.getCreateTime().toLocalDate());
+        for (DrainageGateInfo gate : safeList(gates.listAll())) {
+            updatedAt = latest(updatedAt, gate.getUpdateTime());
+            updatedAt = latest(updatedAt, gate.getCreateTime());
+            add(facilities, key("drainage_gate_info", gate.getFacilityId(), gate.getFacilityCode()),
+                    gate.getFacilityId(), "DRAINAGE_GATE", null, null,
+                    gate.getCreateTime() == null ? null : gate.getCreateTime().toLocalDate());
+        }
+        for (DrainageStorageInfo storage : safeList(storages.listAll())) {
+            updatedAt = latest(updatedAt, storage.getUpdateTime());
+            updatedAt = latest(updatedAt, storage.getCreateTime());
+            add(facilities, key("drainage_storage_info", storage.getFacilityId(), storage.getFacilityCode()),
+                    storage.getFacilityId(), "DRAINAGE_STORAGE", null, null,
+                    storage.getCreateTime() == null ? null : storage.getCreateTime().toLocalDate());
         }
         for (WaterSourceInfo source : safeList(sources.list())) {
             updatedAt = latest(updatedAt, source.getUpdateTime());
@@ -172,16 +182,6 @@ public class BusinessCockpitInfrastructureBaseArchivesAdapter
         return identity == null ? null : table + "|" + identity;
     }
 
-    private static String drainageType(String value) {
-        String type = trimToNull(value);
-        if (type == null) return UNCLASSIFIED;
-        // 新口径为字典编码(drainage_facility_type:0闸门 1调蓄设施 2泵站),中文值仅作存量兼容
-        if (EngineeringFacility.TYPE_GATE.equals(type) || type.contains("闸")) return "DRAINAGE_GATE";
-        if (EngineeringFacility.TYPE_STORAGE.equals(type) || type.contains("调蓄") || type.contains("蓄水")) return "DRAINAGE_STORAGE";
-        if (EngineeringFacility.TYPE_PUMP.equals(type) || type.contains("泵站")) return "DRAINAGE_PUMP_STATION";
-        return UNCLASSIFIED;
-    }
-
     private static CockpitInfrastructureBaseArchivesSnapshot.SourceType type(String code, String name, String industry) {
         return new CockpitInfrastructureBaseArchivesSnapshot.SourceType(code, name, industry, "FACILITY");
     }

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

@@ -3,16 +3,19 @@ package com.zksy.cockpit.infrastructure;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.zksy.WaterSupply.WaterPlantInfo.domain.WaterPlantInfo;
 import com.zksy.WaterSupply.WaterPlantInfo.service.IWaterPlantInfoService;
-import com.zksy.WaterSupply.WaterPumpStation.domain.PumpStationType;
-import com.zksy.WaterSupply.WaterPumpStation.domain.WaterPumpStation;
-import com.zksy.WaterSupply.WaterPumpStation.service.IWaterPumpStationService;
+import com.zksy.WaterSupply.PumpStationInfo.domain.PumpStationType;
+import com.zksy.WaterSupply.PumpStationInfo.domain.PumpStationInfo;
+import com.zksy.WaterSupply.PumpStationInfo.service.IPumpStationInfoService;
 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.drainage.domain.EngineeringFacility;
-import com.zksy.drainage.service.EngineeringFacilityService;
+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.context.annotation.Primary;
 import org.springframework.stereotype.Component;
 
@@ -43,21 +46,24 @@ public class BusinessCockpitInfrastructureOperatingInformationAdapter
     private static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
 
     private final IWaterPlantInfoService plantService;
-    private final IWaterPumpStationService pumpStationService;
+    private final IPumpStationInfoService pumpStationService;
     private final PipeNetworkBaseService pipeNetworkBaseService;
-    private final EngineeringFacilityService engineeringFacilityService;
+    private final DrainageGateInfoService gateService;
+    private final DrainageStorageInfoService storageService;
     private final ManholeBaseService manholeBaseService;
 
     public BusinessCockpitInfrastructureOperatingInformationAdapter(
             IWaterPlantInfoService plantService,
-            IWaterPumpStationService pumpStationService,
+            IPumpStationInfoService pumpStationService,
             PipeNetworkBaseService pipeNetworkBaseService,
-            EngineeringFacilityService engineeringFacilityService,
+            DrainageGateInfoService gateService,
+            DrainageStorageInfoService storageService,
             ManholeBaseService manholeBaseService) {
         this.plantService = plantService;
         this.pumpStationService = pumpStationService;
         this.pipeNetworkBaseService = pipeNetworkBaseService;
-        this.engineeringFacilityService = engineeringFacilityService;
+        this.gateService = gateService;
+        this.storageService = storageService;
         this.manholeBaseService = manholeBaseService;
     }
 
@@ -84,9 +90,9 @@ public class BusinessCockpitInfrastructureOperatingInformationAdapter
                     plant.getPlantCode(), String.valueOf(plant.getId()), "WATER_PLANT", plant.getStatus()));
         }
 
-        for (WaterPumpStation station : safeList(pumpStationService.list(
-                new LambdaQueryWrapper<WaterPumpStation>()
-                        .in(WaterPumpStation::getStationType,
+        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) {
                 continue;
@@ -132,28 +138,13 @@ public class BusinessCockpitInfrastructureOperatingInformationAdapter
                     pipe.getNetworkCode(), pipe.getNetworkId(), "PIPE_NETWORK", pipe.getStatus()));
         }
 
-        for (EngineeringFacility facility : safeList(engineeringFacilityService.list())) {
-            if (facility == null || isBlank(facility.getFacilityId())) {
-                continue;
-            }
-            String typeCode = drainageFacilityType(facility.getFacilityType());
-            if (typeCode == null) {
-                continue;
-            }
-            String sampledAt = format(facility.getUpdateTime());
-            latestUpdatedAt = latest(latestUpdatedAt, sampledAt);
-            // 工程设施是点要素,每个设施计 1 个点(旧表 point_count 已随表结构重建移除)
-            metrics.add(metric(
-                    "drainage_" + typeCode.toLowerCase() + "_point_count",
-                    isBlank(facility.getFacilityName()) ? "排水设施点数" : facility.getFacilityName() + "点数",
-                    "CAPACITY",
-                    "个",
-                    "DRAINAGE",
-                    BigDecimal.ONE,
-                    null,
-                    sampledAt,
-                    false,
-                    facility.getFacilityId(), facility.getFacilityId(), "ENGINEERING_FACILITY", facility.getStatus()));
+        for (DrainageFacilityBase facility : safeList(gateService.listAll())) {
+            addDrainageFacilityMetric(metrics, facility, "gate");
+            latestUpdatedAt = latest(latestUpdatedAt, format(facility.getUpdateTime()));
+        }
+        for (DrainageFacilityBase facility : safeList(storageService.listAll())) {
+            addDrainageFacilityMetric(metrics, facility, "storage");
+            latestUpdatedAt = latest(latestUpdatedAt, format(facility.getUpdateTime()));
         }
 
         // 窨井(维护者 2026-11-12):本端点此前只产 水厂/泵站/管网/排水设施 四类,筛「窨井」时
@@ -222,22 +213,24 @@ public class BusinessCockpitInfrastructureOperatingInformationAdapter
         return null;
     }
 
-    private static String drainageFacilityType(String facilityType) {
-        String normalized = trimToNull(facilityType);
-        if (normalized == null) {
-            return null;
-        }
-        // 新口径为字典编码(drainage_facility_type:0闸门 1调蓄设施 2泵站),中文值仅作存量兼容
-        if (EngineeringFacility.TYPE_GATE.equals(normalized) || normalized.contains("闸")) {
-            return "gate";
+    /** 排水设施是点要素,每个设施计 1 个点;闸门/调蓄共用实现,仅 typeCode 不同 */
+    private void addDrainageFacilityMetric(
+            List<CockpitInfrastructureOperatingInformationSnapshot.SourceMetric> metrics,
+            DrainageFacilityBase facility, String typeCode) {
+        if (facility == null || isBlank(facility.getFacilityId())) {
+            return;
         }
-        if (EngineeringFacility.TYPE_STORAGE.equals(normalized) || normalized.contains("调蓄") || normalized.contains("蓄水")) {
-            return "storage";
-        }
-        if (EngineeringFacility.TYPE_PUMP.equals(normalized) || normalized.contains("泵站")) {
-            return "pump_station";
-        }
-        return null;
+        metrics.add(metric(
+                "drainage_" + typeCode + "_point_count",
+                isBlank(facility.getFacilityName()) ? "排水设施点数" : facility.getFacilityName() + "点数",
+                "CAPACITY",
+                "个",
+                "DRAINAGE",
+                BigDecimal.ONE,
+                null,
+                format(facility.getUpdateTime()),
+                false,
+                facility.getFacilityId(), facility.getFacilityId(), "DRAINAGE_FACILITY", facility.getStatus()));
     }
 
     /** 行业为空的未分类项用 {@code unknown_} 前缀,避免空指针并保持编码可读。 */

+ 6 - 30
pipe-network-service/zksy-system/src/main/java/com/zksy/drainage/domain/EngineeringFacility.java → pipe-network-service/zksy-system/src/main/java/com/zksy/drainage/domain/DrainageFacilityBase.java

@@ -3,35 +3,20 @@ package com.zksy.drainage.domain;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableLogic;
-import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
-import lombok.AllArgsConstructor;
 import lombok.Data;
-import lombok.NoArgsConstructor;
 
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
 import java.util.Date;
 
 /**
- * 工程设施基础数据(闸门 / 调蓄设施 / 泵站)
- * <p>一个工程设施在地图上是一个点要素,直接落 WGS84 经纬度。</p>
+ * 排水设施公共字段(闸门 / 调蓄设施共用)
+ * <p>具体子类只声明各自的差异字段与 @TableName。</p>
  */
 @Data
-@AllArgsConstructor
-@NoArgsConstructor
-@TableName(value = "drainage_engineering_facility", schema = "app_user")
-public class EngineeringFacility {
-
-    /** 设施类型:闸门(字典 drainage_facility_type) */
-    public static final String TYPE_GATE = "0";
-
-    /** 设施类型:调蓄设施 */
-    public static final String TYPE_STORAGE = "1";
-
-    /** 设施类型:泵站 */
-    public static final String TYPE_PUMP = "2";
+public abstract class DrainageFacilityBase {
 
     @TableId(value = "facility_id", type = IdType.ASSIGN_UUID)
     @ApiModelProperty("设施ID")
@@ -43,10 +28,7 @@ public class EngineeringFacility {
     @ApiModelProperty("设施名称")
     private String facilityName;
 
-    @ApiModelProperty("设施类型(0闸门 1调蓄设施 2泵站)")
-    private String facilityType;
-
-    @ApiModelProperty("设施等级")
+    @ApiModelProperty("设施等级(字典 drainage_facility_level)")
     private String facilityLevel;
 
     @ApiModelProperty("管理单位")
@@ -61,7 +43,7 @@ public class EngineeringFacility {
     @ApiModelProperty("WGS84 纬度")
     private BigDecimal latitude;
 
-    @ApiModelProperty("运行状态(0正常 1检修 2停用 3故障)")
+    @ApiModelProperty("运行状态(字典 infrastructure_status:0正常 1异常)")
     private String status;
 
     @ApiModelProperty("建设日期")
@@ -71,13 +53,7 @@ public class EngineeringFacility {
     @ApiModelProperty("设计流量(m³/s)")
     private BigDecimal designFlow;
 
-    @ApiModelProperty("设计扬程(m)")
-    private BigDecimal designHead;
-
-    @ApiModelProperty("调蓄容积(m³)")
-    private BigDecimal storageCapacity;
-
-    @ApiModelProperty("关联设备ID(多个用逗号分隔)")
+    @ApiModelProperty("关联设备ID(多个逗号分隔)")
     private String equipmentId;
 
     @ApiModelProperty("备注")

+ 18 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/drainage/domain/DrainageGateInfo.java

@@ -0,0 +1,18 @@
+package com.zksy.drainage.domain;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.math.BigDecimal;
+
+/** 排水闸门信息(app_user.drainage_gate_info) */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName(value = "drainage_gate_info", schema = "app_user")
+public class DrainageGateInfo extends DrainageFacilityBase {
+
+    @ApiModelProperty("设计水头(m)")
+    private BigDecimal designHead;
+}

+ 18 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/drainage/domain/DrainageStorageInfo.java

@@ -0,0 +1,18 @@
+package com.zksy.drainage.domain;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.math.BigDecimal;
+
+/** 排水调蓄设施信息(app_user.drainage_storage_info) */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName(value = "drainage_storage_info", schema = "app_user")
+public class DrainageStorageInfo extends DrainageFacilityBase {
+
+    @ApiModelProperty("调蓄容积(m³)")
+    private BigDecimal storageCapacity;
+}

+ 91 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/drainage/dto/DrainageFacilityImportBaseDTO.java

@@ -0,0 +1,91 @@
+package com.zksy.drainage.dto;
+
+import com.zksy.common.annotation.Excel;
+import com.zksy.drainage.domain.DrainageFacilityBase;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 排水设施(闸门 / 调蓄设施)Excel 导入公共列。
+ * 字典:drainage_facility_level、infrastructure_status。
+ *
+ * <p>ExcelUtil 只扫描当前类及其直接父类,因此这里把公共列全部平铺在直接父类,
+ * 避免再上一层的字段(位置/备注)在模板中丢失。</p>
+ */
+@Data
+public abstract class DrainageFacilityImportBaseDTO {
+
+    @Excel(name = "*设施编码", sort = 1, width = 20)
+    private String facilityCode;
+
+    @Excel(name = "*设施名称", sort = 2, width = 22)
+    private String facilityName;
+
+    @Excel(name = "设施等级", sort = 3, width = 14,
+            dictType = "drainage_facility_level", comboReadDict = true,
+            prompt = "请从下拉框选择设施等级")
+    private String facilityLevel;
+
+    @Excel(name = "状态", sort = 4, width = 12,
+            dictType = "infrastructure_status", comboReadDict = true,
+            prompt = "请从下拉框选择状态")
+    private String status;
+
+    @Excel(name = "管理单位", sort = 5, width = 24)
+    private String managementUnit;
+
+    @Excel(name = "建设日期", sort = 6, width = 14, dateFormat = "yyyy-MM-dd")
+    private Date buildDate;
+
+    @Excel(name = "设计流量(m³/s)", sort = 7, width = 16)
+    private BigDecimal designFlow;
+
+    @Excel(name = "关联设备ID", sort = 10, width = 24)
+    private String equipmentId;
+
+    @Excel(name = "位置描述", sort = 90, width = 30)
+    private String location;
+
+    @Excel(name = "经度", sort = 91, width = 14)
+    private BigDecimal longitude;
+
+    @Excel(name = "纬度", sort = 92, width = 14)
+    private BigDecimal latitude;
+
+    @Excel(name = "备注", sort = 94, width = 30)
+    private String remark;
+
+    /** DTO → 实体,供导入落库使用。 */
+    public void applyTo(DrainageFacilityBase value) {
+        value.setFacilityCode(getFacilityCode());
+        value.setFacilityName(getFacilityName());
+        value.setFacilityLevel(getFacilityLevel());
+        value.setStatus(getStatus());
+        value.setManagementUnit(getManagementUnit());
+        value.setBuildDate(getBuildDate());
+        value.setDesignFlow(getDesignFlow());
+        value.setEquipmentId(getEquipmentId());
+        value.setLocation(getLocation());
+        value.setLongitude(getLongitude());
+        value.setLatitude(getLatitude());
+        value.setRemark(getRemark());
+    }
+
+    /** 实体 → DTO,供导出使用。 */
+    protected void copyFrom(DrainageFacilityBase value) {
+        setFacilityCode(value.getFacilityCode());
+        setFacilityName(value.getFacilityName());
+        setFacilityLevel(value.getFacilityLevel());
+        setStatus(value.getStatus());
+        setManagementUnit(value.getManagementUnit());
+        setBuildDate(value.getBuildDate());
+        setDesignFlow(value.getDesignFlow());
+        setEquipmentId(value.getEquipmentId());
+        setLocation(value.getLocation());
+        setLongitude(value.getLongitude());
+        setLatitude(value.getLatitude());
+        setRemark(value.getRemark());
+    }
+}

+ 6 - 9
pipe-network-service/zksy-system/src/main/java/com/zksy/drainage/dto/EngineeringFacilityPageInDTO.java → pipe-network-service/zksy-system/src/main/java/com/zksy/drainage/dto/DrainageFacilityPageInDTO.java

@@ -7,11 +7,11 @@ import lombok.Data;
 import java.io.Serializable;
 
 /**
- * 工程设施查询入参(分页查询与地图查询共用)
+ * 排水设施(闸门 / 调蓄设施)查询入参,分页与地图查询共用。
  */
 @Data
-@ApiModel(value = "工程设施查询入参", description = "工程设施查询入参")
-public class EngineeringFacilityPageInDTO implements Serializable {
+@ApiModel(value = "排水设施查询入参", description = "闸门/调蓄设施分页与地图查询共用")
+public class DrainageFacilityPageInDTO implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @ApiModelProperty(value = "设施编码")
@@ -20,9 +20,6 @@ public class EngineeringFacilityPageInDTO implements Serializable {
     @ApiModelProperty(value = "设施名称")
     private String facilityName;
 
-    @ApiModelProperty(value = "设施类型(0闸门 1调蓄设施 2泵站)")
-    private String facilityType;
-
     @ApiModelProperty(value = "设施等级")
     private String facilityLevel;
 
@@ -32,12 +29,12 @@ public class EngineeringFacilityPageInDTO implements Serializable {
     @ApiModelProperty(value = "位置描述")
     private String location;
 
-    @ApiModelProperty(value = "运行状态(0正常 1检修 2停用 3故障)")
+    @ApiModelProperty(value = "运行状态(0正常 1异常)")
     private String status;
 
-    @ApiModelProperty(value = "当前记录起始索引")
+    @ApiModelProperty(value = "页码")
     private Long pageNum;
 
-    @ApiModelProperty(value = "每页显示记录数")
+    @ApiModelProperty(value = "每页记录数")
     private Long pageSize;
 }

+ 29 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/drainage/dto/DrainageGateImportDTO.java

@@ -0,0 +1,29 @@
+package com.zksy.drainage.dto;
+
+import com.zksy.common.annotation.Excel;
+import com.zksy.drainage.domain.DrainageGateInfo;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * 排水闸门信息(app_user.drainage_gate_info)Excel 导入/导出列定义。
+ */
+@Data
+public class DrainageGateImportDTO extends DrainageFacilityImportBaseDTO {
+
+    @Excel(name = "设计水头(m)", sort = 8, width = 16)
+    private BigDecimal designHead;
+
+    public static DrainageGateImportDTO from(DrainageGateInfo value) {
+        DrainageGateImportDTO dto = new DrainageGateImportDTO();
+        dto.copyFrom(value);
+        dto.setDesignHead(value.getDesignHead());
+        return dto;
+    }
+
+    public void applyTo(DrainageGateInfo value) {
+        super.applyTo(value);
+        value.setDesignHead(getDesignHead());
+    }
+}

+ 29 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/drainage/dto/DrainageStorageImportDTO.java

@@ -0,0 +1,29 @@
+package com.zksy.drainage.dto;
+
+import com.zksy.common.annotation.Excel;
+import com.zksy.drainage.domain.DrainageStorageInfo;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * 排水调蓄设施信息(app_user.drainage_storage_info)Excel 导入/导出列定义。
+ */
+@Data
+public class DrainageStorageImportDTO extends DrainageFacilityImportBaseDTO {
+
+    @Excel(name = "调蓄容积(m³)", sort = 8, width = 16)
+    private BigDecimal storageCapacity;
+
+    public static DrainageStorageImportDTO from(DrainageStorageInfo value) {
+        DrainageStorageImportDTO dto = new DrainageStorageImportDTO();
+        dto.copyFrom(value);
+        dto.setStorageCapacity(value.getStorageCapacity());
+        return dto;
+    }
+
+    public void applyTo(DrainageStorageInfo value) {
+        super.applyTo(value);
+        value.setStorageCapacity(getStorageCapacity());
+    }
+}

+ 8 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/drainage/mapper/DrainageGateInfoMapper.java

@@ -0,0 +1,8 @@
+package com.zksy.drainage.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zksy.drainage.domain.DrainageGateInfo;
+
+/** 排水闸门 Mapper */
+public interface DrainageGateInfoMapper extends BaseMapper<DrainageGateInfo> {
+}

+ 8 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/drainage/mapper/DrainageStorageInfoMapper.java

@@ -0,0 +1,8 @@
+package com.zksy.drainage.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zksy.drainage.domain.DrainageStorageInfo;
+
+/** 排水调蓄设施 Mapper */
+public interface DrainageStorageInfoMapper extends BaseMapper<DrainageStorageInfo> {
+}

+ 0 - 9
pipe-network-service/zksy-system/src/main/java/com/zksy/drainage/mapper/EngineeringFacilityMapper.java

@@ -1,9 +0,0 @@
-package com.zksy.drainage.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.zksy.drainage.domain.EngineeringFacility;
-import org.apache.ibatis.annotations.Mapper;
-
-@Mapper
-public interface EngineeringFacilityMapper extends BaseMapper<EngineeringFacility> {
-}

+ 37 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/drainage/service/DrainageFacilityService.java

@@ -0,0 +1,37 @@
+package com.zksy.drainage.service;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.zksy.drainage.domain.DrainageFacilityBase;
+import com.zksy.drainage.dto.DrainageFacilityPageInDTO;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 排水设施(闸门 / 调蓄设施)公共服务,T 为具体实体。
+ */
+public interface DrainageFacilityService<T extends DrainageFacilityBase> extends IService<T> {
+
+    Page<T> findByPage(DrainageFacilityPageInDTO dto);
+
+    List<T> listForMap(DrainageFacilityPageInDTO dto);
+
+    Map<String, List<String>> getFilterOptions();
+
+    T getEntityById(String id);
+
+    /** 按设施编码查询(导入查重用),不存在返回 null。 */
+    T getEntityByCode(String code);
+
+    List<T> listAll();
+
+    boolean saveEntity(T entity);
+
+    boolean updateEntity(T entity);
+
+    boolean removeEntity(String id);
+
+    boolean removeBatchEntity(Collection<String> ids);
+}

+ 7 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/drainage/service/DrainageGateInfoService.java

@@ -0,0 +1,7 @@
+package com.zksy.drainage.service;
+
+import com.zksy.drainage.domain.DrainageGateInfo;
+
+/** 排水闸门服务(公共逻辑见 DrainageFacilityService) */
+public interface DrainageGateInfoService extends DrainageFacilityService<DrainageGateInfo> {
+}

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است