Browse Source

优化

platform-api
blank 2 years ago
parent
commit
2e34f6db7e
  1. 39
      ruoyi-code/src/main/java/com/ruoyi/code/camera/controller/CameraController.java
  2. 18
      ruoyi-code/src/main/java/utils/run_device_cfg.java

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

@ -24,10 +24,9 @@ import utils.run_device_log_search; @@ -24,10 +24,9 @@ import utils.run_device_log_search;
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;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* 摄像机Controller
@ -231,25 +230,35 @@ public class CameraController extends BaseController @@ -231,25 +230,35 @@ public class CameraController extends BaseController
}
@RequestMapping("/getDate/{id}")
public R getDate(@PathVariable("id") Long id){
@RequestMapping("/getLigntCfg/{id}")
public R getLigntCfg(@PathVariable("id") Long id){
Camera camera = cameraService.getById(id);
run_device_cfg cfg = new run_device_cfg();
NativeLong loginID = new NativeLong(Long.parseLong(camera.getLoginId()));
Map<String,Object> data = cfg.getLigntCfg(loginID);
return R.ok().put("data",data);
Map<String,Object> map = cfg.getLigntCfg(loginID);
return R.ok().put("data",map);
}
@RequestMapping("/updatedate")
public R updateDate(@RequestBody Map<String,Object> params){
String id = (String) params.get("id");
@RequestMapping("/setLightCfg")
public R setLightCfg(@RequestBody Map<String,Object> params){
Integer id = (Integer) params.get("id");
Integer emMode = Integer.parseInt((String) params.get("emMode"));
Integer nPreValue = (Integer) params.get("nPreValue");
Integer nBrightness = (Integer) params.get("nBrightness");
String startTime1 = (String) params.get("startTime1");
String startTime2 = (String) params.get("startTime2");
String endTime1 = (String) params.get("endTime1");
String endTime2 = (String) params.get("endTime2");
Camera camera = cameraService.getById(id);
run_device_cfg cfg = new run_device_cfg();
NativeLong nativeID = new NativeLong(Long.parseLong(camera.getLoginId()));
cfg.getLigntCfg(nativeID);
int model = Integer.parseInt((String)params.get("model"));
System.out.println(params);
return R.ok();
boolean flag = cfg.setLightCfg(nativeID, emMode, nPreValue, nBrightness, startTime1, endTime1, startTime2, endTime2);
if (flag){
return R.ok();
}
return R.error();
}

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

@ -3527,7 +3527,7 @@ public class run_device_cfg implements ActionListener, ListSelectionListener { @@ -3527,7 +3527,7 @@ public class run_device_cfg implements ActionListener, ListSelectionListener {
* @param startTime 开始时间 ::
* @param endTime 结束时间 ::
*/
public void setLightCfg(NativeLong loginID,int emMode,int nPreValue,int nBrightness,String startTime , String endTime){
public boolean setLightCfg(NativeLong loginID,int emMode,int nPreValue,int nBrightness,String startTime , String endTime,String startTime2,String endTime2){
//10:10:11
int startHour = Integer.parseInt(startTime.substring(0,2));
int startMinute = Integer.parseInt(startTime.substring(3,5));
@ -3536,6 +3536,13 @@ public class run_device_cfg implements ActionListener, ListSelectionListener { @@ -3536,6 +3536,13 @@ public class run_device_cfg implements ActionListener, ListSelectionListener {
int endMinute = Integer.parseInt(endTime.substring(3,5));
int endSecond = Integer.parseInt(endTime.substring(6,8));
int startHour2 = Integer.parseInt(startTime2.substring(0,2));
int startMinute2 = Integer.parseInt(startTime2.substring(3,5));
int startSecond2 = Integer.parseInt(startTime2.substring(6,8));
int endHour2 = Integer.parseInt(endTime2.substring(0,2));
int endMinute2 = Integer.parseInt(endTime2.substring(3,5));
int endSecond2 = Integer.parseInt(endTime2.substring(6,8));
int nCommand = EM_DEVICE_CFG_TYPE.DEVICE_CFG_SOC_CONSTANT_LAMP;
NetStructs.STU_CFG_SOC_CONSTANT_LAMP_PARAM cfgSupplementLightItem = getCfgSupplementLightItem(loginID,nCommand);
cfgSupplementLightItem.stSOCLamps[0].emMode = emMode;
@ -3551,6 +3558,14 @@ public class run_device_cfg implements ActionListener, ListSelectionListener { @@ -3551,6 +3558,14 @@ public class run_device_cfg implements ActionListener, ListSelectionListener {
s.stuTimeSection[0].nEndHour= endHour;
s.stuTimeSection[0].nEndMinute= endMinute;
s.stuTimeSection[0].nEndSecond= endSecond;
s.stuTimeSection[1].bValue = (byte) 1;
s.stuTimeSection[1].nStartHour= startHour2;
s.stuTimeSection[1].nStartMinute= startMinute2;
s.stuTimeSection[1].nStartSecond= startSecond2;
s.stuTimeSection[1].nEndHour= endHour2;
s.stuTimeSection[1].nEndMinute= endMinute2;
s.stuTimeSection[1].nEndSecond= endSecond2;
}
IntByReference inBufferSize = new IntByReference(0);
@ -3568,6 +3583,7 @@ public class run_device_cfg implements ActionListener, ListSelectionListener { @@ -3568,6 +3583,7 @@ public class run_device_cfg implements ActionListener, ListSelectionListener {
6000);
System.out.println("set light config result = " + result);
return result;
}

Loading…
Cancel
Save