Compare commits

...

56 Commits

Author SHA1 Message Date
71c72bf86e Update pom.xml 2024-05-13 10:49:55 +08:00
c0747b49a8 Update pom.xml 2024-05-11 17:50:46 +08:00
e0f51727b8 Update pom.xml 2024-05-11 17:48:22 +08:00
73a5db20b4 Update pom.xml 2024-05-11 17:45:37 +08:00
89f92b2e15 Update pom.xml 2024-05-11 17:38:04 +08:00
15b1f9324e Update pom.xml 2024-05-11 17:34:16 +08:00
298fd9ecc9 Update pom.xml 2024-05-11 17:32:06 +08:00
8c4c8b3294 Merge branch 'master' of https://gitea.kimgo.cn/wsy182/wePush 2024-05-11 17:14:02 +08:00
bc46cdd3b3 Update logback-prod.xml
启用追加模式
2024-05-11 17:13:54 +08:00
d61be8eb83 Update pom.xml
更新版本
2024-05-11 17:13:44 +08:00
a62681e3f7 Merge pull request 'bug修复' (#1) from dev into master
Reviewed-on: #1
2024-05-11 17:06:49 +08:00
3ce24c98b4 Update logback-prod.xml
禁用追加模式
2024-05-10 18:43:50 +08:00
660d70b2fa Update pom.xml
更新版本
2024-05-10 16:10:09 +08:00
e25cf46793 Update pom.xml
更新版本
2024-05-10 16:03:30 +08:00
f27abbd081 Update Dockerfile 2024-04-28 11:59:52 +08:00
1148f844c0 Update QyWeChatURLService.java 2024-04-23 17:34:21 +08:00
fa1c872897 Create README.md 2024-04-23 14:46:49 +08:00
9462f5caab Update MonitorService.java 2024-04-22 15:35:03 +08:00
7020497109 Update HeartBeatService.java 2024-04-22 15:34:59 +08:00
07be57d5cf Update MonitorService.java 2024-04-22 15:07:41 +08:00
7a8fdc2f4e Update DeviceInfoDAO.java 2024-04-22 15:07:38 +08:00
bbb7bedc94 Update qywecahtpush.sql 2024-04-22 15:07:35 +08:00
dbca2373bc Merge branch 'dev' 2023-12-22 14:10:38 +08:00
8c5ef984e7 Merge branch 'dev' 2023-12-15 10:39:13 +08:00
d869e275e8 Merge branch 'dev' 2023-12-14 14:15:23 +08:00
8053f41066 Merge branch 'dev' 2023-12-14 12:47:07 +08:00
cdd7731d98 Merge branch 'dev' 2023-12-14 12:44:42 +08:00
790404cf5e Merge branch 'dev' 2023-12-14 11:35:18 +08:00
77759c3a31 更新 pom.xml 2023-12-14 10:54:20 +08:00
25285b6cb7 Merge branch 'dev' 2023-12-14 10:53:01 +08:00
4d2471b537 Merge branch 'dev' 2023-12-14 10:04:44 +08:00
6355f1e66b Merge branch 'dev'
fix
2023-12-12 18:54:23 +08:00
258c7c058f 更新 pom.xml 2023-12-12 18:51:36 +08:00
97ebb4bf2d 更新 QyWeChatAppInfoMapperTest.java 2023-12-12 18:49:40 +08:00
673474360b 更新 WeChatMsgTest.java 2023-12-12 18:49:35 +08:00
4a4aea7803 更新 HandleWeChatMsgService.java 2023-12-12 18:49:30 +08:00
715dd2108e 更新 QyWeChatAppInfoMapperTest.java 2023-12-12 18:39:58 +08:00
391686628e 更新 WeChatMsgTest.java 2023-12-12 18:39:56 +08:00
09835f490e 更新 pom.xml 2023-12-12 18:31:45 +08:00
46a2de73ff Merge branch 'dev'
新增功能,微信消息转发,优化代码结构
2023-12-12 18:28:59 +08:00
fc80657dc5 Merge branch 'dev' 2023-12-09 14:39:54 +08:00
6ccd000785 更新 pom.xml 2023-12-09 14:19:43 +08:00
2be32c4d9f Merge branch 'dev'
解决计算时间差错误
2023-12-09 14:17:23 +08:00
8aea9de61c Merge branch 'dev' 2023-12-09 14:15:31 +08:00
4164b69aca 更新 HeartBeatServiceTest.java 2023-12-09 11:35:07 +08:00
4414ad9a26 更新 pom.xml 2023-12-09 11:35:03 +08:00
db949ace34 Merge branch 'dev'
新增服务监控功能。
2023-12-09 11:25:40 +08:00
68e4571077 更新 pom.xml 2023-12-06 16:51:01 +08:00
1d3eaf451f Merge branch 'dev' 2023-12-06 16:48:10 +08:00
e8ccd78a39 更新 pom.xml 2023-12-06 11:15:56 +08:00
3324865570 更新 pom.xml 2023-12-06 11:05:18 +08:00
9e42d4676a 创建 application.yml 2023-12-06 11:03:58 +08:00
6bb83e186d 更新 .gitignore 2023-12-06 11:03:54 +08:00
6923440a89 删除 application.yml 2023-12-06 10:46:53 +08:00
8d39b4938a 更新 .gitignore 2023-12-06 10:44:55 +08:00
b40f5cc0c4 更新 application.yml 2023-12-06 10:43:53 +08:00
9 changed files with 30 additions and 13 deletions

8
README.md Normal file
View File

@@ -0,0 +1,8 @@
## wepush
## 打包
```
mvn clean package
```

View File

@@ -45,9 +45,10 @@ CREATE TABLE device_info (
sn VARCHAR(255),
device_model VARCHAR(255),
last_online_time BIGINT,
status INT
status INT,
remark VARCHAR(255)
);
INSERT INTO device_info (is_monitored, time_out_period, device_brand, android_version, sn, device_model, last_online_time, status) VALUES
(1, 600, 'google', 'Android 10', UNIX_TIMESTAMP(), 1),
INSERT INTO device_info (is_monitored, time_out_period, device_brand, android_version, sn, device_model, last_online_time, status,remark) VALUES
(1, 1800, 'google', 'Android 10',,'Pixel 3', UNIX_TIMESTAMP(), 1,'转发设备'),

View File

@@ -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>

View File

@@ -21,4 +21,5 @@ public class DeviceInfoDAO {
private String deviceModel;
private long lastOnlineTime;
private int status;
private String remark;
}

View File

@@ -1,4 +1,4 @@
package com.kimgo.wepush.service;
package com.kimgo.wepush.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -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);

View File

@@ -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 返回构建完成的文本卡片消息对象。
*/
@@ -162,6 +163,7 @@ public class MonitorService {
"<div class='highlight'>安卓版本: " + deviceInfoDAO.getAndroidVersion() + "</div>" +
"<div class='highlight'>SN: " + deviceInfoDAO.getSN() + "</div>" +
"<div class='highlight'>监测到掉线时间: " + formattedCurrentTime + "</div>" +
"<div class='highlight'>备注: " + deviceInfoDAO.getRemark() + "</div>" +
"检测到设备已掉线,请及时查看设备状态.");
textCard.setUrl("https://kimgo.cn");
// 将构建的TextCard对象设置到TextCardMessage中
@@ -176,6 +178,7 @@ public class MonitorService {
/**
* 更新设备的状态信息。
*
* @param device 设备信息对象包含需要更新的设备的SN序列号
* @param status 需要更新到的新状态。
* @throws DatabaseUpdateException 如果数据库更新过程中发生异常,则抛出此异常。

View File

@@ -1,3 +1,3 @@
spring:
profiles:
active: dev
active: prod

View File

@@ -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>