|
|
@ -110,161 +110,161 @@ public class CameraController extends BaseController |
|
|
|
return R.ok(); |
|
|
|
return R.ok(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
@RequestMapping("register") |
|
|
|
// @RequestMapping("register")
|
|
|
|
public R register(){ |
|
|
|
// public R register(){
|
|
|
|
return cameraService.register(); |
|
|
|
// return cameraService.register();
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
@RequestMapping("outLine") |
|
|
|
// @RequestMapping("outLine")
|
|
|
|
public R outLine(){ |
|
|
|
// public R outLine(){
|
|
|
|
return cameraService.outLine(); |
|
|
|
// return cameraService.outLine();
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
@RequestMapping("reboot/{id}") |
|
|
|
// @RequestMapping("reboot/{id}")
|
|
|
|
public R reboot(@PathVariable("id") Long id){ |
|
|
|
// public R reboot(@PathVariable("id") Long id){
|
|
|
|
Camera c = cameraService.getById(id); |
|
|
|
// Camera c = cameraService.getById(id);
|
|
|
|
return cameraService.rebootByLoginId(c); |
|
|
|
// return cameraService.rebootByLoginId(c);
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
@RequestMapping("showVideo/{id}") |
|
|
|
// @RequestMapping("showVideo/{id}")
|
|
|
|
public R showVideo(HttpServletRequest request,@PathVariable("id") Long id){ |
|
|
|
// public R showVideo(HttpServletRequest request,@PathVariable("id") Long id){
|
|
|
|
//解析ip地址,非服务器ip禁止打开视频
|
|
|
|
// //解析ip地址,非服务器ip禁止打开视频
|
|
|
|
String ip = IPUtils.getIpAddr(request); |
|
|
|
// String ip = IPUtils.getIpAddr(request);
|
|
|
|
List<String> ipArr = Arrays.asList(serverIp,"127.0.0.1"); |
|
|
|
// List<String> ipArr = Arrays.asList(serverIp,"127.0.0.1");
|
|
|
|
System.out.println("show video ip : " + ip); |
|
|
|
// System.out.println("show video ip : " + ip);
|
|
|
|
if(ipArr.contains(ip)) { |
|
|
|
// if(ipArr.contains(ip)) {
|
|
|
|
Camera c = cameraService.getById(id); |
|
|
|
// Camera c = cameraService.getById(id);
|
|
|
|
System.out.println("show loginID:" + c.getLoginId()); |
|
|
|
// System.out.println("show loginID:" + c.getLoginId());
|
|
|
|
RegisterUtil window = new RegisterUtil(); |
|
|
|
// RegisterUtil window = new RegisterUtil();
|
|
|
|
window.m_frame.setVisible(true); |
|
|
|
// window.m_frame.setVisible(true);
|
|
|
|
window.showVideo(new NativeLong(Long.parseLong(c.getLoginId()))); |
|
|
|
// window.showVideo(new NativeLong(Long.parseLong(c.getLoginId())));
|
|
|
|
return R.ok(); |
|
|
|
// return R.ok();
|
|
|
|
} |
|
|
|
// }
|
|
|
|
return R.error("请在服务器上查看视频"); |
|
|
|
// return R.error("请在服务器上查看视频");
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
/** |
|
|
|
// /**
|
|
|
|
* 查询摄像头未绑定站点的 |
|
|
|
// * 查询摄像头未绑定站点的
|
|
|
|
*/ |
|
|
|
// */
|
|
|
|
@RequestMapping("/cameraNoList") |
|
|
|
// @RequestMapping("/cameraNoList")
|
|
|
|
public R getCameraList(){ |
|
|
|
// public R getCameraList(){
|
|
|
|
return R.ok().put("data",cameraService.getCameraList()); |
|
|
|
// return R.ok().put("data",cameraService.getCameraList());
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
/** |
|
|
|
// /**
|
|
|
|
* 根据站点表的id查询摄像头信息 |
|
|
|
// * 根据站点表的id查询摄像头信息
|
|
|
|
*/ |
|
|
|
// */
|
|
|
|
@RequestMapping("/cameraBySid/{sid}") |
|
|
|
// @RequestMapping("/cameraBySid/{sid}")
|
|
|
|
public R getCameraBySid(@PathVariable("sid") Long sid) { |
|
|
|
// public R getCameraBySid(@PathVariable("sid") Long sid) {
|
|
|
|
return R.ok().put("data",cameraService.getCameraBySid(sid)); |
|
|
|
// return R.ok().put("data",cameraService.getCameraBySid(sid));
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
/** |
|
|
|
// /**
|
|
|
|
* 刷新4G信号强度 |
|
|
|
// * 刷新4G信号强度
|
|
|
|
*/ |
|
|
|
// */
|
|
|
|
@RequestMapping("/refreshRssi/{id}") |
|
|
|
// @RequestMapping("/refreshRssi/{id}")
|
|
|
|
public R refreshRssiLevel(@PathVariable("id") Long id){ |
|
|
|
// public R refreshRssiLevel(@PathVariable("id") Long id){
|
|
|
|
Camera c = cameraService.getById(id); |
|
|
|
// Camera c = cameraService.getById(id);
|
|
|
|
if(c.getStatus() == 0 || StringUtils.isBlank(c.getLoginId())){ |
|
|
|
// if(c.getStatus() == 0 || StringUtils.isBlank(c.getLoginId())){
|
|
|
|
return R.error("设备未在线"); |
|
|
|
// return R.error("设备未在线");
|
|
|
|
} |
|
|
|
// }
|
|
|
|
int level = CameraUtil.get4gRssiLevel(new NativeLong(Long.parseLong(c.getLoginId()))); |
|
|
|
// int level = CameraUtil.get4gRssiLevel(new NativeLong(Long.parseLong(c.getLoginId())));
|
|
|
|
c.setRssiLevel(level); |
|
|
|
// c.setRssiLevel(level);
|
|
|
|
cameraService.updateById(c); |
|
|
|
// cameraService.updateById(c);
|
|
|
|
return R.ok(); |
|
|
|
// return R.ok();
|
|
|
|
} |
|
|
|
// }
|
|
|
|
/** |
|
|
|
// /**
|
|
|
|
* 查询摄像头重启数据 |
|
|
|
// * 查询摄像头重启数据
|
|
|
|
*/ |
|
|
|
// */
|
|
|
|
@RequestMapping("/getautocfg/{id}") |
|
|
|
// @RequestMapping("/getautocfg/{id}")
|
|
|
|
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.getById(id);
|
|
|
|
|
|
|
|
//
|
|
|
|
run_device_cfg cfg = new run_device_cfg(); |
|
|
|
// run_device_cfg cfg = new run_device_cfg();
|
|
|
|
// Object data = JSON.toJSON(cfg.getAutoCfg(new NativeLong(Long.parseLong(camera.getLoginId())),nCommand)).toString();
|
|
|
|
//// 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); |
|
|
|
// NetStructs.STU_CFG_AUTO_MAINTAIN cc = cfg.getAutoCfg(new NativeLong(Long.parseLong(camera.getLoginId())),nCommand);
|
|
|
|
Map<String,Object> data = new HashMap<>(); |
|
|
|
// Map<String,Object> data = new HashMap<>();
|
|
|
|
data.put("bEnable",cc.bEnable); |
|
|
|
// data.put("bEnable",cc.bEnable);
|
|
|
|
data.put("uWeekDay",cc.uWeekDay); |
|
|
|
// data.put("uWeekDay",cc.uWeekDay);
|
|
|
|
data.put("uHour",cc.uHour); |
|
|
|
// data.put("uHour",cc.uHour);
|
|
|
|
return R.ok().put("data", data); |
|
|
|
// return R.ok().put("data", data);
|
|
|
|
} |
|
|
|
// }
|
|
|
|
/** |
|
|
|
// /**
|
|
|
|
* 设置摄像头重启 |
|
|
|
// * 设置摄像头重启
|
|
|
|
*/ |
|
|
|
// */
|
|
|
|
@RequestMapping("/setautocfg") |
|
|
|
// @RequestMapping("/setautocfg")
|
|
|
|
public R setAutoCfg(@RequestBody Map<String, Object> params){ |
|
|
|
// public R setAutoCfg(@RequestBody Map<String, Object> params){
|
|
|
|
int id = (Integer) params.get("id"); |
|
|
|
// int id = (Integer) params.get("id");
|
|
|
|
Camera camera = cameraService.getById(id); |
|
|
|
// Camera camera = cameraService.getById(id);
|
|
|
|
|
|
|
|
//
|
|
|
|
run_device_cfg cfg = new run_device_cfg(); |
|
|
|
// run_device_cfg cfg = new run_device_cfg();
|
|
|
|
return cfg.setAutoFtpCfg(new NativeLong(Long.parseLong(camera.getLoginId())), |
|
|
|
// return cfg.setAutoFtpCfg(new NativeLong(Long.parseLong(camera.getLoginId())),
|
|
|
|
Integer.parseInt(params.get("bEnable").toString()), |
|
|
|
// Integer.parseInt(params.get("bEnable").toString()),
|
|
|
|
Integer.parseInt(params.get("uHour").toString()), |
|
|
|
// Integer.parseInt(params.get("uHour").toString()),
|
|
|
|
Integer.parseInt(params.get("uWeekDay").toString())); |
|
|
|
// Integer.parseInt(params.get("uWeekDay").toString()));
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
} |
|
|
|
// }
|
|
|
|
/** |
|
|
|
// /**
|
|
|
|
* 获取日志 |
|
|
|
// * 获取日志
|
|
|
|
*/ |
|
|
|
// */
|
|
|
|
@RequestMapping("/getloginfo") |
|
|
|
// @RequestMapping("/getloginfo")
|
|
|
|
public R getloginfo(@RequestParam Map<String, Object> params){ |
|
|
|
// public R getloginfo(@RequestParam Map<String, Object> params){
|
|
|
|
|
|
|
|
//
|
|
|
|
String id = (String) params.get("id"); |
|
|
|
// String id = (String) params.get("id");
|
|
|
|
String startTime = (String) params.get("startTime"); |
|
|
|
// String startTime = (String) params.get("startTime");
|
|
|
|
String endTime = (String) params.get("endTime"); |
|
|
|
// String endTime = (String) params.get("endTime");
|
|
|
|
|
|
|
|
//
|
|
|
|
Camera camera = cameraService.getById(id); |
|
|
|
// 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();
|
|
|
|
|
|
|
|
//
|
|
|
|
List<LogInfo> data = logSearch.logInfoSearchByTime(new NativeLong(Long.parseLong(camera.getLoginId())), startTime, endTime); |
|
|
|
// List<LogInfo> data = logSearch.logInfoSearchByTime(new NativeLong(Long.parseLong(camera.getLoginId())), startTime, endTime);
|
|
|
|
|
|
|
|
//
|
|
|
|
return R.ok().put("data",data); |
|
|
|
// return R.ok().put("data",data);
|
|
|
|
|
|
|
|
//
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
@RequestMapping("/getLigntCfg/{id}") |
|
|
|
// @RequestMapping("/getLigntCfg/{id}")
|
|
|
|
public R getLigntCfg(@PathVariable("id") Long id){ |
|
|
|
// public R getLigntCfg(@PathVariable("id") Long id){
|
|
|
|
Camera camera = cameraService.getById(id); |
|
|
|
// Camera camera = cameraService.getById(id);
|
|
|
|
run_device_cfg cfg = new run_device_cfg(); |
|
|
|
// run_device_cfg cfg = new run_device_cfg();
|
|
|
|
NativeLong loginID = new NativeLong(Long.parseLong(camera.getLoginId())); |
|
|
|
// NativeLong loginID = new NativeLong(Long.parseLong(camera.getLoginId()));
|
|
|
|
Map<String,Object> map = cfg.getLigntCfg(loginID); |
|
|
|
// Map<String,Object> map = cfg.getLigntCfg(loginID);
|
|
|
|
return R.ok().put("data",map); |
|
|
|
// return R.ok().put("data",map);
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
@RequestMapping("/setLightCfg") |
|
|
|
// @RequestMapping("/setLightCfg")
|
|
|
|
public R setLightCfg(@RequestBody Map<String,Object> params){ |
|
|
|
// public R setLightCfg(@RequestBody Map<String,Object> params){
|
|
|
|
Integer id = (Integer) params.get("id"); |
|
|
|
// Integer id = (Integer) params.get("id");
|
|
|
|
Integer emMode = Integer.parseInt((String) params.get("emMode")); |
|
|
|
// Integer emMode = Integer.parseInt((String) params.get("emMode"));
|
|
|
|
Integer nPreValue = (Integer) params.get("nPreValue"); |
|
|
|
// Integer nPreValue = (Integer) params.get("nPreValue");
|
|
|
|
Integer nBrightness = (Integer) params.get("nBrightness"); |
|
|
|
// Integer nBrightness = (Integer) params.get("nBrightness");
|
|
|
|
String startTime1 = (String) params.get("startTime1"); |
|
|
|
// String startTime1 = (String) params.get("startTime1");
|
|
|
|
String startTime2 = (String) params.get("startTime2"); |
|
|
|
// String startTime2 = (String) params.get("startTime2");
|
|
|
|
String endTime1 = (String) params.get("endTime1"); |
|
|
|
// String endTime1 = (String) params.get("endTime1");
|
|
|
|
String endTime2 = (String) params.get("endTime2"); |
|
|
|
// String endTime2 = (String) params.get("endTime2");
|
|
|
|
|
|
|
|
//
|
|
|
|
Camera camera = cameraService.getById(id); |
|
|
|
// Camera camera = cameraService.getById(id);
|
|
|
|
run_device_cfg cfg = new run_device_cfg(); |
|
|
|
// run_device_cfg cfg = new run_device_cfg();
|
|
|
|
NativeLong nativeID = new NativeLong(Long.parseLong(camera.getLoginId())); |
|
|
|
// NativeLong nativeID = new NativeLong(Long.parseLong(camera.getLoginId()));
|
|
|
|
|
|
|
|
//
|
|
|
|
boolean flag = cfg.setLightCfg(nativeID, emMode, nPreValue, nBrightness, startTime1, endTime1, startTime2, endTime2); |
|
|
|
// boolean flag = cfg.setLightCfg(nativeID, emMode, nPreValue, nBrightness, startTime1, endTime1, startTime2, endTime2);
|
|
|
|
if (flag){ |
|
|
|
// if (flag){
|
|
|
|
return R.ok(); |
|
|
|
// return R.ok();
|
|
|
|
} |
|
|
|
// }
|
|
|
|
return R.error(); |
|
|
|
// return R.error();
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
@RequestMapping("/setNowTime/{id}") |
|
|
|
// @RequestMapping("/setNowTime/{id}")
|
|
|
|
public R setNowTime(@PathVariable("id")Long id){ |
|
|
|
// public R setNowTime(@PathVariable("id")Long id){
|
|
|
|
Camera camera = cameraService.getById(id); |
|
|
|
// Camera camera = cameraService.getById(id);
|
|
|
|
CameraUtil.setNowTime(new NativeLong(Long.parseLong(camera.getLoginId()))); |
|
|
|
// CameraUtil.setNowTime(new NativeLong(Long.parseLong(camera.getLoginId())));
|
|
|
|
return R.ok(); |
|
|
|
// return R.ok();
|
|
|
|
} |
|
|
|
// }
|
|
|
|
} |
|
|
|
} |
|
|
|