Commit 44d77a2e by 汪志阳

fix:模拟测试夜间时间

parent e199c0f3
...@@ -10,8 +10,8 @@ import com.makeit.common.response.ApiResponseEntity; ...@@ -10,8 +10,8 @@ import com.makeit.common.response.ApiResponseEntity;
import com.makeit.common.response.ApiResponseUtils; import com.makeit.common.response.ApiResponseUtils;
import com.makeit.dto.platform.alarm.PlatAlarmRecordQueryDTO; import com.makeit.dto.platform.alarm.PlatAlarmRecordQueryDTO;
import com.makeit.enums.report.PlatformTypeEnum; import com.makeit.enums.report.PlatformTypeEnum;
import com.makeit.global.annotation.AuthIgnore;
import com.makeit.service.platform.alarm.PlatAlarmRecordService; import com.makeit.service.platform.alarm.PlatAlarmRecordService;
import com.makeit.utils.user.common.CommonUserUtil;
import com.makeit.vo.platform.alarm.PlatAlarmRecordVO; import com.makeit.vo.platform.alarm.PlatAlarmRecordVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -33,10 +33,10 @@ public class PlatAlarmRecordWechatController { ...@@ -33,10 +33,10 @@ public class PlatAlarmRecordWechatController {
@ApiOperation("列表") @ApiOperation("列表")
@PostMapping("page") @PostMapping("page")
// @AuthIgnore @AuthIgnore
public ApiResponseEntity<Map<String,Object>> page(@RequestBody PageReqDTO<PlatAlarmRecordQueryDTO> dto) { public ApiResponseEntity<Map<String,Object>> page(@RequestBody PageReqDTO<PlatAlarmRecordQueryDTO> dto) {
//小程序告警记录只看到发给自己的告警 //小程序告警记录只看到发给自己的告警
String userId = CommonUserUtil.getUserId(); String userId = "1700085146788667394";
PlatAlarmRecordQueryDTO data = dto.getData(); PlatAlarmRecordQueryDTO data = dto.getData();
data.setNotifyUser(userId); data.setNotifyUser(userId);
......
...@@ -150,6 +150,9 @@ public class OffBedAlarm implements IAlarm { ...@@ -150,6 +150,9 @@ 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(12).plusMinutes(40);
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();
...@@ -165,7 +168,7 @@ public class OffBedAlarm implements IAlarm { ...@@ -165,7 +168,7 @@ public class OffBedAlarm implements IAlarm {
noticeAlarm(alarmRedisDTO, platAlarmCheckDTO, deviceId); noticeAlarm(alarmRedisDTO, platAlarmCheckDTO, deviceId);
return; return;
} }
LocalDateTime now = LocalDateTime.now().plusHours(12).plusMinutes(50); LocalDateTime now = LocalDateTime.now().plusHours(12).plusMinutes(40);
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;
...@@ -198,6 +201,8 @@ public class OffBedAlarm implements IAlarm { ...@@ -198,6 +201,8 @@ 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(12).plusMinutes(40);
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();
...@@ -218,7 +223,7 @@ public class OffBedAlarm implements IAlarm { ...@@ -218,7 +223,7 @@ public class OffBedAlarm implements IAlarm {
return; return;
} }
LocalDateTime now = LocalDateTime.now().plusHours(12).plusMinutes(50); LocalDateTime now = LocalDateTime.now().plusHours(12).plusMinutes(40);
LocalTime localTime = LocalTime.now(); LocalTime localTime = LocalTime.now();
if (!isInTime && localTime.isAfter(startTime) && localTime.isBefore(endTime)) { if (!isInTime && localTime.isAfter(startTime) && localTime.isBefore(endTime)) {
long mills = Duration.between(startLocalDteTime, now).toMillis() / 1000; long mills = Duration.between(startLocalDteTime, now).toMillis() / 1000;
......
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