Kaynağa Gözat

优化报警管理

zengy 1 hafta önce
ebeveyn
işleme
7df9a8713d
43 değiştirilmiş dosya ile 231 ekleme ve 721 silme
  1. 0 1
      audio-service/src/main/java/com/zksy/audio/service/NoiseLeakAlarmService.java
  2. 1 1
      environment-service/src/main/java/com/zksy/environment/utils/AlarmUtil.java
  3. 2 2
      firefighting-pressure-service/src/main/java/com/zksy/pressure/utils/MessageHandler.java
  4. 1 1
      flammable-gas-service/src/main/java/com/zksy/gas/utils/AlarmUtil.java
  5. 1 1
      flammable-gas-service/src/main/java/com/zksy/gas/utils/MessageHandler.java
  6. 2 2
      manhole-service/src/main/java/com/zksy/manhole/utils/AlarmUtil.java
  7. 22 18
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/alarm/AlarmController.java
  8. 0 79
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/base/alarm/AlarmDataController.java
  9. 0 221
      pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/base/alarm/AlarmTestController.java
  10. 0 257
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/BusinessCockpitEventAdapterTest.java
  11. 1 0
      pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/CockpitFreshnessSemanticsControllerTest.java
  12. 4 4
      pipe-network-service/zksy-system/src/main/java/com/zksy/base/alarm/domain/AlarmData.java
  13. 4 6
      pipe-network-service/zksy-system/src/main/java/com/zksy/base/alarm/service/AlarmDataService.java
  14. 1 1
      pipe-network-service/zksy-system/src/main/java/com/zksy/base/alarm/service/impl/AlarmClearServiceImpl.java
  15. 15 14
      pipe-network-service/zksy-system/src/main/java/com/zksy/base/alarm/service/impl/AlarmDataServiceImpl.java
  16. 1 1
      pipe-network-service/zksy-system/src/main/java/com/zksy/base/drill/service/DrillAlarmSyncService.java
  17. 0 1
      pipe-network-service/zksy-system/src/main/java/com/zksy/base/drill/service/impl/DrillSimulationServiceImpl.java
  18. 1 1
      pipe-network-service/zksy-system/src/main/java/com/zksy/base/service/DrillAlarmSyncService.java
  19. 0 1
      pipe-network-service/zksy-system/src/main/java/com/zksy/base/service/impl/DrillSimulationServiceImpl.java
  20. 2 3
      pipe-network-service/zksy-system/src/main/java/com/zksy/base/service/impl/WaterSupplyDeviceServiceImpl.java
  21. 28 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/base/warning/domain/EquipmentWarningType.java
  22. 5 11
      pipe-network-service/zksy-system/src/main/java/com/zksy/base/warning/domain/WarningType.java
  23. 9 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/base/warning/mapper/EquipmentWarningTypeMapper.java
  24. 0 2
      pipe-network-service/zksy-system/src/main/java/com/zksy/base/warning/mapper/WarningTypeMapper.java
  25. 61 31
      pipe-network-service/zksy-system/src/main/java/com/zksy/base/warning/service/impl/WarningThresholdServiceImpl.java
  26. 48 29
      pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/event/BusinessCockpitEventAdapter.java
  27. 1 1
      pipe-network-service/zksy-system/src/main/java/com/zksy/ops/service/impl/WorkOrderServiceImpl.java
  28. 2 1
      pipe-network-service/zksy-system/src/main/resources/mapper/base/AlarmDataMapper.xml
  29. 10 6
      pipe-network-service/zksy-system/src/main/resources/mapper/base/AlarmOperationsMapper.xml
  30. 3 2
      pipe-network-service/zksy-system/src/main/resources/mapper/base/AlarmReviewMapper.xml
  31. 2 1
      pipe-network-service/zksy-system/src/main/resources/mapper/warning/AlarmWarningRelMapper.xml
  32. 0 1
      pipe-network-service/zksy-system/src/test/java/com/zksy/WaterSupply/MonitorAlarm/WaterSupplyAlarmRealtimeContractTest.java
  33. 0 1
      pipe-network-service/zksy-system/src/test/java/com/zksy/base/alarm/service/AlarmClearServiceTest.java
  34. 0 2
      pipe-network-service/zksy-system/src/test/java/com/zksy/base/service/impl/WaterSupplyDeviceServiceImplTest.java
  35. 2 5
      pipe-network-service/zksy-system/src/test/java/com/zksy/ops/service/impl/WorkOrderServiceImplTest.java
  36. 0 1
      radar-service/src/main/java/com/zksy/radar/utils/MessageHandler.java
  37. 0 1
      telemetry-service/src/main/java/com/zksy/telemetry/utils/MessageHandler.java
  38. 0 1
      water-level-service/src/main/java/com/zksy/water/utils/MessageHandler.java
  39. 0 4
      zk-api-service/src/main/java/com/zksy/api/domain/AlarmData.java
  40. 1 2
      zk-api-service/src/main/java/com/zksy/api/service/CollectionAlarmWriter.java
  41. 0 1
      zk-api-service/src/main/java/com/zksy/api/service/impl/EquipmentStatusApiServiceImpl.java
  42. 0 1
      zk-api-service/src/main/java/com/zksy/api/utils/SmsUtil.java
  43. 1 2
      zk-api-service/src/main/resources/mapper/AlarmDataMapper.xml

+ 0 - 1
audio-service/src/main/java/com/zksy/audio/service/NoiseLeakAlarmService.java

