Commit d4de4782 by 汪志阳

fix:离线删除设备

parent eb151a19
...@@ -236,10 +236,13 @@ public class OffBedAlarm implements IAlarm { ...@@ -236,10 +236,13 @@ public class OffBedAlarm implements IAlarm {
return; return;
} }
LocalTime localTime = LocalTime.now().plusHours(7).plusMinutes(30); LocalTime localTime = LocalTime.now().plusHours(7);
if (!isInTime && localTime.isAfter(startTime) && localTime.isBefore(endTime)) { if (!isInTime && localTime.isAfter(startTime) && localTime.isBefore(endTime)) {
LocalDateTime dateTime = LocalDateTime.of(LocalDate.now(), startTime); LocalDateTime dateTime = LocalDateTime.of(LocalDate.now(), startTime);
long mills = Duration.between(dateTime, currentTime()).toMillis() / 1000; long mills = Duration.between(dateTime, currentTime()).toMillis() / 1000;
if (mills >= 86400) {
mills = mills - 86400;
}
boolean noInOverTime = mills >= duration * 60; boolean noInOverTime = mills >= duration * 60;
if (noInOverTime) { if (noInOverTime) {
platAlarmCheckDTO.setAbnormalValue(String.valueOf(currentTimeMillis - firstOffBedLong)); platAlarmCheckDTO.setAbnormalValue(String.valueOf(currentTimeMillis - firstOffBedLong));
...@@ -324,7 +327,7 @@ public class OffBedAlarm implements IAlarm { ...@@ -324,7 +327,7 @@ public class OffBedAlarm implements IAlarm {
} }
private static LocalDateTime currentTime() { private static LocalDateTime currentTime() {
return LocalDateTime.now().plusHours(7).plusMinutes(30); return LocalDateTime.now().plusHours(7);
// return LocalDateTime.now(); // return LocalDateTime.now();
} }
......
...@@ -154,7 +154,6 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace ...@@ -154,7 +154,6 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
if (parentSpace!=null && parentSpace.getParentPath()!=null && parentSpace.getParentPath().contains(dto.getId())) { if (parentSpace!=null && parentSpace.getParentPath()!=null && parentSpace.getParentPath().contains(dto.getId())) {
throw new BusinessException(CodeMessageEnum.PLATFORM_ERROR_SPACE_NOT_AUTH_PARENT); throw new BusinessException(CodeMessageEnum.PLATFORM_ERROR_SPACE_NOT_AUTH_PARENT);
} }
// todo 编辑后层级大于4,不允许编辑 脏数据太多,待校验
checkAndUpdateSonSpace(space); checkAndUpdateSonSpace(space);
this.updateById(space); this.updateById(space);
List<String> lastSpaceIds = recursionLastSpaceIds(space.getId(), new ArrayList<>()); List<String> lastSpaceIds = recursionLastSpaceIds(space.getId(), new ArrayList<>());
......
...@@ -272,6 +272,11 @@ public class PushCallback implements MqttCallback { ...@@ -272,6 +272,11 @@ public class PushCallback implements MqttCallback {
String alarmType = PlatAlarmConfigEnum.AlarmTypeEnum.OFF_BED.getValue(); String alarmType = PlatAlarmConfigEnum.AlarmTypeEnum.OFF_BED.getValue();
List<String> type = Lists.newArrayList("OFFLINE", "DISCONNECT"); List<String> type = Lists.newArrayList("OFFLINE", "DISCONNECT");
platDeviceList.forEach(device -> { platDeviceList.forEach(device -> {
if (StrUtil.isBlank(messageType) || type.contains(messageType)
|| DeviceState.offline.getValue().equals(device.getStatus())) {
logger.info("离线清除离床预警缓存!");
RedisUtil.delete(RedisConst.ALARM_DEVICE_OFF_BED_ID + device.getId());
}
for (IAlarm alarm : alarmList) { for (IAlarm alarm : alarmList) {
if (alarm.support(alarmType)) { if (alarm.support(alarmType)) {
PlatAlarmConfig config = configMap.get(device.getOrgId()); PlatAlarmConfig config = configMap.get(device.getOrgId());
...@@ -289,9 +294,6 @@ public class PushCallback implements MqttCallback { ...@@ -289,9 +294,6 @@ public class PushCallback implements MqttCallback {
platAlarmCheckDTO.setProperties(properties); platAlarmCheckDTO.setProperties(properties);
//设备状态 //设备状态
platAlarmCheckDTO.setMessageType(messageType); platAlarmCheckDTO.setMessageType(messageType);
if (StrUtil.isBlank(messageType) || type.contains(messageType)) {
RedisUtil.delete(RedisConst.ALARM_DEVICE_OFF_BED_ID + device.getId());
}
alarm.checkConfig(platAlarmCheckDTO); alarm.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