Browse Source

优化

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

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

@ -24,10 +24,9 @@ import utils.run_device_log_search;
import javax.annotation.Resource; 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.text.ParseException;
import java.util.HashMap; import java.text.SimpleDateFormat;
import java.util.List; import java.util.*;
import java.util.Map;
/** /**
* 摄像机Controller * 摄像机Controller
@ -231,26 +230,36 @@ public class CameraController extends BaseController
} }
@RequestMapping("/getDate/{id}") @RequestMapping("/getLigntCfg/{id}")
public R getDate(@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> data = cfg.getLigntCfg(loginID); Map<String,Object> map = cfg.getLigntCfg(loginID);
return R.ok().put("data",data); return R.ok().put("data",map);
} }
@RequestMapping("/updatedate") @RequestMapping("/setLightCfg")
public R updateDate(@RequestBody Map<String,Object> params){ public R setLightCfg(@RequestBody Map<String,Object> params){
String id = (String) params.get("id"); 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); 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()));
cfg.getLigntCfg(nativeID);
int model = Integer.parseInt((String)params.get("model")); boolean flag = cfg.setLightCfg(nativeID, emMode, nPreValue, nBrightness, startTime1, endTime1, startTime2, endTime2);
System.out.println(params); if (flag){
return R.ok(); 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 {
* @param startTime 开始时间 :: * @param startTime 开始时间 ::
* @param endTime 结束时间 :: * @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 //10:10:11
int startHour = Integer.parseInt(startTime.substring(0,2)); int startHour = Integer.parseInt(startTime.substring(0,2));
int startMinute = Integer.parseInt(startTime.substring(3,5)); int startMinute = Integer.parseInt(startTime.substring(3,5));
@ -3536,6 +3536,13 @@ public class run_device_cfg implements ActionListener, ListSelectionListener {
int endMinute = Integer.parseInt(endTime.substring(3,5)); int endMinute = Integer.parseInt(endTime.substring(3,5));
int endSecond = Integer.parseInt(endTime.substring(6,8)); 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; int nCommand = EM_DEVICE_CFG_TYPE.DEVICE_CFG_SOC_CONSTANT_LAMP;
NetStructs.STU_CFG_SOC_CONSTANT_LAMP_PARAM cfgSupplementLightItem = getCfgSupplementLightItem(loginID,nCommand); NetStructs.STU_CFG_SOC_CONSTANT_LAMP_PARAM cfgSupplementLightItem = getCfgSupplementLightItem(loginID,nCommand);
cfgSupplementLightItem.stSOCLamps[0].emMode = emMode; cfgSupplementLightItem.stSOCLamps[0].emMode = emMode;
@ -3551,6 +3558,14 @@ public class run_device_cfg implements ActionListener, ListSelectionListener {
s.stuTimeSection[0].nEndHour= endHour; s.stuTimeSection[0].nEndHour= endHour;
s.stuTimeSection[0].nEndMinute= endMinute; s.stuTimeSection[0].nEndMinute= endMinute;
s.stuTimeSection[0].nEndSecond= endSecond; 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); IntByReference inBufferSize = new IntByReference(0);
@ -3568,6 +3583,7 @@ public class run_device_cfg implements ActionListener, ListSelectionListener {
6000); 6000);
System.out.println("set light config result = " + result); System.out.println("set light config result = " + result);
return result;
} }

Loading…
Cancel
Save