From 10307b4d85572ee11b09eb66c2e25ad8330262f7 Mon Sep 17 00:00:00 2001 From: blankk <2649084208@qq.com> Date: Tue, 12 Jul 2022 16:58:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../camera/controller/CameraController.java | 32 ++++- .../src/main/java/utils/CameraUtil.java | 13 +- .../src/main/java/utils/run_device_cfg.java | 126 ++++++------------ 3 files changed, 76 insertions(+), 95 deletions(-) diff --git a/ruoyi-code/src/main/java/com/ruoyi/code/camera/controller/CameraController.java b/ruoyi-code/src/main/java/com/ruoyi/code/camera/controller/CameraController.java index 8cd9867..e3e175b 100644 --- a/ruoyi-code/src/main/java/com/ruoyi/code/camera/controller/CameraController.java +++ b/ruoyi-code/src/main/java/com/ruoyi/code/camera/controller/CameraController.java @@ -1,7 +1,8 @@ package com.ruoyi.code.camera.controller; -import com.alibaba.fastjson.JSON; +import com.ruoyi.code.camera.domain.Camera; import com.ruoyi.code.camera.domain.LogInfo; +import com.ruoyi.code.camera.service.ICameraService; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.page.R; @@ -9,15 +10,11 @@ import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.IPUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.code.camera.domain.Camera; -import com.ruoyi.code.camera.service.ICameraService; import com.sun.jna.NativeLong; -import com.sun.jna.ptr.IntByReference; import org.springframework.beans.factory.annotation.Value; 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; @@ -233,4 +230,27 @@ public class CameraController extends BaseController return R.ok().put("data",data); } -} + + @RequestMapping("/getDate/{id}") + public R getDate(@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 data = cfg.getLigntCfg(loginID); + return R.ok().put("data",data); + } + + @RequestMapping("/updatedate") + public R updateDate(@RequestBody Map params){ + String id = (String) params.get("id"); + 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(); + } + + + } diff --git a/ruoyi-code/src/main/java/utils/CameraUtil.java b/ruoyi-code/src/main/java/utils/CameraUtil.java index b817a03..677b859 100644 --- a/ruoyi-code/src/main/java/utils/CameraUtil.java +++ b/ruoyi-code/src/main/java/utils/CameraUtil.java @@ -1,16 +1,14 @@ package utils; import com.alibaba.fastjson.JSON; -import com.ruoyi.code.camera.domain.LogInfo; import com.ruoyi.common.utils.DateUtils; import com.sun.jna.NativeLong; import com.sun.jna.ptr.IntByReference; -import sdk.java.lib.netmanager.NetEnums; import sdk.java.lib.netmanager.NetLib; import sdk.java.lib.netmanager.NetStructs; import java.util.Date; -import java.util.List; +import java.util.Map; public class CameraUtil { public static void main(String[] args) { @@ -28,12 +26,13 @@ public class CameraUtil { System.out.println("loginID = "+loginID); run_device_cfg cfg = new run_device_cfg(); - cfg.getLigntCfg(loginID); + Map ligntCfg = cfg.getLigntCfg(loginID); + System.out.println(JSON.toJSON(ligntCfg).toString()); System.out.println("=================================="); //设置参数 - cfg.setLightCfg(loginID, NetEnums.EM_DEV_SUP_LIGHT_MODE.EM_DEV_SUP_LIGHT_MODE_FORCE_AUTO,30,60,"13:50:00","14:00:00"); - System.out.println("=================================="); - cfg.getLigntCfg(loginID); +// cfg.setLightCfg(loginID, NetEnums.EM_DEV_SUP_LIGHT_MODE.EM_DEV_SUP_LIGHT_MODE_FORCE_AUTO,30,60,"13:50:00","14:00:00"); +// System.out.println("=================================="); +// cfg.getLigntCfg(loginID); } /** diff --git a/ruoyi-code/src/main/java/utils/run_device_cfg.java b/ruoyi-code/src/main/java/utils/run_device_cfg.java index 255de9a..a444cbd 100644 --- a/ruoyi-code/src/main/java/utils/run_device_cfg.java +++ b/ruoyi-code/src/main/java/utils/run_device_cfg.java @@ -1,100 +1,33 @@ package utils; -import java.awt.Container; -import java.awt.EventQueue; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.Calendar; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Map; -import java.util.Vector; - -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JOptionPane; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.JTextField; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; -import javax.swing.table.DefaultTableModel; -import javax.swing.table.JTableHeader; -import javax.swing.table.TableCellRenderer; -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; import com.sun.jna.ptr.IntByReference; - import sdk.java.common.GlobalTool; import sdk.java.lib.DataUtils; import sdk.java.lib.netmanager.NetDefs; import sdk.java.lib.netmanager.NetEnums; -import sdk.java.lib.netmanager.NetLib; import sdk.java.lib.netmanager.NetEnums.EM_DEVICE_CFG_TYPE; import sdk.java.lib.netmanager.NetEnums.EM_WHITE_BALANCE; +import sdk.java.lib.netmanager.NetLib; import sdk.java.lib.netmanager.NetStructs; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_ALARM_IN_PARAM; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_ALARM_OUT_PARAM; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_ALARM_PARAM; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_ALL_NETCARD; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_AUTO_MAINTAIN; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_CAMERA; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_CAPTURE_MODE; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_CLOUD_SERVICE; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_COM; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_COM_ITEM; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_DST; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_ENCODE_CONFIG_PARAM; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_ENCODE_PARAM; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_FACE_GROUP_RECOGNIZE_RULE; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_FACE_GROUP_RECOGNIZE_RULES; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_GB28181_PARAM; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_INTELLI_RULE_FACE_DETECT; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_INTELLI_RULE_FACE_STATISTIC; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_INTELLI_SCENE_FACE_DETECT; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_LOG; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_LOG_INFO; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_NET_PORT; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_NET_RTSP; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_NET_SERVICE; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_NET_STORAGE_FTP; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_NET_STORAGE_TRANS; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_NET_STORAGE_TRANS_ITEM; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_NET_WB_INFO; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_NET_WB_ITEM; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_NET_WEB; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_NTP; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_ONE_NETCARD; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_ONVIF; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_OVERLAP_PIC; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_RECORD; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_SNAP_CUTOUT; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_SNAP_TIMES; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_STORAGE; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_TELNET; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_USER_GET; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_USER_INFO; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_USER_ONLINE_ITEM; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_USER_ONLINE_ITEMS; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_USER_SET; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_VIDEO_OSD; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_WATER_MARK; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_WIFI_CONFIG; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_ZK_SERVICE; -import sdk.java.lib.netmanager.NetStructs.STU_CFG_ZK_SERVICE_ITEM; -import sdk.java.lib.netmanager.NetStructs.STU_SYS_INFO; -import sdk.java.lib.netmanager.NetStructs.STU_SYS_PROCESSOR_INFO; -import sdk.java.lib.netmanager.NetStructs.STU_TIME; +import sdk.java.lib.netmanager.NetStructs.*; + +import javax.swing.*; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.JTableHeader; +import javax.swing.table.TableCellRenderer; +import javax.swing.table.TableColumn; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.*; public class run_device_cfg implements ActionListener, ListSelectionListener { @@ -3523,7 +3456,7 @@ public class run_device_cfg implements ActionListener, ListSelectionListener { System.out.println("result = " + result); } - public void getLigntCfg(NativeLong loginID){ + public Map getLigntCfg(NativeLong loginID){ 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_ITEM item = cfgSupplementLightItem.stSOCLamps[0]; @@ -3536,6 +3469,7 @@ public class run_device_cfg implements ActionListener, ListSelectionListener { int nBrightness = item.nBrightness; NetStructs.STU_TIME_SECTION_SCHEDULE timeInterval = item.stuWeekTimeSection.stuTimeDay[0].stuTimeSection[0]; + NetStructs.STU_TIME_SECTION_SCHEDULE timeInterval2 = item.stuWeekTimeSection.stuTimeDay[0].stuTimeSection[1]; int isEnable = timeInterval.bValue; int startHour = timeInterval.nStartHour; int startMinute = timeInterval.nStartMinute; @@ -3544,6 +3478,14 @@ public class run_device_cfg implements ActionListener, ListSelectionListener { int endMinute = timeInterval.nEndMinute; int endSecond = timeInterval.nEndSecond; + int isEnable2 = timeInterval2.bValue; + int startHour2 = timeInterval2.nStartHour; + int startMinute2 = timeInterval2.nStartMinute; + int startSecond2 = timeInterval2.nStartSecond; + int endHour2 = timeInterval2.nEndHour; + int endMinute2 = timeInterval2.nEndMinute; + int endSecond2 = timeInterval2.nEndSecond; + System.out.println("emMode="+emMode); System.out.println("nPreValue="+nPreValue); System.out.println("nBrightness="+nBrightness); @@ -3554,6 +3496,26 @@ public class run_device_cfg implements ActionListener, ListSelectionListener { System.out.println("endHour="+endHour); System.out.println("endMinute="+endMinute); System.out.println("endSecond="+endSecond); + Map map = new HashMap<>(); + map.put("emMode",emMode); + map.put("nPreValue",nPreValue); + map.put("nBrightness",nBrightness); + map.put("isEnable",isEnable); + map.put("startHour",startHour); + map.put("startMinute",startMinute); + map.put("startSecond",startSecond); + map.put("endHour",endHour); + map.put("endMinute",endMinute); + map.put("endSecond",endSecond); + + map.put("isEnable2",isEnable2); + map.put("startHour2",startHour2); + map.put("startMinute2",startMinute2); + map.put("startSecond2",startSecond2); + map.put("endHour2",endHour2); + map.put("endMinute2",endMinute2); + map.put("endSecond2",endSecond2); + return map; } /**