控制中心优化

This commit is contained in:
2025-10-07 09:50:49 +08:00
parent 9afc0222d5
commit dfa5b446f9
3 changed files with 24 additions and 7 deletions

View File

@ -65,13 +65,22 @@ public class RedisKeyExpirationListener implements MessageListener {
if (lockInfo != null) { if (lockInfo != null) {
try { try {
String deviceOnlineStatusRedisKey = GlobalConstants.GLOBAL_REDIS_KEY+ DEVICE_KEY_PREFIX+ message + DeviceRedisKeyConstants.DEVICE_ONLINE_STATUS_KEY_PREFIX ; String deviceOnlineStatusRedisKey = GlobalConstants.GLOBAL_REDIS_KEY+ DEVICE_KEY_PREFIX+ message + DeviceRedisKeyConstants.DEVICE_ONLINE_STATUS_KEY_PREFIX ;
String deviceOnlineStatusRedis = RedisUtils.getCacheObject(deviceOnlineStatusRedisKey); // String deviceOnlineStatusRedis = RedisUtils.getCacheObject(deviceOnlineStatusRedisKey);
if(StringUtils.isBlank(deviceOnlineStatusRedis)){ // if(StringUtils.isBlank(deviceOnlineStatusRedis)){
// UpdateWrapper<Device> deviceUpdateWrapper = new UpdateWrapper<>();
// deviceUpdateWrapper.eq("device_imei", element);
// deviceUpdateWrapper.set("online_status", 0);
// deviceMapper.update(deviceUpdateWrapper);
// }else{
// RedisUtils.deleteObject(deviceOnlineStatusRedisKey);
// }
UpdateWrapper<Device> deviceUpdateWrapper = new UpdateWrapper<>(); UpdateWrapper<Device> deviceUpdateWrapper = new UpdateWrapper<>();
deviceUpdateWrapper.eq("device_imei", element); deviceUpdateWrapper.eq("device_imei", element);
deviceUpdateWrapper.set("online_status", 0); deviceUpdateWrapper.set("online_status", 0);
deviceMapper.update(deviceUpdateWrapper); deviceMapper.update(deviceUpdateWrapper);
}else{ String deviceOnlineStatusRedis = RedisUtils.getCacheObject(deviceOnlineStatusRedisKey);
if(StringUtils.isNotBlank(deviceOnlineStatusRedis)){
RedisUtils.deleteObject(deviceOnlineStatusRedisKey); RedisUtils.deleteObject(deviceOnlineStatusRedisKey);
} }
} finally { } finally {

View File

@ -58,6 +58,13 @@ public class WebDeviceVo implements Serializable {
*/ */
private Integer deviceStatus; private Integer deviceStatus;
/**绑定状态
* 0 未绑定
* 1 已绑定
*/
private Integer binding_status;
/** /**
* 绑定时间 * 绑定时间
*/ */

View File

@ -252,12 +252,13 @@
dt.pc_model_dictionary detailPageUrl, dt.pc_model_dictionary detailPageUrl,
ap.name personnelBy, ap.name personnelBy,
d.device_status, d.device_status,
d.binding_status,
d.online_status, d.online_status,
c.binding_time, c.binding_time,
ROW_NUMBER() OVER (PARTITION BY d.id ORDER BY c.binding_time) AS row_num ROW_NUMBER() OVER (PARTITION BY d.id ORDER BY c.binding_time) AS row_num
from device d from device d
inner join device_type dt on d.device_type = dt.id inner join device_type dt on d.device_type = dt.id
inner join app_device_bind_record c on d.id = c.device_id left join app_device_bind_record c on d.id = c.device_id
left join app_personnel_info ap on ap.device_id = d.id left join app_personnel_info ap on ap.device_id = d.id
where dt.communication_mode in (0, 2) ) a where a.row_num = 1 where dt.communication_mode in (0, 2) ) a where a.row_num = 1
<if test="criteria.deviceType != null"> <if test="criteria.deviceType != null">