459242451@qq.com 3 жил өмнө
parent
commit
5ffb9047b3

+ 8 - 4
ruoyi-admin/src/main/java/com/ruoyi/web/job/CanalScheduling.java

@@ -397,10 +397,14 @@ public class CanalScheduling implements Runnable, ApplicationContextAware {
                     redisCache.deleteObject(CacheConstants.DEVICE_STATIC);
                 } else if (StrUtil.equalsIgnoreCase(database, "ship") && StrUtil.equalsIgnoreCase(table, "device")) {
                     // 设备信息
-                    redisCache.deleteObject(CollUtil.set(false,
-                            CacheConstants.DEVICE_STATIC,
-                            CacheConstants.DEVICE_TYPE_STATIC,
-                            CacheConstants.DEVICE_LIST_STATIC));
+                    // 如果状态和经纬度变更才去删除redis
+                    if (ObjectUtil.notEqual(beforeDataMap.get("online_status"), afterDataMap.get("online_status")) || ObjectUtil.notEqual(beforeDataMap.get("longitude"), afterDataMap.get("longitude")) || ObjectUtil.notEqual(beforeDataMap.get(
+                            "latitude"), afterDataMap.get("latitude"))) {
+                        redisCache.deleteObject(CollUtil.set(false,
+                                CacheConstants.DEVICE_STATIC,
+                                CacheConstants.DEVICE_TYPE_STATIC,
+                                CacheConstants.DEVICE_LIST_STATIC));
+                    }
                 } else if (StrUtil.equalsIgnoreCase(database, "ais_database") && (StrUtil.equalsIgnoreCase(table, "sem_instrument"))) {
                     // 嗅探系统-站点信息
                     client.updateDocument(ElasticConstants.AIS_SEM_INSTRUMENT, Convert.toStr(afterDataMap.get("id")), afterDataMap);