| 
					
				 | 
			
			
				@@ -9,6 +9,7 @@ import com.ozs.service.entity.BaseCameraManagement; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ozs.service.entity.MsgAlarm; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ozs.service.service.BaseCameraManagementService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ozs.service.service.MsgAlarmService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ozs.service.service.impl.CameraCaptureService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.slf4j.Logger; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.slf4j.LoggerFactory; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.util.ObjectUtils; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -42,7 +43,7 @@ public class PictureController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     MsgAlarmService msgAlarmService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    MinioUtils minioUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    CameraCaptureService cameraCaptureService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 获取图片 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -66,7 +67,7 @@ public class PictureController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     URL url = new URL("http://124.70.58.209:18891/snap/"+l.getCameraCode()+"/"+l.getChannel()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     String fileName = "cameraPicture/"+l.getCameraCode()+"_"+uuid +".jpg"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     log.info("fileName="+fileName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    getCapture(url, fileName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    cameraCaptureService.getCapture(url, fileName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } catch (MalformedURLException e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } catch (IOException e) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -76,64 +77,4 @@ public class PictureController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return AjaxResult.success(list); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public void getCapture(URL url,String fileName) throws IOException { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        HttpURLConnection connection = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        BufferedInputStream bis = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        BufferedOutputStream bos = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            connection = (HttpURLConnection) url.openConnection(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // http正文内,因此需要设为true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            connection.setDoOutput(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            connection.setDoInput(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // Post 请求不能使用缓存 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            connection.setUseCaches(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //设置本次连接是否自动重定向 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            connection.setInstanceFollowRedirects(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            connection.setRequestMethod("GET"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            connection.setRequestProperty("Accept-Language", "zh,zh-CN;q=0.9"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            connection.setRequestProperty("connection", "keep-alive"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //设置参数类型是json格式 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            connection.setRequestProperty("Content-Type", "application/json;charset=utf-8"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            connection.setRequestProperty("Accept","application/json"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            connection.setRequestProperty("Charsert", "UTF-8"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //设置读取时间为30秒 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            connection.setConnectTimeout(30 * 1000); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            connection.setReadTimeout(30 * 1000); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            connection.connect(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // 返回流 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            System.out.println("responseCode=" + connection.getResponseCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            log.info("responseCode="+connection.getResponseCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                InputStream input = connection.getInputStream(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                bis = new BufferedInputStream(input); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                minioUtils.minIoClientUpload(input, fileName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                FileOutputStream output = new FileOutputStream(fileName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                bos = new BufferedOutputStream(output); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                byte[] buffer = new byte[1024]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                int size = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                while ((size = bis.read(buffer, 0, 1024)) != -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                    bos.write(buffer, 0, size); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                bos.flush(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //先关闭外层的缓冲流,再关闭内层的流,但是在关闭外层流的同时, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //内层流也会自动的进行关闭,关于内层流的关闭,可以省略 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } finally { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (bis != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                bis.close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            if (bos != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                bos.close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (connection != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                connection.disconnect(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            os.close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |