Commit 7ab887cd by 汪志阳

fix:去除模拟时间代码

parent f3f9905e
......@@ -93,6 +93,10 @@ public class OffBedAlarm implements IAlarm {
log.error("离床告警配置时间段解析失败,config:{}", JSONUtil.toJsonStr(ruleConfig));
return;
}
// 00:00 -> 23:59:59999
if (LocalTime.MIN.equals(endTime)) {
ruleConfig.setOffBedEnd(LocalTime.MAX);
}
log.info("离床预警时间范围,begin:{},end:{}", startTime, endTime);
String personState = Convert.toStr(properties.get("person"));
boolean isOffBed = "0".equals(personState);
......@@ -148,7 +152,6 @@ public class OffBedAlarm implements IAlarm {
Long firstOffBedLong = alarmRedisDTO.getStartLong();
long currentTimeMillis = System.currentTimeMillis();
// todo 模拟时间
currentTimeMillis = currentLong();
boolean isOverTime = (currentTimeMillis - firstOffBedLong) / 1000 >= duration * 60;
LocalDateTime firstOffBedTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(firstOffBedLong), ZoneOffset.of("+8"));
......@@ -165,8 +168,6 @@ public class OffBedAlarm implements IAlarm {
noticeAlarm(alarmRedisDTO, platAlarmCheckDTO, deviceId);
return;
}
// LocalDateTime now = LocalDateTime.now();
// todo 模拟时间
LocalDateTime now = currentTime();
LocalDateTime startLocalDteTime = LocalDateTime.of(LocalDate.now(), startTime);
if (!isInTime) {
......@@ -203,7 +204,6 @@ public class OffBedAlarm implements IAlarm {
Long firstOffBedLong = alarmRedisDTO.getStartLong();
long currentTimeMillis = System.currentTimeMillis();
// todo 模拟时间
currentTimeMillis = currentLong();
boolean isOverTime = (currentTimeMillis - firstOffBedLong) / 1000 >= duration * 60;
LocalDateTime firstOffBedTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(firstOffBedLong), ZoneOffset.of("+8"));
......@@ -225,8 +225,6 @@ public class OffBedAlarm implements IAlarm {
return;
}
// todo 模拟时间
// LocalDateTime now = LocalDateTime.now();
LocalDateTime now = currentTime();
LocalTime localTime = LocalTime.now();
if (!isInTime && localTime.isAfter(startTime) && localTime.isBefore(endTime)) {
......@@ -246,7 +244,6 @@ public class OffBedAlarm implements IAlarm {
}
private void sendToRedis(AlarmRedisDTO alarmRedisDTO, String deviceId) {
// todo 模拟时间
Date now = toDate();
// Date now = new Date();
long endLong = now.getTime();
......@@ -255,7 +252,6 @@ public class OffBedAlarm implements IAlarm {
alarmRedisDTO = new AlarmRedisDTO();
alarmRedisDTO.setAlarm(CommonEnum.NO.getValue());
alarmRedisDTO.setStart(now);
// todo 模拟时间
endLong = currentLong();
alarmRedisDTO.setStartLong(endLong);
RedisUtil.set(RedisConst.ALARM_DEVICE_OFF_BED_ID + deviceId, alarmRedisDTO);
......@@ -326,7 +322,8 @@ public class OffBedAlarm implements IAlarm {
}
private LocalDateTime currentTime() {
return LocalDateTime.now().plusHours(8);
// return LocalDateTime.now().plusHours(7);
return LocalDateTime.now();
}
private LocalDateTime longToTime(Long longTime) {
......@@ -338,13 +335,4 @@ public class OffBedAlarm implements IAlarm {
ZonedDateTime zdt = currentTime().atZone(zoneId);
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