gao.qiang 2 недель назад
Родитель
Сommit
bce0c32170
1 измененных файлов с 7 добавлено и 4 удалено
  1. 7 4
      hazard-admin/src/main/java/com/ozs/web/core/util/CameraUtil.java

+ 7 - 4
hazard-admin/src/main/java/com/ozs/web/core/util/CameraUtil.java

@@ -1052,14 +1052,14 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
         // 找出未记录日志的设备
         Set<String> inactiveCameraCodes = new HashSet<>(allCameraCodes);
         inactiveCameraCodes.removeAll(loggedCameraCodes);
+        // 保存设备状态变更记录
+        saveDeviceResume(loggedCameraCodes, 1);
+        saveDeviceResume(inactiveCameraCodes, 2);
 
         // 更新设备状态
         updateDeviceStatus(loggedCameraCodes, 1); // 启用设备
         updateDeviceStatus(inactiveCameraCodes, 2); // 禁用设备
 
-        // 保存设备状态变更记录
-        saveDeviceResume(loggedCameraCodes, 1);
-        saveDeviceResume(inactiveCameraCodes, 2);
     }
 
     // 辅助方法:更新设备状态
@@ -1084,6 +1084,9 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
             BaseDeviceDynamicManagement deviceDynamicManagement = baseDeviceDynamicManagementService.getOne(
                     new LambdaQueryWrapper<BaseDeviceDynamicManagement>()
                             .eq(BaseDeviceDynamicManagement::getCameraCode, cameraCode));
+            BaseDeviceResume deviceResume = baseDeviceResumeService.getOne(
+                    new LambdaQueryWrapper<BaseDeviceResume>()
+                            .eq(BaseDeviceResume::getCameraCode, cameraCode));
 
             boolean shouldDisable = (status == 1) || (deviceDynamicManagement != null && (status == 2 && deviceDynamicManagement.getIsDisable().equals(1)));
 
@@ -1091,7 +1094,7 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
             resume.setCameraCode(cameraCode);
             resume.setIsDisable(status);
 
-            if (shouldDisable) {
+            if (shouldDisable||ObjectUtils.isEmpty(deviceResume)) {
                 resumes.add(resume);
             }
         }