From 305fe6a8621998e5130d541660c2e3c5f02672d6 Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期一, 30 十月 2023 09:27:36 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ard-work/src/main/java/com/ruoyi/device/noguidezone/domain/ArdCameraNoGuideZone.java | 125 +++++
ard-work/src/main/java/com/ruoyi/utils/sdk/hiksdk/lib/ExceptionCallBack.java | 10
ard-work/src/main/resources/templates/test.html | 555 +++++++++++++++-------
ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java | 10
ard-work/src/main/java/com/ruoyi/device/camera/controller/ArdCamerasController.java | 23
ard-work/src/main/java/com/ruoyi/device/camera/service/IArdCamerasService.java | 25 +
ard-work/src/main/java/com/ruoyi/utils/sdk/dhsdk/service/impl/DhClientServiceImpl.java | 4
ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml | 30 +
ard-work/src/main/java/com/ruoyi/device/noguidezone/service/IArdCameraNoGuideZoneService.java | 61 ++
ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java | 4
ard-work/src/main/java/com/ruoyi/device/camera/controller/CameraSdkController.java | 38 +
ard-work/src/main/java/com/ruoyi/utils/sdk/hiksdk/service/impl/HikClientServiceImpl.java | 15
ard-work/src/main/java/com/ruoyi/alarmpoints/tube/controller/ArdTubesDetailsController.java | 1
ard-work/src/main/java/com/ruoyi/alarmpoints/well/mapper/ArdAlarmpointsWellMapper.java | 8
ard-work/src/main/java/com/ruoyi/device/noguidezone/mapper/ArdCameraNoGuideZoneMapper.java | 61 ++
ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java | 19
ard-work/src/main/java/com/ruoyi/device/noguidezone/controller/ArdCameraNoGuideZoneController.java | 113 ++++
ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java | 88 +++
ard-work/src/main/java/com/ruoyi/device/noguidezone/service/impl/ArdCameraNoGuideZoneServiceImpl.java | 98 ++++
ard-work/src/main/resources/mapper/device/ArdCameraNoGuideZoneMapper.xml | 99 ++++
20 files changed, 1,183 insertions(+), 204 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/controller/ArdTubesDetailsController.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/controller/ArdTubesDetailsController.java
index 2d2f9c3..d979117 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/controller/ArdTubesDetailsController.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/controller/ArdTubesDetailsController.java
@@ -120,6 +120,7 @@
String message = ardTubesDetailsService.importArdTubesDetails(tubesDetailsList, updateSupport, operName,tubeId);
return success(message);
}
+
@PostMapping("/importTemplate")
@ApiOperation(value = "绠$嚎璇︽儏妯℃澘涓嬭浇鎺ュ彛")
public void importTemplate(HttpServletResponse response)
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java
index 4df23f5..340b055 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java
@@ -152,9 +152,9 @@
@ApiOperation("瀵煎叆浜�")
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
ExcelUtil<ArdAlarmpointsWell> util = new ExcelUtil<ArdAlarmpointsWell>(ArdAlarmpointsWell.class);
- List<ArdAlarmpointsWell> userList = util.importExcel(file.getInputStream());
+ List<ArdAlarmpointsWell> wellList = util.importExcel(file.getInputStream());
String operName = getUsername();
- String message = ardAlarmpointsWellService.importUser(userList, updateSupport, operName);
+ String message = ardAlarmpointsWellService.importWell(wellList, updateSupport, operName);
return success(message);
}
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/mapper/ArdAlarmpointsWellMapper.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/mapper/ArdAlarmpointsWellMapper.java
index d48d616..87e7bd6 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/mapper/ArdAlarmpointsWellMapper.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/mapper/ArdAlarmpointsWellMapper.java
@@ -62,7 +62,13 @@
* @return 缁撴灉
*/
public int updateArdAlarmpointsWell(ArdAlarmpointsWell ardAlarmpointsWell);
-
+ /**
+ * 淇敼浜曠鐞嗘寜浜曞彿
+ *
+ * @param ardAlarmpointsWell 浜曠鐞�
+ * @return 缁撴灉
+ */
+ public int updateArdAlarmpointsWellByWellId(ArdAlarmpointsWell ardAlarmpointsWell);
/**
* 鍒犻櫎浜曠鐞�
*
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java
index a002a4d..ae2d433 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java
@@ -60,7 +60,13 @@
* @return 缁撴灉
*/
public int updateArdAlarmpointsWell(ArdAlarmpointsWell ardAlarmpointsWell);
-
+ /**
+ * 淇敼浜曠鐞嗘寜浜曞彿
+ *
+ * @param ardAlarmpointsWell 浜曠鐞�
+ * @return 缁撴灉
+ */
+ public int updateArdAlarmpointsWellByWellId(ArdAlarmpointsWell ardAlarmpointsWell);
/**
* 鎵归噺鍒犻櫎浜曠鐞�
*
@@ -84,7 +90,7 @@
* @param operName 鎿嶄綔鐢ㄦ埛
* @return 缁撴灉
*/
- public String importUser(List<ArdAlarmpointsWell> ardAlarmpointsWellList, Boolean isUpdateSupport, String operName);
+ public String importWell(List<ArdAlarmpointsWell> ardAlarmpointsWellList, Boolean isUpdateSupport, String operName);
/**
* 鏍¢獙鐢ㄦ埛鏄惁鏈夋暟鎹潈闄�
*
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java
index b2c5e8a..70182f0 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java
@@ -126,7 +126,13 @@
ardAlarmpointsWell.setUpdateTime(DateUtils.getNowDate());
return ardAlarmpointsWellMapper.updateArdAlarmpointsWell(ardAlarmpointsWell);
}
-
+ @Override
+ @Transactional
+ public int updateArdAlarmpointsWellByWellId(ArdAlarmpointsWell ardAlarmpointsWell) {
+ ardAlarmpointsWell.setUpdateBy(SecurityUtils.getUsername());
+ ardAlarmpointsWell.setUpdateTime(DateUtils.getNowDate());
+ return ardAlarmpointsWellMapper.updateArdAlarmpointsWellByWellId(ardAlarmpointsWell);
+ }
/**
* 鎵归噺鍒犻櫎浜曠鐞�
*
@@ -150,7 +156,7 @@
}
@Override
- public String importUser(List<ArdAlarmpointsWell> ardAlarmpointsWellList, Boolean isUpdateSupport, String operName) {
+ public String importWell(List<ArdAlarmpointsWell> ardAlarmpointsWellList, Boolean isUpdateSupport, String operName) {
if (StringUtils.isNull(ardAlarmpointsWellList) || ardAlarmpointsWellList.size() == 0) {
throw new ServiceException("瀵煎叆浜曟暟鎹笉鑳戒负绌猴紒");
}
@@ -163,9 +169,9 @@
//鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛id
String userId = SecurityUtils.getUserId();
well.setUserId(userId);
- // 楠岃瘉鏄惁瀛樺湪杩欎釜鐢ㄦ埛
- ArdAlarmpointsWell u = ardAlarmpointsWellMapper.selectArdAlarmpointsWellByWellId(well.getWellId());
- if (StringUtils.isNull(u)) {
+ // 楠岃瘉鏄惁瀛樺湪杩欎釜浜�
+ ArdAlarmpointsWell w = ardAlarmpointsWellMapper.selectArdAlarmpointsWellByWellId(well.getWellId());
+ if (StringUtils.isNull(w)) {
BeanValidators.validateWithException(validator, well);
well.setCreateBy(operName);
this.insertArdAlarmpointsWell(well);
@@ -173,10 +179,9 @@
successMsg.append("<br/>" + successNum + "銆佷簳鍙� " + well.getWellId() + " 瀵煎叆鎴愬姛");
} else if (isUpdateSupport) {
BeanValidators.validateWithException(validator, well);
- checkWellAllowed(well);
checkWellDataScope(well.getUserId());
well.setUpdateBy(operName);
- this.updateArdAlarmpointsWell(well);
+ this.updateArdAlarmpointsWellByWellId(well);
successNum++;
successMsg.append("<br/>" + successNum + "銆佷簳鍙� " + well.getWellId() + " 鏇存柊鎴愬姛");
} else {
diff --git a/ard-work/src/main/java/com/ruoyi/device/camera/controller/ArdCamerasController.java b/ard-work/src/main/java/com/ruoyi/device/camera/controller/ArdCamerasController.java
index 8c103db..9a28677 100644
--- a/ard-work/src/main/java/com/ruoyi/device/camera/controller/ArdCamerasController.java
+++ b/ard-work/src/main/java/com/ruoyi/device/camera/controller/ArdCamerasController.java
@@ -3,6 +3,7 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell;
import com.ruoyi.common.constant.CameraConstants;
import com.ruoyi.device.camera.domain.ArdCameras;
import com.ruoyi.device.camera.domain.CameraCmd;
@@ -27,6 +28,7 @@
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.core.page.TableDataInfo;
+import org.springframework.web.multipart.MultipartFile;
import java.util.*;
@@ -137,6 +139,27 @@
return toAjax(ardCamerasService.deleteArdCamerasByIds(ids));
}
+ @Log(title = "瀵煎叆鐩告満璁惧", businessType = BusinessType.IMPORT)
+ @PreAuthorize("@ss.hasPermi('device:cameras:import')")
+ @PostMapping("/importData")
+ @ApiOperation("瀵煎叆鐩告満璁惧")
+ public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
+ ExcelUtil<ArdCameras> util = new ExcelUtil<ArdCameras>(ArdCameras.class);
+ List<ArdCameras> camerasList = util.importExcel(file.getInputStream());
+ String operName = getUsername();
+ String message = ardCamerasService.importCameras(camerasList, updateSupport, operName);
+ return success(message);
+ }
+
+ @PostMapping("/importTemplate")
+ @ApiOperation("鐩告満璁惧瀵煎叆妯℃澘")
+ public void importTemplate(HttpServletResponse response) {
+ ExcelUtil<ArdCameras> util = new ExcelUtil<ArdCameras>(ArdCameras.class);
+ util.importTemplateExcel(response, "鐩告満璁惧鏁版嵁");
+ }
+
+
+
@GetMapping("/options")
@ApiOperation("閫夋嫨鐩告満鏁版嵁")
public List options(ArdCameras ardCameras) {
diff --git a/ard-work/src/main/java/com/ruoyi/device/camera/controller/CameraSdkController.java b/ard-work/src/main/java/com/ruoyi/device/camera/controller/CameraSdkController.java
index b19b27c..e3904b4 100644
--- a/ard-work/src/main/java/com/ruoyi/device/camera/controller/CameraSdkController.java
+++ b/ard-work/src/main/java/com/ruoyi/device/camera/controller/CameraSdkController.java
@@ -11,11 +11,18 @@
import com.ruoyi.device.camera.domain.CameraCmd;
import com.ruoyi.device.camera.service.IArdCamerasService;
import com.ruoyi.device.camera.service.ICameraSdkService;
+import com.ruoyi.device.noguidezone.domain.ArdCameraNoGuideZone;
+import com.ruoyi.device.noguidezone.service.IArdCameraNoGuideZoneService;
+import com.ruoyi.utils.gis.GisUtil;
+import com.ruoyi.utils.gis.Point;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
+
import javax.annotation.Resource;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -36,7 +43,8 @@
private ICameraSdkService cameraSdkService;
@Resource
private IArdCamerasService ardCamerasService;
-
+ @Autowired
+ private IArdCameraNoGuideZoneService ardCameraNoGuideZoneService;
@RequestMapping("/preview")
private String preview() {
@@ -137,6 +145,7 @@
Map<String, Object> ptzMap = cameraSdkService.getPtz(cmd);
return AjaxResult.success("鑾峰彇ptz", ptzMap);
}
+
@ApiOperation("鑾峰彇PTZ鑼冨洿")
@PostMapping("/getPTZScope")
@Log(title = "鑾峰彇PTZ鑼冨洿", businessType = BusinessType.CONTROL)
@@ -165,6 +174,33 @@
public @ResponseBody
AjaxResult setTargetPosition(@RequestBody CameraCmd cmd) {
cmd.setOperator(SecurityUtils.getUserId());
+ //鎷︽埅鎵嬪姩寮曞
+ ArdCameraNoGuideZone ardCameraNoGuideZone = new ArdCameraNoGuideZone();
+ ardCameraNoGuideZone.setCameraId(cmd.getCameraId());
+ //鑾峰彇褰撳墠鐩告満鐨勭寮曞彲瑙嗗煙鍒楄〃
+ List<ArdCameraNoGuideZone> ardCameraNoGuideZones = ardCameraNoGuideZoneService.selectArdCameraNoGuideZoneList(ardCameraNoGuideZone);
+ if (ardCameraNoGuideZones.size() > 0) {
+ //鑾峰彇鍒板綋鍓嶇浉鏈虹殑鍧愭爣闆嗗悎
+ List<Point> pointList = new ArrayList<>();
+ for(ArdCameraNoGuideZone zone:ardCameraNoGuideZones) {
+ String[] parts = zone.getPoi().split(",");
+ for (int i = 0; i < parts.length; i += 3) {
+ Point point = new Point();
+ point.setLongitude(Double.valueOf(parts[i]));
+ point.setLatitude(Double.valueOf(parts[i + 1]));
+ pointList.add(point);
+ }
+ }
+ double lon = cmd.getTargetPosition()[0];
+ double lat = cmd.getTargetPosition()[1];
+ Point targetPoint = new Point(lon, lat);
+ //鍒ゆ柇寮曞鐩爣鏄惁鍦ㄥ潗鏍囬泦鍚堢粍鎴愮殑澶氳竟褰㈠唴
+ boolean inPolygon = GisUtil.isInPolygon(targetPoint, pointList);
+ if(inPolygon)
+ {
+ return AjaxResult.error("寮曞鍧愭爣浣嶄簬绂佸紩鍙鍩熷唴");
+ }
+ }
return toAjax(cameraSdkService.guideTargetPosition(cmd));
}
diff --git a/ard-work/src/main/java/com/ruoyi/device/camera/service/IArdCamerasService.java b/ard-work/src/main/java/com/ruoyi/device/camera/service/IArdCamerasService.java
index b36ac59..cdacba2 100644
--- a/ard-work/src/main/java/com/ruoyi/device/camera/service/IArdCamerasService.java
+++ b/ard-work/src/main/java/com/ruoyi/device/camera/service/IArdCamerasService.java
@@ -5,6 +5,7 @@
import java.util.Map;
import java.util.TreeMap;
+import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell;
import com.ruoyi.device.camera.domain.ArdCameras;
import com.ruoyi.device.camera.domain.CameraCmd;
import com.ruoyi.scheduling.domian.SchedulingParam;
@@ -71,6 +72,30 @@
*/
public int deleteArdCamerasById(String id);
+
+ /**
+ * 瀵煎叆鐩告満璁惧淇℃伅
+ *
+ * @param ardCamerasList 鐩告満璁惧鏁版嵁鍒楄〃
+ * @param isUpdateSupport 鏄惁鏇存柊鏀寔锛屽鏋滃凡瀛樺湪锛屽垯杩涜鏇存柊鏁版嵁
+ * @param operName 鎿嶄綔鐢ㄦ埛
+ * @return 缁撴灉
+ */
+ public String importCameras(List<ArdCameras> ardCamerasList, Boolean isUpdateSupport, String operName);
+ /**
+ * 鏍¢獙鐩告満鏄惁鍏佽鎿嶄綔
+ *
+ * @param ardCameras 鐩告満淇℃伅
+ */
+ public void checkCameraAllowed(ArdCameras ardCameras);
+ /**
+ * 鏍¢獙鐢ㄦ埛鏄惁鏈夋暟鎹潈闄�
+ *
+ * @param userId 鐢ㄦ埛id
+ */
+ public void checkCameraDataScope(String userId);
+
+
public List findOptions(ArdCameras ardCameras);
/**
* @鎻忚堪 鑾峰彇鏈儴闂ㄤ互涓嬬殑鎵�鏈夌浉鏈哄拰閮ㄩ棬
diff --git a/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java b/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java
index 1ef2e1a..a8265ea 100644
--- a/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java
@@ -3,13 +3,18 @@
import java.util.*;
import java.util.stream.Collectors;
+import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell;
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.constant.CameraConstants;
import com.ruoyi.common.core.domain.entity.SysDept;
+import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.redis.RedisCache;
+import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.bean.BeanValidators;
+import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.device.camera.domain.CameraCmd;
import com.ruoyi.device.channel.domain.ArdChannel;
@@ -25,10 +30,12 @@
import com.ruoyi.system.mapper.SysDeptMapper;
import com.ruoyi.utils.gis.Point;
import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
+import javax.validation.Validator;
/**
* 鐩告満璁惧Service涓氬姟灞傚鐞�
@@ -50,7 +57,8 @@
private ArdChannelMapper ardChannelMapper;
@Resource
private IVtduService vtduService;
-
+ @Autowired
+ protected Validator validator;
@PostConstruct
public void loadCameras() {
@@ -200,6 +208,84 @@
return i;
}
+ @Override
+ public String importCameras(List<ArdCameras> ardCamerasList, Boolean isUpdateSupport, String operName) {
+ if (StringUtils.isNull(ardCamerasList) || ardCamerasList.size() == 0) {
+ throw new ServiceException("瀵煎叆浜曟暟鎹笉鑳戒负绌猴紒");
+ }
+ int successNum = 0;
+ int failureNum = 0;
+ StringBuilder successMsg = new StringBuilder();
+ StringBuilder failureMsg = new StringBuilder();
+ for (ArdCameras camera : ardCamerasList) {
+ try {
+ //鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛id
+ String userId = SecurityUtils.getUserId();
+ camera.setUserId(userId);
+ // 楠岃瘉鏄惁瀛樺湪杩欎釜鐢ㄦ埛
+ ArdCameras u = ardCamerasMapper.selectArdCamerasById(camera.getId());
+ if (StringUtils.isNull(u)) {
+ BeanValidators.validateWithException(validator, camera);
+ camera.setCreateBy(operName);
+ this.insertArdCameras(camera);
+ successNum++;
+ successMsg.append("<br/>" + successNum + "銆佺浉鏈篒D " + camera.getId() + " 瀵煎叆鎴愬姛");
+ } else if (isUpdateSupport) {
+ BeanValidators.validateWithException(validator, camera);
+ checkCameraDataScope(camera.getUserId());
+ camera.setUpdateBy(operName);
+ this.updateArdCameras(camera);
+ successNum++;
+ successMsg.append("<br/>" + successNum + "銆佺浉鏈篒D " + camera.getId() + " 鏇存柊鎴愬姛");
+ } else {
+ failureNum++;
+ failureMsg.append("<br/>" + failureNum + "銆佺浉鏈篒D " + camera.getId() + " 宸插瓨鍦�");
+ }
+ } catch (Exception e) {
+ failureNum++;
+ String msg = "<br/>" + failureNum + "銆佺浉鏈篒D " + camera.getId() + " 瀵煎叆澶辫触锛�";
+ failureMsg.append(msg + e.getMessage());
+ log.error(msg, e);
+ }
+ }
+ if (failureNum > 0) {
+ failureMsg.insert(0, "寰堟姳姝夛紝瀵煎叆澶辫触锛佸叡 " + failureNum + " 鏉℃暟鎹牸寮忎笉姝g‘锛岄敊璇涓嬶細");
+ throw new ServiceException(failureMsg.toString());
+ } else {
+ successMsg.insert(0, "鎭枩鎮紝鏁版嵁宸插叏閮ㄥ鍏ユ垚鍔燂紒鍏� " + successNum + " 鏉★紝鏁版嵁濡備笅锛�");
+ }
+ return successMsg.toString();
+ }
+
+ /**
+ * 鏍¢獙鐩告満鏄惁鍏佽鎿嶄綔
+ *
+ * @param ardCameras 鐩告満淇℃伅
+ */
+ @Override
+ public void checkCameraAllowed(ArdCameras ardCameras) {
+ if (StringUtils.isNotNull(ardCameras.getId())) {
+ throw new ServiceException("涓嶅厑璁告搷浣滀簳");
+ }
+ }
+
+ /**
+ * 鏍¢獙鐢ㄦ埛鏄惁鏈夋暟鎹潈闄�
+ *
+ * @param userId 鐢ㄦ埛id
+ */
+ @Override
+ public void checkCameraDataScope(String userId) {
+ if (!SysUser.isAdmin(SecurityUtils.getUserId())) {
+ ArdCameras camera = new ArdCameras();
+ camera.setUserId(userId);
+ List<ArdCameras> cameras = SpringUtils.getAopProxy(this).selectArdCamerasList(camera);
+ if (StringUtils.isEmpty(cameras)) {
+ throw new ServiceException("娌℃湁鏉冮檺璁块棶浜曟暟鎹紒");
+ }
+ }
+ }
+
public List findOptions(ArdCameras ardCameras) {
List<ArdCameras> options = ardCamerasMapper.findOptions(ardCameras);
for (ArdCameras camera :
diff --git a/ard-work/src/main/java/com/ruoyi/device/noguidezone/controller/ArdCameraNoGuideZoneController.java b/ard-work/src/main/java/com/ruoyi/device/noguidezone/controller/ArdCameraNoGuideZoneController.java
new file mode 100644
index 0000000..d19e78d
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/device/noguidezone/controller/ArdCameraNoGuideZoneController.java
@@ -0,0 +1,113 @@
+package com.ruoyi.device.noguidezone.controller;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.device.noguidezone.domain.ArdCameraNoGuideZone;
+import com.ruoyi.device.noguidezone.service.IArdCameraNoGuideZoneService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 绂佸紩鍙鍩烠ontroller
+ *
+ * @author ard
+ * @date 2023-10-27
+ */
+@Api(tags = "绂佸紩鍙鍩熺鐞嗘帴鍙�")
+@RestController
+@RequestMapping("/device/noguidezone")
+public class ArdCameraNoGuideZoneController extends BaseController
+{
+ @Autowired
+ private IArdCameraNoGuideZoneService ardCameraNoGuideZoneService;
+
+ /**
+ * 鏌ヨ绂佸紩鍙鍩熷垪琛�
+ */
+ @ApiOperation("鏌ヨ绂佸紩鍙鍩熷垪琛�")
+ @PreAuthorize("@ss.hasPermi('device:noguidezone:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(ArdCameraNoGuideZone ardCameraNoGuideZone)
+ {
+ startPage();
+ List<ArdCameraNoGuideZone> list = ardCameraNoGuideZoneService.selectArdCameraNoGuideZoneList(ardCameraNoGuideZone);
+ return getDataTable(list);
+ }
+
+ /**
+ * 瀵煎嚭绂佸紩鍙鍩熷垪琛�
+ */
+ @PreAuthorize("@ss.hasPermi('device:noguidezone:export')")
+ @Log(title = "绂佸紩鍙鍩�", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, ArdCameraNoGuideZone ardCameraNoGuideZone)
+ {
+ List<ArdCameraNoGuideZone> list = ardCameraNoGuideZoneService.selectArdCameraNoGuideZoneList(ardCameraNoGuideZone);
+ ExcelUtil<ArdCameraNoGuideZone> util = new ExcelUtil<ArdCameraNoGuideZone>(ArdCameraNoGuideZone.class);
+ util.exportExcel(response, list, "绂佸紩鍙鍩熸暟鎹�");
+ }
+
+ /**
+ * 鑾峰彇绂佸紩鍙鍩熻缁嗕俊鎭�
+ */
+ @ApiOperation("鑾峰彇绂佸紩鍙鍩熻缁嗕俊鎭�")
+ @PreAuthorize("@ss.hasPermi('device:noguidezone:query')")
+ @GetMapping(value = "/{name}")
+ public AjaxResult getInfo(@PathVariable("name") String name)
+ {
+ return success(ardCameraNoGuideZoneService.selectArdCameraNoGuideZoneByName(name));
+ }
+
+ /**
+ * 鏂板绂佸紩鍙鍩�
+ */
+ @ApiOperation("鏂板绂佸紩鍙鍩�")
+ @PreAuthorize("@ss.hasPermi('device:noguidezone:add')")
+ @Log(title = "绂佸紩鍙鍩�", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody ArdCameraNoGuideZone ardCameraNoGuideZone)
+ {
+ return toAjax(ardCameraNoGuideZoneService.insertArdCameraNoGuideZone(ardCameraNoGuideZone));
+ }
+
+ /**
+ * 淇敼绂佸紩鍙鍩�
+ */
+ @ApiOperation("淇敼绂佸紩鍙鍩�")
+ @PreAuthorize("@ss.hasPermi('device:noguidezone:edit')")
+ @Log(title = "绂佸紩鍙鍩�", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody ArdCameraNoGuideZone ardCameraNoGuideZone)
+ {
+ return toAjax(ardCameraNoGuideZoneService.updateArdCameraNoGuideZone(ardCameraNoGuideZone));
+ }
+
+ /**
+ * 鍒犻櫎绂佸紩鍙鍩�
+ */
+ @ApiOperation("鍒犻櫎绂佸紩鍙鍩�")
+ @PreAuthorize("@ss.hasPermi('device:noguidezone:remove')")
+ @Log(title = "绂佸紩鍙鍩�", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{names}")
+ public AjaxResult remove(@PathVariable String[] names)
+ {
+ return toAjax(ardCameraNoGuideZoneService.deleteArdCameraNoGuideZoneByNames(names));
+ }
+}
diff --git a/ard-work/src/main/java/com/ruoyi/device/noguidezone/domain/ArdCameraNoGuideZone.java b/ard-work/src/main/java/com/ruoyi/device/noguidezone/domain/ArdCameraNoGuideZone.java
new file mode 100644
index 0000000..1c85b51
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/device/noguidezone/domain/ArdCameraNoGuideZone.java
@@ -0,0 +1,125 @@
+package com.ruoyi.device.noguidezone.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 绂佸紩鍙鍩熷璞� ard_camera_no_guide_zone
+ *
+ * @author ard
+ * @date 2023-10-27
+ */
+public class ArdCameraNoGuideZone extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** 鍚嶇О */
+ @Excel(name = "鍚嶇О")
+ private String name;
+
+ /** 鑼冨洿 */
+ @Excel(name = "鑼冨洿")
+ private String poi;
+
+ /** 鐩告満ID */
+ @Excel(name = "鐩告満ID")
+ private String cameraId;
+
+ /** 鏄惁鍚敤 */
+ @Excel(name = "鏄惁鍚敤")
+ private String enabled;
+
+ /** 閮ㄩ棬ID */
+ @Excel(name = "閮ㄩ棬ID")
+ private Long deptId;
+
+ /** 鐢ㄦ埛ID */
+ @Excel(name = "鐢ㄦ埛ID")
+ private String userId;
+
+ /** id */
+ private String id;
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+ public void setPoi(String poi)
+ {
+ this.poi = poi;
+ }
+
+ public String getPoi()
+ {
+ return poi;
+ }
+ public void setCameraId(String cameraId)
+ {
+ this.cameraId = cameraId;
+ }
+
+ public String getCameraId()
+ {
+ return cameraId;
+ }
+ public void setEnabled(String enabled)
+ {
+ this.enabled = enabled;
+ }
+
+ public String getEnabled()
+ {
+ return enabled;
+ }
+ public void setDeptId(Long deptId)
+ {
+ this.deptId = deptId;
+ }
+
+ public Long getDeptId()
+ {
+ return deptId;
+ }
+ public void setUserId(String userId)
+ {
+ this.userId = userId;
+ }
+
+ public String getUserId()
+ {
+ return userId;
+ }
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("name", getName())
+ .append("poi", getPoi())
+ .append("cameraId", getCameraId())
+ .append("enabled", getEnabled())
+ .append("deptId", getDeptId())
+ .append("userId", getUserId())
+ .append("createBy", getCreateBy())
+ .append("createTime", getCreateTime())
+ .append("updateBy", getUpdateBy())
+ .append("updateTime", getUpdateTime())
+ .append("id", getId())
+ .toString();
+ }
+}
diff --git a/ard-work/src/main/java/com/ruoyi/device/noguidezone/mapper/ArdCameraNoGuideZoneMapper.java b/ard-work/src/main/java/com/ruoyi/device/noguidezone/mapper/ArdCameraNoGuideZoneMapper.java
new file mode 100644
index 0000000..5e0fe53
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/device/noguidezone/mapper/ArdCameraNoGuideZoneMapper.java
@@ -0,0 +1,61 @@
+package com.ruoyi.device.noguidezone.mapper;
+
+import java.util.List;
+import com.ruoyi.device.noguidezone.domain.ArdCameraNoGuideZone;
+
+/**
+ * 绂佸紩鍙鍩烳apper鎺ュ彛
+ *
+ * @author ard
+ * @date 2023-10-27
+ */
+public interface ArdCameraNoGuideZoneMapper
+{
+ /**
+ * 鏌ヨ绂佸紩鍙鍩�
+ *
+ * @param name 绂佸紩鍙鍩熶富閿�
+ * @return 绂佸紩鍙鍩�
+ */
+ public ArdCameraNoGuideZone selectArdCameraNoGuideZoneByName(String name);
+
+ /**
+ * 鏌ヨ绂佸紩鍙鍩熷垪琛�
+ *
+ * @param ardCameraNoGuideZone 绂佸紩鍙鍩�
+ * @return 绂佸紩鍙鍩熼泦鍚�
+ */
+ public List<ArdCameraNoGuideZone> selectArdCameraNoGuideZoneList(ArdCameraNoGuideZone ardCameraNoGuideZone);
+
+ /**
+ * 鏂板绂佸紩鍙鍩�
+ *
+ * @param ardCameraNoGuideZone 绂佸紩鍙鍩�
+ * @return 缁撴灉
+ */
+ public int insertArdCameraNoGuideZone(ArdCameraNoGuideZone ardCameraNoGuideZone);
+
+ /**
+ * 淇敼绂佸紩鍙鍩�
+ *
+ * @param ardCameraNoGuideZone 绂佸紩鍙鍩�
+ * @return 缁撴灉
+ */
+ public int updateArdCameraNoGuideZone(ArdCameraNoGuideZone ardCameraNoGuideZone);
+
+ /**
+ * 鍒犻櫎绂佸紩鍙鍩�
+ *
+ * @param name 绂佸紩鍙鍩熶富閿�
+ * @return 缁撴灉
+ */
+ public int deleteArdCameraNoGuideZoneByName(String name);
+
+ /**
+ * 鎵归噺鍒犻櫎绂佸紩鍙鍩�
+ *
+ * @param names 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎
+ * @return 缁撴灉
+ */
+ public int deleteArdCameraNoGuideZoneByNames(String[] names);
+}
diff --git a/ard-work/src/main/java/com/ruoyi/device/noguidezone/service/IArdCameraNoGuideZoneService.java b/ard-work/src/main/java/com/ruoyi/device/noguidezone/service/IArdCameraNoGuideZoneService.java
new file mode 100644
index 0000000..6ec3b33
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/device/noguidezone/service/IArdCameraNoGuideZoneService.java
@@ -0,0 +1,61 @@
+package com.ruoyi.device.noguidezone.service;
+
+import java.util.List;
+import com.ruoyi.device.noguidezone.domain.ArdCameraNoGuideZone;
+
+/**
+ * 绂佸紩鍙鍩烻ervice鎺ュ彛
+ *
+ * @author ard
+ * @date 2023-10-27
+ */
+public interface IArdCameraNoGuideZoneService
+{
+ /**
+ * 鏌ヨ绂佸紩鍙鍩�
+ *
+ * @param name 绂佸紩鍙鍩熶富閿�
+ * @return 绂佸紩鍙鍩�
+ */
+ public ArdCameraNoGuideZone selectArdCameraNoGuideZoneByName(String name);
+
+ /**
+ * 鏌ヨ绂佸紩鍙鍩熷垪琛�
+ *
+ * @param ardCameraNoGuideZone 绂佸紩鍙鍩�
+ * @return 绂佸紩鍙鍩熼泦鍚�
+ */
+ public List<ArdCameraNoGuideZone> selectArdCameraNoGuideZoneList(ArdCameraNoGuideZone ardCameraNoGuideZone);
+
+ /**
+ * 鏂板绂佸紩鍙鍩�
+ *
+ * @param ardCameraNoGuideZone 绂佸紩鍙鍩�
+ * @return 缁撴灉
+ */
+ public int insertArdCameraNoGuideZone(ArdCameraNoGuideZone ardCameraNoGuideZone);
+
+ /**
+ * 淇敼绂佸紩鍙鍩�
+ *
+ * @param ardCameraNoGuideZone 绂佸紩鍙鍩�
+ * @return 缁撴灉
+ */
+ public int updateArdCameraNoGuideZone(ArdCameraNoGuideZone ardCameraNoGuideZone);
+
+ /**
+ * 鎵归噺鍒犻櫎绂佸紩鍙鍩�
+ *
+ * @param names 闇�瑕佸垹闄ょ殑绂佸紩鍙鍩熶富閿泦鍚�
+ * @return 缁撴灉
+ */
+ public int deleteArdCameraNoGuideZoneByNames(String[] names);
+
+ /**
+ * 鍒犻櫎绂佸紩鍙鍩熶俊鎭�
+ *
+ * @param name 绂佸紩鍙鍩熶富閿�
+ * @return 缁撴灉
+ */
+ public int deleteArdCameraNoGuideZoneByName(String name);
+}
diff --git a/ard-work/src/main/java/com/ruoyi/device/noguidezone/service/impl/ArdCameraNoGuideZoneServiceImpl.java b/ard-work/src/main/java/com/ruoyi/device/noguidezone/service/impl/ArdCameraNoGuideZoneServiceImpl.java
new file mode 100644
index 0000000..621b003
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/device/noguidezone/service/impl/ArdCameraNoGuideZoneServiceImpl.java
@@ -0,0 +1,98 @@
+package com.ruoyi.device.noguidezone.service.impl;
+
+import java.util.List;
+ import com.ruoyi.common.utils.DateUtils;
+
+import com.ruoyi.common.utils.uuid.IdUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import java.util.ArrayList;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.device.noguidezone.mapper.ArdCameraNoGuideZoneMapper;
+import com.ruoyi.device.noguidezone.domain.ArdCameraNoGuideZone;
+import com.ruoyi.device.noguidezone.service.IArdCameraNoGuideZoneService;
+
+/**
+ * 绂佸紩鍙鍩烻ervice涓氬姟灞傚鐞�
+ *
+ * @author ard
+ * @date 2023-10-27
+ */
+@Service
+public class ArdCameraNoGuideZoneServiceImpl implements IArdCameraNoGuideZoneService {
+ @Autowired
+ private ArdCameraNoGuideZoneMapper ardCameraNoGuideZoneMapper;
+
+ /**
+ * 鏌ヨ绂佸紩鍙鍩�
+ *
+ * @param name 绂佸紩鍙鍩熶富閿�
+ * @return 绂佸紩鍙鍩�
+ */
+ @Override
+ public ArdCameraNoGuideZone selectArdCameraNoGuideZoneByName(String name) {
+ return ardCameraNoGuideZoneMapper.selectArdCameraNoGuideZoneByName(name);
+ }
+
+ /**
+ * 鏌ヨ绂佸紩鍙鍩熷垪琛�
+ *
+ * @param ardCameraNoGuideZone 绂佸紩鍙鍩�
+ * @return 绂佸紩鍙鍩�
+ */
+ @Override
+ public List<ArdCameraNoGuideZone> selectArdCameraNoGuideZoneList(ArdCameraNoGuideZone ardCameraNoGuideZone) {
+ return ardCameraNoGuideZoneMapper.selectArdCameraNoGuideZoneList(ardCameraNoGuideZone);
+ }
+
+ /**
+ * 鏂板绂佸紩鍙鍩�
+ *
+ * @param ardCameraNoGuideZone 绂佸紩鍙鍩�
+ * @return 缁撴灉
+ */
+ @Override
+ public int insertArdCameraNoGuideZone(ArdCameraNoGuideZone ardCameraNoGuideZone) {
+ ardCameraNoGuideZone.setUserId(SecurityUtils.getUserId());
+ ardCameraNoGuideZone.setCreateBy(SecurityUtils.getUsername());
+ ardCameraNoGuideZone.setCreateTime(DateUtils.getNowDate());
+ ardCameraNoGuideZone.setId(IdUtils.simpleUUID());
+ return ardCameraNoGuideZoneMapper.insertArdCameraNoGuideZone(ardCameraNoGuideZone);
+ }
+
+ /**
+ * 淇敼绂佸紩鍙鍩�
+ *
+ * @param ardCameraNoGuideZone 绂佸紩鍙鍩�
+ * @return 缁撴灉
+ */
+ @Override
+ public int updateArdCameraNoGuideZone(ArdCameraNoGuideZone ardCameraNoGuideZone) {
+ ardCameraNoGuideZone.setUpdateBy(SecurityUtils.getUsername());
+ ardCameraNoGuideZone.setUpdateTime(DateUtils.getNowDate());
+ return ardCameraNoGuideZoneMapper.updateArdCameraNoGuideZone(ardCameraNoGuideZone);
+ }
+
+ /**
+ * 鎵归噺鍒犻櫎绂佸紩鍙鍩�
+ *
+ * @param names 闇�瑕佸垹闄ょ殑绂佸紩鍙鍩熶富閿�
+ * @return 缁撴灉
+ */
+ @Override
+ public int deleteArdCameraNoGuideZoneByNames(String[] names) {
+ return ardCameraNoGuideZoneMapper.deleteArdCameraNoGuideZoneByNames(names);
+ }
+
+ /**
+ * 鍒犻櫎绂佸紩鍙鍩熶俊鎭�
+ *
+ * @param name 绂佸紩鍙鍩熶富閿�
+ * @return 缁撴灉
+ */
+ @Override
+ public int deleteArdCameraNoGuideZoneByName(String name) {
+ return ardCameraNoGuideZoneMapper.deleteArdCameraNoGuideZoneByName(name);
+ }
+}
diff --git a/ard-work/src/main/java/com/ruoyi/utils/sdk/dhsdk/service/impl/DhClientServiceImpl.java b/ard-work/src/main/java/com/ruoyi/utils/sdk/dhsdk/service/impl/DhClientServiceImpl.java
index 2b62b12..ccb5b6a 100644
--- a/ard-work/src/main/java/com/ruoyi/utils/sdk/dhsdk/service/impl/DhClientServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/utils/sdk/dhsdk/service/impl/DhClientServiceImpl.java
@@ -896,7 +896,7 @@
// 璁惧鏂嚎鍥炶皟: 褰撹澶囧嚭鐜版柇绾挎椂锛孲DK浼氳皟鐢ㄨ鍑芥暟
private static class DisConnect implements NetSDKLib.fDisConnect {
public void invoke(LLong m_hLoginHandle, String pchDVRIP, int nDVRPort, Pointer dwUser) {
- log.warn("Device[" + pchDVRIP + "] Port[" + nDVRPort + "] DisConnect!");
+ log.warn("Device[" + pchDVRIP + ":" + nDVRPort + "] DisConnect!");
}
}
@@ -904,7 +904,7 @@
private static class HaveReConnect implements NetSDKLib.fHaveReConnect {
@Override
public void invoke(LLong lLoginID, String pchDVRIP, int nDVRPort, Pointer dwUser) {
- log.warn("ReConnect Device[" + pchDVRIP + "] Port[" + nDVRPort + "]");
+ log.warn("ReConnect Device[" + pchDVRIP + ":" + nDVRPort + "]");
}
}
diff --git a/ard-work/src/main/java/com/ruoyi/utils/sdk/hiksdk/lib/ExceptionCallBack.java b/ard-work/src/main/java/com/ruoyi/utils/sdk/hiksdk/lib/ExceptionCallBack.java
index 70b0678..4558212 100644
--- a/ard-work/src/main/java/com/ruoyi/utils/sdk/hiksdk/lib/ExceptionCallBack.java
+++ b/ard-work/src/main/java/com/ruoyi/utils/sdk/hiksdk/lib/ExceptionCallBack.java
@@ -22,19 +22,19 @@
Integer port = camera.getPort();
switch (dwType) {
case EXCEPTION_EXCHANGE:
- log.warn("Device[" + ip + "] Port[" + port + "]鐢ㄦ埛浜や簰鏃跺紓甯�");
+ log.warn("Device[" + ip + ":" + port + "]鐢ㄦ埛浜や簰鏃跺紓甯�");
break;
case EXCEPTION_PREVIEW:
- log.warn("Device[" + ip + "] Port[" + port + "]缃戠粶棰勮寮傚父");
+ log.warn("Device[" + ip + ":" + port + "]缃戠粶棰勮寮傚父");
break;
case EXCEPTION_RECONNECT:
- log.warn("Device[" + ip + "] Port[" + port + "]棰勮鏃堕噸杩�");
+ log.warn("Device[" + ip + ":" + port + "]棰勮鏃堕噸杩�");
break;
case RELOGIN_SUCCESS:
- log.warn("Device[" + ip + "] Port[" + port + "]鐢ㄦ埛閲嶇櫥闄嗘垚鍔�");
+ log.warn("Device[" + ip + ":" + port + "]鐢ㄦ埛閲嶇櫥闄嗘垚鍔�");
break;
case EXCEPTION_RELOGIN:
- log.warn("Device[" + ip + "] Port[" + port + "]鐢ㄦ埛閲嶇櫥闄�");
+ log.warn("Device[" + ip + ":" + port + "]鐢ㄦ埛閲嶇櫥闄�");
break;
}
}
diff --git a/ard-work/src/main/java/com/ruoyi/utils/sdk/hiksdk/service/impl/HikClientServiceImpl.java b/ard-work/src/main/java/com/ruoyi/utils/sdk/hiksdk/service/impl/HikClientServiceImpl.java
index b1d9d82..3d09337 100644
--- a/ard-work/src/main/java/com/ruoyi/utils/sdk/hiksdk/service/impl/HikClientServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/utils/sdk/hiksdk/service/impl/HikClientServiceImpl.java
@@ -1094,7 +1094,7 @@
public boolean controlInfrarecfg(CameraCmd cmd) {
String cameraId = cmd.getCameraId();
boolean enable = cmd.isEnable();
- Integer channelNum = cmd.getChanNo();
+ Integer chanNo = cmd.getChanNo();
if (!GlobalVariable.loginMap.containsKey(cameraId)) {
return false;
}
@@ -1102,17 +1102,17 @@
NET_DVR_CAMERAPARAMCFG_EX struDayNigh = new NET_DVR_CAMERAPARAMCFG_EX();
Pointer point = struDayNigh.getPointer();
IntByReference ibrBytesReturned = new IntByReference(0);
- boolean b_GetCameraParam = hCNetSDK.NET_DVR_GetDVRConfig(userId, NET_DVR_GET_CCDPARAMCFG_EX, channelNum, point, struDayNigh.size(), ibrBytesReturned);
+ boolean b_GetCameraParam = hCNetSDK.NET_DVR_GetDVRConfig(userId, NET_DVR_GET_CCDPARAMCFG_EX, chanNo, point, struDayNigh.size(), ibrBytesReturned);
if (!b_GetCameraParam) {
log.error("鑾峰彇鍓嶇鍙傛暟澶辫触锛岄敊璇爜锛�" + hCNetSDK.NET_DVR_GetLastError());
}
struDayNigh.read();
- log.debug("鏄惁寮�鍚瑙嗭細" + struDayNigh.struDayNight.byDayNightFilterType);
+ String current = struDayNigh.struDayNight.byDayNightFilterType == 1 ? "寮�鍚�" : "鍏抽棴";
+ log.debug("褰撳墠鐘舵��:" + current);
NET_DVR_DAYNIGHT daynight = new NET_DVR_DAYNIGHT();
if (enable) {
daynight.byDayNightFilterType = 1;//澶滄櫄
-
} else {
daynight.byDayNightFilterType = 0;//鐧藉ぉ
}
@@ -1120,12 +1120,15 @@
daynight.byDayNightFilterTime = 60;
struDayNigh.struDayNight = daynight;
struDayNigh.write();
- boolean bool = hCNetSDK.NET_DVR_SetDVRConfig(userId, NET_DVR_SET_CCDPARAMCFG_EX, channelNum, point, struDayNigh.size());
+ boolean bool = hCNetSDK.NET_DVR_SetDVRConfig(userId, NET_DVR_SET_CCDPARAMCFG_EX, chanNo, point, struDayNigh.size());
if (!bool) {
int code = hCNetSDK.NET_DVR_GetLastError();
log.error("璁剧疆澶滆澶辫触,璇风◢鍚庨噸璇�" + code);
}
- log.debug("璁剧疆澶滆鎴愬姛");
+ else {
+ log.debug("璁剧疆澶滆鎴愬姛");
+ }
+
return bool;
}
diff --git a/ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml b/ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml
index 7fbd1d1..3e5dea9 100644
--- a/ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml
+++ b/ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml
@@ -185,7 +185,35 @@
</trim>
where id = #{id}
</update>
-
+ <update id="updateArdAlarmpointsWellByWellId" parameterType="ArdAlarmpointsWell">
+ update ard_alarmpoints_well
+ <trim prefix="SET" suffixOverrides=",">
+ <if test="wellId != null">well_id = #{wellId},</if>
+ <if test="wellNumber != null">well_number = #{wellNumber},</if>
+ <if test="oilProduction != null">oil_production = #{oilProduction},</if>
+ <if test="wellBlock != null">well_block = #{wellBlock},</if>
+ <if test="productionDate != null">production_date = #{productionDate},</if>
+ <if test="displacementMode != null">displacement_mode = #{displacementMode},</if>
+ <if test="surroundingEnvironment != null">surrounding_environment = #{surroundingEnvironment},</if>
+ <if test="wellType != null">well_type = #{wellType},</if>
+ <if test="installedLoad != null">installed_load = #{installedLoad},</if>
+ <if test="meteringStation != null">metering_station = #{meteringStation},</if>
+ <if test="transferStation != null">transfer_station = #{transferStation},</if>
+ <if test="dehydrationStation != null">dehydration_station = #{dehydrationStation},</if>
+ <if test="runStatus != null">run_status = #{runStatus},</if>
+ <if test="longitude != null">longitude = #{longitude},</if>
+ <if test="latitude != null">latitude = #{latitude},</if>
+ <if test="altitude != null">altitude = #{altitude},</if>
+ <if test="deptId != null">dept_id = #{deptId},</if>
+ <if test="userId != null">user_id = #{userId},</if>
+ <if test="createBy != null">create_by = #{createBy},</if>
+ <if test="createTime != null">create_time = #{createTime},</if>
+ <if test="updateBy != null">update_by = #{updateBy},</if>
+ <if test="updateTime != null">update_time = #{updateTime},</if>
+ <if test="cameraId != null">camera_id = #{cameraId},</if>
+ </trim>
+ where well_id = #{wellId}
+ </update>
<delete id="deleteArdAlarmpointsWellById" parameterType="String">
delete
from ard_alarmpoints_well
diff --git a/ard-work/src/main/resources/mapper/device/ArdCameraNoGuideZoneMapper.xml b/ard-work/src/main/resources/mapper/device/ArdCameraNoGuideZoneMapper.xml
new file mode 100644
index 0000000..84718c3
--- /dev/null
+++ b/ard-work/src/main/resources/mapper/device/ArdCameraNoGuideZoneMapper.xml
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.device.noguidezone.mapper.ArdCameraNoGuideZoneMapper">
+
+ <resultMap type="ArdCameraNoGuideZone" id="ArdCameraNoGuideZoneResult">
+ <result property="name" column="name" />
+ <result property="poi" column="poi" />
+ <result property="cameraId" column="camera_id" />
+ <result property="enabled" column="enabled" />
+ <result property="deptId" column="dept_id" />
+ <result property="userId" column="user_id" />
+ <result property="createBy" column="create_by" />
+ <result property="createTime" column="create_time" />
+ <result property="updateBy" column="update_by" />
+ <result property="updateTime" column="update_time" />
+ <result property="id" column="id" />
+ </resultMap>
+
+ <sql id="selectArdCameraNoGuideZoneVo">
+ select name, poi, camera_id, enabled, dept_id, user_id, create_by, create_time, update_by, update_time, id from ard_camera_no_guide_zone
+ </sql>
+
+ <select id="selectArdCameraNoGuideZoneList" parameterType="ArdCameraNoGuideZone" resultMap="ArdCameraNoGuideZoneResult">
+ <include refid="selectArdCameraNoGuideZoneVo"/>
+ <where>
+ <if test="name != null and name != ''"> and name like '%'||#{name}||'%'</if>
+ <if test="poi != null and poi != ''"> and poi = #{poi}</if>
+ <if test="cameraId != null and cameraId != ''"> and camera_id = #{cameraId}</if>
+ <if test="enabled != null and enabled != ''"> and enabled = #{enabled}</if>
+ <if test="deptId != null "> and dept_id = #{deptId}</if>
+ <if test="userId != null and userId != ''"> and user_id = #{userId}</if>
+ </where>
+ </select>
+
+ <select id="selectArdCameraNoGuideZoneByName" parameterType="String" resultMap="ArdCameraNoGuideZoneResult">
+ <include refid="selectArdCameraNoGuideZoneVo"/>
+ where name = #{name}
+ </select>
+
+ <insert id="insertArdCameraNoGuideZone" parameterType="ArdCameraNoGuideZone">
+ insert into ard_camera_no_guide_zone
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="name != null">name,</if>
+ <if test="poi != null">poi,</if>
+ <if test="cameraId != null">camera_id,</if>
+ <if test="enabled != null">enabled,</if>
+ <if test="deptId != null">dept_id,</if>
+ <if test="userId != null">user_id,</if>
+ <if test="createBy != null">create_by,</if>
+ <if test="createTime != null">create_time,</if>
+ <if test="updateBy != null">update_by,</if>
+ <if test="updateTime != null">update_time,</if>
+ <if test="id != null">id,</if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
+ <if test="name != null">#{name},</if>
+ <if test="poi != null">#{poi},</if>
+ <if test="cameraId != null">#{cameraId},</if>
+ <if test="enabled != null">#{enabled},</if>
+ <if test="deptId != null">#{deptId},</if>
+ <if test="userId != null">#{userId},</if>
+ <if test="createBy != null">#{createBy},</if>
+ <if test="createTime != null">#{createTime},</if>
+ <if test="updateBy != null">#{updateBy},</if>
+ <if test="updateTime != null">#{updateTime},</if>
+ <if test="id != null">#{id},</if>
+ </trim>
+ </insert>
+
+ <update id="updateArdCameraNoGuideZone" parameterType="ArdCameraNoGuideZone">
+ update ard_camera_no_guide_zone
+ <trim prefix="SET" suffixOverrides=",">
+ <if test="poi != null">poi = #{poi},</if>
+ <if test="cameraId != null">camera_id = #{cameraId},</if>
+ <if test="enabled != null">enabled = #{enabled},</if>
+ <if test="deptId != null">dept_id = #{deptId},</if>
+ <if test="userId != null">user_id = #{userId},</if>
+ <if test="createBy != null">create_by = #{createBy},</if>
+ <if test="createTime != null">create_time = #{createTime},</if>
+ <if test="updateBy != null">update_by = #{updateBy},</if>
+ <if test="updateTime != null">update_time = #{updateTime},</if>
+ <if test="id != null">id = #{id},</if>
+ </trim>
+ where name = #{name}
+ </update>
+
+ <delete id="deleteArdCameraNoGuideZoneByName" parameterType="String">
+ delete from ard_camera_no_guide_zone where name = #{name}
+ </delete>
+
+ <delete id="deleteArdCameraNoGuideZoneByNames" parameterType="String">
+ delete from ard_camera_no_guide_zone where name in
+ <foreach item="name" collection="array" open="(" separator="," close=")">
+ #{name}
+ </foreach>
+ </delete>
+</mapper>
\ No newline at end of file
diff --git a/ard-work/src/main/resources/templates/test.html b/ard-work/src/main/resources/templates/test.html
index 8c81faf..38e86f4 100644
--- a/ard-work/src/main/resources/templates/test.html
+++ b/ard-work/src/main/resources/templates/test.html
@@ -4,133 +4,139 @@
<meta charset="UTF-8">
<title>娴嬭瘯椤�</title>
<script th:src="@{/js/jquery-3.6.4.min.js}"></script>
- <script th:src="@{/js/adapter.min.js}"></script>
- <script th:src="@{/js/webrtcstreamer.js}"></script>
<link rel="stylesheet" th:href="@{/css/bootstrap.css}"/>
<script th:src="@{/js/bootstrap.js}"></script>
<style>
.top-buffer {
margin-top: 10px;
}
+
+ .container {
+ border: 2px solid #1b6d85;
+ padding: 20px;
+ }
</style>
<body>
<div class="container">
<div class="row ">
- <div class="dropdown">
- 鐩告満id锛�<select id="select">
+ <div class="col-md-12">
+ 鐩告満id锛�<select id="select" style="width: 330px;">
</select>
</div>
</div>
- <div class="row top-buffer">
- <div class="col-md-1 col-md-offset-1">
- <button id="up" type="button" class="btn btn-primary">涓�</button>
- </div>
- <div class="col-md-4 col-md-offset-3">
- <div class="btn-group" role="group">
- <button id="controlZoomIn" type="button" class="btn btn-primary">璋冪劍-</button>
- <button id="controlZoomOut" type="button" class="btn btn-primary">璋冪劍+</button>
- </div>
- </div>
- </div>
- <div class="row ">
- <div class="col-md-1">
- <button id="left" type="button" class="btn btn-primary">宸�</button>
- </div>
- <div class="col-md-1 col-md-offset-1">
- <button id="right" type="button" class="btn btn-primary">鍙�</button>
- </div>
- <div class="col-md-4 col-md-offset-2">
- <div class="btn-group" role="group">
- <button id="controlFocusNear" type="button" class="btn btn-primary">鑱氱劍-</button>
- <button id="controlFocusFar" type="button" class="btn btn-primary">鑱氱劍+</button>
- </div>
- </div>
- </div>
- <div class="row ">
- <div class="col-md-1 col-md-offset-1">
- <button id="down" type="button" class="btn btn-primary">涓�</button>
- </div>
- <div class="col-md-4 col-md-offset-3">
- <div class="btn-group" role="group">
- <button id="controlIrisOpen" type="button" class="btn btn-primary">鍏夊湀-</button>
- <button id="controlIrisClose" type="button" class="btn btn-primary">鍏夊湀+</button>
- </div>
- </div>
- </div>
<div class="row">
- <div class="col-md-6">
- <div class="row top-buffer">
- <div class="input-group">
- <span class="input-group-addon">鐩殑鍧愭爣鍊硷細</span>
- <input id="targetPostion" class="form-control" placeholder="鐩殑鍧愭爣"/>
- <button id="setTargetPostion" type="button" class="btn btn-default">鎸囧悜鍧愭爣</button>
- </div>
- <div class="input-group">
- <span class="input-group-addon">P鍊硷細</span>
- <input id="p" class="form-control" placeholder="璇疯緭鍏鍊�"/>
- </div>
- <div class="input-group">
- <span class="input-group-addon">T鍊硷細</span>
- <input id="t" class="form-control" placeholder="璇疯緭鍏鍊�"/>
- </div>
- <div class="input-group">
- <span class="input-group-addon">Z鍊硷細</span>
- <input id="z" class="form-control" placeholder="璇疯緭鍏鍊�"/>
- </div>
- </div>
- <div class="row top-buffer">
- <div class="btn-group" role="group">
- <button id="getPTZ" type="button" class="btn btn-default">鑾峰彇ptz</button>
- <button id="setPTZ" type="button" class="btn btn-default">璁剧疆ptz</button>
- <button id="setPreset" type="button" class="btn btn-default">璁鹃缃偣</button>
- <button id="gotoPreset" type="button" class="btn btn-default">璋冮缃偣</button>
- <button id="getZeroPTZ" type="button" class="btn btn-default">璋冪敤闆舵柟浣嶈</button>
- <button id="setZeroPTZ" type="button" class="btn btn-default">璁剧疆闆舵柟浣嶈</button>
- </div>
- </div>
- <div class="row top-buffer">
- <div class="btn-group" role="group">
- <button id="FocusMode" type="button" class="btn btn-default">鎵嬪姩鑱氱劍</button>
- <div id="focusDiv" class="input-group">
- <span class="input-group-addon">鑱氱劍鍊硷細</span>
- <input id="focus" class="form-control" placeholder="鑱氱劍鍊�"/>
- </div>
- <button id="getFocusPos" type="button" class="btn btn-default">鑾峰彇鑱氱劍鍊�</button>
- <button id="setFocusPos" type="button" class="btn btn-default">璁剧疆鑱氱劍鍊�</button>
- </div>
- </div>
- <div class="row top-buffer">
- <div class="btn-group" role="group">
- <button id="WiperPwron" type="button" class="btn btn-default">寮�鍚洦鍒�</button>
- <button id="Defogcfg" type="button" class="btn btn-default">寮�鍚�忛浘</button>
- <button id="Infrarecfg" type="button" class="btn btn-default">寮�鍚孩澶�</button>
- <button id="HeateRpwron" type="button" class="btn btn-default">寮�鍚簯鍙板姞鐑�</button>
- <button id="CameraDeicing" type="button" class="btn btn-default">寮�鍚暅澶村姞鐑�</button>
- </div>
- </div>
- <div class="row top-buffer">
- <div class="btn-group" role="group">
- <button id="voice" type="button" class="btn btn-default">寮�濮嬭闊冲璁�</button>
- <button id="record" type="button" class="btn btn-default">寮�濮嬪綍鍍�</button>
- <button id="realCutPic" type="button" class="btn btn-default">瀹炴椂鎶撳浘</button>
- <button id="saveCutPic" type="button" class="btn btn-default">瀛樺偍鎶撳浘</button>
- </div>
- </div>
- <div class="row top-buffer">
- <div class="col-md-6">
- <img class="thumbnail" id="imgContainer" style="width: 500px; height: 300px;"/>
- </div>
- </div>
- </div>
- <div class="col-md-1"/>
<div class="col-md-5">
<div class="row top-buffer">
- <video id="video" muted autoplay loop controls style="width: 800px; height: 100%; object-fit: fill;"/>
+ <div class="col-md-1 col-md-offset-1">
+ <button id="up" type="button" class="btn btn-primary">涓�</button>
+ </div>
+ <div class="col-md-6 col-md-offset-2">
+ <div class="btn-group" role="group">
+ <button id="controlZoomIn" type="button" class="btn btn-primary">璋冪劍-</button>
+ <button id="controlZoomOut" type="button" class="btn btn-primary">璋冪劍+</button>
+ </div>
+ </div>
+ </div>
+ <div class="row ">
+ <div class="col-md-1">
+ <button id="left" type="button" class="btn btn-primary">宸�</button>
+ </div>
+ <div class="col-md-1 col-md-offset-1">
+ <button id="right" type="button" class="btn btn-primary">鍙�</button>
+ </div>
+ <div class="col-md-6 col-md-offset-1">
+ <div class="btn-group" role="group">
+ <button id="controlFocusNear" type="button" class="btn btn-primary">鑱氱劍-</button>
+ <button id="controlFocusFar" type="button" class="btn btn-primary">鑱氱劍+</button>
+ </div>
+ </div>
+ </div>
+ <div class="row ">
+ <div class="col-md-1 col-md-offset-1">
+ <button id="down" type="button" class="btn btn-primary">涓�</button>
+ </div>
+ <div class="col-md-6 col-md-offset-2">
+ <div class="btn-group" role="group">
+ <button id="controlIrisOpen" type="button" class="btn btn-primary">鍏夊湀-</button>
+ <button id="controlIrisClose" type="button" class="btn btn-primary">鍏夊湀+</button>
+ </div>
+ </div>
+ </div>
+ <div class="row ">
+ <div class="col-md-10">
+ <div class="row top-buffer">
+ <div class="input-group">
+ <span class="input-group-addon">鐩殑鍧愭爣鍊硷細</span>
+ <input id="targetPostion" class="form-control" placeholder="鐩殑鍧愭爣"/>
+ <button id="setTargetPostion" type="button" class="btn btn-default">鎸囧悜鍧愭爣</button>
+ </div>
+ <div class="input-group">
+ <span class="input-group-addon">P鍊硷細</span>
+ <input id="p" class="form-control" placeholder="璇疯緭鍏鍊�"/>
+ </div>
+ <div class="input-group">
+ <span class="input-group-addon">T鍊硷細</span>
+ <input id="t" class="form-control" placeholder="璇疯緭鍏鍊�"/>
+ </div>
+ <div class="input-group">
+ <span class="input-group-addon">Z鍊硷細</span>
+ <input id="z" class="form-control" placeholder="璇疯緭鍏鍊�"/>
+ </div>
+ </div>
+ <div class="row top-buffer">
+ <div class="btn-group" role="group">
+ <button id="getPTZ" type="button" class="btn btn-default">鑾峰彇ptz</button>
+ <button id="setPTZ" type="button" class="btn btn-default">璁剧疆ptz</button>
+ <button id="setPreset" type="button" class="btn btn-default">璁鹃缃偣</button>
+ <button id="gotoPreset" type="button" class="btn btn-default">璋冮缃偣</button>
+ <button id="setZeroPTZ" type="button" class="btn btn-default">璁剧疆闆舵柟浣嶈</button>
+ </div>
+ </div>
+ <div class="row top-buffer">
+ <div class="btn-group" role="group">
+ <button id="FocusMode" type="button" class="btn btn-default">鎵嬪姩鑱氱劍</button>
+ <div id="focusDiv" class="input-group">
+ <span class="input-group-addon">鑱氱劍鍊硷細</span>
+ <input id="focus" class="form-control" placeholder="鑱氱劍鍊�"/>
+ </div>
+ <button id="getFocusPos" type="button" class="btn btn-default">鑾峰彇鑱氱劍鍊�</button>
+ <button id="setFocusPos" type="button" class="btn btn-default">璁剧疆鑱氱劍鍊�</button>
+ </div>
+ </div>
+ <div class="row top-buffer">
+ <div class="btn-group" role="group">
+ <button id="WiperPwron" type="button" class="btn btn-default">寮�鍚洦鍒�</button>
+ <button id="Defogcfg" type="button" class="btn btn-default">寮�鍚�忛浘</button>
+ <button id="Infrarecfg" type="button" class="btn btn-default">寮�鍚孩澶�</button>
+ <button id="HeateRpwron" type="button" class="btn btn-default">寮�鍚簯鍙板姞鐑�</button>
+ <button id="CameraDeicing" type="button" class="btn btn-default">寮�鍚暅澶村姞鐑�</button>
+ </div>
+ </div>
+ <div class="row top-buffer">
+ <div class="btn-group" role="group">
+ <button id="voice" type="button" class="btn btn-default">寮�濮嬭闊冲璁�</button>
+ <button id="record" type="button" class="btn btn-default">寮�濮嬪綍鍍�</button>
+ <button id="saveCutPic" type="button" class="btn btn-default">瀛樺偍鎶撳浘</button>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="col-md-6">
+ <div class="row">
+ <div class="row top-buffer">
+ <video id="video" muted autoplay loop controls
+ style="width: 100%; height: 360px; object-fit: fill; border: 2px solid #3498db;"/>
+ </div>
+ <div class="row">
+ <img class="thumbnail" id="imgContainer"
+ style="width: 100%; height: 360px; border: 2px solid #3498db;"/>
+ </div>
</div>
</div>
</div>
</div>
-<script th:inline="javascript" th:type="module">
+<script th:inline="javascript">
var cameraId, opt, optOpen, optClose, token;
window.onload = function () {
@@ -175,7 +181,6 @@
dataType: "json",
data: JSON.stringify(opt),
success: function (data) {
- console.log(data);
token = data.token;
}
})
@@ -589,20 +594,20 @@
cameraId = $('#select option:selected').val();
opt = {"cameraId": cameraId, "chanNo": 1};
$.ajax({
- headers: {
- 'Accept': 'application/json',
- 'Content-Type': 'application/json',
- 'Authorization': token
- },
- url: "../cameraSdk/getFocusPos",
- type: "post",
- dataType: "json",
- data: JSON.stringify(opt),
- success: function (datas) {
- console.log(datas);
- $("#focus").val(datas.data);
- }
- })
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json',
+ 'Authorization': token
+ },
+ url: "../cameraSdk/getFocusPos",
+ type: "post",
+ dataType: "json",
+ data: JSON.stringify(opt),
+ success: function (datas) {
+ console.log(datas);
+ $("#focus").val(datas.data);
+ }
+ })
})
var heateRpwronflag = true;
$("#HeateRpwron").click(function () {
@@ -656,7 +661,8 @@
$.ajax({
headers: {
'Accept': 'application/json',
- 'Content-Type': 'application/json'
+ 'Content-Type': 'application/json',
+ 'Authorization': token
},
url: "../cameraSdk/cameraDeicing",
type: "post",
@@ -721,7 +727,7 @@
console.log(data.data);
setTimeout(() => {
$('#imgContainer').attr('src', data.data);
- }, 1000 )
+ }, 1000)
}
})
@@ -790,67 +796,264 @@
})
}
- let webRtcServer = null;
- let videoMap = new Map();
$('video').click(function (e) {
- let ID = e.target.id;//鑾峰彇褰撳墠鐐瑰嚮浜嬩欢鐨勫厓绱�
- console.log(ID);
- if (videoMap.get(ID) != null) {
- closeVideo(ID, videoMap.get(ID));
- } else {
- var cameraId = $('#select option:selected').val();
- let camera = cameraMap.get(cameraId);
- console.log(camera);
- if (camera.factory == "3") {
- realViewYs("127.0.0.1", ID, camera.username, camera.password, camera.ipaddr, camera.port);
- } else if (camera.factory == "2") {
- realViewDh("127.0.0.1", ID, camera.username, camera.password, camera.ipaddr, camera.port);
- } else {
- realViewHik("127.0.0.1", ID, camera.username, camera.password, camera.ipaddr, camera.port);
+ var cameraId = $('#select option:selected').val();
+ $.ajax({
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json',
+ 'Authorization': token
+ },
+ url: "../vtdu/media/" + cameraId + "_" + 1,
+ type: "get",
+ dataType: "json",
+ success: function (data) {
+ realView(data.data.webrtcUrl + "/", e.target.id);
}
- }
+ })
});
- //棰勮娴峰悍鐩告満
- function realViewHik(serverip, elem, username, password, ipaddr, port) {
- // webRtcServer = new WebRtcStreamer(elem, "http://" + serverip + ":8000");
- webRtcServer = new WebRtcStreamer(elem, "http://192.168.1.227:8000");
- let rtspUrl = "rtsp://" + username + ":" + password + "@" + ipaddr + ":" + port + "/ch1/main/av_stream";
- let option = "rtptransport=tcp";
- console.log("rtsp鍦板潃锛�" + rtspUrl);
- webRtcServer.connect(rtspUrl, null, option, null);
- videoMap.set(elem, webRtcServer);
+ let webrtcClient;
+ //whep鎿嶄綔鏂规硶
+ const restartPause = 2000;
+ const unquoteCredential = (v) => (
+ JSON.parse(`"${v}"`)
+ );
+ const linkToIceServers = (links) => (
+ (links !== null) ? links.split(', ').map((link) => {
+ const m = link.match(/^<(.+?)>; rel="ice-server"(; username="(.*?)"; credential="(.*?)"; credential-type="password")?/i);
+ const ret = {
+ urls: [m[1]],
+ };
+
+ if (m[3] !== undefined) {
+ ret.username = unquoteCredential(m[3]);
+ ret.credential = unquoteCredential(m[4]);
+ ret.credentialType = "password";
+ }
+
+ return ret;
+ }) : []
+ );
+ const parseOffer = (offer) => {
+ const ret = {
+ iceUfrag: '',
+ icePwd: '',
+ medias: [],
+ };
+
+ for (const line of offer.split('\r\n')) {
+ if (line.startsWith('m=')) {
+ ret.medias.push(line.slice('m='.length));
+ } else if (ret.iceUfrag === '' && line.startsWith('a=ice-ufrag:')) {
+ ret.iceUfrag = line.slice('a=ice-ufrag:'.length);
+ } else if (ret.icePwd === '' && line.startsWith('a=ice-pwd:')) {
+ ret.icePwd = line.slice('a=ice-pwd:'.length);
+ }
+ }
+
+ return ret;
+ };
+ const generateSdpFragment = (offerData, candidates) => {
+ const candidatesByMedia = {};
+ for (const candidate of candidates) {
+ const mid = candidate.sdpMLineIndex;
+ if (candidatesByMedia[mid] === undefined) {
+ candidatesByMedia[mid] = [];
+ }
+ candidatesByMedia[mid].push(candidate);
+ }
+
+ let frag = 'a=ice-ufrag:' + offerData.iceUfrag + '\r\n'
+ + 'a=ice-pwd:' + offerData.icePwd + '\r\n';
+
+ let mid = 0;
+
+ for (const media of offerData.medias) {
+ if (candidatesByMedia[mid] !== undefined) {
+ frag += 'm=' + media + '\r\n'
+ + 'a=mid:' + mid + '\r\n';
+
+ for (const candidate of candidatesByMedia[mid]) {
+ frag += 'a=' + candidate.candidate + '\r\n';
+ }
+ }
+ mid++;
+ }
+
+ return frag;
}
- //棰勮澶у崕鐩告満
- function realViewDh(serverip, elem, username, password, ipaddr, port) {
- webRtcServer = new WebRtcStreamer(elem, "http://" + serverip + ":8000");
- let rtspUrl = "rtsp://" + username + ":" + password + "@" + ipaddr + ":" + port + "/cam/realmonitor?channel=1&subtype=0";
- let option = "rtptransport=tcp";
- console.log("rtsp鍦板潃锛�" + rtspUrl);
+ class WHEPClient {
+ constructor(whepUrl, videoId) {
+ this.video = videoId;
+ this.wurl = new URL('whep', whepUrl);
+ this.pc = null;
+ this.restartTimeout = null;
+ this.eTag = '';
+ this.queuedCandidates = [];
+ this.start();
+ }
- webRtcServer.connect(rtspUrl, null, option, null);
- videoMap.set(elem, webRtcServer);
+ start() {
+ console.log("requesting ICE servers");
+ fetch(this.wurl, {
+ method: 'OPTIONS',
+ })
+ .then((res) => this.onIceServers(res))
+ .catch((err) => {
+ console.log('error: ' + err);
+ this.scheduleRestart();
+ });
+ }
+
+ onIceServers(res) {
+ this.pc = new RTCPeerConnection({
+ iceServers: linkToIceServers(res.headers.get('Link')),
+ });
+
+ const direction = "sendrecv";
+ this.pc.addTransceiver("video", {direction});
+ this.pc.addTransceiver("audio", {direction});
+
+ this.pc.onicecandidate = (evt) => this.onLocalCandidate(evt);
+ this.pc.oniceconnectionstatechange = () => this.onConnectionState();
+
+ this.pc.ontrack = (evt) => {
+ console.log("new track:", evt.track.kind);
+ document.getElementById(this.video).srcObject = evt.streams[0];
+ };
+
+ this.pc.createOffer()
+ .then((offer) => this.onLocalOffer(offer));
+ }
+
+ onLocalOffer(offer) {
+ this.offerData = parseOffer(offer.sdp);
+ this.pc.setLocalDescription(offer);
+
+ console.log("sending offer");
+ console.log(this.wurl);
+ fetch(this.wurl, {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/sdp',
+ },
+ body: offer.sdp,
+ })
+ .then((res) => {
+ if (res.status !== 201) {
+ throw new Error('bad status code');
+ }
+ // this.eTag = res.headers.get('ETag');
+ this.eTag = res.headers.get("ETag") || res.headers.get('E-Tag');
+ return res.text();
+ })
+ .then((sdp) => this.onRemoteAnswer(new RTCSessionDescription({
+ type: 'answer',
+ sdp,
+ })))
+ .catch((err) => {
+ console.log('error: ' + err);
+ this.scheduleRestart();
+ });
+ }
+
+ onConnectionState() {
+ if (this.restartTimeout !== null) {
+ return;
+ }
+
+ console.log("peer connection state:", this.pc.iceConnectionState);
+
+ switch (this.pc.iceConnectionState) {
+ case "disconnected":
+ this.scheduleRestart();
+ }
+ }
+
+ onRemoteAnswer(answer) {
+ if (this.restartTimeout !== null) {
+ return;
+ }
+
+ this.pc.setRemoteDescription(new RTCSessionDescription(answer));
+
+ if (this.queuedCandidates.length !== 0) {
+ this.sendLocalCandidates(this.queuedCandidates);
+ this.queuedCandidates = [];
+ }
+ }
+
+ onLocalCandidate(evt) {
+ if (this.restartTimeout !== null) {
+ return;
+ }
+
+ if (evt.candidate !== null) {
+ if (this.eTag === '') {
+ this.queuedCandidates.push(evt.candidate);
+ } else {
+ this.sendLocalCandidates([evt.candidate])
+ }
+ }
+ }
+
+ sendLocalCandidates(candidates) {
+ fetch(this.wurl, {
+ method: 'PATCH',
+ headers: {
+ 'Content-Type': 'application/trickle-ice-sdpfrag',
+ 'If-Match': this.eTag,
+ },
+
+ body: generateSdpFragment(this.offerData, candidates),
+ })
+ .then((res) => {
+ if (res.status !== 204) {
+ throw new Error('bad status code');
+ }
+ })
+ .catch((err) => {
+ console.log('error: ' + err);
+ this.scheduleRestart();
+ });
+ }
+
+ scheduleRestart() {
+ if (this.restartTimeout !== null) {
+ return;
+ }
+
+ if (this.pc !== null) {
+ this.pc.close();
+ this.pc = null;
+ }
+
+ this.restartTimeout = window.setTimeout(() => {
+ this.restartTimeout = null;
+ this.start();
+ }, restartPause);
+
+ this.eTag = '';
+ this.queuedCandidates = [];
+ }
+
+ stop() {
+ if (this.pc) {
+ try {
+ this.pc.close();
+ } catch (e) {
+ console.log("Failure close peer connection:" + e);
+ }
+ this.pc = null;
+ }
+ }
}
- //棰勮瀹囪鐩告満
- function realViewYs(serverip, elem, username, password, ipaddr, port) {
- webRtcServer = new WebRtcStreamer(elem, "http://" + serverip + ":8000");
- let rtspUrl = "rtsp://" + username + ":" + password + "@" + ipaddr + ":" + port + "/media/video1/multicast";
- console.log("rtsp鍦板潃锛�" + rtspUrl);
- let option = "rtptransport=tcp";
- webRtcServer.connect(rtspUrl, null, option, null);
- videoMap.set(elem, webRtcServer);
- }
-
- function closeVideo(id, webrtc) {
- webrtc.disconnect();
- videoMap.delete(id);
- }
-
- //椤甸潰閫�鍑烘椂閿�姣�
- window.onbeforeunload = function () {
- webRtcServer.disconnect();
+ function realView(whepUrl, videoId) {
+ console.log(whepUrl)
+ webrtcClient = new WHEPClient(whepUrl, videoId);
}
</script>
</body>
--
Gitblit v1.9.3