Browse Source

截图定时优化

wyyay 8 months ago
parent
commit
2639fa10ad

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

@@ -66,16 +66,22 @@ public class CameraCaptureService {
                     byteArrayOutputStream.write(bytes,0,index);
                     byteArrayOutputStream.write(bytes,0,index);
                 }
                 }
                 ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
                 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();
                 if (log.isDebugEnabled()) {
                 if (log.isDebugEnabled()) {
                     log.debug("getCapture======" + fileName);
                     log.debug("getCapture======" + fileName);
                 }
                 }
                 minioUtils.minIoClientUpload(byteArrayInputStream, fileName);
                 minioUtils.minIoClientUpload(byteArrayInputStream, fileName);
                 if (log.isDebugEnabled()) {
                 if (log.isDebugEnabled()) {
-                    log.debug("fileName"+fileName+"图片结束截图时间"+new Date());
+                    log.debug("fileName:"+fileName+"图片结束截图时间:"+new Date());
                 }
                 }
-                String uploadUrl = "/data/test_picture/"+ IdUtils.fastSimpleUUID()+".jpeg";
-                byteArrayInputStream.reset();
-                IOUtils.copy(byteArrayInputStream, new FileOutputStream(uploadUrl));
             }
             }
         } catch (Exception e) {
         } catch (Exception e) {
             //先关闭外层的缓冲流,再关闭内层的流,但是在关闭外层流的同时,
             //先关闭外层的缓冲流,再关闭内层的流,但是在关闭外层流的同时,