|
@@ -1,8 +1,11 @@
|
|
package com.ozs.service.service.impl;
|
|
package com.ozs.service.service.impl;
|
|
|
|
|
|
import com.ozs.common.utils.MinioUtils;
|
|
import com.ozs.common.utils.MinioUtils;
|
|
|
|
+import com.ozs.common.utils.uuid.IdUtils;
|
|
|
|
+import com.ozs.service.utils.FileUploader;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
@@ -21,6 +24,8 @@ public class CameraCaptureService {
|
|
private static final Logger log = LoggerFactory.getLogger(CameraCaptureService.class);
|
|
private static final Logger log = LoggerFactory.getLogger(CameraCaptureService.class);
|
|
@Resource
|
|
@Resource
|
|
MinioUtils minioUtils;
|
|
MinioUtils minioUtils;
|
|
|
|
+ @Autowired
|
|
|
|
+ FileUploader fileUploader;
|
|
|
|
|
|
public void getCapture(URL url, String fileName) throws IOException {
|
|
public void getCapture(URL url, String fileName) throws IOException {
|
|
HttpURLConnection connection = null;
|
|
HttpURLConnection connection = null;
|
|
@@ -66,6 +71,10 @@ public class CameraCaptureService {
|
|
log.info("getCapture======" + fileName);
|
|
log.info("getCapture======" + fileName);
|
|
minioUtils.minIoClientUpload(byteArrayInputStream, fileName);
|
|
minioUtils.minIoClientUpload(byteArrayInputStream, fileName);
|
|
System.out.println("fileName"+fileName+"图片结束截图时间"+new Date());
|
|
System.out.println("fileName"+fileName+"图片结束截图时间"+new Date());
|
|
|
|
+ String uploadUrl = "/data/test_picture/"+ IdUtils.fastSimpleUUID()+".jpeg";
|
|
|
|
+ //File targetVideoDir = new File(uploadUrl);
|
|
|
|
+ fileUploader.transfer(uploadUrl,bytes);
|
|
|
|
+
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
//先关闭外层的缓冲流,再关闭内层的流,但是在关闭外层流的同时,
|
|
//先关闭外层的缓冲流,再关闭内层的流,但是在关闭外层流的同时,
|