Update MonitorService.java

pull/1/head
wangsiyuan 2024-04-22 15:35:03 +08:00
parent 7020497109
commit 9462f5caab
1 changed files with 5 additions and 3 deletions

View File

@ -70,15 +70,15 @@ public class MonitorService {
long timeDifferenceSeconds = timeDifferenceMillis / 1000; long timeDifferenceSeconds = timeDifferenceMillis / 1000;
// 如果设备超出设定的超时周期未上线,则认为设备离线,并进行相应处理 // 如果设备超出设定的超时周期未上线,则认为设备离线,并进行相应处理
if (timeDifferenceSeconds > device.getTimeOutPeriod()) { if (timeDifferenceSeconds > device.getTimeOutPeriod()) {
logger.info("Device offline. SN: {}, LastOnlineTime: {}, TimeDifference: {}, TimeoutPeriod: {}", //logger.info("Device offline. SN: {}, LastOnlineTime: {}, TimeDifference: {}, TimeoutPeriod: {}",
device.getSN(), device.getLastOnlineTime(), timeDifferenceSeconds, device.getTimeOutPeriod()); //device.getSN(), device.getLastOnlineTime(), timeDifferenceSeconds, device.getTimeOutPeriod());
updateStatus(device, 0); // 更新设备状态为离线 updateStatus(device, 0); // 更新设备状态为离线
logger.info("Update the device status to offline."); logger.info("Update the device status to offline.");
sendNotification(device); // 发送设备离线通知 sendNotification(device); // 发送设备离线通知
} else { } else {
// 如果设备仍在设定的超时周期内上线,则认为设备在线,并更新设备状态 // 如果设备仍在设定的超时周期内上线,则认为设备在线,并更新设备状态
updateStatus(device, 1); // 更新设备状态为在线 updateStatus(device, 1); // 更新设备状态为在线
logger.info("update the device status to online."); //logger.info("update the device status to online.");
} }
} catch (DatabaseUpdateException dbe) { } catch (DatabaseUpdateException dbe) {
// 更新数据库出错时的处理逻辑 // 更新数据库出错时的处理逻辑
@ -138,6 +138,7 @@ public class MonitorService {
/** /**
* *
*
* @param deviceInfoDAO 访 * @param deviceInfoDAO 访
* @return TextCardMessage * @return TextCardMessage
*/ */
@ -177,6 +178,7 @@ public class MonitorService {
/** /**
* *
*
* @param device SN * @param device SN
* @param status * @param status
* @throws DatabaseUpdateException * @throws DatabaseUpdateException