Commit e81968de by huangjy

feat:设备误报取设备当前上报的时间戳

parent e95e9b55
ALTER TABLE `plat_device_other`
ALTER TABLE `plat_device_other`
......@@ -109,3 +109,10 @@ CREATE TABLE `plat_elder_breathe_heart_rate_record` (
`iot_device_id` varchar(64) DEFAULT NULL COMMENT 'iot设备id',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='长者呼吸心率记录';
-- end
ALTER TABLE `plat_alarm_record`
ADD COLUMN `current_timestamp` int(8) COMMENT '当前上报时间戳' AFTER `wechat_read_flag`;
\ No newline at end of file
......@@ -32,6 +32,7 @@ public class PlatAlarmCheckDTO {
private String abnormalValue;
//设备状态
private String messageType;
private Long timestamp;
}
......@@ -93,8 +93,8 @@ public class PlatAlarmRecord extends BaseBusEntity {
@ApiModelProperty(value = "微信端 0-未读 1-已读")
private String wechatReadFlag;
@ApiModelProperty(value = "记录当前时间")
private Long currentTimestamp;
}
......@@ -184,6 +184,7 @@ public class BreathAlarm implements IAlarm {
PlatAlarmRecord platAlarmRecord = platAlarmRecordService.convertToPlatAlarmRecord(platAlarmCheckDTO,platElder);
platAlarmRecord.setElderIds(platElder.getId());
platAlarmRecord.setElderName(platElder.getName());
platAlarmRecord.setCurrentTimestamp(platAlarmCheckDTO.getTimestamp());
platAlarmRecordService.noticeDeviceAlarm(platAlarmCheckDTO.getPlatAlarmConfig(), platAlarmRecord);
log.error("长者呼吸异常,发出告警,设备id:"+platDevice.getId()+", 长者名称:"+platElder.getName());
}
......
......@@ -232,6 +232,7 @@ public class FallAlarm implements IAlarm {
PlatAlarmRecord platAlarmRecord = platAlarmRecordService.convertToPlatAlarmRecord(platAlarmCheckDTO, platElder);
platAlarmRecord.setElderIds(platElder.getId());
platAlarmRecord.setElderName(platElder.getName());
platAlarmRecord.setCurrentTimestamp(platAlarmCheckDTO.getTimestamp());
platAlarmRecordService.noticeDeviceAlarm(platAlarmCheckDTO.getPlatAlarmConfig(), platAlarmRecord);
log.error("长者跌倒,发出告警,设备id:" + platDevice.getId() + ", 长者名称:" + platElder.getName());
}
......
......@@ -167,6 +167,7 @@ public class HeartAlarm implements IAlarm {
PlatAlarmRecord platAlarmRecord = platAlarmRecordService.convertToPlatAlarmRecord(platAlarmCheckDTO,platElder);
platAlarmRecord.setElderIds(platElder.getId());
platAlarmRecord.setElderName(platElder.getName());
platAlarmRecord.setCurrentTimestamp(platAlarmCheckDTO.getTimestamp());
platAlarmRecordService.noticeDeviceAlarm(platAlarmCheckDTO.getPlatAlarmConfig(), platAlarmRecord);
log.error("长者心率异常,发出告警,设备plat_id:"+platDevice.getId()+", 长者名称:"+platElder.getName());
}
......
......@@ -634,9 +634,10 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
if (platDevice == null) {
throw new RuntimeException("找不到告警关联的设备,设备已解绑" + deviceId);
}
Timestamp timestamp = Timestamp.valueOf(platAlarmRecord.getCreateDate());
log.info("开始想设备发送误报通知");
String result = iotDevicePropertiesOperateService.deviceFunctionAttr(platDevice.getOriDeviceId(), timestamp.getTime());
String result = iotDevicePropertiesOperateService.deviceFunctionAttr(platDevice.getOriDeviceId(),
platAlarmRecord.getCurrentTimestamp() == null ? System.currentTimeMillis() : platAlarmRecord.getCurrentTimestamp());
if (StringUtils.isNotEmpty(result)) {
throw new RuntimeException("发送误报通知失败:" + result);
}
......
......@@ -238,6 +238,7 @@ public class PushCallback implements MqttCallback {
platAlarmCheckDTO.setProperties(properties);
//设备状态
platAlarmCheckDTO.setMessageType(messageType);
platAlarmCheckDTO.setTimestamp(timestamp);
alarm.checkConfig(platAlarmCheckDTO);
}
}
......
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