Commit 36655ce1 by 汪志阳

fix:回退代码

parent 1a9a479c
......@@ -96,7 +96,6 @@ public class OffBedAlarm implements IAlarm {
return;
}
log.info("离床预警时间范围,begin:{},end:{}", startTime, endTime);
String personState = Convert.toStr(properties.get("person"));
boolean isOffBed = "0".equals(personState);
// 1-有人 0-无人
......@@ -199,7 +198,6 @@ public class OffBedAlarm implements IAlarm {
LocalTime startTime = ruleConfig.getOffBedStart();
LocalDateTime startLocalDteTime = LocalDateTime.of(LocalDate.now(), startTime);
LocalTime endTime = ruleConfig.getOffBedEnd();
LocalDateTime endLocalDteTime = LocalDateTime.of(LocalDate.now(), endTime);
Long firstOffBedLong = alarmRedisDTO.getStartLong();
long currentTimeMillis = System.currentTimeMillis();
......@@ -207,11 +205,6 @@ public class OffBedAlarm implements IAlarm {
LocalDateTime firstOffBedTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(firstOffBedLong), ZoneOffset.of("+8"));
LocalTime firstTime = firstOffBedTime.toLocalTime();
if (firstTime.isAfter(endTime)) {
log.info("handleUnCrossDay第一次离床时间:{},在时间范围外 config:{}", firstTime, config.getRuleConfig());
return;
}
boolean isInTime = firstTime.isAfter(startTime) && firstTime.isBefore(endTime);
LocalTime endTimeLimit = endTime.plusMinutes(-duration);
......@@ -229,7 +222,7 @@ public class OffBedAlarm implements IAlarm {
}
LocalDateTime now = LocalDateTime.now();
if (!isInTime && now.isAfter(startLocalDteTime) && now.isBefore(endLocalDteTime)) {
if (!isInTime && now.isAfter(startLocalDteTime)) {
long mills = Duration.between(startLocalDteTime, now).toMillis() / 1000;
boolean noInOverTime = mills >= duration * 60;
if (noInOverTime) {
......
package com.makeit.iotapi;
import com.makeit.dto.platform.alarm.PlatAlarmCheckDTO;
import com.makeit.entity.platform.device.PlatDevice;
import com.makeit.module.admin.vo.plat.PlatTenantVO;
import com.makeit.module.iot.service.IotOrgService;
import com.makeit.module.iot.service.IotProductDeviceService;
import com.makeit.module.iot.service.IotTokenService;
import com.makeit.service.platform.alarm.alarmStrategy.OffBedAlarm;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
......@@ -17,6 +20,8 @@ public class IotDeviceInfoContentFall {
private IotOrgService iotOrgService;
@Autowired
private IotProductDeviceService iotProductDeviceService;
@Autowired
private OffBedAlarm offBedAlarm;
@Test
......@@ -76,4 +81,14 @@ public class IotDeviceInfoContentFall {
void updateIotOrgInfo() {
iotOrgService.updateIotOrgInfo("1698964909267415040", "lxl2234");
}
@Test
void offBedAlarm() {
PlatAlarmCheckDTO platAlarmCheckDTO = new PlatAlarmCheckDTO();
PlatDevice platDevice = new PlatDevice();
platDevice.setOrgId("1712384736845950978");
platDevice.setId("1732609639364812811");
platAlarmCheckDTO.setPlatDevice(platDevice);
offBedAlarm.checkConfig(platAlarmCheckDTO);
}
}
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