Commit 19934102 by huangjy

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

parent d155ded5
ALTER TABLE `plat_device_other`
ALTER TABLE `plat_device_other`
......@@ -115,4 +115,4 @@ CREATE TABLE `plat_elder_breathe_heart_rate_record` (
ALTER TABLE `plat_alarm_record`
ADD COLUMN `current_timestamp` int(8) COMMENT '当前上报时间戳' AFTER `wechat_read_flag`;
\ No newline at end of file
ADD COLUMN `device_time` varchar(64) COMMENT '当前上报时间' AFTER `wechat_read_flag`;
\ No newline at end of file
......@@ -102,11 +102,11 @@ public class IotDevicePropertiesOperateService extends IotCommonService {
return "";
}
public String deviceFunctionAttr(String deviceId, Long timestamp) {
public String deviceFunctionAttr(String deviceId, String alarmId) {
String url = iotUrl + "device/invoked/" + deviceId + "/function/misinformation";
Map<String,Map<String,Object>> map = Maps.newHashMap();
Map<String,Object> reqMap = Maps.newHashMap();
reqMap.put("timestamp",timestamp);
reqMap.put("timestamp",alarmId);
reqMap.put("url", uploadUrl);
map.put("misinformationNotify",reqMap);
HttpRequest request = buildRequest(url, JSON.toJSONString(map));
......
......@@ -32,7 +32,7 @@ public class PlatAlarmCheckDTO {
private String abnormalValue;
//设备状态
private String messageType;
private Long timestamp;
private String deviceTime;
}
......@@ -94,7 +94,7 @@ public class PlatAlarmRecord extends BaseBusEntity {
@ApiModelProperty(value = "微信端 0-未读 1-已读")
private String wechatReadFlag;
@ApiModelProperty(value = "记录当前时间")
private Long currentTimestamp;
private String deviceTime;
}
......@@ -184,7 +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());
platAlarmRecord.setDeviceTime(platAlarmCheckDTO.getDeviceTime());
platAlarmRecordService.noticeDeviceAlarm(platAlarmCheckDTO.getPlatAlarmConfig(), platAlarmRecord);
log.error("长者呼吸异常,发出告警,设备id:"+platDevice.getId()+", 长者名称:"+platElder.getName());
}
......
......@@ -232,7 +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());
platAlarmRecord.setDeviceTime(platAlarmCheckDTO.getDeviceTime());
platAlarmRecordService.noticeDeviceAlarm(platAlarmCheckDTO.getPlatAlarmConfig(), platAlarmRecord);
log.error("长者跌倒,发出告警,设备id:" + platDevice.getId() + ", 长者名称:" + platElder.getName());
}
......
......@@ -167,7 +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());
platAlarmRecord.setDeviceTime(platAlarmCheckDTO.getDeviceTime());
platAlarmRecordService.noticeDeviceAlarm(platAlarmCheckDTO.getPlatAlarmConfig(), platAlarmRecord);
log.error("长者心率异常,发出告警,设备plat_id:"+platDevice.getId()+", 长者名称:"+platElder.getName());
}
......
......@@ -66,7 +66,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.*;
import java.util.regex.Matcher;
......@@ -637,7 +636,7 @@ public class PlatAlarmRecordServiceImpl extends ServiceImpl<PlatAlarmRecordMappe
log.info("开始想设备发送误报通知");
String result = iotDevicePropertiesOperateService.deviceFunctionAttr(platDevice.getOriDeviceId(),
platAlarmRecord.getCurrentTimestamp() == null ? System.currentTimeMillis() : platAlarmRecord.getCurrentTimestamp());
StringUtils.isEmpty(platAlarmRecord.getDeviceTime()) ? "" : platAlarmRecord.getDeviceTime());
if (StringUtils.isNotEmpty(result)) {
throw new RuntimeException("发送误报通知失败:" + result);
}
......
......@@ -238,7 +238,7 @@ public class PushCallback implements MqttCallback {
platAlarmCheckDTO.setProperties(properties);
//设备状态
platAlarmCheckDTO.setMessageType(messageType);
platAlarmCheckDTO.setTimestamp(timestamp);
platAlarmCheckDTO.setDeviceTime(properties.getString("alarmId"));
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