From dfa5b446f9ffe824fc507f4b2d2f47d4605f4480 Mon Sep 17 00:00:00 2001 From: chenyouting <514333061@qq.com> Date: Tue, 7 Oct 2025 09:50:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A7=E5=88=B6=E4=B8=AD=E5=BF=83=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../listener/RedisKeyExpirationListener.java | 21 +++++++++++++------ .../equipment/domain/vo/WebDeviceVo.java | 7 +++++++ .../mapper/equipment/DeviceMapper.xml | 3 ++- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/listener/RedisKeyExpirationListener.java b/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/listener/RedisKeyExpirationListener.java index 13f190fa..8996609e 100644 --- a/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/listener/RedisKeyExpirationListener.java +++ b/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/listener/RedisKeyExpirationListener.java @@ -65,13 +65,22 @@ public class RedisKeyExpirationListener implements MessageListener { if (lockInfo != null) { try { String deviceOnlineStatusRedisKey = GlobalConstants.GLOBAL_REDIS_KEY+ DEVICE_KEY_PREFIX+ message + DeviceRedisKeyConstants.DEVICE_ONLINE_STATUS_KEY_PREFIX ; +// String deviceOnlineStatusRedis = RedisUtils.getCacheObject(deviceOnlineStatusRedisKey); +// if(StringUtils.isBlank(deviceOnlineStatusRedis)){ +// UpdateWrapper deviceUpdateWrapper = new UpdateWrapper<>(); +// deviceUpdateWrapper.eq("device_imei", element); +// deviceUpdateWrapper.set("online_status", 0); +// deviceMapper.update(deviceUpdateWrapper); +// }else{ +// RedisUtils.deleteObject(deviceOnlineStatusRedisKey); +// } + + UpdateWrapper deviceUpdateWrapper = new UpdateWrapper<>(); + deviceUpdateWrapper.eq("device_imei", element); + deviceUpdateWrapper.set("online_status", 0); + deviceMapper.update(deviceUpdateWrapper); String deviceOnlineStatusRedis = RedisUtils.getCacheObject(deviceOnlineStatusRedisKey); - if(StringUtils.isBlank(deviceOnlineStatusRedis)){ - UpdateWrapper deviceUpdateWrapper = new UpdateWrapper<>(); - deviceUpdateWrapper.eq("device_imei", element); - deviceUpdateWrapper.set("online_status", 0); - deviceMapper.update(deviceUpdateWrapper); - }else{ + if(StringUtils.isNotBlank(deviceOnlineStatusRedis)){ RedisUtils.deleteObject(deviceOnlineStatusRedisKey); } } finally { diff --git a/fys-modules/fys-equipment/src/main/java/com/fuyuanshen/equipment/domain/vo/WebDeviceVo.java b/fys-modules/fys-equipment/src/main/java/com/fuyuanshen/equipment/domain/vo/WebDeviceVo.java index f1d0879f..c257d38e 100644 --- a/fys-modules/fys-equipment/src/main/java/com/fuyuanshen/equipment/domain/vo/WebDeviceVo.java +++ b/fys-modules/fys-equipment/src/main/java/com/fuyuanshen/equipment/domain/vo/WebDeviceVo.java @@ -58,6 +58,13 @@ public class WebDeviceVo implements Serializable { */ private Integer deviceStatus; + + /**绑定状态 + * 0 未绑定 + * 1 已绑定 + */ + private Integer binding_status; + /** * 绑定时间 */ diff --git a/fys-modules/fys-equipment/src/main/resources/mapper/equipment/DeviceMapper.xml b/fys-modules/fys-equipment/src/main/resources/mapper/equipment/DeviceMapper.xml index 856516b2..7330179d 100644 --- a/fys-modules/fys-equipment/src/main/resources/mapper/equipment/DeviceMapper.xml +++ b/fys-modules/fys-equipment/src/main/resources/mapper/equipment/DeviceMapper.xml @@ -252,12 +252,13 @@ dt.pc_model_dictionary detailPageUrl, ap.name personnelBy, d.device_status, + d.binding_status, d.online_status, c.binding_time, ROW_NUMBER() OVER (PARTITION BY d.id ORDER BY c.binding_time) AS row_num from device d 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 where dt.communication_mode in (0, 2) ) a where a.row_num = 1