Forráskód Böngészése

设备告警上报与处理bug 修改

jingyuanchao 1 éve
szülő
commit
24f8fd3af3

+ 35 - 0
project_data/sql/0.1.1/soc/soc.sql

@@ -1024,3 +1024,38 @@ INSERT INTO sys_dict_type (dict_name, dict_type, status, create_by, create_time,
 INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES (0, '未启用', '0', 'iot_connect_status', null, 'default', 'N', '0', '超级管理员', '2024-07-08 15:46:15', '', null, null);
 INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES (1, '在线', '1', 'iot_connect_status', null, 'default', 'N', '0', '超级管理员', '2024-07-08 15:46:27', '', null, null);
 INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark) VALUES (2, '离线', '2', 'iot_connect_status', null, 'default', 'N', '0', '超级管理员', '2024-07-08 15:46:40', '', null, null);
+
+delete from iot_alarm_system_field;
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (129, 4184, '水浸', '4184', '水浸告警', 'alarm', '{\"0\": \"正常\",\"1\": \"告警\"}', '{\"EQUALS\": \"等于\"}', 'ENUM', '枚举', NULL, 1, NULL, NULL, NULL, NULL);
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (130, 4182, '烟感', '4182', '烟雾告警', 'alarm', '{\"0\": \"正常\",\"1\": \"告警\"}', '{\"EQUALS\": \"等于\"}', 'ENUM', '枚举', NULL, 1, NULL, NULL, NULL, NULL);
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (131, 4183, '温湿度', '4183_1', '环境温度', 'temperature', '{}', '{\"GT\": \"大于\",\"GTE\": \"大于等于\",\"LT\": \"小于\",\"LTE\": \"小于等于\",\"EQUALS\": \"等于\"}', 'FLOAT', '浮点型', '°C', 1, NULL, NULL, NULL, NULL);
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (132, 4183, '温湿度', '4183_2', '环境湿度', 'humidity', '{}', '{\"GT\": \"大于\",\"GTE\": \"大于等于\",\"LT\": \"小于\",\"LTE\": \"小于等于\",\"EQUALS\": \"等于\"}', 'FLOAT', '浮点型', '%RH', 1, NULL, NULL, NULL, NULL);
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (133, 41885, '燃气', '41885', '可燃气体告警', 'alarm', '{\"0\": \"正常\",\"1\": \"告警\"}', '{\"EQUALS\": \"等于\"}', 'ENUM', '枚举', '', 1, NULL, NULL, NULL, NULL);
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (134, 4188, '门磁', '4188', '门磁开关状态', 'alarm', '{\"0\":\"门已打开\",\"1\":\"门已关闭\"}', '{\"EQUALS\": \"等于\"}', 'ENUM', '枚举', '', 1, NULL, NULL, NULL, NULL);
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (135, 4181, '红外', '4181', '红外告警', 'alarm', '{\"0\": \"正常\",\"1\": \"告警\"}', '{\"EQUALS\": \"等于\"}', 'ENUM', '枚举', '', 1, NULL, NULL, NULL, NULL);
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (136, 41881, '盗情', '41881', '被盗告警', 'alarm', '{\"0\": \"正常\",\"1\": \"告警\"}', '{\"EQUALS\": \"等于\"}', 'ENUM', '枚举', NULL, 1, NULL, NULL, NULL, NULL);
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (137, 415, '空调', '415_1', '电流', 'current', '{}', '{}', 'FLOAT', '浮点型', 'A', 1, NULL, NULL, NULL, NULL);
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (138, 415, '空调', '415_2', '电压', 'voltage', '{}', '{}', 'FLOAT', '浮点型', 'V', 1, NULL, NULL, NULL, NULL);
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (139, 415, '空调', '415_3', '回风温度', 'returnAirTemperature', '{}', '{}', 'FLOAT', '浮点型', '°C', 1, NULL, NULL, NULL, NULL);
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (140, 415, '空调', '415_4', '室内温度', 'indoorAirTemperature', '{}', '{}', 'FLOAT', '浮点型', '°C', 1, NULL, NULL, NULL, NULL);
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (141, 415, '空调', '415_5', '室外温度', 'indoorAirTemperature', '{}', '{}', 'FLOAT', '浮点型', '°C', 1, NULL, NULL, NULL, NULL);
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (142, 415, '空调', '415_6', '温度', 'temperature', '{}', '{}', 'FLOAT', '浮点型', '°C', 1, NULL, NULL, NULL, NULL);
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (143, 415, '空调', '415_7', '湿度', 'humidity', '{}', '{}', 'FLOAT', '浮点型', '%RH', 1, NULL, NULL, NULL, NULL);
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (144, 415, '空调', '415_8', '室内湿度', 'indoorHumidity', '{}', '{}', 'FLOAT', '浮点型', '%RH', 1, NULL, NULL, NULL, NULL);
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (145, 408, 'UPS', '408_1', 'UPS输入相电压Ua', 'upsInputPhaseVoltageUa', '{}', '{}', 'FLOAT', '浮点型', 'V', 1, NULL, NULL, NULL, NULL);
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (146, 408, 'UPS', '408_2', 'UPS输入相电压Ub', 'upsInputPhaseVoltageUb', '{}', '{}', 'FLOAT', '浮点型', 'V', 1, NULL, NULL, NULL, NULL);
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (147, 408, 'UPS', '408_3', 'UPS输入相电压Uc', 'upsInputPhaseVoltageUc', '{}', '{}', 'FLOAT', '浮点型', 'V', 1, NULL, NULL, NULL, NULL);
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (148, 408, 'UPS', '408_4', 'UPS输入频率', 'upsInputFrequency', '{}', '{}', 'FLOAT', '浮点型', 'Hz', 1, NULL, NULL, NULL, NULL);
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (149, 408, 'UPS', '408_5', 'UPS输出相电压Ua', 'upsOutputPhaseVoltageUa', '{}', '{}', 'FLOAT', '浮点型', 'V', 1, NULL, NULL, NULL, NULL);
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (150, 408, 'UPS', '408_6', 'UPS输出相电压Ub', 'upsOutputPhaseVoltageUb', '{}', '{}', 'FLOAT', '浮点型', 'V', 1, NULL, NULL, NULL, NULL);
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (151, 408, 'UPS', '408_7', 'UPS输出相电压Uc', 'upsOutputPhaseVoltageUc', '{}', '{}', 'FLOAT', '浮点型', 'V', 1, NULL, NULL, NULL, NULL);
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (152, 408, 'UPS', '408_8', 'UPS输出频率', 'upsOutputFrequency', '{}', '{}', 'FLOAT', '浮点型', 'Hz', 1, NULL, NULL, NULL, NULL);
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (153, 408, 'UPS', '408_9', '交流输入中断告警', 'acInputInterruptAlarm', '{\"0\": \"正常\",\"1\": \"告警\"}', '{\"EQUALS\": \"等于\"}', 'ENUM', '枚举', NULL, 1, NULL, NULL, NULL, NULL);
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (154, 408, 'UPS', '408_10', 'UPS主机温度', 'upsHostTemperature', '{}', '{}', 'FLOAT', '浮点型', '°C', 1, NULL, NULL, NULL, NULL);
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (155, 408, 'UPS', '408_1', '旁路状态', 'bypassState', '{}', '{}', 'TEXT', '文本型', NULL, 1, NULL, NULL, NULL, NULL);
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (156, 408, 'UPS', '408_2', 'UPS类型', 'upsType', '{}', '{}', 'TEXT', '文本型', NULL, 1, NULL, NULL, NULL, NULL);
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (157, 408, 'UPS', '408_3', 'UPS电池电流', 'upsBatteryCurrent', '{}', '{}', 'FLOAT', '浮点型', 'A', 1, NULL, NULL, NULL, NULL);
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (158, 408, 'UPS', '408_4', '电池容量', 'batteryCapacity', '{}', '{}', 'FLOAT', '浮点型', '%', 1, NULL, NULL, NULL, NULL);
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (159, 408, 'UPS', '408_5', '电池剩余备用时间', 'batteryRemainingStandbyTime', '{}', '{}', 'FLOAT', '浮点型', 's', 1, NULL, NULL, NULL, NULL);
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (160, 408, 'UPS', '408_6', '电池电压低告警', 'lowBatteryVoltageAlarm', '{\"0\": \"正常\",\"1\": \"告警\"}', '{\"EQUALS\": \"等于\"}', 'ENUM', '枚举', NULL, 1, NULL, NULL, NULL, NULL);
+INSERT INTO  `iot_alarm_system_field`(`id`, `source_type`, `source_type_des`, `sys_field_code`, `name`, `property_name`, `specs`, `operators`, `type`, `type_des`, `unit`, `enable`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (161, 4186, '8小时回路', '4186', '8小时回路通电状态', 'status', '{\"0\": \"断电\",\"1\": \"通电\"}', '{\"EQUALS\": \"等于\"}', 'ENUM', '枚举', NULL, 1, NULL, NULL, NULL, NULL);

+ 2 - 0
soc-modules/soc-modules-host/src/main/java/com/xunmei/host/iot/service/impl/IotDeviceInfoServiceImpl.java

@@ -280,6 +280,8 @@ public class IotDeviceInfoServiceImpl extends ServiceImpl<IotDeviceInfoMapper, I
             return;
         }
         deleteDeviceByToken(iotCode);
