Commit 9e1968ff by 李小龙

fix: 设备告警数据

parent 092fd478
......@@ -63,7 +63,7 @@ public class BehaviorAlarm implements IAlarm {
String ruleConfigStr = config.getRuleConfig();
JSONObject properties = platAlarmCheckDTO.getProperties();
PlatDevice platDevice = platAlarmCheckDTO.getPlatDevice();
String deviceId = platDevice.getOriDeviceId();
String deviceId = platDevice.getId();
if (StringUtils.isBlank(ruleConfigStr)) {
log.error("行为告警配置未配置,告警配置id:" + config.getId());
return;
......@@ -71,7 +71,7 @@ public class BehaviorAlarm implements IAlarm {
String personState = Convert.toStr(properties.get("personState"));
PlatAlarmConfigBehaviorDTOVO ruleConfig = JsonUtil.toObj(ruleConfigStr, PlatAlarmConfigBehaviorDTOVO.class);
Integer duration = ruleConfig.getAverageDuration();//分钟
PlatDayDurationRecord platDayDurationRecord = dayDurationUtil.get(platDevice.getOriDeviceId());
PlatDayDurationRecord platDayDurationRecord = dayDurationUtil.get(deviceId);
// if (platDayDurationRecord == null) {
// log.error("行为告警未找到行为异常平均时长,设备plat_id:" + platDevice.getId());
// return;
......
......@@ -84,7 +84,7 @@ public class BreathAlarm implements IAlarm {
Integer duration = ruleConfig.getDuration();
JSONObject properties = platAlarmCheckDTO.getProperties();
PlatDevice platDevice = platAlarmCheckDTO.getPlatDevice();
String deviceId = platDevice.getOriDeviceId();
String deviceId = platDevice.getId();
String personState = Convert.toStr(properties.get("personState"));
//呼吸率
......
......@@ -44,7 +44,7 @@ public class FallAlarm implements IAlarm {
public void checkConfig(PlatAlarmCheckDTO platAlarmCheckDTO) {
JSONObject properties = platAlarmCheckDTO.getProperties();
PlatDevice platDevice = platAlarmCheckDTO.getPlatDevice();
String deviceId = platDevice.getOriDeviceId();
String deviceId = platDevice.getId();
String personState = Convert.toStr(properties.get("personState"));
AlarmRedisDTO alarmRedisDTO = RedisUtil.get(RedisConst.ALARM_DEVICE_FALL_ID + deviceId);
if(alarmRedisDTO==null){
......@@ -54,7 +54,7 @@ public class FallAlarm implements IAlarm {
}
if (StringUtils.equals(personState, CommonEnum.YES.getValue())) {
if (StringUtils.equals(alarmRedisDTO.getAlarm(),CommonEnum.YES.getValue())){
log.error("长者跌倒,已告警过,设备iot_id:"+deviceId);
log.error("长者跌倒,已告警过,设备plat_id:"+deviceId);
return;
}
notice(platAlarmCheckDTO);
......
......@@ -71,7 +71,7 @@ public class HeartAlarm implements IAlarm {
JSONObject properties = platAlarmCheckDTO.getProperties();
PlatDevice platDevice = platAlarmCheckDTO.getPlatDevice();
String deviceId = platDevice.getOriDeviceId();
String deviceId = platDevice.getId();
Integer start = ruleConfig.getHeartRateStart();
Integer end = ruleConfig.getHeartRateeEnd();
Integer duration = ruleConfig.getDuration();
......
......@@ -39,7 +39,7 @@ public class DayDurationUtil implements ApplicationRunner {
if(CollectionUtils.isEmpty(platDayDurationRecords)){
return;
}
Map<String, List<PlatDayDurationRecord>> deviceIdMap = platDayDurationRecords.stream().collect(Collectors.groupingBy(PlatDayDurationRecord::getOriDeviceId));
Map<String, List<PlatDayDurationRecord>> deviceIdMap = platDayDurationRecords.stream().collect(Collectors.groupingBy(PlatDayDurationRecord::getDeviceId));
deviceIdMap.entrySet().stream().map(vo -> {
List<PlatDayDurationRecord> value = vo.getValue();
int size = value.size();
......@@ -52,16 +52,16 @@ public class DayDurationUtil implements ApplicationRunner {
}
public void put(PlatDayDurationRecord platDayDurationRecord) {
RedisUtil.set(RedisConst.ELDER_DAY_DURATION_PREFIX + platDayDurationRecord.getOriDeviceId(), platDayDurationRecord);
RedisUtil.set(RedisConst.ELDER_DAY_DURATION_PREFIX + platDayDurationRecord.getDeviceId(), platDayDurationRecord);
}
public PlatDayDurationRecord get(String oriDeviceId) {
PlatDayDurationRecord platDayDurationRecord = RedisUtil.get(RedisConst.ELDER_DAY_DURATION_PREFIX + oriDeviceId);
public PlatDayDurationRecord get(String platDeviceId) {
PlatDayDurationRecord platDayDurationRecord = RedisUtil.get(RedisConst.ELDER_DAY_DURATION_PREFIX + platDeviceId);
if(platDayDurationRecord==null){
//getAll();
}
return RedisUtil.get(RedisConst.ELDER_DAY_DURATION_PREFIX + oriDeviceId);
return RedisUtil.get(RedisConst.ELDER_DAY_DURATION_PREFIX + platDeviceId);
}
/**
......
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