@ -1,7 +1,5 @@
				@@ -1,7 +1,5 @@
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					package  com.ruoyi.code.camera.controller ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  com.alibaba.fastjson.JSON ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  com.ruoyi.code.camera.domain.LogInfo ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  com.ruoyi.common.annotation.Log ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  com.ruoyi.common.core.controller.BaseController ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  com.ruoyi.common.core.page.R ;  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -18,7 +16,6 @@ import org.springframework.security.access.prepost.PreAuthorize;
				@@ -18,7 +16,6 @@ import org.springframework.security.access.prepost.PreAuthorize;
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  org.springframework.web.bind.annotation.* ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  sdk.java.lib.netmanager.NetEnums ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  sdk.java.lib.netmanager.NetLib ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  sdk.java.lib.netmanager.NetStructs ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  utils.CameraUtil ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  utils.RegisterUtil ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  utils.run_device_cfg ;  
				
			 
			
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
				 
				 
				
					@ -28,7 +25,6 @@ import javax.annotation.Resource;
				@@ -28,7 +25,6 @@ import javax.annotation.Resource;
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  javax.servlet.http.HttpServletRequest ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  javax.servlet.http.HttpServletResponse ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  java.util.Arrays ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  java.util.HashMap ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  java.util.List ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					import  java.util.Map ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -64,6 +60,7 @@ public class CameraController extends BaseController
				@@ -64,6 +60,7 @@ public class CameraController extends BaseController
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    @PreAuthorize ( "@ss.hasPermi('web:camera:query')" )  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  R  info ( @PathVariable ( "id" )  Long  id ) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        Camera  camera  =  cameraService . getById ( id ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        return  R . ok ( ) . put ( "data" ,  camera ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
				 
				 
				
					@ -187,50 +184,44 @@ public class CameraController extends BaseController
				@@ -187,50 +184,44 @@ public class CameraController extends BaseController
					 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  R  getAutoCfg ( @PathVariable ( "id" )  Long  id ) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        int  nCommand  =  NetEnums . EM_DEVICE_CFG_TYPE . DEVICE_CFG_AUTO_MAINTAIN ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        Camera  camera  =  cameraService . getById ( id ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        Camera  camera  =  cameraService . getCameraBySid ( id ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        IntByReference  nError  =  new  IntByReference ( 0 ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        NativeLong  loginID  =  NetLib . instance . Net_LoginDevice ( camera . getIp ( ) ,  camera . getPort ( ) ,  camera . getUsername ( ) ,  camera . getPassword ( ) ,  null , nError ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        run_device_cfg  cfg  =  new  run_device_cfg ( ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					//        Object data = JSON.toJSON(cfg.getAutoCfg(new NativeLong(Long.parseLong(camera.getLoginId())),nCommand)).toString();
  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        NetStructs . STU_CFG_AUTO_MAINTAIN  cc  =  cfg . getAutoCfg ( new  NativeLong ( Long . parseLong ( camera . getLoginId ( ) ) ) , nCommand ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        Map < String , Object >  data  =  new  HashMap < > ( ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        data . put ( "bEnable" , cc . bEnable ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        data . put ( "uWeekDay" , cc . uWeekDay ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        data . put ( "uHour" , cc . uHour ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        return  R . ok ( ) . put ( "data" ,  data ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        cfg . getAutoCfg ( loginID , nCommand ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        return  R . ok ( ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    / * *  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  设置摄像头重启  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * /  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    @RequestMapping ( "/setautocfg" )  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  R  setAutoCfg ( @RequestBody  Map < String ,  Object >  params ) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        String  id  =  ( String )  params . get ( "id" ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        Camera  camera  =  cameraService . getById ( id ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    @RequestMapping ( "/setautocfg/" )  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  R  setAutoCfg ( @RequestParam  Map < String ,  Object >  params ) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        run_device_cfg  cfg  =  new  run_device_cfg ( ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        return  cfg . setAutoFtpCfg ( new  NativeLong ( Long . parseLong ( camera . getLoginId ( ) ) ) ,  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    Integer . parseInt ( params . get ( "bEnable" ) . toString ( ) ) ,  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    Integer . parseInt ( params . get ( "uHour" ) . toString ( ) ) ,  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					                    Integer . parseInt ( params . get ( "uWeekDay" ) . toString ( ) ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        Camera  camera  =  cameraService . getCameraBySid ( ( Long )  params . get ( "sid" ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        IntByReference  nError  =  new  IntByReference ( 0 ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        NativeLong  loginID  =  NetLib . instance . Net_LoginDevice ( camera . getIp ( ) ,  camera . getPort ( ) ,  camera . getUsername ( ) ,  camera . getPassword ( ) ,  null , nError ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        run_device_cfg  cfg  =  new  run_device_cfg ( ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        cfg . setAutoFtpCfg ( loginID , ( int ) params . get ( "benable" ) , ( int ) params . get ( "uHour" ) , ( int ) params . get ( "uWeekDay" ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        return  R . ok ( ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    / * *  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     *  获取日志  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					     * /  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    @RequestMapping ( "/getloginfo" )  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    @RequestMapping ( "/getloginfo/ " )  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    public  R  getloginfo ( @RequestParam  Map < String ,  Object >  params ) {  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        String  id  =  ( String )  params . get ( "id" ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        String  startTime  =  ( String )  params . get ( "startTime" ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        String  endTime  =  ( String )  params . get ( "endTime" ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        Camera  camera  =  cameraService . getById ( id ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        Camera  camera  =  cameraService . getCameraBySid ( ( Long )  params . get ( "sid" ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        IntByReference  nError  =  new  IntByReference ( 0 ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        NativeLong  loginID  =  NetLib . instance . Net_LoginDevice ( camera . getIp ( ) ,  camera . getPort ( ) ,  camera . getUsername ( ) ,  camera . getPassword ( ) ,  null , nError ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        run_device_log_search  logSearch  =  new  run_device_log_search ( ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        logSearch . logInfoSearchByTime ( loginID , ( String )  params . get ( "strStartTime" ) , ( String )  params . get ( "strEndTime" ) ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        List < LogInfo >  data  =  logSearch . logInfoSearchByTime ( new  NativeLong ( Long . parseLong ( camera . getLoginId ( ) ) ) ,  startTime ,  endTime ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        System . out . println ( data ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        return  R . ok ( ) . put ( "data" , data ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					
 
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					        return  R . ok ( ) ;  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					    }  
				
			 
			
		
	
		
			
				
					 
					 
				
				 
				 
				
					}