+        iotAlarmSubsystemService.deleteByIotToken(iotCode);
+        iotAlarmDefenceAreaService.deleteByIotToken(iotCode);
         LogUtils.SOCKET_BASE_DEVICE_INFO.info("删除设备数据,token:{}", iotCode);
     }
 

+ 16 - 11
soc-modules/soc-modules-host/src/main/java/com/xunmei/host/iot/service/impl/IotDeviceStatusServiceImpl.java

@@ -186,7 +186,7 @@ public class IotDeviceStatusServiceImpl extends ServiceImpl<IotDeviceStatusMappe
         final JSONArray data = (JSONArray) req.getData();
         final List<AlarmDataReq> dataReqList = data.toJavaList(AlarmDataReq.class);
         for (AlarmDataReq dataReq : dataReqList) {
-            IotDeviceInfo deviceInfo = iotDeviceInfoService.selectByTokenProductAndDeviceCode(req.getToken(), req.getProductName(), req.getDeviceName());
+            IotDeviceInfo deviceInfo = iotDeviceInfoService.selectByTokenProductAndDeviceCode(req.getToken(), req.getProductName(), dataReq.getDeviceCode());
             if (ObjectUtil.isNull(deviceInfo)) {
                 LogUtils.SOCKET_DEVICE_ALARM_DATA.error("收到设备报警消息,根据token:{},productName:{},deviceName:{}未查询到设备信息", req.getToken(), req.getProductName(), req.getDeviceName());
                 continue;
@@ -195,16 +195,21 @@ public class IotDeviceStatusServiceImpl extends ServiceImpl<IotDeviceStatusMappe
             iotAlarmData.setOrgId(sysOrg.getId());
             iotAlarmData.setDeviceId(String.valueOf(deviceInfo.getId()));
             final String sourceType = SensorType.getCodeByProduct(dataReq.getProductType());
-            fieldList.stream()
-                    .filter(r -> ObjectUtil.equal(r.getSourceType(), sourceType))
-                    .filter(r -> ObjectUtil.equal(r.getPropertyName(), dataReq.getProductProperty()))
-                    .findAny()
-                    .ifPresent(r -> {
-                        iotAlarmData.setSourceType(r.getSourceType());
-                        iotAlarmData.setSourceTypeDes(r.getSourceTypeDes());
-                        iotAlarmData.setFieldCode(r.getSysFieldCode());
-                    });
-            iotAlarmDataService.save(iotAlarmData);
+            try {
+                fieldList.stream()
+                        .filter(r -> ObjectUtil.equal(String.valueOf(r.getSourceType()), sourceType))
+                        .filter(r -> ObjectUtil.equal(r.getPropertyName(), dataReq.getProductProperty()))
+                        .findAny()
+                        .ifPresent(r -> {
+                            iotAlarmData.setSourceType(r.getSourceType());
+                            iotAlarmData.setSourceTypeDes(r.getSourceTypeDes());
+                            iotAlarmData.setFieldCode(r.getSysFieldCode());
+                        });
+            } catch (Exception e) {
+
+                e.printStackTrace();
+            }
+            iotAlarmDataService.saveOrUpdate(iotAlarmData);
             // 发生报警
             if(ObjectUtil.isNotNull(dataReq.getStartTime())&&ObjectUtil.isNull(dataReq.getEndTime())){
                 updateStatusByDevicePrimaryId(deviceInfo.getId(), DeviceStatusEnum.ALARM.getValue());

+ 2 - 2
soc-modules/soc-modules-host/src/main/java/com/xunmei/host/websocket/handler/SocWebSocketHandler.java

@@ -129,8 +129,8 @@ public class SocWebSocketHandler extends AbstractWebSocketHandler {
     @Override
     protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception {
         // 从WebSocket会话中获取登录用户信息
-        String token = WebSocketSessionHolder.updateToken(session);
-        //String token = "de672e88-c120-41d8-8f5e-4a882d13b894";
+        //String token = WebSocketSessionHolder.updateToken(session);
+        String token = "de672e88-c120-41d8-8f5e-4a882d13b894";
         if (StringUtils.isEmpty(token)) {
             LogUtils.WEBSOCKET_MSG.error("会话消息不存在,ip:{}", WebSocketUtils.getIp(session));
             return;

+ 1 - 0
soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/service/IotAlarmDataService.java

@@ -40,4 +40,5 @@ public interface IotAlarmDataService extends IService<IotAlarmData> {
     TableDataInfo<IotAlarmDataVo> selectSensorAlarmPageList(AppAlarmPageDto requestDto);
 
     List<Map<String,String>> selectAlarmCount(String orgPath);
+    void deleteData(Long orgId);
 }

+ 8 - 0
soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/service/impl/IotAlarmDataServiceImpl.java

@@ -3,6 +3,8 @@ package com.xunmei.iot.service.impl;
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.xunmei.common.core.constant.SecurityConstants;
@@ -20,6 +22,7 @@ import com.xunmei.iot.vo.alarmData.SensorAlarmCountVo;
 import com.xunmei.system.api.RemoteOrgService;
 import com.xunmei.system.api.domain.SysOrg;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.time.LocalDateTime;
@@ -235,4 +238,9 @@ public class IotAlarmDataServiceImpl extends ServiceImpl<IotAlarmDataMapper, Iot
         return baseMapper.selectAlarmCount(orgPath,beginTime);
     }
 
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void deleteData(Long orgId) {
+        baseMapper.delete(new LambdaQueryWrapper<IotAlarmData>().eq(IotAlarmData::getOrgId, orgId));
+    }
 }

+ 4 - 1
soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/service/impl/IotServerInfoServiceImpl.java

@@ -17,6 +17,7 @@ import com.xunmei.common.security.utils.SecurityUtils;
 import com.xunmei.iot.dto.serverInfo.IotServerInfoEditDto;
 import com.xunmei.iot.dto.serverInfo.IotServerInfoPageDto;
 import com.xunmei.iot.mapper.IotServerInfoMapper;
+import com.xunmei.iot.service.IotAlarmDataService;
 import com.xunmei.iot.service.IotServerInfoService;
 import com.xunmei.iot.vo.serverInfo.IotServerInfoPageVo;
 import com.xunmei.system.api.RemoteHostService;
@@ -50,7 +51,8 @@ public class IotServerInfoServiceImpl extends ServiceImpl<IotServerInfoMapper, I
     RemoteOrgService orgService;
     @Autowired
     RemoteHostService hostService;
-
+    @Autowired
+    IotAlarmDataService alarmDataService;
     @Override
     public TableDataInfo<IotServerInfoPageVo> serverPage(IotServerInfoPageDto request) {
         if (request.getCheckSub()) {
@@ -142,6 +144,7 @@ public class IotServerInfoServiceImpl extends ServiceImpl<IotServerInfoMapper, I
         }
         //删除iot服务对应的数据
         hostService.delData(info.getIotCode());
+        alarmDataService.deleteData(info.getOrgId());
     }
 
     @Override