@@ -188,7 +188,6 @@ public class NoiseLeakAlarmService {
                                   double lowerFreq, double upperFreq) {
         AlarmData alarm = new AlarmData();
         alarm.setDeviceCode(encode);
-        alarm.setWarningType("漏失报警");
         alarm.setWarningCode(LEAK_WARNING_CODE);
         // 漏失告警只在 alarm_data 中保存 RMS 的越限上限;最小值仅用于恢复判断,不入库。
         if (maxValue != null) {

+ 1 - 1
environment-service/src/main/java/com/zksy/environment/utils/AlarmUtil.java

@@ -75,7 +75,7 @@ public class AlarmUtil {
         try {
             AlarmData alarmData = new AlarmData();
             alarmData.setDeviceCode(deviceCode);
-            alarmData.setWarningType(warningType);
+            
             alarmData.setWarningCode(warningCode);
             alarmData.setMinValue(minValue);
             alarmData.setMaxValue(maxValue);

+ 2 - 2
firefighting-pressure-service/src/main/java/com/zksy/pressure/utils/MessageHandler.java

@@ -277,7 +277,7 @@ public class MessageHandler extends ChannelInboundHandlerAdapter {
 		try {
 			AlarmData alarmData = new AlarmData();
 			alarmData.setDeviceCode(deviceCode);
-			alarmData.setWarningType(warningType);
+			
 			alarmData.setWarningCode(warningCode);
 			alarmData.setMinValue(minValue);
 			alarmData.setMaxValue(maxValue);
@@ -310,7 +310,7 @@ public class MessageHandler extends ChannelInboundHandlerAdapter {
 		try {
 			AlarmData alarmData = new AlarmData();
 			alarmData.setDeviceCode(deviceCode);
-			alarmData.setWarningType(warningType);
+			
 			alarmData.setWarningCode(warningCode);
 			alarmData.setActualValue(actualValue);
 			alarmData.setAlarmLevel(1);

+ 1 - 1
flammable-gas-service/src/main/java/com/zksy/gas/utils/AlarmUtil.java

@@ -43,7 +43,7 @@ public class AlarmUtil {
         try {
             AlarmData alarmData = new AlarmData();
             alarmData.setDeviceCode(deviceCode);
-            alarmData.setWarningType(warningType);
+            
             alarmData.setWarningCode(warningCode);
             alarmData.setMinValue(minValue);
             alarmData.setMaxValue(maxValue);

+ 1 - 1
flammable-gas-service/src/main/java/com/zksy/gas/utils/MessageHandler.java

@@ -265,7 +265,7 @@ public class MessageHandler extends ChannelInboundHandlerAdapter {
 		try {
 			AlarmData alarmData = new AlarmData();
 			alarmData.setDeviceCode(deviceCode);
-			alarmData.setWarningType(warningType);
+			
 			alarmData.setWarningCode(warningCode);
 			alarmData.setMinValue(minValue);
 			alarmData.setMaxValue(maxValue);

+ 2 - 2
manhole-service/src/main/java/com/zksy/manhole/utils/AlarmUtil.java

@@ -72,7 +72,7 @@ public class AlarmUtil {
         try {
             AlarmData alarmData = new AlarmData();
             alarmData.setDeviceCode(deviceCode);
-            alarmData.setWarningType(warningType);
+            
             alarmData.setWarningCode(warningCode);
             alarmData.setMinValue(minValue);
             alarmData.setMaxValue(maxValue);
@@ -118,7 +118,7 @@ public class AlarmUtil {
         try {
             AlarmData alarmData = new AlarmData();
             alarmData.setDeviceCode(deviceCode);
-            alarmData.setWarningType(warningType);
+            
             alarmData.setWarningCode(warningCode);
             alarmData.setActualValue(actualValue);
             alarmData.setAlarmLevel(alarmLevel);

+ 22 - 18
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/alarm/AlarmController.java

@@ -23,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.multipart.MultipartFile;
+
 import javax.validation.Valid;
 
 import java.time.LocalDateTime;
@@ -48,35 +49,44 @@ public class AlarmController {
     @GetMapping
     @ApiOperation("报警事件清单,分页及子系统数据范围校验")
     @PreAuthorize("@ss.hasPermi('alarm:operations:list')")
-    public AjaxResult list(@Valid AlarmQuery query) { return AjaxResult.success(operations.page(query)); }
+    public AjaxResult list(@Valid AlarmQuery query) {
+        return AjaxResult.success(operations.page(query));
+    }
 
     @GetMapping("/statistics")
     @ApiOperation("按等级统计报警事件")
     @PreAuthorize("@ss.hasPermi('alarm:operations:list')")
-    public AjaxResult statistics(@Valid AlarmQuery query) { return AjaxResult.success(operations.statistics(query)); }
+    public AjaxResult statistics(@Valid AlarmQuery query) {
+        return AjaxResult.success(operations.statistics(query));
+    }
 
     @GetMapping("/dashboard")
     @ApiOperation("首页报警态势:报警总数、报警中设备、近N天分级趋势及分类占比")
     @PreAuthorize("@ss.hasPermi('alarm:operations:list')")
-    public AjaxResult dashboard(@Valid AlarmQuery query,
-            @RequestParam(value = "days", defaultValue = "7") int days) {
+    public AjaxResult dashboard(@Valid AlarmQuery query, @RequestParam(value = "days", defaultValue = "7") int days) {
         return AjaxResult.success(operations.dashboard(query, days));
     }
 
     @GetMapping("/reminders")
     @ApiOperation("按最近操作时间查询未处理报警提醒,固定 alarm_status=0")
     @PreAuthorize("@ss.hasPermi('alarm:operations:list')")
-    public AjaxResult reminders(@Valid AlarmQuery query) { return AjaxResult.success(operations.reminders(query)); }
+    public AjaxResult reminders(@Valid AlarmQuery query) {
+        return AjaxResult.success(operations.reminders(query));
+    }
 
     @GetMapping("/options")
     @ApiOperation("报警查询字典选项")
     @PreAuthorize("@ss.hasPermi('alarm:operations:list')")
-    public AjaxResult options(@Valid AlarmQuery query) { return AjaxResult.success(operations.options(query)); }
+    public AjaxResult options(@Valid AlarmQuery query) {
+        return AjaxResult.success(operations.options(query));
+    }
 
     @GetMapping("/map")
     @ApiOperation("供水、排水当前报警GIS点位,按设备大类隔离")
     @PreAuthorize("@ss.hasPermi('alarm:operations:list')")
-    public AjaxResult map(@Valid AlarmQuery query) { return AjaxResult.success(operations.map(query)); }
+    public AjaxResult map(@Valid AlarmQuery query) {
+        return AjaxResult.success(operations.map(query));
+    }
 
     @GetMapping("/{alarmId}")
     @ApiOperation("范围内报警事件详情")
@@ -95,8 +105,7 @@ public class AlarmController {
     @GetMapping("/{alarmId}/analysis")
     @ApiOperation("排水报警真实监测曲线及日月均值")
     @PreAuthorize("@ss.hasPermi('alarm:operations:list')")
-    public AjaxResult analysis(@PathVariable("alarmId") String alarmId, @Valid AlarmQuery query,
-            @RequestParam(value = "period", defaultValue = "CURVE") AlarmSeriesPeriod period) {
+    public AjaxResult analysis(@PathVariable("alarmId") String alarmId, @Valid AlarmQuery query, @RequestParam(value = "period", defaultValue = "CURVE") AlarmSeriesPeriod period) {
         return AjaxResult.success(operations.analysis(alarmId, query, period));
     }
 
@@ -139,16 +148,14 @@ public class AlarmController {
     @ApiOperation("提交审核;确认报警同时创建待派单工单,不修改设备状态")
     @PreAuthorize("@ss.hasPermi('alarm:review:audit')")
     @Log(title = "报警审核", businessType = BusinessType.UPDATE)
-    public AjaxResult review(@PathVariable("alarmId") String alarmId, @Valid AlarmReviewQuery query,
-                             @Valid @RequestBody AlarmReviewRequest request) {
+    public AjaxResult review(@PathVariable("alarmId") String alarmId, @Valid AlarmReviewQuery query, @Valid @RequestBody AlarmReviewRequest request) {
         return AjaxResult.success(reviewService.review(alarmId, query, request));
     }
 
     @PostMapping("/{alarmId}/attachments")
     @ApiOperation("上传报警审核图片,仅JPG/JPEG/PNG且单张不超过10MB")
     @PreAuthorize("@ss.hasPermi('alarm:review:audit')")
-    public AjaxResult uploadAttachment(@PathVariable("alarmId") String alarmId, @Valid AlarmReviewQuery query,
-                                       @RequestPart("file") MultipartFile file) throws Exception {
+    public AjaxResult uploadAttachment(@PathVariable("alarmId") String alarmId, @Valid AlarmReviewQuery query, @RequestPart("file") MultipartFile file) throws Exception {
         reviewService.detail(alarmId, query);
         return AjaxResult.success(attachmentService.upload(alarmId, file));
     }
@@ -156,10 +163,7 @@ public class AlarmController {
     @GetMapping("/findByPage")
     @ApiOperation("报警分页查询")
     @Anonymous
-    public AjaxResult findByPage(@ApiParam("页码") long pageNum,
-                                  @ApiParam("每页条数") long pageSize,
-                                  @RequestParam(value = "warningType", required = false) String warningType,
-                                  @RequestParam(value = "alarmStatus", required = false) Integer alarmStatus) {
+    public AjaxResult findByPage(@ApiParam("页码") long pageNum, @ApiParam("每页条数") long pageSize, @RequestParam(value = "warningType", required = false) String warningType, @RequestParam(value = "alarmStatus", required = false) Integer alarmStatus) {
         Page<AlarmData> page = service.findByPage(pageNum, pageSize, null, warningType, null, alarmStatus, null, null, null);
         return AjaxResult.success(page);
     }
@@ -190,6 +194,6 @@ public class AlarmController {
     @ApiOperation("获取未处理报警点位(报警一张图)")
     @Anonymous
     public AjaxResult getActivePoints() {
-        return AjaxResult.success(service.getAlarmDataList(null, null, null, AlarmRecordStatusEnum.UNHANDLED.getCode()));
+        return AjaxResult.success(service.getAlarmDataList(null, null, AlarmRecordStatusEnum.UNHANDLED.getCode()));
     }
 }

+ 0 - 79
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/base/alarm/AlarmDataController.java

@@ -1,79 +0,0 @@
-package com.zksy.web.controller.base.alarm;
-
-import com.zksy.base.alarm.domain.AlarmData;
-import com.zksy.base.alarm.service.AlarmDataService;
-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.web.bind.annotation.*;
-
-import java.time.LocalDateTime;
-import java.util.Arrays;
-
-@RestController
-@RequestMapping("/alarmData")
-@Api(tags = "报警数据信息", description = "报警数据信息desc")
-public class AlarmDataController {
-    @Autowired
-    private AlarmDataService service;
-
-    @GetMapping("/findByPage")
-    @ApiOperation(value = "报警数据信息查询分页")
-    @Anonymous
-    public AjaxResult findByPage(@ApiParam(value = "页码", required = true) long pageNum,
-                                 @ApiParam(value = "页数", required = true) long pageSize,
-                                 @ApiParam(value = "设备编码", required = false) String deviceCode,
-                                 @ApiParam(value = "预警类型", required = false) String warningType,
-                                 @ApiParam(value = "预警编码", required = false) String warningCode,
-                                 @ApiParam(value = "报警状态 0-未处理 1-已处理", required = false) Integer alarmStatus,
-                                 @ApiParam(value = "设备类型(如drainage)", required = false) String equipmentType,
-                                 @ApiParam(value = "开始时间(yyyy-MM-dd HH:mm:ss)", required = false) String startTime,
-                                 @ApiParam(value = "结束时间(yyyy-MM-dd HH:mm:ss)", required = false) String endTime) {
-        return AjaxResult.success(service.findByPage(pageNum, pageSize, deviceCode, warningType, warningCode, alarmStatus, equipmentType, startTime, endTime));
-    }
-    @GetMapping("/getAlarmDataList")
-    @ApiOperation(value = "报警数据信息查询")
-    @Anonymous
-    public AjaxResult getAlarmDataList(@ApiParam(value = "设备编码", required = false) String deviceCode,
-                                         @ApiParam(value = "预警类型", required = false) String warningType,
-                                         @ApiParam(value = "预警编码", required = false) String warningCode,
-                                         @ApiParam(value = "报警状态 0-未处理 1-已处理", required = false) Integer alarmStatus) {
-        return AjaxResult.success(service.getAlarmDataList(deviceCode, warningType, warningCode, alarmStatus));
-    }
-
-    @GetMapping("/getById/{id}")
-    @ApiOperation(value = "根据Id查询报警数据信息")
-    public AjaxResult getById(@PathVariable String id) {
-        return AjaxResult.success(service.getById(id));
-    }
-
-    @PostMapping("/save")
-    @ApiOperation(value = "报警数据信息保存")
-    public AjaxResult save(@RequestBody AlarmData entity) {
-        return service.saveAlarmData(entity) ? AjaxResult.success(entity) : AjaxResult.error("保存失败");
-    }
-
-    @PostMapping("/update")
-    @ApiOperation(value = "报警数据信息修改")
-    public AjaxResult update(@RequestBody AlarmData entity) {
-        entity.setUpdateTime(LocalDateTime.now());
-        return service.updateById(entity) ? AjaxResult.success(entity) : AjaxResult.error("修改失败");
-    }
-
-    @PostMapping("/handle")
-    @ApiOperation(value = "处理报警")
-    public AjaxResult handle(@RequestBody AlarmData entity) {
-        entity.setAlarmStatus(1);
-        entity.setUpdateTime(LocalDateTime.now());
-        return service.updateById(entity) ? AjaxResult.success(entity) : AjaxResult.error("处理失败");
-    }
-
-    @PostMapping("/deleteBatch")
-    @ApiOperation(value = "报警数据信息删除")
-    public AjaxResult delete(@RequestBody String[] ids) {
-        return service.removeByIds(Arrays.asList(ids)) ? AjaxResult.success("删除成功") : AjaxResult.error("删除失败");
-    }
-}

+ 0 - 221
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/base/alarm/AlarmTestController.java

@@ -1,221 +0,0 @@
-package com.zksy.web.controller.base.alarm;
-
-import com.zksy.base.alarm.domain.AlarmData;
-import com.zksy.base.alarm.service.AlarmDataService;
-import com.zksy.common.core.domain.AjaxResult;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import java.math.BigDecimal;
-import java.time.LocalDateTime;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Random;
-
-@RestController
-@RequestMapping("/alarmTest")
-@Api(tags = "报警测试", description = "模拟采集数据和报警测试")
-public class AlarmTestController {
-
-    @Autowired
-    private AlarmDataService alarmDataService;
-
-    private Random random = new Random();
-
-    @GetMapping("/simulateManhole")
-    @ApiOperation(value = "模拟井盖设备采集数据并报警")
-    public AjaxResult simulateManhole() {
-        String deviceCode = "TEST-MANHOLE-001";
-
-        double temperature = 30 + random.nextDouble() * 40;
-        double tiltAngle = 0 + random.nextDouble() * 90;
-        double threshold = 60.0;
-
-        Map<String, Object> result = new HashMap<>();
-        result.put("deviceCode", deviceCode);
-        result.put("temperature", temperature);
-        result.put("tiltAngle", tiltAngle);
-        result.put("threshold", threshold);
-
-        if (temperature > 50) {
-            AlarmData alarmData = new AlarmData();
-            alarmData.setDeviceCode(deviceCode);
-            alarmData.setWarningType("温度预警");
-            alarmData.setWarningCode("WARN-TEMPERATURE");
-            alarmData.setMaxValue(BigDecimal.valueOf(50.0));
-            alarmData.setActualValue(BigDecimal.valueOf(temperature));
-            alarmData.setAlarmStatus(0);
-            alarmData.setRemark("模拟井盖温度报警");
-            alarmData.setCreateTime(LocalDateTime.now());
-            alarmDataService.saveAlarmData(alarmData);
-            result.put("temperatureAlarm", true);
-        } else {
-            result.put("temperatureAlarm", false);
-        }
-
-        if (tiltAngle > threshold) {
-            AlarmData alarmData = new AlarmData();
-            alarmData.setDeviceCode(deviceCode);
-            alarmData.setWarningType("倾斜预警");
-            alarmData.setWarningCode("WARN-TILT");
-            alarmData.setMaxValue(BigDecimal.valueOf(threshold));
-            alarmData.setActualValue(BigDecimal.valueOf(tiltAngle));
-            alarmData.setAlarmStatus(0);
-            alarmData.setRemark("模拟井盖倾斜报警");
-            alarmData.setCreateTime(LocalDateTime.now());
-            alarmDataService.saveAlarmData(alarmData);
-            result.put("tiltAlarm", true);
-        } else {
-            result.put("tiltAlarm", false);
-        }
-
-        return AjaxResult.success(result);
-    }
-
-    @GetMapping("/simulateGas")
-    @ApiOperation(value = "模拟可燃气体设备采集数据并报警")
-    public AjaxResult simulateGas() {
-        String deviceCode = "TEST-GAS-001";
-
-        float temperature = 20 + random.nextFloat() * 40;
-        float humidity = 40 + random.nextFloat() * 40;
-        BigDecimal gasConcentration = BigDecimal.valueOf(random.nextDouble() * 100);
-
-        Map<String, Object> result = new HashMap<>();
-        result.put("deviceCode", deviceCode);
-        result.put("temperature", temperature);
-        result.put("humidity", humidity);
-        result.put("gasConcentration", gasConcentration);
-
-        if (temperature > 50) {
-            AlarmData alarmData = new AlarmData();
-            alarmData.setDeviceCode(deviceCode);
-            alarmData.setWarningType("温度预警");
-            alarmData.setWarningCode("WARN-TEMPERATURE");
-            alarmData.setMaxValue(BigDecimal.valueOf(50.0));
-            alarmData.setActualValue(BigDecimal.valueOf(temperature));
-            alarmData.setAlarmStatus(0);
-            alarmData.setRemark("模拟可燃气体温度报警");
-            alarmData.setCreateTime(LocalDateTime.now());
-            alarmDataService.saveAlarmData(alarmData);
-            result.put("temperatureAlarm", true);
-        } else {
-            result.put("temperatureAlarm", false);
-        }
-
-        if (humidity > 80) {
-            AlarmData alarmData = new AlarmData();
-            alarmData.setDeviceCode(deviceCode);
-            alarmData.setWarningType("湿度预警");
-            alarmData.setWarningCode("WARN-HUMIDITY");
-            alarmData.setMaxValue(BigDecimal.valueOf(80.0));
-            alarmData.setActualValue(BigDecimal.valueOf(humidity));
-            alarmData.setAlarmStatus(0);
-            alarmData.setRemark("模拟可燃气体湿度报警");
-            alarmData.setCreateTime(LocalDateTime.now());
-            alarmDataService.saveAlarmData(alarmData);
-            result.put("humidityAlarm", true);
-        } else {
-            result.put("humidityAlarm", false);
-        }
-
-        if (gasConcentration.doubleValue() > 50) {
-            AlarmData alarmData = new AlarmData();
-            alarmData.setDeviceCode(deviceCode);
-            alarmData.setWarningType("气体浓度预警");
-            alarmData.setWarningCode("WARN-GAS-CONCENTRATION");
-            alarmData.setMaxValue(BigDecimal.valueOf(50.0));
-            alarmData.setActualValue(gasConcentration);
-            alarmData.setAlarmStatus(0);
-            alarmData.setRemark("模拟可燃气体浓度报警");
-            alarmData.setCreateTime(LocalDateTime.now());
-            alarmDataService.saveAlarmData(alarmData);
-            result.put("gasConcentrationAlarm", true);
-        } else {
-            result.put("gasConcentrationAlarm", false);
-        }
-
-        return AjaxResult.success(result);
-    }
-
-    @GetMapping("/simulateEnvironment")
-    @ApiOperation(value = "模拟环境设备采集数据并报警")
-    public AjaxResult simulateEnvironment() {
-        String deviceCode = "TEST-ENV-001";
-
-        double temperature = 15 + random.nextDouble() * 50;
-        double humidity = 30 + random.nextDouble() * 60;
-
-        Map<String, Object> result = new HashMap<>();
-        result.put("deviceCode", deviceCode);
-        result.put("temperature", temperature);
-        result.put("humidity", humidity);
-
-        if (temperature > 50) {
-            AlarmData alarmData = new AlarmData();
-            alarmData.setDeviceCode(deviceCode);
-            alarmData.setWarningType("温度预警");
-            alarmData.setWarningCode("WARN-TEMPERATURE");
-            alarmData.setMaxValue(BigDecimal.valueOf(50.0));
-            alarmData.setActualValue(BigDecimal.valueOf(temperature));
-            alarmData.setAlarmStatus(0);
-            alarmData.setRemark("模拟环境温度报警");
-            alarmData.setCreateTime(LocalDateTime.now());
-            alarmDataService.saveAlarmData(alarmData);
-            result.put("temperatureAlarm", true);
-        } else {
-            result.put("temperatureAlarm", false);
-        }
-
-        if (humidity > 90) {
-            AlarmData alarmData = new AlarmData();
-            alarmData.setDeviceCode(deviceCode);
-            alarmData.setWarningType("湿度预警");
-            alarmData.setWarningCode("WARN-HUMIDITY");
-            alarmData.setMaxValue(BigDecimal.valueOf(90.0));
-            alarmData.setActualValue(BigDecimal.valueOf(humidity));
-            alarmData.setAlarmStatus(0);
-            alarmData.setRemark("模拟环境湿度报警");
-            alarmData.setCreateTime(LocalDateTime.now());
-            alarmDataService.saveAlarmData(alarmData);
-            result.put("humidityAlarm", true);
-        } else {
-            result.put("humidityAlarm", false);
-        }
-
-        return AjaxResult.success(result);
-    }
-
-    @PostMapping("/customAlarm")
-    @ApiOperation(value = "自定义报警测试")
-    public AjaxResult customAlarm(@RequestBody Map<String, Object> params) {
-        AlarmData alarmData = new AlarmData();
-        alarmData.setDeviceCode((String) params.get("deviceCode"));
-        alarmData.setWarningType((String) params.get("warningType"));
-        alarmData.setWarningCode((String) params.get("warningCode"));
-        
-        Object minValueObj = params.get("minValue");
-        if (minValueObj != null) {
-            alarmData.setMinValue(new BigDecimal(minValueObj.toString()));
-        }
-        
-        Object maxValueObj = params.get("maxValue");
-        if (maxValueObj != null) {
-            alarmData.setMaxValue(new BigDecimal(maxValueObj.toString()));
-        }
-        
-        Object actualValueObj = params.get("actualValue");
-        if (actualValueObj != null) {
-            alarmData.setActualValue(new BigDecimal(actualValueObj.toString()));
-        }
-        
-        alarmData.setAlarmStatus(0);
-        alarmData.setRemark((String) params.getOrDefault("remark", "自定义测试报警"));
-        alarmData.setCreateTime(LocalDateTime.now());
-        
-        boolean success = alarmDataService.saveAlarmData(alarmData);
-        return success ? AjaxResult.success(alarmData) : AjaxResult.error("保存失败");
-    }
-}

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

@@ -1,257 +0,0 @@
-package com.zksy.web.controller.cockpit;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.zksy.base.alarm.domain.AlarmData;
-import com.zksy.base.alarm.service.AlarmDataService;
-import com.zksy.base.domain.EquipmentBase;
-import com.zksy.base.domain.EquipmentType;
-import com.zksy.base.domain.MonitorPoint;
-import com.zksy.base.service.EquipmentBaseService;
-import com.zksy.base.service.EquipmentTypeService;
-import com.zksy.base.service.MonitorPointService;
-import com.zksy.base.warning.domain.AlarmWarningRel;
-import com.zksy.base.warning.domain.EarlyWarning;
-import com.zksy.base.warning.domain.WarningType;
-import com.zksy.base.warning.mapper.AlarmWarningRelMapper;
-import com.zksy.base.warning.mapper.WarningTypeMapper;
-import com.zksy.base.warning.service.EarlyWarningService;
-import com.zksy.cockpit.event.BusinessCockpitEventAdapter;
-import com.zksy.cockpit.event.CockpitCurrentEventsSnapshot;
-import com.zksy.cockpit.event.CockpitEventSnapshot;
-import com.zksy.cockpit.event.CockpitHistoryAnalysisSnapshot;
-import com.zksy.cockpit.event.CockpitHandlingEfficiencySnapshot;
-import com.zksy.cockpit.event.CockpitMultidimensionalAnalysisSnapshot;
-import com.zksy.ops.domain.WorkOrder;
-import com.zksy.ops.service.WorkOrderService;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import java.math.BigDecimal;
-import java.time.Clock;
-import java.time.Instant;
-import java.time.LocalDateTime;
-import java.time.OffsetDateTime;
-import java.time.ZoneOffset;
-import java.util.Arrays;
-import java.util.Collections;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-class BusinessCockpitEventAdapterTest {
-
-    private static final String DEVICE_CODE = "GAS-001";
-    private EquipmentBaseService equipmentBaseService;
-    private EquipmentTypeService equipmentTypeService;
-    private MonitorPointService monitorPointService;
-    private EarlyWarningService earlyWarningService;
-    private AlarmDataService alarmDataService;
-    private WarningTypeMapper warningTypeMapper;
-    private AlarmWarningRelMapper alarmWarningRelMapper;
-    private WorkOrderService workOrderService;
-    private BusinessCockpitEventAdapter adapter;
-
-    @BeforeEach
-    void setUp() {
-        equipmentBaseService = mock(EquipmentBaseService.class);
-        equipmentTypeService = mock(EquipmentTypeService.class);
-        monitorPointService = mock(MonitorPointService.class);
-        earlyWarningService = mock(EarlyWarningService.class);
-        alarmDataService = mock(AlarmDataService.class);
-        warningTypeMapper = mock(WarningTypeMapper.class);
-        alarmWarningRelMapper = mock(AlarmWarningRelMapper.class);
-        workOrderService = mock(WorkOrderService.class);
-        adapter = new BusinessCockpitEventAdapter(
-                equipmentBaseService,
-                equipmentTypeService,
-                monitorPointService,
-                earlyWarningService,
-                alarmDataService,
-                warningTypeMapper,
-                alarmWarningRelMapper,
-                workOrderService,
-                Clock.fixed(Instant.parse("2026-09-02T02:00:00Z"), ZoneOffset.UTC));
-
-        EquipmentType gasRoot = type(3, "燃气", 0);
-        EquipmentType gasSensor = type(11, "燃气浓度计", 3);
-        EquipmentBase device = device("E-001", DEVICE_CODE, 11);
-        MonitorPoint point = point("P-001", "MP-GAS-001", "燃气监测点");
-        EarlyWarning warning = warning();
-        AlarmData alarm = alarm();
-        AlarmWarningRel relation = relation();
-        WorkOrder order = workOrder();
-        WarningType warningType = warningType();
-
-        when(equipmentTypeService.list()).thenReturn(Arrays.asList(gasRoot, gasSensor));
-        when(equipmentBaseService.list()).thenReturn(Collections.singletonList(device));
-        when(equipmentBaseService.getEquipmentByPoint("P-001"))
-                .thenReturn(Collections.singletonList(device));
-        when(monitorPointService.list()).thenReturn(Collections.singletonList(point));
-        when(earlyWarningService.list()).thenReturn(Collections.singletonList(warning));
-        when(alarmDataService.list()).thenReturn(Collections.singletonList(alarm));
-        when(warningTypeMapper.selectList(any(QueryWrapper.class)))
-                .thenReturn(Collections.singletonList(warningType));
-        when(alarmWarningRelMapper.selectList(any(QueryWrapper.class)))
-                .thenReturn(Collections.singletonList(relation));
-        when(workOrderService.list()).thenReturn(Collections.singletonList(order));
-    }
-
-    @Test
-    void currentSnapshotUsesEquipmentTypeAndAuthoritativeRelations() {
-        CockpitCurrentEventsSnapshot snapshot = adapter.loadCurrentEvents();
-
-        assertEquals(1, snapshot.getWarnings().size());
-        assertEquals("W-001", snapshot.getWarnings().get(0).getWarningNo());
-        assertEquals("11", snapshot.getWarnings().get(0).getTypeCode());
-        assertEquals(1, snapshot.getAlarms().size());
-        assertEquals("A-001", snapshot.getAlarms().get(0).getAlarmId());
-        assertEquals("UNHANDLED", snapshot.getAlarms().get(0).getStatus());
-        assertFalse(snapshot.getAlarms().get(0).isCoordinateVerified());
-        assertEquals(2, snapshot.getWorkOrders().size());
-        assertEquals(1, snapshot.getWorkOrders().stream()
-                .filter(item -> "W-001".equals(item.getEventNo())).count());
-        assertEquals(1, snapshot.getWorkOrders().stream()
-                .filter(item -> "A-001".equals(item.getEventNo())).count());
-    }
-
-    @Test
-    void deviceHistoryPaginatesCombinedFamiliesAndKeepsRelation() {
-        CockpitEventSnapshot snapshot = adapter.loadHistory(
-                DEVICE_CODE,
-                OffsetDateTime.parse("2026-09-02T08:00:00+08:00"),
-                OffsetDateTime.parse("2026-09-02T12:00:00+08:00"),
-                1,
-                2);
-
-        assertEquals(DEVICE_CODE, snapshot.getDeviceCode());
-        assertEquals("11", snapshot.getDeviceType());
-        assertEquals("燃气浓度计", snapshot.getDeviceTypeName());
-        assertEquals(2, snapshot.getTotal());
-        assertEquals(1, snapshot.getWarnings().size());
-        assertEquals(1, snapshot.getAlarms().size());
-        assertEquals("A-001", snapshot.getAlarms().get(0).getAlarmId());
-        assertEquals(1, snapshot.getAlarmWarningRelations().size());
-        assertEquals("W-001", snapshot.getAlarmWarningRelations().get(0).getWarningNo());
-    }
-
-    @Test
-    void allAnalysisSnapshotsShareTheSameTypeAndEventFacts() {
-        CockpitHistoryAnalysisSnapshot history = adapter.loadHistoryAnalysis();
-        CockpitHandlingEfficiencySnapshot efficiency = adapter.loadHandlingEfficiency();
-        CockpitMultidimensionalAnalysisSnapshot analysis = adapter.loadMultidimensionalAnalysis();
-
-        assertEquals(1, history.getWarnings().size());
-        assertEquals(1, history.getAlarms().size());
-        assertEquals(2, history.getWorkOrders().size());
-        assertEquals(1, efficiency.getWarnings().size());
-        assertEquals("燃气-001", efficiency.getWarnings().get(0).getDeviceName());
-        assertEquals(1, analysis.getWarnings().size());
-        assertEquals("GAS_EVENT", analysis.getWarnings().get(0).getWarningType());
-        assertEquals("11", analysis.getWarnings().get(0).getTypeCode());
-        assertTrue(analysis.getWarnings().get(0).getCause() == null);
-    }
-
-    @Test
-    void unknownDeviceReturnsNullWithoutInventingAnEventSnapshot() {
-        assertNull(adapter.loadCurrent("UNKNOWN"));
-    }
-
-    private static EquipmentType type(int id, String name, int parentId) {
-        EquipmentType type = new EquipmentType();
-        type.setId(id);
-        type.setTypeName(name);
-        type.setParentId(parentId);
-        return type;
-    }
-
-    private static EquipmentBase device(String id, String code, int typeId) {
-        EquipmentBase device = new EquipmentBase();
-        device.setEquipmentId(id);
-        device.setEquipmentCode(code);
-        device.setEquipmentName("燃气-001");
-        device.setEquipmentTypeId(typeId);
-        device.setEquipmentLocation("城北燃气站");
-        device.setLongitude(new BigDecimal("110.100"));
-        device.setLatitude(new BigDecimal("28.400"));
-        return device;
-    }
-
-    private static MonitorPoint point(String id, String code, String name) {
-        MonitorPoint point = new MonitorPoint();
-        point.setPointId(id);
-        point.setPointCode(code);
-        point.setPointName(name);
-        point.setLocation("城北燃气站监测点");
-        return point;
-    }
-
-    private static EarlyWarning warning() {
-        EarlyWarning warning = new EarlyWarning();
-        warning.setWarningId("WARN-ID-001");
-        warning.setWarningNo("W-001");
-        warning.setWarningName("燃气浓度预警");
-        warning.setWarningType("GAS_EVENT");
-        warning.setWarningLevel("1");
-        warning.setDeviceCode(DEVICE_CODE);
-        warning.setDeviceName("燃气-001");
-        warning.setLocation("城北燃气站");
-        warning.setStatus("PENDING");
-        warning.setPublishTime(LocalDateTime.parse("2026-09-02T09:00:00"));
-        warning.setUpdateTime(LocalDateTime.parse("2026-09-02T09:05:00"));
-        return warning;
-    }
-
-    private static AlarmData alarm() {
-        AlarmData alarm = new AlarmData();
-        alarm.setId("A-001");
-        alarm.setAlarmNo("ALARM-001");
-        alarm.setDeviceCode(DEVICE_CODE);
-        alarm.setWarningType("GAS_EVENT");
-        alarm.setWarningCode("GAS_CONCENTRATION");
-        alarm.setAlarmLevel(2);
-        alarm.setAlarmStatus(0);
-        alarm.setActualValue(new BigDecimal("22.5"));
-        alarm.setMinValue(new BigDecimal("0"));
-        alarm.setMaxValue(new BigDecimal("20"));
-        alarm.setWorkOrderId(1001L);
-        alarm.setCreateTime(LocalDateTime.parse("2026-09-02T10:00:00"));
-        alarm.setUpdateTime(LocalDateTime.parse("2026-09-02T10:05:00"));
-        return alarm;
-    }
-
-    private static WarningType warningType() {
-        WarningType type = new WarningType();
-        type.setEquipmentTypeId(11);
-        type.setWarningCode("GAS_CONCENTRATION");
-        type.setWarningName("燃气浓度");
-        type.setWarningUnit("mg/m3");
-        return type;
-    }
-
-    private static AlarmWarningRel relation() {
-        AlarmWarningRel relation = new AlarmWarningRel();
-        relation.setRelId("REL-001");
-        relation.setWarningId("WARN-ID-001");
-        relation.setAlarmId("A-001");
-        relation.setCreateTime(LocalDateTime.parse("2026-09-02T10:01:00"));
-        return relation;
-    }
-
-    private static WorkOrder workOrder() {
-        WorkOrder order = new WorkOrder();
-        order.setOrderId(1001L);
-        order.setOrderNo("WO-001");
-        order.setDeviceId("E-001");
-        order.setOrderLevel(0);
-        order.setOrderDesc("处理燃气浓度异常");
-        order.setOrderStatus(3);
-        order.setCreateTime(java.sql.Timestamp.valueOf("2026-09-02 10:10:00"));
-        order.setUpdateTime(java.sql.Timestamp.valueOf("2026-09-02 10:20:00"));
-        return order;
-    }
-}

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

@@ -197,6 +197,7 @@ class CockpitFreshnessSemanticsControllerTest {
         }
         assertTrue(Arrays.stream(CockpitFreshnessController.class.getDeclaredMethods())
                 .filter(method -> method.isAnnotationPresent(org.springframework.web.bind.annotation.GetMapping.class))
+                .count() == 1);
     }
 
     private void assertTrue(boolean condition) {

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

@@ -43,14 +43,14 @@ public class AlarmData implements Serializable {
     @ApiModelProperty(value = "设备类型,由设备台账查询补充")
     private String deviceType;
 
-    @TableField(value = "warning_type")
-    @ApiModelProperty(value = "预警类型")
-    private String warningType;
-
     @TableField(value = "warning_code")
     @ApiModelProperty(value = "预警编码")
     private String warningCode;
 
+    @TableField(exist = false)
+    @ApiModelProperty(value = "预警名称")
+    private String warningName;
+
     @TableField(value = "min_value")
     @ApiModelProperty(value = "预警最小值,小于等于该值视为报警")
     private BigDecimal minValue;

+ 4 - 6
pipe-network-service/zksy-system/src/main/java/com/zksy/base/alarm/service/AlarmDataService.java

@@ -7,11 +7,9 @@ import com.zksy.base.alarm.domain.AlarmData;
 import java.util.List;
 
 public interface AlarmDataService extends IService<AlarmData> {
-    Page<AlarmData> findByPage(long pageNum, long pageSize, String deviceCode,
-                                 String warningType, String warningCode, Integer alarmStatus,
-                                 String equipmentType, String startTime, String endTime);
-        List<AlarmData> getAlarmDataList(String deviceCode, 
-                                       String warningType, String warningCode, Integer alarmStatus);
-    
+    Page<AlarmData> findByPage(long pageNum, long pageSize, String deviceCode, String warningType, String warningCode, Integer alarmStatus, String equipmentType, String startTime, String endTime);
+
+    List<AlarmData> getAlarmDataList(String deviceCode, String warningCode, Integer alarmStatus);
+
     boolean saveAlarmData(AlarmData alarmData);
 }

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

@@ -119,7 +119,7 @@ public class AlarmClearServiceImpl implements AlarmClearService {
 
         result.setRemainingCauseCount(remaining.size());
         result.setRemainingCauseSummary(remaining.stream()
-                .map(alarm -> StrUtil.blankToDefault(alarm.getWarningType(), "监测报警"))
+                .map(alarm -> "监测报警")
                 .distinct().collect(Collectors.joining(";")));
         result.setRemainingCauseAlarmIds(remaining.stream()
                 .map(AlarmData::getId).filter(StrUtil::isNotBlank)

+ 15 - 14
pipe-network-service/zksy-system/src/main/java/com/zksy/base/alarm/service/impl/AlarmDataServiceImpl.java

@@ -38,7 +38,7 @@ import java.util.stream.Collectors;
 
 @Service
 public class AlarmDataServiceImpl extends ServiceImpl<AlarmDataMapper, AlarmData>
-    implements AlarmDataService {
+        implements AlarmDataService {
 
     @Autowired
     private EquipmentBaseMapper equipmentBaseMapper;
@@ -57,16 +57,16 @@ public class AlarmDataServiceImpl extends ServiceImpl<AlarmDataMapper, AlarmData
 
     @Override
     public Page<AlarmData> findByPage(long pageNum, long pageSize, String deviceCode,
-                                        String warningType, String warningCode,
-                                        Integer alarmStatus, String equipmentType,
-                                        String startTime, String endTime) {
+                                      String warningType, String warningCode,
+                                      Integer alarmStatus, String equipmentType,
+                                      String startTime, String endTime) {
         Page<AlarmData> page = new Page<>(pageNum, pageSize);
 
         // 当传入 equipmentType='drainage' 时,通过设备类型树关联查询排水类设备编码列表。
         // 不能再写死历史类型 ID:当前排水根类型为 2,子类型由 equipment_type.parent_id 维护。
         List<String> deviceCodes = deviceCodesForQuery(equipmentType);
         if ("drainage".equals(equipmentType) && (deviceCodes == null || deviceCodes.isEmpty())) {
-                return new Page<>(pageNum, pageSize);
+            return new Page<>(pageNum, pageSize);
         }
 
         // 数据库先按设备编码保留最新一条,再执行分页,避免内存去重造成分页漏数据。
@@ -160,7 +160,7 @@ public class AlarmDataServiceImpl extends ServiceImpl<AlarmDataMapper, AlarmData
         Map<Long, WorkOrder> orders = orderIds.isEmpty()
                 ? Collections.emptyMap()
                 : workOrderMapper.selectBatchIds(orderIds).stream().collect(Collectors.toMap(
-                        WorkOrder::getOrderId, order -> order, (a, b) -> a));
+                WorkOrder::getOrderId, order -> order, (a, b) -> a));
         for (AlarmData record : records) {
             WorkOrder order = record.getWorkOrderId() == null
                     ? null : orders.get(record.getWorkOrderId());
@@ -212,14 +212,14 @@ public class AlarmDataServiceImpl extends ServiceImpl<AlarmDataMapper, AlarmData
         // 批量查询 equipment_base
         LambdaQueryWrapper<EquipmentBase> eqWrapper = new LambdaQueryWrapper<>();
         eqWrapper.in(EquipmentBase::getEquipmentCode, codes)
-                 .select(EquipmentBase::getEquipmentCode, EquipmentBase::getEquipmentName, EquipmentBase::getEquipmentTypeId,
-                         EquipmentBase::getLongitude, EquipmentBase::getLatitude);
+                .select(EquipmentBase::getEquipmentCode, EquipmentBase::getEquipmentName, EquipmentBase::getEquipmentTypeId,
+                        EquipmentBase::getLongitude, EquipmentBase::getLatitude);
         List<EquipmentBase> equipmentList = equipmentBaseMapper.selectList(eqWrapper);
         Set<Integer> typeIds = equipmentList.stream().map(EquipmentBase::getEquipmentTypeId)
                 .filter(Objects::nonNull).collect(Collectors.toSet());
         Map<Integer, String> typeNames = typeIds.isEmpty() ? Collections.emptyMap()
                 : equipmentTypeMapper.selectBatchIds(typeIds).stream().collect(Collectors.toMap(
-                        EquipmentType::getId, EquipmentType::getTypeName, (a, b) -> a));
+                EquipmentType::getId, EquipmentType::getTypeName, (a, b) -> a));
         // 构建 code -> EquipmentBase 映射
         java.util.Map<String, EquipmentBase> codeEquipMap = equipmentList.stream()
                 .filter(e -> e.getEquipmentCode() != null)
@@ -246,11 +246,10 @@ public class AlarmDataServiceImpl extends ServiceImpl<AlarmDataMapper, AlarmData
 
     @Override
     public List<AlarmData> getAlarmDataList(String deviceCode,
-                                              String warningType, String warningCode,
-                                              Integer alarmStatus) {
+                                            String warningCode,
+                                            Integer alarmStatus) {
         LambdaQueryWrapper<AlarmData> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.like(deviceCode != null, AlarmData::getDeviceCode, deviceCode)
-                .like(warningType != null, AlarmData::getWarningType, warningType)
                 .like(warningCode != null, AlarmData::getWarningCode, warningCode)
                 .eq(alarmStatus != null, AlarmData::getAlarmStatus, alarmStatus);
         queryWrapper.orderByDesc(AlarmData::getCreateTime);
@@ -279,7 +278,7 @@ public class AlarmDataServiceImpl extends ServiceImpl<AlarmDataMapper, AlarmData
         if (baseMapper.insert(alarmData) != 1) throw new IllegalStateException("报警入库失败");
         writeLifecycleLog(alarmData.getId(), AlarmLogOperTypeEnum.CREATED,
                 AlarmLifecycleSupport.createdDescription(alarmData.getAlarmNo(), alarmData.getRemark(),
-                        alarmData.getWarningType(), alarmData.getWarningCode(), alarmData.getActualValue(),
+                        null, alarmData.getWarningCode(), alarmData.getActualValue(),
                         alarmData.getMinValue(), alarmData.getMaxValue()), "监测系统", alarmData.getCreateTime(), 0L);
         return true;
     }
@@ -290,7 +289,9 @@ public class AlarmDataServiceImpl extends ServiceImpl<AlarmDataMapper, AlarmData
         return saveAlarmData(alarmData);
     }
 
-    /** 覆盖通用修改与各子系统的人工处理入口,只有状态真正改变才记处理日志。 */
+    /**
+     * 覆盖通用修改与各子系统的人工处理入口,只有状态真正改变才记处理日志。
+     */
     @Override
     @Transactional(rollbackFor = Exception.class)
     public boolean updateById(AlarmData alarmData) {

+ 1 - 1
pipe-network-service/zksy-system/src/main/java/com/zksy/base/drill/service/DrillAlarmSyncService.java

@@ -53,7 +53,7 @@ public class DrillAlarmSyncService {
         Integer typeId = equipmentBase.getEquipmentTypeId();
         boolean needCreateCase = EquipmentTypeEnum.MANHOLE_COVER_MONITOR.getId().equals(typeId);
         int caseLevel = alarmData.getAlarmLevel() != null ? alarmData.getAlarmLevel() : AlarmLevelEnum.LEVEL_FOUR.getCode();
-        String desc = alarmData.getWarningType() != null ? alarmData.getWarningType() : "设备告警";
+        String desc = "设备告警";
         if (alarmData.getRemark() != null) {
             desc += "-" + alarmData.getRemark();
         }

+ 0 - 1
pipe-network-service/zksy-system/src/main/java/com/zksy/base/drill/service/impl/DrillSimulationServiceImpl.java

@@ -60,7 +60,6 @@ public class DrillSimulationServiceImpl implements DrillSimulationService {
             try {
                 AlarmData alarm = new AlarmData();
                 alarm.setDeviceCode(eq.getEquipmentCode());
-                alarm.setWarningType(typeNameMap.getOrDefault(eq.getEquipmentTypeId(), "未知类型") + "模拟告警");
                 alarm.setWarningCode("DRILL-" + System.currentTimeMillis());
                 alarm.setMinValue(new BigDecimal("0"));
                 alarm.setMaxValue(new BigDecimal("100"));

+ 1 - 1
pipe-network-service/zksy-system/src/main/java/com/zksy/base/service/DrillAlarmSyncService.java

@@ -48,7 +48,7 @@ public class DrillAlarmSyncService {
         Integer typeId = equipmentBase.getEquipmentTypeId();
         boolean needCreateCase = EquipmentTypeEnum.MANHOLE_COVER_MONITOR.getId().equals(typeId);
         int caseLevel = alarmData.getAlarmLevel() != null ? alarmData.getAlarmLevel() : AlarmLevelEnum.LEVEL_FOUR.getCode();
-        String desc = alarmData.getWarningType() != null ? alarmData.getWarningType() : "设备告警";
+        String desc = "设备告警";
         if (alarmData.getRemark() != null) {
             desc += "-" + alarmData.getRemark();
         }

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

@@ -60,7 +60,6 @@ public class DrillSimulationServiceImpl implements DrillSimulationService {
             try {
                 AlarmData alarm = new AlarmData();
                 alarm.setDeviceCode(eq.getEquipmentCode());
-                alarm.setWarningType(typeNameMap.getOrDefault(eq.getEquipmentTypeId(), "未知类型") + "模拟告警");
                 alarm.setWarningCode("DRILL-" + System.currentTimeMillis());
                 alarm.setMinValue(new BigDecimal("0"));
                 alarm.setMaxValue(new BigDecimal("100"));

+ 2 - 3
pipe-network-service/zksy-system/src/main/java/com/zksy/base/service/impl/WaterSupplyDeviceServiceImpl.java

@@ -232,7 +232,7 @@ public class WaterSupplyDeviceServiceImpl extends ServiceImpl<EquipmentBaseMappe
                 : null;
         if (activeAlarm != null) {
             vo.setAlertLevel(activeAlarm.getAlarmLevel());
-            vo.setAbnormalReason(StrUtil.isNotBlank(activeAlarm.getWarningType()) ? activeAlarm.getWarningType() : "设备报警");
+            vo.setAbnormalReason("设备报警");
         } else if (status != null && Objects.equals(status.getCurrentStatus(), 3)) {
             // Maintenance is an operational status, not a monitoring alarm level.
             vo.setAbnormalReason("设备维修中");
@@ -456,8 +456,7 @@ public class WaterSupplyDeviceServiceImpl extends ServiceImpl<EquipmentBaseMappe
             vo.setEquipmentTypeName(type.getTypeName());
         }
         if (alarm != null) {
-            vo.setAbnormalReason(StrUtil.isNotBlank(alarm.getWarningType())
-                    ? alarm.getWarningType() : "设备报警");
+            vo.setAbnormalReason("设备报警");
             vo.setCreateTime(alarm.getCreateTime());
         } else if (Objects.equals(vo.getCurrentStatus(), 3)) {
             vo.setAbnormalReason("设备维修中");

+ 28 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/base/warning/domain/EquipmentWarningType.java

@@ -0,0 +1,28 @@
+package com.zksy.base.warning.domain;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+@ApiModel("设备对应预/报警类型")
+@Data
+@TableName(value = "equipment_warning_type", schema = "app_user")
+public class EquipmentWarningType implements Serializable {
+    @TableField("equipment_type_id")
+    @ApiModelProperty("设备类型ID(复合主键)")
+    private Integer equipmentTypeId;
+    @TableField("warning_type_id")
+    @ApiModelProperty("报警类型ID(复合主键)")
+    private Integer warningTypeId;
+    @TableField("create_time")
+    @ApiModelProperty("创建时间")
+    private LocalDateTime createTime;
+    @TableField("update_time")
+    @ApiModelProperty("更新时间")
+    private LocalDateTime updateTime;
+}

+ 5 - 11
pipe-network-service/zksy-system/src/main/java/com/zksy/base/warning/domain/WarningType.java

@@ -1,9 +1,9 @@
 package com.zksy.base.warning.domain;
 
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
-import com.baomidou.mybatisplus.annotation.TableField;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -11,22 +11,18 @@ import lombok.Data;
 import java.io.Serializable;
 import java.time.LocalDateTime;
 
-/** 设备类型对应的可配置预警指标。 */
-@ApiModel("设备预警指标")
+@ApiModel("预/报警类型")
 @Data
-@TableName(value = "equipment_warning_type", schema = "app_user")
+@TableName(value = "warning_type", schema = "app_user")
 public class WarningType implements Serializable {
     @TableId(value = "id", type = IdType.AUTO)
     @ApiModelProperty("主键")
     private Integer id;
-    @TableField("equipment_type_id")
-    @ApiModelProperty("设备类型ID")
-    private Integer equipmentTypeId;
     @TableField("warning_code")
-    @ApiModelProperty("报警编码")
+    @ApiModelProperty("编码")
     private String warningCode;
     @TableField("warning_name")
-    @ApiModelProperty("报警名称")
+    @ApiModelProperty("名称")
     private String warningName;
     @TableField("warning_unit")
     @ApiModelProperty("监测单位")
@@ -34,8 +30,6 @@ public class WarningType implements Serializable {
     @TableField("data_type")
     @ApiModelProperty("数据类型:0最小值和最大值,1最小值,2最大值")
     private Integer dataType;
-    @ApiModelProperty("备注")
-    private String remark;
     @TableField("create_time")
     @ApiModelProperty("创建时间")
     private LocalDateTime createTime;

+ 9 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/base/warning/mapper/EquipmentWarningTypeMapper.java

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

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

@@ -2,8 +2,6 @@ package com.zksy.base.warning.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zksy.base.warning.domain.WarningType;
-import org.apache.ibatis.annotations.Mapper;
 
-@Mapper
 public interface WarningTypeMapper extends BaseMapper<WarningType> {
 }

+ 61 - 31
pipe-network-service/zksy-system/src/main/java/com/zksy/base/warning/service/impl/WarningThresholdServiceImpl.java

@@ -12,6 +12,7 @@ import com.zksy.base.enums.EquipmentTypeEnum;
 import com.zksy.base.mapper.EquipmentBaseMapper;
 import com.zksy.base.mapper.EquipmentTypeMapper;
 import com.zksy.base.warning.domain.*;
+import com.zksy.base.warning.mapper.EquipmentWarningTypeMapper;
 import com.zksy.base.warning.mapper.WarningTypeMapper;
 import com.zksy.base.warning.service.WarningThresholdService;
 import com.zksy.common.exception.ServiceException;
@@ -28,24 +29,27 @@ public class WarningThresholdServiceImpl extends ServiceImpl<WarningThresholdMap
         implements WarningThresholdService {
     private final EquipmentBaseMapper equipmentBaseMapper;
     private final EquipmentTypeMapper equipmentTypeMapper;
-    private final WarningTypeMapper warningTypeMapper;
+    private final EquipmentWarningTypeMapper warningTypeMapper;
+    private final WarningTypeMapper refWarningTypeMapper;
     private final WarningThresholdMapper thresholdMapper;
 
     public WarningThresholdServiceImpl(EquipmentBaseMapper equipmentBaseMapper,
                                          EquipmentTypeMapper equipmentTypeMapper,
-                                         WarningTypeMapper warningTypeMapper,
+                                         EquipmentWarningTypeMapper warningTypeMapper,
+                                         WarningTypeMapper refWarningTypeMapper,
                                          WarningThresholdMapper thresholdMapper) {
         this.equipmentBaseMapper = equipmentBaseMapper;
         this.equipmentTypeMapper = equipmentTypeMapper;
         this.warningTypeMapper = warningTypeMapper;
+        this.refWarningTypeMapper = refWarningTypeMapper;
         this.thresholdMapper = thresholdMapper;
     }
 
     @Override
     public List<EquipmentType> listTypes(Integer rootTypeId) {
         Integer root = validRoot(rootTypeId);
-        Set<Integer> configuredTypeIds = warningTypeMapper.selectList(Wrappers.lambdaQuery(WarningType.class))
-                .stream().map(WarningType::getEquipmentTypeId).filter(Objects::nonNull).collect(Collectors.toSet());
+        Set<Integer> configuredTypeIds = warningTypeMapper.selectList(Wrappers.lambdaQuery(EquipmentWarningType.class))
+                .stream().map(EquipmentWarningType::getEquipmentTypeId).filter(Objects::nonNull).collect(Collectors.toSet());
         if (configuredTypeIds.isEmpty()) return Collections.emptyList();
         LambdaQueryWrapper<EquipmentType> wrapper = Wrappers.lambdaQuery(EquipmentType.class);
         if (root == 0) {
@@ -99,22 +103,26 @@ public class WarningThresholdServiceImpl extends ServiceImpl<WarningThresholdMap
         Map<Integer, EquipmentType> typeMap = equipmentTypeMapper.selectBatchIds(
                 devices.stream().map(d -> Integer.valueOf(d.getEquipmentTypeId())).distinct().collect(Collectors.toList()))
                 .stream().collect(Collectors.toMap(EquipmentType::getId, Function.identity(), (a, b) -> a));
-        Map<Integer, List<WarningType>> metadata = warningTypeMapper.selectList(
-                Wrappers.lambdaQuery(WarningType.class).in(WarningType::getEquipmentTypeId,
-                        typeMap.keySet())).stream().collect(Collectors.groupingBy(WarningType::getEquipmentTypeId));
+        Map<Integer, List<EquipmentWarningType>> metadata = warningTypeMapper.selectList(
+                Wrappers.lambdaQuery(EquipmentWarningType.class).in(EquipmentWarningType::getEquipmentTypeId,
+                        typeMap.keySet())).stream().collect(Collectors.groupingBy(EquipmentWarningType::getEquipmentTypeId));
+        Map<Integer, WarningType> wtById = loadWarningTypes(metadata.values().stream().flatMap(List::stream).collect(Collectors.toList()));
 
         List<WarningThresholdView> result = new ArrayList<>();
         for (EquipmentBase device : devices) {
             WarningThresholdView view = new WarningThresholdView();
             view.setEquipmentId(device.getEquipmentId()); view.setEquipmentCode(device.getEquipmentCode());
             view.setEquipmentName(device.getEquipmentName()); view.setEquipmentTypeId(device.getEquipmentTypeId() == null ? null : String.valueOf(device.getEquipmentTypeId()));
-            EquipmentType type = typeMap.get(Integer.valueOf(device.getEquipmentTypeId()));
+            EquipmentType type = typeMap.get(device.getEquipmentTypeId());
             view.setEquipmentTypeName(type == null ? device.getEquipmentTypeName() : type.getTypeName());
-            for (WarningType meta : metadata.getOrDefault(Integer.valueOf(device.getEquipmentTypeId()), Collections.emptyList())) {
+            for (EquipmentWarningType meta : metadata.getOrDefault(device.getEquipmentTypeId(), Collections.emptyList())) {
+                WarningType wt = wtById.get(meta.getWarningTypeId());
+                String code = wt == null ? null : wt.getWarningCode();
                 WarningThresholdItem item = new WarningThresholdItem();
-                item.setId(meta.getId()); item.setEquipmentTypeId(meta.getEquipmentTypeId()); item.setWarningCode(meta.getWarningCode());
-                item.setWarningName(meta.getWarningName()); item.setWarningUnit(meta.getWarningUnit()); item.setDataType(meta.getDataType()); item.setRemark(meta.getRemark());
-                WarningThreshold saved = configuredByKey.get(device.getEquipmentCode() + "\u0000" + meta.getWarningCode());
+                item.setId(meta.getEquipmentTypeId() != null && meta.getWarningTypeId() != null ? meta.getEquipmentTypeId() * 100000 + meta.getWarningTypeId() : null); item.setEquipmentTypeId(meta.getEquipmentTypeId()); item.setWarningCode(code);
+                item.setWarningName(wt == null ? null : wt.getWarningName()); item.setWarningUnit(wt == null ? null : wt.getWarningUnit());
+                item.setDataType(wt == null ? null : wt.getDataType());
+                WarningThreshold saved = configuredByKey.get(device.getEquipmentCode() + "\u0000" + code);
                 if (Boolean.TRUE.equals(configuredOnly) && saved == null) continue;
                 if (saved != null) {
                     item.setMinValue(saved.getMinValue()); item.setMaxValue(saved.getMaxValue());
@@ -168,14 +176,17 @@ public class WarningThresholdServiceImpl extends ServiceImpl<WarningThresholdMap
                 .filter(Objects::nonNull).map(Integer::valueOf).distinct().collect(Collectors.toList());
         Map<Integer, EquipmentType> typeMap = equipmentTypeMapper.selectBatchIds(typeIds).stream()
                 .collect(Collectors.toMap(EquipmentType::getId, Function.identity(), (a, b) -> a));
-        List<WarningType> warningTypes = warningTypeMapper.selectList(
-                Wrappers.lambdaQuery(WarningType.class).in(WarningType::getEquipmentTypeId, typeIds));
+        List<EquipmentWarningType> warningTypes = warningTypeMapper.selectList(
+                Wrappers.lambdaQuery(EquipmentWarningType.class).in(EquipmentWarningType::getEquipmentTypeId, typeIds));
+        Map<Integer, WarningType> wtById = loadWarningTypes(warningTypes);
         if (warningName != null && !warningName.trim().isEmpty()) {
+            final Map<Integer, WarningType> wtMap = wtById;
             warningTypes = warningTypes.stream()
-                    .filter(type -> containsIgnoreCase(type.getWarningName(), warningName))
+                    .filter(type -> { WarningType w = wtMap.get(type.getWarningTypeId()); return w != null && containsIgnoreCase(w.getWarningName(), warningName); })
                     .collect(Collectors.toList());
         }
-        Set<String> warningCodes = warningTypes.stream().map(WarningType::getWarningCode)
+        Set<String> warningCodes = warningTypes.stream()
+                .map(type -> { WarningType w = wtById.get(type.getWarningTypeId()); return w == null ? null : w.getWarningCode(); })
                 .filter(Objects::nonNull).collect(Collectors.toSet());
         if (warningCodes.isEmpty()) {
             emptyPage.setRecords(Collections.emptyList());
@@ -189,15 +200,16 @@ public class WarningThresholdServiceImpl extends ServiceImpl<WarningThresholdMap
                 .orderByDesc(WarningThreshold::getCreateTime)
                 .orderByAsc(WarningThreshold::getWarningCode);
         Page<WarningThreshold> thresholdPage = thresholdMapper.selectPage(new Page<>(current, size), thresholdWrapper);
-        Map<Integer, Map<String, WarningType>> metadata = warningTypes.stream().collect(Collectors.groupingBy(
-                WarningType::getEquipmentTypeId,
-                Collectors.toMap(WarningType::getWarningCode, Function.identity(), (a, b) -> a)));
+        Map<Integer, Map<String, EquipmentWarningType>> metadata = warningTypes.stream()
+                .filter(type -> { WarningType w = wtById.get(type.getWarningTypeId()); return w != null && w.getWarningCode() != null; })
+                .collect(Collectors.groupingBy(EquipmentWarningType::getEquipmentTypeId,
+                        Collectors.toMap(type -> wtById.get(type.getWarningTypeId()).getWarningCode(), Function.identity(), (a, b) -> a)));
         List<WarningThresholdListItem> records = new ArrayList<>();
         for (WarningThreshold threshold : thresholdPage.getRecords()) {
             EquipmentBase device = deviceByCode.get(threshold.getDeviceCode());
             if (device == null || device.getEquipmentTypeId() == null) continue;
             Integer typeId = Integer.valueOf(device.getEquipmentTypeId());
-            WarningType warningType = metadata.getOrDefault(typeId, Collections.emptyMap()).get(threshold.getWarningCode());
+            EquipmentWarningType warningType = metadata.getOrDefault(typeId, Collections.emptyMap()).get(threshold.getWarningCode());
             if (warningType == null) continue;
             WarningThresholdListItem row = new WarningThresholdListItem();
             row.setEquipmentId(device.getEquipmentId());
@@ -206,11 +218,12 @@ public class WarningThresholdServiceImpl extends ServiceImpl<WarningThresholdMap
             row.setEquipmentTypeId(device.getEquipmentTypeId() == null ? null : String.valueOf(device.getEquipmentTypeId()));
             EquipmentType type = typeMap.get(typeId);
             row.setEquipmentTypeName(type == null ? device.getEquipmentTypeName() : type.getTypeName());
-            row.setId(warningType.getId());
+            row.setId(warningType.getEquipmentTypeId() != null && warningType.getWarningTypeId() != null ? warningType.getEquipmentTypeId() * 100000 + warningType.getWarningTypeId() : null);
             row.setWarningCode(threshold.getWarningCode());
-            row.setWarningName(warningType.getWarningName());
-            row.setWarningUnit(warningType.getWarningUnit());
-            row.setDataType(warningType.getDataType());
+            WarningType wt = wtById.get(warningType.getWarningTypeId());
+            row.setWarningName(wt == null ? null : wt.getWarningName());
+            row.setWarningUnit(wt == null ? null : wt.getWarningUnit());
+            row.setDataType(wt == null ? null : wt.getDataType());
             row.setMinValue(threshold.getMinValue());
             row.setMaxValue(threshold.getMaxValue());
             row.setPeriodStart(threshold.getPeriodStart());
@@ -224,6 +237,18 @@ public class WarningThresholdServiceImpl extends ServiceImpl<WarningThresholdMap
         return page;
     }
 
+    /**
+     * 根据 equipment_warning_type.warning_type_id 批量关联 warning_type 主表,
+     * 返回 id -> WarningType 的映射(EquipmentWarningType 已不再冗余存储 warning_code/name/unit/dataType)。
+     */
+    private Map<Integer, WarningType> loadWarningTypes(Collection<EquipmentWarningType> ewts) {
+        Set<Integer> ids = ewts.stream().map(EquipmentWarningType::getWarningTypeId)
+                .filter(Objects::nonNull).collect(Collectors.toSet());
+        if (ids.isEmpty()) return Collections.emptyMap();
+        return refWarningTypeMapper.selectBatchIds(ids).stream()
+                .collect(Collectors.toMap(WarningType::getId, Function.identity(), (a, b) -> a));
+    }
+
     private boolean containsIgnoreCase(String value, String keyword) {
         return keyword == null || keyword.trim().isEmpty()
                 || (value != null && value.toLowerCase(Locale.ROOT).contains(keyword.trim().toLowerCase(Locale.ROOT)));
@@ -244,13 +269,18 @@ public class WarningThresholdServiceImpl extends ServiceImpl<WarningThresholdMap
         int count = 0;
         for (String code : codes) {
             Integer typeId = Integer.valueOf(byCode.get(code).getEquipmentTypeId());
-            Map<String, WarningType> metadata = warningTypeMapper.selectList(Wrappers.lambdaQuery(WarningType.class).eq(WarningType::getEquipmentTypeId, typeId)).stream().collect(Collectors.toMap(WarningType::getWarningCode, Function.identity(), (a, b) -> a));
+            List<EquipmentWarningType> ewtList = warningTypeMapper.selectList(Wrappers.lambdaQuery(EquipmentWarningType.class).eq(EquipmentWarningType::getEquipmentTypeId, typeId));
+            Map<Integer, WarningType> wtById = loadWarningTypes(ewtList);
+            Map<String, EquipmentWarningType> metadata = ewtList.stream()
+                    .filter(type -> { WarningType w = wtById.get(type.getWarningTypeId()); return w != null && w.getWarningCode() != null; })
+                    .collect(Collectors.toMap(type -> wtById.get(type.getWarningTypeId()).getWarningCode(), Function.identity(), (a, b) -> a));
             for (WarningThresholdSaveItem input : request.getThresholds()) {
-                WarningType meta = metadata.get(input.getWarningCode());
+                EquipmentWarningType meta = metadata.get(input.getWarningCode());
                 if (meta == null) throw new ServiceException("指标不属于设备类型:" + input.getWarningCode());
-                if (meta.getDataType() == 0 && input.getMinValue() != null && input.getMaxValue() != null && input.getMinValue() >= input.getMaxValue()) throw new ServiceException(meta.getWarningName() + "最小值必须小于最大值");
-                if (meta.getDataType() == 1) input.setMaxValue(null);
-                if (meta.getDataType() == 2) input.setMinValue(null);
+                WarningType wt = wtById.get(meta.getWarningTypeId());
+                if (wt != null && wt.getDataType() == 0 && input.getMinValue() != null && input.getMaxValue() != null && input.getMinValue() >= input.getMaxValue()) throw new ServiceException(wt.getWarningName() + "最小值必须小于最大值");
+                if (wt != null && wt.getDataType() == 1) input.setMaxValue(null);
+                if (wt != null && wt.getDataType() == 2) input.setMinValue(null);
                 WarningThreshold entity = thresholdMapper.selectOne(Wrappers.lambdaQuery(WarningThreshold.class).eq(WarningThreshold::getDeviceCode, code).eq(WarningThreshold::getWarningCode, input.getWarningCode()).last("limit 1"));
                 if (entity == null) { entity = new WarningThreshold(); entity.setDeviceCode(code); entity.setWarningCode(input.getWarningCode()); entity.setCreateTime(LocalDateTime.now()); }
                 entity.setMinValue(input.getMinValue()); entity.setMaxValue(input.getMaxValue()); entity.setUpdateTime(LocalDateTime.now());
@@ -291,8 +321,8 @@ public class WarningThresholdServiceImpl extends ServiceImpl<WarningThresholdMap
         if (root == 0) wrapper.in(EquipmentType::getParentId, rootIds());
         else wrapper.eq(EquipmentType::getParentId, root);
         List<Integer> ids = equipmentTypeMapper.selectList(wrapper).stream().map(EquipmentType::getId).collect(Collectors.toList());
-        Set<Integer> configuredTypeIds = warningTypeMapper.selectList(Wrappers.lambdaQuery(WarningType.class))
-                .stream().map(WarningType::getEquipmentTypeId).filter(Objects::nonNull).collect(Collectors.toSet());
+        Set<Integer> configuredTypeIds = warningTypeMapper.selectList(Wrappers.lambdaQuery(EquipmentWarningType.class))
+                .stream().map(EquipmentWarningType::getEquipmentTypeId).filter(Objects::nonNull).collect(Collectors.toSet());
         ids.retainAll(configuredTypeIds);
         if (selectedType != null) { if (!ids.contains(selectedType)) throw new ServiceException("设备类型不属于当前子系统"); return Collections.singleton(String.valueOf(selectedType)); }
         return ids.stream().map(String::valueOf).collect(Collectors.toSet());

+ 48 - 29
pipe-network-service/zksy-system/src/main/java/com/zksy/cockpit/event/BusinessCockpitEventAdapter.java

@@ -11,8 +11,10 @@ import com.zksy.base.service.EquipmentTypeService;
 import com.zksy.base.service.MonitorPointService;
 import com.zksy.base.warning.domain.AlarmWarningRel;
 import com.zksy.base.warning.domain.EarlyWarning;
+import com.zksy.base.warning.domain.EquipmentWarningType;
 import com.zksy.base.warning.domain.WarningType;
 import com.zksy.base.warning.mapper.AlarmWarningRelMapper;
+import com.zksy.base.warning.mapper.EquipmentWarningTypeMapper;
 import com.zksy.base.warning.mapper.WarningTypeMapper;
 import com.zksy.base.warning.service.EarlyWarningService;
 import com.zksy.cockpit.foundation.CockpitTypeIndustry;
@@ -28,15 +30,8 @@ import java.time.OffsetDateTime;
 import java.time.ZoneId;
 import java.time.format.DateTimeFormatter;
 import java.time.format.DateTimeParseException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
+import java.util.*;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 
 /**
@@ -64,10 +59,12 @@ public class BusinessCockpitEventAdapter {
     private final MonitorPointService monitorPointService;
     private final EarlyWarningService earlyWarningService;
     private final AlarmDataService alarmDataService;
-    private final WarningTypeMapper warningTypeMapper;
+    private final EquipmentWarningTypeMapper warningTypeMapper;
+    private final WarningTypeMapper refWarningTypeMapper;
     private final AlarmWarningRelMapper alarmWarningRelMapper;
     private final WorkOrderService workOrderService;
     private final Clock clock;
+    private Map<Integer, WarningType> warningTypeById = Collections.emptyMap();
 
     public BusinessCockpitEventAdapter(
             EquipmentBaseService equipmentBaseService,
@@ -75,7 +72,8 @@ public class BusinessCockpitEventAdapter {
             MonitorPointService monitorPointService,
             EarlyWarningService earlyWarningService,
             AlarmDataService alarmDataService,
-            WarningTypeMapper warningTypeMapper,
+            EquipmentWarningTypeMapper warningTypeMapper,
+            WarningTypeMapper refWarningTypeMapper,
             AlarmWarningRelMapper alarmWarningRelMapper,
             WorkOrderService workOrderService,
             Clock clock) {
@@ -85,6 +83,7 @@ public class BusinessCockpitEventAdapter {
         this.earlyWarningService = earlyWarningService;
         this.alarmDataService = alarmDataService;
         this.warningTypeMapper = warningTypeMapper;
+        this.refWarningTypeMapper = refWarningTypeMapper;
         this.alarmWarningRelMapper = alarmWarningRelMapper;
         this.workOrderService = workOrderService;
         this.clock = clock;
@@ -227,12 +226,12 @@ public class BusinessCockpitEventAdapter {
     private CockpitEventAlarm toEventAlarm(AlarmFact item, Facts facts) {
         AlarmData alarm = item.alarm;
         PointFact point = facts.pointsByDevice.get(normalize(alarm.getDeviceCode()));
-        WarningType metadata = warningType(alarm, facts);
+        EquipmentWarningType metadata = warningType(alarm, facts);
         return new CockpitEventAlarm(
                 trimToNull(alarm.getId()),
                 trimToNull(alarm.getWarningCode()),
-                firstNonBlank(metadata == null ? null : metadata.getWarningName(), alarm.getWarningCode()),
-                trimToNull(alarm.getWarningType()),
+                firstNonBlank(warningTypeName(metadata), alarm.getWarningCode()),
+                null,
                 alarm.getAlarmLevel(),
                 CockpitEventLevelColor.resolve(alarm.getAlarmLevel()),
                 alarmStatus(alarm.getAlarmStatus()),
@@ -240,7 +239,7 @@ public class BusinessCockpitEventAdapter {
                 alarm.getActualValue(),
                 alarm.getMinValue(),
                 alarm.getMaxValue(),
-                metadata == null ? null : metadata.getWarningUnit(),
+                warningTypeUnit(metadata),
                 trimToNull(alarm.getDeviceCode()),
                 firstNonBlank(alarm.getDeviceName(), deviceName(alarm.getDeviceCode(), facts)),
                 point == null ? null : point.location);
@@ -318,18 +317,18 @@ public class BusinessCockpitEventAdapter {
     private CockpitCurrentEventsSnapshot.SourceAlarm currentAlarm(AlarmFact item, Facts facts) {
         AlarmData alarm = item.alarm;
         PointFact point = facts.pointsByDevice.get(normalize(alarm.getDeviceCode()));
-        WarningType metadata = warningType(alarm, facts);
+        EquipmentWarningType metadata = warningType(alarm, facts);
         EquipmentBase device = facts.devicesByCode.get(normalize(alarm.getDeviceCode()));
         return new CockpitCurrentEventsSnapshot.SourceAlarm(
                 trimToNull(alarm.getId()),
-                firstNonBlank(metadata == null ? null : metadata.getWarningName(), alarm.getWarningCode()),
-                trimToNull(alarm.getWarningType()),
+                firstNonBlank(warningTypeName(metadata), alarm.getWarningCode()),
+                null,
                 alarm.getAlarmLevel(),
                 alarmStatus(alarm.getAlarmStatus()),
                 offsetTime(alarm.getCreateTime()),
                 offsetTime(alarm.getUpdateTime()),
                 alarm.getActualValue(),
-                metadata == null ? null : metadata.getWarningUnit(),
+                warningTypeUnit(metadata),
                 trimToNull(alarm.getDeviceCode()),
                 firstNonBlank(alarm.getDeviceName(), device == null ? null : device.getEquipmentName()),
                 point == null ? null : point.code,
@@ -464,7 +463,7 @@ public class BusinessCockpitEventAdapter {
         return facts.alarms.stream()
                 .map(item -> new CockpitMultidimensionalAnalysisSnapshot.SourceAlarm(
                         trimToNull(item.alarm.getId()),
-                        trimToNull(item.alarm.getWarningType()),
+                        null,
                         null,
                         item.alarm.getAlarmLevel(),
                         offsetTime(item.alarm.getCreateTime()),
@@ -510,7 +509,7 @@ public class BusinessCockpitEventAdapter {
         Map<Integer, EquipmentType> types = typeIndex();
         Map<String, EquipmentBase> devices = deviceIndex();
         Map<String, PointFact> points = pointIndex();
-        Map<String, WarningType> warningTypes = warningTypeIndex();
+        Map<String, EquipmentWarningType> warningTypes = warningTypeIndex();
         List<EarlyWarning> warnings = safeList(earlyWarningService.list());
         List<AlarmData> alarms = safeList(alarmDataService.list());
         List<AlarmWarningRel> relations = safeList(alarmWarningRelMapper.selectList(new QueryWrapper<AlarmWarningRel>()));
@@ -601,17 +600,37 @@ public class BusinessCockpitEventAdapter {
         return result;
     }
 
-    private Map<String, WarningType> warningTypeIndex() {
-        Map<String, WarningType> result = new LinkedHashMap<>();
-        for (WarningType type : safeList(warningTypeMapper.selectList(new QueryWrapper<WarningType>()))) {
-            if (type != null && type.getEquipmentTypeId() != null && !isBlank(type.getWarningCode())) {
-                result.put(type.getEquipmentTypeId() + "\u0000" + type.getWarningCode().trim(), type);
+    private Map<String, EquipmentWarningType> warningTypeIndex() {
+        List<EquipmentWarningType> list = safeList(warningTypeMapper.selectList(new QueryWrapper<EquipmentWarningType>()));
+        Set<Integer> ids = list.stream().map(EquipmentWarningType::getWarningTypeId)
+                .filter(Objects::nonNull).collect(Collectors.toSet());
+        Map<Integer, WarningType> wtById = ids.isEmpty() ? Collections.emptyMap()
+                : refWarningTypeMapper.selectBatchIds(ids).stream()
+                .collect(Collectors.toMap(WarningType::getId, Function.identity(), (a, b) -> a));
+        this.warningTypeById = wtById;
+        Map<String, EquipmentWarningType> result = new LinkedHashMap<>();
+        for (EquipmentWarningType type : list) {
+            WarningType wt = wtById.get(type.getWarningTypeId());
+            if (type != null && type.getEquipmentTypeId() != null && wt != null && !isBlank(wt.getWarningCode())) {
+                result.put(type.getEquipmentTypeId() + "\u0000" + wt.getWarningCode().trim(), type);
             }
         }
         return result;
     }
 
-    private WarningType warningType(AlarmData alarm, Facts facts) {
+    private String warningTypeName(EquipmentWarningType meta) {
+        if (meta == null) return null;
+        WarningType wt = warningTypeById.get(meta.getWarningTypeId());
+        return wt == null ? null : wt.getWarningName();
+    }
+
+    private String warningTypeUnit(EquipmentWarningType meta) {
+        if (meta == null) return null;
+        WarningType wt = warningTypeById.get(meta.getWarningTypeId());
+        return wt == null ? null : wt.getWarningUnit();
+    }
+
+    private EquipmentWarningType warningType(AlarmData alarm, Facts facts) {
         if (alarm == null || isBlank(alarm.getWarningCode())) {
             return null;
         }
@@ -821,7 +840,7 @@ public class BusinessCockpitEventAdapter {
         private final Map<Integer, EquipmentType> typesById;
         private final Map<String, EquipmentBase> devicesByCode;
         private final Map<String, PointFact> pointsByDevice;
-        private final Map<String, WarningType> warningTypes;
+        private final Map<String, EquipmentWarningType> warningTypes;
         private final List<AlarmWarningRel> relations;
         private final List<WarningFact> warnings;
         private final List<AlarmFact> alarms;
@@ -831,7 +850,7 @@ public class BusinessCockpitEventAdapter {
                 Map<Integer, EquipmentType> typesById,
                 Map<String, EquipmentBase> devicesByCode,
                 Map<String, PointFact> pointsByDevice,
-                Map<String, WarningType> warningTypes,
+                Map<String, EquipmentWarningType> warningTypes,
                 List<AlarmWarningRel> relations,
                 List<WarningFact> warnings,
                 List<AlarmFact> alarms,

+ 1 - 1
pipe-network-service/zksy-system/src/main/java/com/zksy/ops/service/impl/WorkOrderServiceImpl.java

@@ -890,7 +890,7 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder
     /** 生成报警转工单时的默认问题描述。 */
     private String buildAlarmOrderDesc(AlarmData alarm) {
         StringBuilder sb = new StringBuilder();
-        sb.append(StringUtils.isEmpty(alarm.getWarningType()) ? "监测报警" : alarm.getWarningType());
+        sb.append("监测报警");
         // 状态类报警可能没有实际值,此时不拼接无意义的数值和阈值占位。
         if (alarm.getActualValue() != null) {
             sb.append(",当前值:").append(alarm.getActualValue().toPlainString());

+ 2 - 1
pipe-network-service/zksy-system/src/main/resources/mapper/base/AlarmDataMapper.xml

@@ -21,6 +21,7 @@
     <select id="selectLatestPage" resultType="com.zksy.base.alarm.domain.AlarmData">
         SELECT a.*
         FROM alarm_data a
+        LEFT JOIN app_user.warning_type wt ON wt.warning_code = a.warning_code
         <where>
             <if test="deviceCodes != null and deviceCodes.size() > 0">
                 AND a.device_code IN
@@ -32,7 +33,7 @@
                 AND a.device_code LIKE CONCAT('%', #{deviceCode}, '%')
             </if>
             <if test="warningType != null and warningType != ''">
-                AND a.warning_type LIKE CONCAT('%', #{warningType}, '%')
+                AND wt.warning_name LIKE CONCAT('%', #{warningType}, '%')
             </if>
             <if test="warningCode != null and warningCode != ''">
                 AND a.warning_code LIKE CONCAT('%', #{warningCode}, '%')

+ 10 - 6
pipe-network-service/zksy-system/src/main/resources/mapper/base/AlarmOperationsMapper.xml

@@ -13,8 +13,11 @@
         a.*, e.equipment_id, e.equipment_name AS current_device_name, e.equipment_location,
         e.equipment_type_id, e.equipment_image, e.longitude, e.latitude, st.alarm_status AS device_alarm_status,
         w.order_no, w.order_status, w.plan_finish_time, COALESCE(u.nick_name,u.user_name) AS receive_user_name,
-        (SELECT wt.warning_unit FROM app_user.equipment_warning_type wt
-            WHERE wt.equipment_type_id = e.equipment_type_id AND wt.warning_code = a.warning_code LIMIT 1) AS warning_unit
+        (SELECT wtt.warning_unit FROM app_user.equipment_warning_type ewt
+            JOIN app_user.warning_type wtt ON wtt.id = ewt.warning_type_id
+            WHERE ewt.equipment_type_id = e.equipment_type_id AND wtt.warning_code = a.warning_code LIMIT 1) AS warning_unit,
+        (SELECT wtt.warning_name FROM app_user.warning_type wtt
+            WHERE wtt.warning_code = a.warning_code LIMIT 1) AS warning_name
     </sql>
     <resultMap id="alarm" type="com.zksy.base.alarm.dto.AlarmVO" autoMapping="true">
         <id property="id" column="id"/>
@@ -79,12 +82,13 @@
         GROUP BY 1, 2 ORDER BY 1, 2
     </select>
     <select id="countByWarningType" resultType="java.util.Map">
-        SELECT COALESCE(NULLIF(trim(wt.warning_name), ''), NULLIF(trim(a.warning_type), ''), '未分类') AS name,
+        SELECT COALESCE(NULLIF(trim(wt.warning_name), ''), '未分类') AS name,
             COUNT(*) AS count
         <include refid="joins"/>
-        LEFT JOIN LATERAL (SELECT t.warning_name FROM app_user.equipment_warning_type t
-            WHERE t.equipment_type_id = e.equipment_type_id AND t.warning_code = a.warning_code
-            ORDER BY t.warning_name LIMIT 1) wt ON true
+        LEFT JOIN LATERAL (SELECT wt.warning_name FROM app_user.equipment_warning_type ewt
+            JOIN app_user.warning_type wt ON wt.id = ewt.warning_type_id
+            WHERE ewt.equipment_type_id = e.equipment_type_id AND wt.warning_code = a.warning_code
+            ORDER BY wt.warning_name LIMIT 1) wt ON true
         <where><include refid="filters"/></where> GROUP BY 1 ORDER BY count DESC, name
     </select>
     <select id="countByDeviceType" resultType="java.util.Map">

+ 3 - 2
pipe-network-service/zksy-system/src/main/resources/mapper/base/AlarmReviewMapper.xml

@@ -30,9 +30,10 @@
         (SELECT e.equipment_id FROM app_user.equipment_base e WHERE e.equipment_code = a.device_code ORDER BY e.equipment_id LIMIT 1) AS equipment_id,
         (SELECT e.equipment_location FROM app_user.equipment_base e WHERE e.equipment_code = a.device_code ORDER BY e.equipment_id LIMIT 1) AS equipment_location,
         (SELECT e.equipment_name FROM app_user.equipment_base e WHERE e.equipment_code = a.device_code ORDER BY e.equipment_id LIMIT 1) AS current_device_name,
-        (SELECT w.warning_unit FROM app_user.equipment_warning_type w
+        (SELECT wt.warning_unit FROM app_user.equipment_warning_type w
             JOIN app_user.equipment_base e ON e.equipment_type_id = w.equipment_type_id
-            WHERE e.equipment_code = a.device_code AND w.warning_code = a.warning_code
+            JOIN app_user.warning_type wt ON wt.id = w.warning_type_id
+            WHERE e.equipment_code = a.device_code AND wt.warning_code = a.warning_code
             ORDER BY e.equipment_id LIMIT 1) AS warning_unit
     </sql>
     <resultMap id="review" type="com.zksy.base.alarm.dto.AlarmReviewVO" autoMapping="true">

+ 2 - 1
pipe-network-service/zksy-system/src/main/resources/mapper/warning/AlarmWarningRelMapper.xml

@@ -11,7 +11,7 @@
             (SELECT t.type_name FROM app_user.equipment_base e
              JOIN app_user.equipment_type t ON t.id::text = e.equipment_type_id::text
              WHERE e.equipment_code = a.device_code ORDER BY e.equipment_id LIMIT 1) AS device_type,
-            a.warning_type,
+            wt.warning_name AS warning_type,
             a.warning_code,
             a.alarm_no,
             a.actual_value,
@@ -19,6 +19,7 @@
             a.create_time
         FROM alarm_warning_rel r
         LEFT JOIN alarm_data a ON r.alarm_id = a.id
+        LEFT JOIN app_user.warning_type wt ON wt.warning_code = a.warning_code
         WHERE r.warning_id = #{warningId}
         ORDER BY a.create_time DESC
     </select>

+ 0 - 1
pipe-network-service/zksy-system/src/test/java/com/zksy/WaterSupply/MonitorAlarm/WaterSupplyAlarmRealtimeContractTest.java

@@ -100,7 +100,6 @@ class WaterSupplyAlarmRealtimeContractTest {
         AlarmData alarm = new AlarmData();
         alarm.setId(id);
         alarm.setDeviceCode(deviceCode);
-        alarm.setWarningType(warningType);
         alarm.setWarningCode("WARN-" + warningType);
         alarm.setAlarmStatus(alarmStatus);
         alarm.setAlarmLevel(alarmLevel);

+ 0 - 1
pipe-network-service/zksy-system/src/test/java/com/zksy/base/alarm/service/AlarmClearServiceTest.java

@@ -80,7 +80,6 @@ class AlarmClearServiceTest {
         AlarmData alarm = new AlarmData();
         alarm.setId(id);
         alarm.setDeviceCode("CN-GS-202609020001");
-        alarm.setWarningType(warningType);
         alarm.setAlarmStatus(alarmStatus);
         return alarm;
     }

+ 0 - 2
pipe-network-service/zksy-system/src/test/java/com/zksy/base/service/impl/WaterSupplyDeviceServiceImplTest.java

@@ -224,7 +224,6 @@ class WaterSupplyDeviceServiceImplTest {
         processedAlarm.setDeviceCode(repairDevice.getEquipmentCode());
         processedAlarm.setAlarmStatus(0);
         processedAlarm.setAlarmLevel(1);
-        processedAlarm.setWarningType("历史压力超限");
         when(alarmDataMapper.selectList(any())).thenReturn(Collections.singletonList(processedAlarm));
         when(workOrderMapper.selectList(any())).thenReturn(Collections.emptyList());
 
@@ -362,7 +361,6 @@ class WaterSupplyDeviceServiceImplTest {
     private static AlarmData alarm(String deviceCode, String warningType, int level) {
         AlarmData alarm = new AlarmData();
         alarm.setDeviceCode(deviceCode);
-        alarm.setWarningType(warningType);
         alarm.setAlarmLevel(level);
         alarm.setAlarmStatus(0);
         return alarm;

+ 2 - 5
pipe-network-service/zksy-system/src/test/java/com/zksy/ops/service/impl/WorkOrderServiceImplTest.java

@@ -157,21 +157,19 @@ class WorkOrderServiceImplTest {
     @Test
     void alarmOrderPersistsFaultDescriptionWithZeroActualValue() {
         AlarmData alarm = new AlarmData();
-        alarm.setWarningType("压力预警");
         alarm.setActualValue(java.math.BigDecimal.ZERO);
         alarm.setMinValue(java.math.BigDecimal.ONE);
         alarm.setMaxValue(java.math.BigDecimal.TEN);
         WorkOrder order = createAlarmOrderWithGeneratedDescription(alarm);
-        assertEquals("压力预警,当前值:0(阈值:1~10),请现场核实处理", order.getOrderDesc());
+        assertEquals("监测报警,当前值:0(阈值:1~10),请现场核实处理", order.getOrderDesc());
     }
 
     @Test
     void alarmOrderWithoutActualValueOmitsPlaceholderAndThreshold() {
         AlarmData alarm = new AlarmData();
-        alarm.setWarningType("设备离线");
         alarm.setMaxValue(java.math.BigDecimal.ZERO);
         WorkOrder order = createAlarmOrderWithGeneratedDescription(alarm);
-        assertEquals("设备离线,请现场核实处理", order.getOrderDesc());
+        assertEquals("监测报警,请现场核实处理", order.getOrderDesc());
     }
 
     private WorkOrder createAlarmOrderWithGeneratedDescription(AlarmData alarm) {
@@ -277,7 +275,6 @@ class WorkOrderServiceImplTest {
     @ValueSource(strings = {"  "})
     void missingWarningCodeFailsClosedInsteadOfFallingBackToAlarmName(String warningCode) {
         AlarmData alarm = stubAlarmForConflict(warningCode);
-        alarm.setWarningType("显示名称不能代替报警编码");
         ServiceException error = assertThrows(ServiceException.class,
                 () -> service.createWorkOrderFromAlarm("a-conflict", null, null));
         assertTrue(error.getMessage().contains("报警编码缺失"));

+ 0 - 1
radar-service/src/main/java/com/zksy/radar/utils/MessageHandler.java

@@ -257,7 +257,6 @@ public class MessageHandler extends ChannelInboundHandlerAdapter {
 		try {
 			AlarmData alarmData = new AlarmData();
 			alarmData.setDeviceCode(deviceCode);
-			alarmData.setWarningType(warningType);
 			alarmData.setWarningCode(warningCode);
 			alarmData.setMinValue(minValue);
 			alarmData.setMaxValue(maxValue);

+ 0 - 1
telemetry-service/src/main/java/com/zksy/telemetry/utils/MessageHandler.java

@@ -169,7 +169,6 @@ public class MessageHandler extends ChannelInboundHandlerAdapter {
             run(deviceCode, warningCode + ":报警入库", () -> {
                 AlarmData alarm = new AlarmData();
                 alarm.setDeviceCode(deviceCode);
-                alarm.setWarningType(warningType);
                 alarm.setWarningCode(warningCode);
                 alarm.setMinValue(min);
                 alarm.setMaxValue(max);

+ 0 - 1
water-level-service/src/main/java/com/zksy/water/utils/MessageHandler.java

@@ -256,7 +256,6 @@ public class MessageHandler extends ChannelInboundHandlerAdapter {
 		try {
 			AlarmData alarmData = new AlarmData();
 			alarmData.setDeviceCode(deviceCode);
-			alarmData.setWarningType(warningType);
 			alarmData.setWarningCode(warningCode);
 			alarmData.setMinValue(minValue);
 			alarmData.setMaxValue(maxValue);

+ 0 - 4
zk-api-service/src/main/java/com/zksy/api/domain/AlarmData.java

@@ -35,10 +35,6 @@ public class AlarmData implements Serializable {
     @ApiModelProperty(value = "设备编码")
     private String deviceCode;
 
-    @TableField(value = "warning_type")
-    @ApiModelProperty(value = "告警类型")
-    private String warningType;
-
     @TableField(value = "warning_code")
     @ApiModelProperty(value = "告警编码")
     private String warningCode;

+ 1 - 2
zk-api-service/src/main/java/com/zksy/api/service/CollectionAlarmWriter.java

@@ -42,7 +42,6 @@ public class CollectionAlarmWriter {
     public boolean saveOrUpdateUnhandled(AlarmData alarm) {
         if (alarm == null) throw new IllegalArgumentException("告警不能为空");
         validateKey(alarm.getDeviceCode(), alarm.getWarningCode());
-        alarm.setWarningType(alarmLabel(alarm.getWarningType()));
         alarm.setRemark(alarmLabel(alarm.getRemark()));
 
         if (alarm.getCreateTime() == null) alarm.setCreateTime(LocalDateTime.now());
@@ -72,7 +71,7 @@ public class CollectionAlarmWriter {
             alarm.setAlarmNo(AlarmLifecycleSupport.nextAlarmNo(mapper::existsAlarmNo));
             if (mapper.insert(alarm) != 1) throw new IllegalStateException("告警入库未成功");
             writeLifecycleLog(alarm.getId(), AlarmLogOperTypeEnum.CREATED,
-                    AlarmLifecycleSupport.createdDescription(alarm.getAlarmNo(), alarm.getRemark(), alarm.getWarningType(),
+                    AlarmLifecycleSupport.createdDescription(alarm.getAlarmNo(), alarm.getRemark(), null,
                             alarm.getWarningCode(), alarm.getActualValue(), alarm.getMinValue(), alarm.getMaxValue()),
                     "监测系统", alarm.getCreateTime(), 0L);
             return true;

+ 0 - 1
zk-api-service/src/main/java/com/zksy/api/service/impl/EquipmentStatusApiServiceImpl.java

@@ -192,7 +192,6 @@ public class EquipmentStatusApiServiceImpl implements EquipmentStatusApiService
     private void saveOfflineAlarm(String deviceCode) {
         AlarmData alarmData = new AlarmData();
         alarmData.setDeviceCode(deviceCode);
-        alarmData.setWarningType("设备离线");
         alarmData.setWarningCode("OFFLINE");
         alarmData.setAlarmLevel(4);
         alarmData.setAlarmStatus(0);

+ 0 - 1
zk-api-service/src/main/java/com/zksy/api/utils/SmsUtil.java

@@ -286,7 +286,6 @@ public class SmsUtil {
         try {
             AlarmData alarmData = new AlarmData();
             alarmData.setDeviceCode(deviceCode);
-            alarmData.setWarningType(warningType);
             alarmData.setWarningCode(warningCode);
             alarmData.setMinValue(minValue);
             alarmData.setMaxValue(maxValue);

+ 1 - 2
zk-api-service/src/main/resources/mapper/AlarmDataMapper.xml

@@ -8,7 +8,6 @@
             <id property="id" column="id" jdbcType="VARCHAR"/>
             <result property="workOrderId" column="work_order_id" jdbcType="BIGINT"/>
             <result property="deviceCode" column="device_code" jdbcType="VARCHAR"/>
-            <result property="warningType" column="warning_type" jdbcType="VARCHAR"/>
             <result property="warningCode" column="warning_code" jdbcType="VARCHAR"/>
             <result property="minValue" column="min_value" jdbcType="DECIMAL"/>
             <result property="maxValue" column="max_value" jdbcType="DECIMAL"/>
@@ -25,7 +24,7 @@
 
     <sql id="Base_Column_List">
         id,work_order_id,device_code,
-        warning_type,warning_code,min_value,max_value,alarm_level,deviation_ratio,audit_status,
+        warning_code,min_value,max_value,alarm_level,deviation_ratio,audit_status,
         actual_value,alarm_status,
         remark,create_time,update_time
     </sql>