Commit d4de4782 by 汪志阳

fix:离线删除设备

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