Commit 29f8fa76 by huangjy

fix:呼吸率和心率告警问题

parent 2110f403
...@@ -95,6 +95,7 @@ public class BreathAlarm implements IAlarm { ...@@ -95,6 +95,7 @@ public class BreathAlarm implements IAlarm {
int hasPerson = (int) properties.get("person"); int hasPerson = (int) properties.get("person");
if (0 == hasPerson) { if (0 == hasPerson) {
log.info("当前上报数据无人,不需要告警"); log.info("当前上报数据无人,不需要告警");
RedisUtil.delete(RedisConst.ALARM_DEVICE_BR_ID + deviceId);
return; return;
} }
...@@ -125,7 +126,7 @@ public class BreathAlarm implements IAlarm { ...@@ -125,7 +126,7 @@ public class BreathAlarm implements IAlarm {
} }
Long startLong = alarmRedisDTO.getStartLong(); Long startLong = alarmRedisDTO.getStartLong();
long count = endLong - startLong; long count = endLong - startLong;
if (count/1000 >= duration) { if (duration + 5 >= count/1000 && count/1000 >= duration) {
if (StringUtils.equals(alarmRedisDTO.getAlarm(), CommonEnum.YES.getValue())) { if (StringUtils.equals(alarmRedisDTO.getAlarm(), CommonEnum.YES.getValue())) {
log.error("呼吸已告警,设备plat_id:" + platDevice.getId()); log.error("呼吸已告警,设备plat_id:" + platDevice.getId());
return; return;
......
...@@ -99,6 +99,7 @@ public class HeartAlarm implements IAlarm { ...@@ -99,6 +99,7 @@ public class HeartAlarm implements IAlarm {
int hasPerson = (int) properties.get("person"); int hasPerson = (int) properties.get("person");
if (0 == hasPerson) { if (0 == hasPerson) {
log.info("当前上报数据无人,不需要告警"); log.info("当前上报数据无人,不需要告警");
RedisUtil.delete(RedisConst.ALARM_DEVICE_HR_ID + deviceId);
return; return;
} }
...@@ -114,7 +115,7 @@ public class HeartAlarm implements IAlarm { ...@@ -114,7 +115,7 @@ public class HeartAlarm implements IAlarm {
} }
Long startLong = alarmRedisDTO.getStartLong(); Long startLong = alarmRedisDTO.getStartLong();
long count = endLong - startLong; long count = endLong - startLong;
if (count/1000 >= duration) { if (duration + 5 >= count/1000 && count/1000 >= duration) {
//todo 如果每台服务器都能收到上报消息 加redis锁 //todo 如果每台服务器都能收到上报消息 加redis锁
//RLock lock = RedisLockUtil.lock(RedisConst.LOCK_ALARM + deviceId); //RLock lock = RedisLockUtil.lock(RedisConst.LOCK_ALARM + deviceId);
if (StringUtils.equals(alarmRedisDTO.getAlarm(), CommonEnum.YES.getValue())) { if (StringUtils.equals(alarmRedisDTO.getAlarm(), CommonEnum.YES.getValue())) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment