|
|
@@ -34,6 +34,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
@@ -273,6 +274,9 @@ public class DeviceInfoService {
|
|
|
// 同步显示信息
|
|
|
deviceSyncFullCardService.noticeSyncDevice(List.of(deviceInfo));
|
|
|
|
|
|
+ // 设备信息改变时,更新 对应的物模型数据
|
|
|
+ iotThingService.updateThingByDevice(deviceInfo);
|
|
|
+
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|
|
|
@@ -326,6 +330,7 @@ public class DeviceInfoService {
|
|
|
* @param deviceId
|
|
|
* @return
|
|
|
*/
|
|
|
+ @Transactional
|
|
|
public ResultContent deleteDeviceInfo(String deviceId) {
|
|
|
DeviceInfo deviceInfo = deviceInfoDao.findTopByDeviceId(deviceId);
|
|
|
if (ObjectUtils.isEmpty(deviceInfo)) {
|
|
|
@@ -351,6 +356,9 @@ public class DeviceInfoService {
|
|
|
// 更新设备权限
|
|
|
jmxSyncService.syncDevicesSecurity(List.of(deviceInfo));
|
|
|
|
|
|
+ // 设备信息改变时,更新 对应的物模型数据
|
|
|
+ iotThingService.updateThingByDevice(deviceInfo);
|
|
|
+
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|
|
|
@@ -360,6 +368,7 @@ public class DeviceInfoService {
|
|
|
* @param deviceId
|
|
|
* @return
|
|
|
*/
|
|
|
+ @Transactional
|
|
|
public ResultContent cancelDeviceInfo(String deviceId) {
|
|
|
DeviceInfo deviceInfo = deviceInfoDao.findTopByDeviceId(deviceId);
|
|
|
if (ObjectUtils.isEmpty(deviceInfo)) {
|
|
|
@@ -383,6 +392,10 @@ public class DeviceInfoService {
|
|
|
|
|
|
operationLogsService.addLogs(String.format("注销了设备;%s", deviceInfo.getDeviceName()), LogsLevel.High, deviceInfo);
|
|
|
// 回收权限
|
|
|
+
|
|
|
+ // 设备信息改变时,更新 对应的物模型数据
|
|
|
+ iotThingService.updateThingByDevice(deviceInfo);
|
|
|
+
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|