Commit 5d960feb by 汪志阳

fix:离床预警时间范围前配置

parent 90cdebd5
......@@ -132,7 +132,8 @@ public class OffBedAlarm implements IAlarm {
// 第一次离床时间在范围前,则已范围开始时间起始算
if (firstOffBedTime.isBefore(startTime)) {
boolean over = (Math.abs(Duration.between(LocalDateTime.now(), startTime).toMillis())) / 1000 >= duration * 60;
if (over) {
LocalDateTime warmTime = startTime.plusMinutes(duration);
if (over && LocalDateTime.now().isAfter(warmTime)) {
platAlarmCheckDTO.setAbnormalValue(String.valueOf(localDateLong - firstOffBedLong));
platAlarmCheckDTO.setPlatAlarmConfig(config);
log.info("离床告警离床时间在范围前,发送预警,配置:{}", config);
......@@ -180,6 +181,18 @@ public class OffBedAlarm implements IAlarm {
}
}
public static void main(String[] args) {
LocalDateTime startTime = LocalDateTime.of(2023, 12, 14, 18, 00);
LocalDateTime localDateTime = startTime.plusMinutes(1);
System.out.println(localDateTime);
LocalDateTime startTime2 = LocalDateTime.of(2023, 12, 14, 18, 01,34);
System.out.println(startTime2.isAfter(localDateTime));
System.out.println(localDateTime.equals(LocalDateTime.now()));
}
private void noticeAlarm(AlarmRedisDTO alarmRedisDTO, PlatAlarmCheckDTO platAlarmCheckDTO, String deviceId) {
notice(platAlarmCheckDTO);
alarmRedisDTO.setStart(new Date());
......
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