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)