Commit 1a9a479c by 汪志阳

fix:回退代码

parent cf93b476
...@@ -151,9 +151,6 @@ public class OffBedAlarm implements IAlarm { ...@@ -151,9 +151,6 @@ public class OffBedAlarm implements IAlarm {
Long firstOffBedLong = alarmRedisDTO.getStartLong(); Long firstOffBedLong = alarmRedisDTO.getStartLong();
long currentTimeMillis = System.currentTimeMillis(); long currentTimeMillis = System.currentTimeMillis();
LocalDateTime nowTest = LocalDateTime.now().plusHours(5).plusMinutes(45);
currentTimeMillis = nowTest.toInstant(ZoneOffset.of("+8")).toEpochMilli();
log.info("handleCrossDay,测试当前的时间:{},时间戳:{}", nowTest, currentTimeMillis);
boolean isOverTime = (currentTimeMillis - firstOffBedLong) / 1000 >= duration * 60; boolean isOverTime = (currentTimeMillis - firstOffBedLong) / 1000 >= duration * 60;
LocalDateTime firstOffBedTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(firstOffBedLong), ZoneOffset.of("+8")); LocalDateTime firstOffBedTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(firstOffBedLong), ZoneOffset.of("+8"));
LocalTime firstTime = firstOffBedTime.toLocalTime(); LocalTime firstTime = firstOffBedTime.toLocalTime();
...@@ -173,8 +170,7 @@ public class OffBedAlarm implements IAlarm { ...@@ -173,8 +170,7 @@ public class OffBedAlarm implements IAlarm {
noticeAlarm(alarmRedisDTO, platAlarmCheckDTO, deviceId); noticeAlarm(alarmRedisDTO, platAlarmCheckDTO, deviceId);
return; return;
} }
// LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
LocalDateTime now = LocalDateTime.now().plusHours(5).plusMinutes(50);;
LocalDateTime startLocalDteTime = LocalDateTime.of(LocalDate.now(), startTime); LocalDateTime startLocalDteTime = LocalDateTime.of(LocalDate.now(), startTime);
if (!isInTime) { if (!isInTime) {
long mills = Duration.between(startLocalDteTime, now).toMillis() / 1000; long mills = Duration.between(startLocalDteTime, now).toMillis() / 1000;
...@@ -194,11 +190,6 @@ public class OffBedAlarm implements IAlarm { ...@@ -194,11 +190,6 @@ public class OffBedAlarm implements IAlarm {
} }
public static void main(String[] args) {
LocalDateTime now = LocalDateTime.now().plusHours(5).plusMinutes(45);
System.out.println(now);
}
private void handleUnCrossDay(AlarmRedisDTO alarmRedisDTO, PlatAlarmConfigOffBedDTOVO ruleConfig, private void handleUnCrossDay(AlarmRedisDTO alarmRedisDTO, PlatAlarmConfigOffBedDTOVO ruleConfig,
PlatAlarmCheckDTO platAlarmCheckDTO, PlatAlarmCheckDTO platAlarmCheckDTO,
PlatAlarmConfig config, PlatAlarmConfig config,
...@@ -212,8 +203,6 @@ public class OffBedAlarm implements IAlarm { ...@@ -212,8 +203,6 @@ public class OffBedAlarm implements IAlarm {
Long firstOffBedLong = alarmRedisDTO.getStartLong(); Long firstOffBedLong = alarmRedisDTO.getStartLong();
long currentTimeMillis = System.currentTimeMillis(); long currentTimeMillis = System.currentTimeMillis();
LocalDateTime nowTest = LocalDateTime.now().plusHours(5).plusMinutes(45);
currentTimeMillis = nowTest.toInstant(ZoneOffset.of("+8")).toEpochMilli();
boolean isOverTime = (currentTimeMillis - firstOffBedLong) / 1000 >= duration * 60; boolean isOverTime = (currentTimeMillis - firstOffBedLong) / 1000 >= duration * 60;
LocalDateTime firstOffBedTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(firstOffBedLong), ZoneOffset.of("+8")); LocalDateTime firstOffBedTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(firstOffBedLong), ZoneOffset.of("+8"));
LocalTime firstTime = firstOffBedTime.toLocalTime(); LocalTime firstTime = firstOffBedTime.toLocalTime();
...@@ -239,7 +228,7 @@ public class OffBedAlarm implements IAlarm { ...@@ -239,7 +228,7 @@ public class OffBedAlarm implements IAlarm {
return; return;
} }
LocalDateTime now = LocalDateTime.now().plusHours(5).plusMinutes(45); LocalDateTime now = LocalDateTime.now();
if (!isInTime && now.isAfter(startLocalDteTime) && now.isBefore(endLocalDteTime)) { if (!isInTime && now.isAfter(startLocalDteTime) && now.isBefore(endLocalDteTime)) {
long mills = Duration.between(startLocalDteTime, now).toMillis() / 1000; long mills = Duration.between(startLocalDteTime, now).toMillis() / 1000;
boolean noInOverTime = mills >= duration * 60; boolean noInOverTime = mills >= duration * 60;
......
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