Compare commits
53 Commits
07be57d5cf
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 71c72bf86e | |||
| c0747b49a8 | |||
| e0f51727b8 | |||
| 73a5db20b4 | |||
| 89f92b2e15 | |||
| 15b1f9324e | |||
| 298fd9ecc9 | |||
| 8c4c8b3294 | |||
| bc46cdd3b3 | |||
| d61be8eb83 | |||
| a62681e3f7 | |||
| 3ce24c98b4 | |||
| 660d70b2fa | |||
| e25cf46793 | |||
| f27abbd081 | |||
| 1148f844c0 | |||
| fa1c872897 | |||
| 9462f5caab | |||
| 7020497109 | |||
| dbca2373bc | |||
| 8c5ef984e7 | |||
| d869e275e8 | |||
| 8053f41066 | |||
| cdd7731d98 | |||
| 790404cf5e | |||
| 77759c3a31 | |||
| 25285b6cb7 | |||
| 4d2471b537 | |||
| 6355f1e66b | |||
| 258c7c058f | |||
| 97ebb4bf2d | |||
| 673474360b | |||
| 4a4aea7803 | |||
| 715dd2108e | |||
| 391686628e | |||
| 09835f490e | |||
| 46a2de73ff | |||
| fc80657dc5 | |||
| 6ccd000785 | |||
| 2be32c4d9f | |||
| 8aea9de61c | |||
| 4164b69aca | |||
| 4414ad9a26 | |||
| db949ace34 | |||
| 68e4571077 | |||
| 1d3eaf451f | |||
| e8ccd78a39 | |||
| 3324865570 | |||
| 9e42d4676a | |||
| 6bb83e186d | |||
| 6923440a89 | |||
| 8d39b4938a | |||
| b40f5cc0c4 |
9
pom.xml
9
pom.xml
@@ -6,14 +6,17 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.1.6</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
<relativePath/>
|
||||
</parent>
|
||||
|
||||
<!-- 打包文件名版本信息 -->
|
||||
<groupId>com.kimgo</groupId>
|
||||
<artifactId>wePush</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>1.2.0</version>
|
||||
<name>wePush</name>
|
||||
<description>wePush</description>
|
||||
<description>Add log.</description>
|
||||
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
</properties>
|
||||
|
||||
@@ -102,7 +102,7 @@ public class HeartBeatService {
|
||||
try {
|
||||
DeviceInfoDAO deviceInfoDAO = deviceInfoDAOMapper.selectOne(queryWrapper);
|
||||
if (deviceInfoDAO != null) {
|
||||
logger.info("Data is queried in the database based on the SN");
|
||||
//logger.info("Data is queried in the database based on the SN");
|
||||
return deviceInfoDAO;
|
||||
}
|
||||
return null; // 数据不存在
|
||||
@@ -120,7 +120,7 @@ public class HeartBeatService {
|
||||
* @return 转换后的 DeviceInfoDAO 对象。
|
||||
*/
|
||||
private DeviceInfoDAO convertToDeviceInfoDAO(DeviceInfo deviceInfo) {
|
||||
logger.info("start convert to device info dao");
|
||||
// logger.info("start convert to device info dao");
|
||||
|
||||
DeviceInfoDAO deviceInfoDAO = new DeviceInfoDAO();
|
||||
deviceInfoDAO.setIsMonitored(1);
|
||||
|
||||
@@ -70,15 +70,15 @@ public class MonitorService {
|
||||
long timeDifferenceSeconds = timeDifferenceMillis / 1000;
|
||||
// 如果设备超出设定的超时周期未上线,则认为设备离线,并进行相应处理
|
||||
if (timeDifferenceSeconds > device.getTimeOutPeriod()) {
|
||||
logger.info("Device offline. SN: {}, LastOnlineTime: {}, TimeDifference: {}, TimeoutPeriod: {}",
|
||||
device.getSN(), device.getLastOnlineTime(), timeDifferenceSeconds, device.getTimeOutPeriod());
|
||||
//logger.info("Device offline. SN: {}, LastOnlineTime: {}, TimeDifference: {}, TimeoutPeriod: {}",
|
||||
//device.getSN(), device.getLastOnlineTime(), timeDifferenceSeconds, device.getTimeOutPeriod());
|
||||
updateStatus(device, 0); // 更新设备状态为离线
|
||||
logger.info("Update the device status to offline.");
|
||||
sendNotification(device); // 发送设备离线通知
|
||||
} else {
|
||||
// 如果设备仍在设定的超时周期内上线,则认为设备在线,并更新设备状态
|
||||
updateStatus(device, 1); // 更新设备状态为在线
|
||||
logger.info("update the device status to online.");
|
||||
//logger.info("update the device status to online.");
|
||||
}
|
||||
} catch (DatabaseUpdateException dbe) {
|
||||
// 更新数据库出错时的处理逻辑
|
||||
@@ -138,6 +138,7 @@ public class MonitorService {
|
||||
|
||||
/**
|
||||
* 构建并设置文本卡片消息的内容。
|
||||
*
|
||||
* @param deviceInfoDAO 设备信息数据访问对象,用于获取设备的详细信息。
|
||||
* @return TextCardMessage 返回构建完成的文本卡片消息对象。
|
||||
*/
|
||||
@@ -177,6 +178,7 @@ public class MonitorService {
|
||||
|
||||
/**
|
||||
* 更新设备的状态信息。
|
||||
*
|
||||
* @param device 设备信息对象,包含需要更新的设备的SN(序列号)。
|
||||
* @param status 需要更新到的新状态。
|
||||
* @throws DatabaseUpdateException 如果数据库更新过程中发生异常,则抛出此异常。
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
spring:
|
||||
profiles:
|
||||
active: dev
|
||||
active: prod
|
||||
@@ -1,6 +1,7 @@
|
||||
<configuration>
|
||||
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
|
||||
<file>logs/wePush_prod.log</file>
|
||||
<append>true</append>
|
||||
<encoder>
|
||||
<pattern>%date %level [%thread] %logger{10} [%file:%line] %msg%n</pattern>
|
||||
</encoder>
|
||||
|
||||
Reference in New Issue
Block a user