Commit 451d718a by 汪志阳

fix:修复bug

parent 4ef7b8e9
......@@ -13,7 +13,6 @@ import com.makeit.entity.platform.elder.PlatElder;
import com.makeit.enums.CommonEnum;
import com.makeit.enums.platform.alarm.PlatAlarmConfigEnum;
import com.makeit.enums.redis.RedisConst;
import com.makeit.module.iot.enums.DeviceInfoContentBreatheEnum;
import com.makeit.service.platform.alarm.PlatAlarmRecordService;
import com.makeit.utils.AlarmRedisDTO;
import com.makeit.utils.data.convert.JsonUtil;
......@@ -56,12 +55,12 @@ public class OffBedAlarm implements IAlarm {
platAlarmRecordService.getElderListByDeviceId(platAlarmCheckDTO);
List<PlatElder> platElderList = platAlarmCheckDTO.getPlatElderList();
if (CollectionUtils.isEmpty(platElderList)) {
log.error("呼吸告警心率设备未关联长者,设备plat_id:" + platAlarmCheckDTO.getPlatDevice().getId());
log.error("离床告警心率设备未关联长者,设备plat_id:" + platAlarmCheckDTO.getPlatDevice().getId());
return;
}
PlatAlarmConfig config = platAlarmCheckDTO.getPlatAlarmConfig();
if (!"5".equals(config.getAlarmType())) {
log.error("呼吸告警配置不存在,config:{}", JSONUtil.toJsonStr(config));
log.error("离床告警配置不存在,config:{}", JSONUtil.toJsonStr(config));
return;
}
if (CommonEnum.NO.getValue().equals(config.getStatus())) {
......@@ -87,7 +86,7 @@ public class OffBedAlarm implements IAlarm {
String deviceId = platDevice.getId();
List<LocalDateTime> timeRange = getOffTimeRange(ruleConfig);
if (CollUtil.isEmpty(timeRange)) {
log.error("离床告警配置时间段解析失败,config:{}", JSONUtil.toJsonStr(ruleConfig));
log.warn("离床告警配置时间段解析失败,config:{}", JSONUtil.toJsonStr(ruleConfig));
return;
}
LocalDateTime startTime = timeRange.get(0);
......@@ -95,7 +94,7 @@ public class OffBedAlarm implements IAlarm {
Integer duration = ruleConfig.getDuration();
String personState = Convert.toStr(properties.get("personState"));
boolean isInRange = LocalDateTime.now().isAfter(startTime) && LocalDateTime.now().isBefore(endTime);
if (!DeviceInfoContentBreatheEnum.PersonStateEnum.NOBODY.eq(personState) || !isInRange) {
if (!"0".equals(personState) || !isInRange) {
return;
}
AlarmRedisDTO alarmRedisDTO = RedisUtil.get(RedisConst.ALARM_DEVICE_OFF_BED_ID + deviceId);
......@@ -107,10 +106,10 @@ public class OffBedAlarm implements IAlarm {
alarmRedisDTO.setStart(now);
alarmRedisDTO.setStartLong(endLong);
RedisUtil.set(RedisConst.ALARM_DEVICE_OFF_BED_ID + deviceId, alarmRedisDTO);
log.info("发现长者设备状态无人,设备plat_id:" + deviceId);
log.warn("发现长者设备状态无人,设备plat_id:" + deviceId);
return;
}
log.info("redis获取offbed数据:{}", JSONUtil.toJsonStr(alarmRedisDTO));
log.warn("redis获取offbed数据:{}", JSONUtil.toJsonStr(alarmRedisDTO));
Date now = new Date();
long endLong = now.getTime();
Long startLong = alarmRedisDTO.getStartLong();
......@@ -118,7 +117,7 @@ public class OffBedAlarm implements IAlarm {
String messageType = platAlarmCheckDTO.getMessageType();
if (count / 1000 >= duration) {
if (StringUtils.equals(alarmRedisDTO.getAlarm(), CommonEnum.YES.getValue())) {
log.info("离床告警已告警过,设备plat_id:" + deviceId);
log.warn("离床告警已告警过,设备plat_id:" + deviceId);
return;
}
alarmRedisDTO.setStartLong(endLong);
......@@ -127,11 +126,9 @@ public class OffBedAlarm implements IAlarm {
platAlarmCheckDTO.setAbnormalValue(String.valueOf(count));
RedisUtil.set(RedisConst.ALARM_DEVICE_OFF_BED_ID + deviceId, alarmRedisDTO);
notice(platAlarmCheckDTO);
}
if (StringUtils.equalsAnyIgnoreCase(messageType, "REPORT_PROPERTY", "OFFLINE", "DISCONNECT")) {
log.info("删除redisoffbed预警");
// RedisUtil.delete(RedisConst.ALARM_DEVICE_OFF_BED_ID + deviceId);
} else if (StringUtils.equalsAnyIgnoreCase(messageType, "REPORT_PROPERTY", "OFFLINE", "DISCONNECT")) {
log.warn("删除redisoffbed预警");
RedisUtil.delete(RedisConst.ALARM_DEVICE_OFF_BED_ID + deviceId);
}
}
......@@ -188,4 +185,8 @@ public class OffBedAlarm implements IAlarm {
log.info("离床告警配置,发出告警,设备id:" + platDevice.getId() + ", 长者名称:" + platElder.getName());
}
}
public static void main(String[] args) {
System.out.println();
}
}
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