From 61b89e502b408778919d0e0adfc7d648c3af8861 Mon Sep 17 00:00:00 2001 From: luyya Date: Fri, 21 Nov 2025 11:21:53 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9C=81=E5=8E=85=E4=BD=8D=E7=BD=AE=E6=B1=87?= =?UTF-8?q?=E8=81=9A=E5=A4=84=E7=90=86redis=E6=95=B0=E6=8D=AE=E5=85=A5?= =?UTF-8?q?=E5=9C=A8=E7=BA=BF=E5=BA=93=E6=8F=90=E7=A4=BA=E5=94=AF=E4=B8=80?= =?UTF-8?q?=E7=B4=A2=E5=BC=95=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dromara/system/service/impl/DeviceRedisServiceImpl.java | 5 ++++- .../src/main/resources/mapper/system/DeviceRedisMapper.xml | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/stwzhj-modules/stwzhj-system/src/main/java/org/dromara/system/service/impl/DeviceRedisServiceImpl.java b/stwzhj-modules/stwzhj-system/src/main/java/org/dromara/system/service/impl/DeviceRedisServiceImpl.java index 6a3c411d..137054ce 100644 --- a/stwzhj-modules/stwzhj-system/src/main/java/org/dromara/system/service/impl/DeviceRedisServiceImpl.java +++ b/stwzhj-modules/stwzhj-system/src/main/java/org/dromara/system/service/impl/DeviceRedisServiceImpl.java @@ -45,7 +45,10 @@ public class DeviceRedisServiceImpl implements IDeviceRedisService { // 在插入前对数据进行去重(基于唯一约束) Map uniqueMap = new LinkedHashMap<>(); for (DeviceRedis device : list) { - String key = device.getDeviceCode() + "|" + + if ("99".equals(device.getDeviceType())){ + continue; + } + String key = device.getDeviceCode() + "|" + device.getDeviceType() + "|" + device.getInfoSource(); // 保留最后一次出现的记录(根据业务需求调整) uniqueMap.put(key, device); diff --git a/stwzhj-modules/stwzhj-system/src/main/resources/mapper/system/DeviceRedisMapper.xml b/stwzhj-modules/stwzhj-system/src/main/resources/mapper/system/DeviceRedisMapper.xml index 2851a471..37568851 100644 --- a/stwzhj-modules/stwzhj-system/src/main/resources/mapper/system/DeviceRedisMapper.xml +++ b/stwzhj-modules/stwzhj-system/src/main/resources/mapper/system/DeviceRedisMapper.xml @@ -20,7 +20,7 @@ #{entity.deviceCode},#{entity.deviceType},#{entity.online},#{entity.zzjgdm},#{entity.gpsTime},#{entity.infoSource} ) - ON conflict(device_code,info_source) do update set + ON conflict(device_code,device_type,info_source) do update set (online,zzjgdm,gps_time) =(EXCLUDED.online,EXCLUDED.zzjgdm,EXCLUDED.gps_time)