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