Compare commits

6 Commits

Author SHA1 Message Date
9c98fa9077 Merge branch 'dyf-device' into 6170 2025-09-23 13:58:09 +08:00
135e6d6899 设备分享 2025-09-23 11:42:44 +08:00
f07ec53645 控制中心设备绑定修改3 2025-09-22 14:05:39 +08:00
74b0059aca 控制中心设备绑定修改2 2025-09-22 14:03:44 +08:00
8e66f1ca28 控制中心设备绑定修改 2025-09-22 12:41:54 +08:00
1b33356a2a 在线状态修改 2025-09-22 11:02:26 +08:00
5 changed files with 24 additions and 15 deletions

View File

@ -71,6 +71,8 @@ public class RedisKeyExpirationListener implements MessageListener {
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{
RedisUtils.deleteObject(deviceOnlineStatusRedisKey);
} }
} finally { } finally {
//释放锁 //释放锁

View File

@ -54,7 +54,7 @@ public class ReceiverMessageHandler implements MessageHandler {
RedisUtils.offerDeduplicated(queueKey,dedupKey,deviceImei, Duration.ofHours(24)); RedisUtils.offerDeduplicated(queueKey,dedupKey,deviceImei, Duration.ofHours(24));
//在线状态 //在线状态
String deviceOnlineStatusRedisKey = GlobalConstants.GLOBAL_REDIS_KEY+ DEVICE_KEY_PREFIX+ deviceImei + DeviceRedisKeyConstants.DEVICE_ONLINE_STATUS_KEY_PREFIX ; String deviceOnlineStatusRedisKey = GlobalConstants.GLOBAL_REDIS_KEY+ DEVICE_KEY_PREFIX+ deviceImei + DeviceRedisKeyConstants.DEVICE_ONLINE_STATUS_KEY_PREFIX ;
RedisUtils.setCacheObject(deviceOnlineStatusRedisKey, "1", Duration.ofSeconds(62)); RedisUtils.setCacheObject(deviceOnlineStatusRedisKey, "1", Duration.ofSeconds(65));
} }
String state = payloadDict.getStr("state"); String state = payloadDict.getStr("state");

View File

@ -98,21 +98,24 @@ public class MqttMessageConsumer {
String threadName = Thread.currentThread().getName(); String threadName = Thread.currentThread().getName();
try { try {
log.info("业务处理线程 {} 开始处理消息: {}", threadName, message); log.info("业务处理线程 {} 开始处理消息: {}", threadName, message);
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> updateWrapper = new UpdateWrapper<>();
// updateWrapper.eq("device_imei", message)
// .set("online_status", 1);
// deviceMapper.update(updateWrapper);
// }
QueryWrapper<Device> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("device_imei", message);
queryWrapper.eq("online_status", 1);
Long count = deviceMapper.selectCount(queryWrapper);
if(count == 0){
UpdateWrapper<Device> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<Device> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("device_imei", message) updateWrapper.eq("device_imei", message)
.set("online_status", 1); .set("online_status", 1);
deviceMapper.update(updateWrapper); deviceMapper.update(updateWrapper);
} }
// QueryWrapper<Device> queryWrapper = new QueryWrapper<>();
// queryWrapper.eq("device_imei", message);
// queryWrapper.eq("online_status", 1);
// Long count = deviceMapper.selectCount(queryWrapper);
// if(count == 0){
//
// }
// 模拟业务处理耗时 // 模拟业务处理耗时
// Thread.sleep(200); // Thread.sleep(200);

View File

@ -114,4 +114,9 @@ public class AppDeviceShareVo implements Serializable {
* 创建时间 * 创建时间
*/ */
private String createTime; private String createTime;
/**
* 设备详情页面
*/
private String detailPageUrl;
} }

View File

@ -239,8 +239,7 @@
where d.device_mac = #{deviceMac} where d.device_mac = #{deviceMac}
</select> </select>
<select id="queryWebDeviceList" resultType="com.fuyuanshen.equipment.domain.vo.WebDeviceVo"> <select id="queryWebDeviceList" resultType="com.fuyuanshen.equipment.domain.vo.WebDeviceVo">
select d.id, d.device_name, d.device_name, select DISTINCT d.id, d.device_name,
d.device_name,
d.device_mac, d.device_mac,
d.device_sn, d.device_sn,
d.device_imei, d.device_imei,
@ -255,7 +254,7 @@
c.binding_time c.binding_time
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 and c.communication_mode = 0 inner 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) where dt.communication_mode in (0, 2)
<if test="criteria.deviceType != null"> <if test="criteria.deviceType != null">
@ -285,7 +284,7 @@
<if test="criteria.onlineStatus != null"> <if test="criteria.onlineStatus != null">
and d.online_status = #{criteria.onlineStatus} and d.online_status = #{criteria.onlineStatus}
</if> </if>
ORDER BY d.create_time DESC ORDER BY c.binding_time DESC
</select> </select>
<select id="getLocationHistory" resultType="com.fuyuanshen.equipment.domain.vo.LocationHistoryVo"> <select id="getLocationHistory" resultType="com.fuyuanshen.equipment.domain.vo.LocationHistoryVo">
select a.id,a.device_name,a.device_type,b.type_name deviceTypeName,a.device_imei,a.device_mac from device a select a.id,a.device_name,a.device_type,b.type_name deviceTypeName,a.device_imei,a.device_mac from device a