Compare commits

..

No commits in common. '2e2f0b34a45b7e716b332f8c189e2f18e8b45a88' and '97d8014087fbad57603c5b6e08e5120c30482f7f' have entirely different histories.

  1. 53
      ruoyi-code/src/main/java/com/ruoyi/code/camera/controller/CameraController.java
  2. 12
      ruoyi-code/src/main/java/com/ruoyi/code/camera/domain/LogInfo.java
  3. 20
      ruoyi-code/src/main/java/utils/run_device_cfg.java
  4. 9
      ruoyi-code/src/main/java/utils/run_device_log_search.java

53
ruoyi-code/src/main/java/com/ruoyi/code/camera/controller/CameraController.java

@ -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();
}
}

12
ruoyi-code/src/main/java/com/ruoyi/code/camera/domain/LogInfo.java

@ -37,16 +37,4 @@ public class LogInfo implements Serializable{ @@ -37,16 +37,4 @@ public class LogInfo implements Serializable{
/** 客户端类型 */
private String cClientType;
public LogInfo(String cLogTime,String cOperUserName,String cMainType,String cSubType,String cRemoteIP,String cClientType){
this.cLogTime=cLogTime;
this.cOperUserName=cOperUserName;
this.cMainType=cMainType;
this.cSubType=cSubType;
this.cRemoteIP=cRemoteIP;
this.cClientType=cClientType;
}
public LogInfo(){
}
}

20
ruoyi-code/src/main/java/utils/run_device_cfg.java

@ -29,7 +29,6 @@ import javax.swing.table.TableColumn; @@ -29,7 +29,6 @@ import javax.swing.table.TableColumn;
import com.alibaba.fastjson.JSON;
import com.ruoyi.code.camera.domain.Camera;
import com.ruoyi.code.camera.domain.CameraNetFtp;
import com.ruoyi.common.core.page.R;
import com.sun.jna.NativeLong;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
@ -3725,9 +3724,8 @@ public class run_device_cfg implements ActionListener, ListSelectionListener { @@ -3725,9 +3724,8 @@ public class run_device_cfg implements ActionListener, ListSelectionListener {
6000);
STU_CFG_AUTO_MAINTAIN stuCfgAutoMaintain = new STU_CFG_AUTO_MAINTAIN();
DataUtils.sdk_data_ptrToStructure(ptrOutBuffer, stuCfgAutoMaintain);
System.out.println(stuCfgAutoMaintain);
return stuCfgAutoMaintain;
}
@ -3740,7 +3738,7 @@ public class run_device_cfg implements ActionListener, ListSelectionListener { @@ -3740,7 +3738,7 @@ public class run_device_cfg implements ActionListener, ListSelectionListener {
* @param uWeekDay 周几重启
* @return
*/
public R setAutoFtpCfg(NativeLong loginID, int bEnable,int uHour,int uWeekDay){
public STU_CFG_AUTO_MAINTAIN setAutoFtpCfg(NativeLong loginID, int bEnable,int uHour,int uWeekDay){
@ -3755,17 +3753,16 @@ public class run_device_cfg implements ActionListener, ListSelectionListener { @@ -3755,17 +3753,16 @@ public class run_device_cfg implements ActionListener, ListSelectionListener {
stuCfgAutoMaintain.uHour=uHour;
stuCfgAutoMaintain.uWeekDay=uWeekDay;
System.out.println(JSON.toJSON(stuCfgAutoMaintain));
inBufferSize.setValue(stuCfgAutoMaintain.size());
Pointer ptrInBuffer = DataUtils.sdk_data_createPtr(inBufferSize.getValue());
DataUtils.sdk_data_structureToPtr(stuCfgAutoMaintain, ptrInBuffer, 0);
if(null == ptrInBuffer) {
System.out.println(ptrInBuffer);
return R.error();
}
if(null == ptrInBuffer)
return null;
boolean bResult2 = NetLib.instance.Net_SetDeviceCfg(
loginID,
nCommand,
@ -3778,10 +3775,9 @@ public class run_device_cfg implements ActionListener, ListSelectionListener { @@ -3778,10 +3775,9 @@ public class run_device_cfg implements ActionListener, ListSelectionListener {
{
int error = NetLib.instance.Net_LastError();
String strError = String.format("Net_SetDeviceCfg fail, command = %d, errorCode = %d", nCommand, error);
System.out.println(strError);
return R.error(500,strError);
return null;
}
System.out.println(stuCfgAutoMaintain);
return R.ok();
return stuCfgAutoMaintain;
}
}

9
ruoyi-code/src/main/java/utils/run_device_log_search.java

@ -391,7 +391,7 @@ public class run_device_log_search implements ActionListener { @@ -391,7 +391,7 @@ public class run_device_log_search implements ActionListener {
STU_CFG_LOG stuLogSearch = new STU_CFG_LOG();
if(StringUtils.isEmpty(strStartTime))
strStartTime = "2022-07-01 00:00:00";
strStartTime = "2000-01-01 00:00:00";
byte[] tmpByArr = DataUtils.sdk_data_stringToByteArray(strStartTime, GlobalTool.getEncodeType());
System.arraycopy(tmpByArr, 0, stuLogSearch.stuSearchCondition.cStartTime, 0, tmpByArr.length);
@ -435,10 +435,10 @@ public class run_device_log_search implements ActionListener { @@ -435,10 +435,10 @@ public class run_device_log_search implements ActionListener {
DataUtils.sdk_data_ptrToStructure(pBuffer, stuLogSearch);
LogInfo logInfo = new LogInfo();
for(int i=0; i<stuLogSearch.stuLogResult.uCurAmount; i++)
{
LogInfo logInfo = new LogInfo();
STU_CFG_LOG_INFO stuLogInfo = stuLogSearch.stuLogResult.stuResult[i];
String cLogTime = DataUtils.sdk_data_byteArrayToString(stuLogInfo.cLogTime, GlobalTool.getEncodeType());
@ -459,7 +459,8 @@ public class run_device_log_search implements ActionListener { @@ -459,7 +459,8 @@ public class run_device_log_search implements ActionListener {
String cClientType = DataUtils.sdk_data_byteArrayToString(stuLogInfo.stuLogDetail.cClientType, GlobalTool.getEncodeType());
logInfo.setCClientType(cClientType);
System.out.println(cClientType);
System.out.println(JSON.toJSON(logInfo));
logInfoList.add(logInfo);
}

Loading…
Cancel
Save