Browse Source

编辑修改

master
wangwei_123 1 week ago
parent
commit
1461ebccc2
  1. 12
      cc-admin-master/yudao-module-hand-mqtt/src/main/java/cn/iocoder/yudao/module/mqtt/processor/BatchDeviceMessageProcessor.java
  2. 2
      cc-admin-master/yudao-module-hand/src/main/java/cn/iocoder/yudao/module/hand/service/impl/HandDetectorServiceImpl.java
  3. 6
      cc-admin-master/yudao-module-hand/src/main/java/cn/iocoder/yudao/module/hand/vo/HandDataVo.java

12
cc-admin-master/yudao-module-hand-mqtt/src/main/java/cn/iocoder/yudao/module/mqtt/processor/BatchDeviceMessageProcessor.java

@ -599,13 +599,16 @@ public class BatchDeviceMessageProcessor {
}
}
// 推送报警消息(值变化时)
if (handVo.getLastPushValue() == null
|| !handVo.getLastPushValue().equals(handVo.getValue())) {
Integer lastPushLevel = handVo.getLastPushLevel();
// 判定条件:首次推送(为null) 或 等级发生变化
if (lastPushLevel == null || !lastPushLevel.equals(newLevel)) {
sendAlarmMessage(handVo, alarmRule.getGasTypeName(), handVo.getValue(), true, context);
// 更新最后推送的状态
handVo.setLastPushValue(handVo.getValue());
handVo.setLastPushLevel(newLevel);
}
handVo.setGasStatus(HandAlarmType.ALARM.getType());
}
@ -864,7 +867,6 @@ public class BatchDeviceMessageProcessor {
);
// 异步发送 Kafka,耗时极短 (<1ms)
// 使用 sourceSn 作为 Key,保证同一个部门/设备的报警排队有序处理
String key = handVo.getSn();
String json = JsonUtils.toJsonString(event);

2
cc-admin-master/yudao-module-hand/src/main/java/cn/iocoder/yudao/module/hand/service/impl/HandDetectorServiceImpl.java

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.hand.service.impl;
import cn.iocoder.yudao.framework.common.exception.ServiceException;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.module.hand.dal.HandDetectorDO;
import cn.iocoder.yudao.module.hand.mapper.HandDetectorMapper;
import cn.iocoder.yudao.module.hand.service.HandDetectorService;
@ -165,6 +166,7 @@ public class HandDetectorServiceImpl implements HandDetectorService {
}
// 更新
HandDetectorDO updateObj = BeanUtils.toBean(updateReqVO, HandDetectorDO.class);
updateObj.setTenantId(loginUser.getTenantId().intValue());
handDetectorMapper.updateById(updateObj);
redisUtil.hset(

6
cc-admin-master/yudao-module-hand/src/main/java/cn/iocoder/yudao/module/hand/vo/HandDataVo.java

@ -110,7 +110,9 @@ public class HandDataVo {
@Schema(description = "部门id")
private Long deptId;
@Schema(description = "最后推送数据")
private Double lastPushValue;
@Schema(description = "最后推送等级")
private Integer lastPushLevel;
@Schema(description = "最后推送等级")
private Double lastPushValue;
}

Loading…
Cancel
Save