Browse Source

页面表单更新修复,这里update应该为查出来的DO,不是前端的DO,采用更安全的redis策略,更新DB删除缓存,查询设备的时候补充缓存

chenzhangyue 2 years ago
parent
commit
d38ccc257c

+ 6 - 5
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java

@@ -544,18 +544,19 @@ public class DeviceServiceImpl implements IDeviceService {
         if (deviceInStore.getGeoCoordSys() != null) {
             // 坐标系变化,需要重新计算GCJ02坐标和WGS84坐标
             if (!deviceInStore.getGeoCoordSys().equals(device.getGeoCoordSys())) {
-                updateDeviceChannelGeoCoordSys(device);
+                deviceInStore.setGeoCoordSys(device.getGeoCoordSys());
+                updateDeviceChannelGeoCoordSys(deviceInStore);
             }
         }else {
-            device.setGeoCoordSys("WGS84");
+            deviceInStore.setGeoCoordSys("WGS84");
         }
         if (device.getCharset() == null) {
-            device.setCharset("GB2312");
+            deviceInStore.setCharset("GB2312");
         }
 
         // 更新redis
-        redisCatchStorage.updateDevice(device);
-        deviceMapper.updateCustom(device);
+        deviceMapper.updateCustom(deviceInStore);
+        redisCatchStorage.removeDevice(deviceInStore.getDeviceId());
     }
 
     @Override