fix(client): 设备移除逻辑与认证流程优化
- 修改设备移除时的本地清理方法,统一调用 clearLocalAuth - 优化设备数量限制校验逻辑,避免重复计算当前设备- 移除冗余的设备状态检查,简化设备移除流程- 调整 Redis 连接超时与等待时间,提升连接稳定性- 增强 MySQL 数据库连接配置,添加自动重连机制 -优化 Druid 连接池参数,提高数据库连接性能 - 简化客户端认证与数据上报逻辑,提升处理效率 - 移除过期设备状态更新逻辑,减少不必要的数据库操作- 调整慢 SQL 记录阈值,便于及时发现性能问题-优化版本分布与数据类型统计查询逻辑,提高响应速度
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import com.ruoyi.system.domain.ClientDevice;
|
||||
import io.lettuce.core.dynamic.annotation.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ClientDeviceMapper {
|
||||
ClientDevice selectByDeviceId(String deviceId);
|
||||
List<ClientDevice> selectByUsername(String username);
|
||||
List<ClientDevice> selectByUsername(@Param("username") String username);
|
||||
List<ClientDevice> selectOnlineDevices();
|
||||
int insert(ClientDevice device);
|
||||
int updateByDeviceId(ClientDevice device);
|
||||
int updateExpiredDevicesOffline();
|
||||
int deleteByDeviceId(String deviceId);
|
||||
int countByUsername(String username);
|
||||
}
|
||||
|
||||
@@ -247,11 +247,4 @@ public interface ClientMonitorMapper {
|
||||
* @return 在线设备列表
|
||||
*/
|
||||
public List<ClientDevice> selectOnlineDevices();
|
||||
|
||||
/**
|
||||
* 将过期设备设置为离线状态
|
||||
*
|
||||
* @return 影响行数
|
||||
*/
|
||||
public int updateExpiredDevicesOffline();
|
||||
}
|
||||
@@ -20,7 +20,7 @@
|
||||
</select>
|
||||
|
||||
<select id="selectByUsername" resultMap="ClientDeviceMap">
|
||||
select * from client_device where username = #{username} order by update_time desc
|
||||
select * from client_device where username = #{username} and status != 'removed' order by update_time desc
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.ruoyi.system.domain.ClientDevice" useGeneratedKeys="true" keyProperty="id">
|
||||
@@ -52,11 +52,6 @@
|
||||
<select id="selectOnlineDevices" resultMap="ClientDeviceMap">
|
||||
select * from client_device where status = 'online' order by last_active_at desc
|
||||
</select>
|
||||
|
||||
<update id="updateExpiredDevicesOffline">
|
||||
update client_device set status = 'offline'
|
||||
where status = 'online' and (last_active_at is null or last_active_at < date_sub(now(), interval 2 minute))
|
||||
</update>
|
||||
</mapper>
|
||||
|
||||
|
||||
|
||||
@@ -455,14 +455,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
WHERE status = 'online'
|
||||
ORDER BY last_active_at DESC
|
||||
</select>
|
||||
|
||||
<!-- 将过期设备设置为离线状态(5分钟未活跃) -->
|
||||
<update id="updateExpiredDevicesOffline">
|
||||
UPDATE client_device
|
||||
SET status = 'offline'
|
||||
WHERE status = 'online'
|
||||
AND (last_active_at IS NULL OR last_active_at < DATE_SUB(NOW(), INTERVAL 5 MINUTE))
|
||||
</update>
|
||||
|
||||
<!-- 删除30天前的错误报告 -->
|
||||
<delete id="deleteExpiredErrorReports">
|
||||
|
||||
Reference in New Issue
Block a user