Browse Source

截图定时优化

wyyay 9 months ago
parent
commit
64fb5e570b

+ 9 - 9
business-service/src/main/java/com/ozs/service/service/impl/CameraCaptureService.java

@@ -66,15 +66,15 @@ public class CameraCaptureService {
                     byteArrayOutputStream.write(bytes,0,index);
                 }
                 ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
-                String uploadUrl = "/data/test_picture/"+ IdUtils.fastSimpleUUID()+".jpeg";
-                if (log.isDebugEnabled()) {
-                    log.debug("生成至服务器本地开始,路径为======" + uploadUrl);
-                }
-                IOUtils.copy(byteArrayInputStream, new FileOutputStream(uploadUrl));
-                if (log.isDebugEnabled()) {
-                    log.debug("生成至服务器本地结束,路径为======");
-                }
-                byteArrayInputStream.reset();
+//                String uploadUrl = "/data/test_picture/"+ IdUtils.fastSimpleUUID()+".jpeg";
+//                if (log.isDebugEnabled()) {
+//                    log.debug("生成至服务器本地开始,路径为======" + uploadUrl);
+//                }
+//                IOUtils.copy(byteArrayInputStream, new FileOutputStream(uploadUrl));
+//                if (log.isDebugEnabled()) {
+//                    log.debug("生成至服务器本地结束,路径为======");
+//                }
+//                byteArrayInputStream.reset();
                 if (log.isDebugEnabled()) {
                     log.debug("getCapture======" + fileName);
                 }

+ 1 - 1
hazard-admin/src/main/java/com/ozs/web/controller/shotschedule/ShotPictureExecutors.java

@@ -44,7 +44,7 @@ public class ShotPictureExecutors {
      */
     @Async
     @Scheduled(fixedRate = 60000)
-    public synchronized void handleNormalPicture() {
+    public void handleNormalPicture() {
 
         try {
             List<SysDictData> dataList = DictUtils.getDictCache("shot_switch");

+ 6 - 1
hazard-admin/src/main/java/com/ozs/web/controller/shotschedule/TaskService.java

@@ -62,6 +62,9 @@ public class TaskService {
         }
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
         Set<BaseCameraVO> normalSet = redisService.getSetMembers(Constants.NORMAL_SET);
+        if (log.isDebugEnabled()) {
+            log.debug("正常摄像机数量:"+normalSet.size());
+        }
         if (!CollectionUtils.isEmpty(normalSet)) {
             String finalAddress = address;
             normalSet.forEach(item -> {
@@ -106,6 +109,9 @@ public class TaskService {
             msgAlarmService.initializationCameraCache();
         }
         Set<BaseCameraVO> alarmSet = redisService.getSetMembers(Constants.ALARM_SET);
+        if (log.isDebugEnabled()) {
+            log.debug("报警摄像机数量:"+alarmSet.size());
+        }
         if(!CollectionUtils.isEmpty(alarmSet)){
             String finalAddress = address;
             alarmSet.forEach(item -> {
@@ -134,5 +140,4 @@ public class TaskService {
             });
         }
     }
-
 }