Commit 81661d91 by 汪志阳

fix:临界值处理判断

parent 835ab649
......@@ -67,7 +67,8 @@ public class OffBedAlarm implements IAlarm {
log.error("离床告警配置为禁用,告警配置id:" + config.getId());
return;
}
String ruleConfigStr = config.getRuleConfig();
String ruleConfigStr = "{\"offBedStart\":\"23:07:00\",\"offBedEnd\":\"00:00:00\",\"duration\":\"1\"}";
// String ruleConfigStr = config.getRuleConfig();
if (StringUtils.isBlank(ruleConfigStr)) {
log.error("离床告警配置未配置,告警配置id:" + config.getId());
return;
......@@ -88,7 +89,7 @@ public class OffBedAlarm implements IAlarm {
String deviceId = platDevice.getId();
LocalTime startTime = ruleConfig.getOffBedStart();
LocalTime endTime = ruleConfig.getOffBedEnd();
if (startTime == null || endTime == null) {
if (startTime == null || endTime == null || startTime.equals(endTime)) {
log.error("离床告警配置时间段解析失败,config:{}", JSONUtil.toJsonStr(ruleConfig));
return;
}
......@@ -122,8 +123,8 @@ public class OffBedAlarm implements IAlarm {
log.info("离床告警已发送预警过!");
return;
}
// 是否跨天
boolean isCrossDay = startTime.isAfter(endTime);
// 是否跨天 xxx-0:00,未跨天
boolean isCrossDay = startTime.isAfter(endTime) && !endTime.equals(LocalTime.MIN);
if (isCrossDay) {
log.info("离床预警跨天处理:config:{}", config.getRuleConfig());
handleCrossDay(alarmRedisDTO, ruleConfig, platAlarmCheckDTO, config, deviceId);
......@@ -195,6 +196,9 @@ public class OffBedAlarm implements IAlarm {
LocalTime startTime = ruleConfig.getOffBedStart();
LocalDateTime startLocalDteTime = LocalDateTime.of(LocalDate.now(), startTime);
LocalTime endTime = ruleConfig.getOffBedEnd();
if (LocalTime.MIN.equals(endTime)) {
endTime = LocalTime.MAX;
}
// LocalDateTime endLocalDteTime = LocalDateTime.of(LocalDate.now(), endTime);
Long firstOffBedLong = alarmRedisDTO.getStartLong();
......@@ -335,4 +339,12 @@ public class OffBedAlarm implements IAlarm {
return Date.from(zdt.toInstant());
}
public static void main(String[] args) {
LocalTime of = LocalTime.of(0, 0);
LocalTime of1 = LocalTime.of(00, 00);
System.out.println(of.equals(of1));
System.out.println(LocalTime.MIN);
}
}
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