From e8a4f9014fbea4159ea15642226c6793d57d13ee Mon Sep 17 00:00:00 2001
From: Administrator <1144154118@qq.com>
Date: 星期二, 22 八月 2023 11:05:44 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ard-work/src/main/java/com/ruoyi/utils/tools/Point.java | 18 ++
ard-work/src/main/java/com/ruoyi/device/camera/service/IArdCamerasService.java | 8 +
ard-work/src/main/java/com/ruoyi/app/position/service/IArdAppPositionService.java | 7 +
ard-work/src/main/java/com/ruoyi/device/hiksdk/controller/SdkController.java | 19 ++
ard-work/src/main/java/com/ruoyi/utils/tools/GisTool.java | 109 +++++++++++++++
ard-work/src/main/java/com/ruoyi/scheduling/controller/SchedulingController.java | 14 +
ard-work/src/main/java/com/ruoyi/scheduling/domian/SchedulingParam.java | 5
ard-work/src/main/java/com/ruoyi/app/position/service/impl/ArdAppPositionServiceImpl.java | 47 ++++++
ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java | 4
ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java | 57 ++++++++
ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/SdkOperateAspect.java | 4
ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java | 70 +++++++++
12 files changed, 358 insertions(+), 4 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/app/position/service/IArdAppPositionService.java b/ard-work/src/main/java/com/ruoyi/app/position/service/IArdAppPositionService.java
index 6952476..835646e 100644
--- a/ard-work/src/main/java/com/ruoyi/app/position/service/IArdAppPositionService.java
+++ b/ard-work/src/main/java/com/ruoyi/app/position/service/IArdAppPositionService.java
@@ -73,4 +73,11 @@
* 2023/8/17 13:56:36
*/
public List<SysUser>getNearAppUsers(SchedulingParam param);
+
+ /**
+ * 鑾峰彇灏佹帶鍦堝唴鎵�鏈夊湪绾縜pp鐢ㄦ埛(澶氳竟褰�)
+ * 鍒樿嫃涔�
+ * 2023/8/17 13:56:36
+ */
+ public List<SysUser>getNearAppUsersWithPolygon(SchedulingParam param);
}
diff --git a/ard-work/src/main/java/com/ruoyi/app/position/service/impl/ArdAppPositionServiceImpl.java b/ard-work/src/main/java/com/ruoyi/app/position/service/impl/ArdAppPositionServiceImpl.java
index c046a48..3a88178 100644
--- a/ard-work/src/main/java/com/ruoyi/app/position/service/impl/ArdAppPositionServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/app/position/service/impl/ArdAppPositionServiceImpl.java
@@ -13,11 +13,13 @@
import com.ruoyi.scheduling.domian.SchedulingParam;
import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.utils.tools.GisTool;
+import com.ruoyi.utils.tools.Point;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
+import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -172,5 +174,50 @@
}
return filteredList;
}
+ /**
+ * 鑾峰彇灏佹帶鍦堝唴鎵�鏈夊湪绾縜pp鐢ㄦ埛(澶氳竟褰�)
+ * 鍒樿嫃涔�
+ * 2023/8/17 13:56:36
+ */
+ @Override
+ public List<SysUser> getNearAppUsersWithPolygon(SchedulingParam param) {
+ List<SysUser> filteredList = new ArrayList<>();
+ try {
+ Long deptId = SecurityUtils.getLoginUser().getUser().getDeptId();
+ List<Point> partitionLocation = param.getPartitionLocation();
+ SysUser user = new SysUser();
+ user.setDeptId(deptId);
+ List<SysUser> appUserList = iSysUserService.selectAllAppUserList(user);
+ //杩囨护鍦ㄧ嚎
+ List<SysUser> onLineList = appUserList.stream()
+ .filter(sysUser -> (sysUser.getAppOnlineState().equals("1")))
+ .collect(Collectors.toList());
+ //杩囨护鑼冨洿
+ for (SysUser sysUser : onLineList) {
+ ArdAppPosition ardAppPosition = ardAppPositionMapper.selectLastArdAppPositionByUserId(sysUser.getUserId());
+ if (ardAppPosition != null) {
+ Double lon = ardAppPosition.getLongitude();
+ Double lat = ardAppPosition.getLatitude();
+ if (lon == null || lat == null) {
+ continue;
+ }
+ Point point2D=new Point();
+ point2D.setLongitude(lon);
+ point2D.setLatitude(lat);
+ boolean inPolygon = GisTool.isInPolygon(point2D, partitionLocation);
+ if (inPolygon) {
+ Map<String, Object> params = new HashMap<>();
+ params.put("longitude", lon);
+ params.put("latitude", lat);
+ sysUser.setParams(params);
+ filteredList.add(sysUser); // 灏嗘弧瓒虫潯浠剁殑鐢ㄦ埛娣诲姞鍒扮瓫閫夊垪琛ㄤ腑
+ }
+ }
+ }
+ } catch (Exception ex) {
+ log.error("鑾峰彇灏佹帶鍦堝唴鎵�鏈夊湪绾縜pp鐢ㄦ埛寮傚父" + ex.getMessage());
+ }
+ return filteredList;
+ }
}
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 4236c78..c51ff05 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
@@ -86,9 +86,15 @@
public TreeMap getNearCamerasBycoordinate(CameraCmd cmd);
/**
- * 鑾峰彇鐩戞帶鍦堝唴鎵�鏈夊湪绾垮厜鐢�
+ * 鑾峰彇鐩戞帶鍦堝唴鎵�鏈夊湪绾垮厜鐢�(鍗婂緞)
* 鍒樿嫃涔�
* 2023/8/17 13:56:36
*/
List<ArdCameras> getNearCameras(SchedulingParam param);
+ /**
+ * 鑾峰彇鐩戞帶鍦堝唴鎵�鏈夊湪绾垮厜鐢�(澶氳竟褰�)
+ * 鍒樿嫃涔�
+ * 2023/8/17 13:56:36
+ */
+ public List<ArdCameras> getNearCamerasWithPolygon(SchedulingParam param);
}
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 e14f950..6e25a85 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
@@ -1,5 +1,6 @@
package com.ruoyi.device.camera.service.impl;
+import java.awt.geom.Point2D;
import java.time.LocalTime;
import java.util.*;
import java.util.stream.Collectors;
@@ -25,6 +26,7 @@
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.system.mapper.SysDeptMapper;
import com.ruoyi.utils.tools.GisTool;
+import com.ruoyi.utils.tools.Point;
import com.sun.org.apache.bcel.internal.generic.NEW;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -329,7 +331,60 @@
double[] camPosition = new double[]{camera.getLongitude(), camera.getLatitude()};
double distance = GisTool.getDistance(new double[]{longitude, latitude}, camPosition);
if (distance <= radius) {
- camera.setChanNo(ArdTool.getChannelBydayNightTime(dayNightTime));
+ /*鑾峰彇閫氶亾鍒楄〃*/
+ ArdChannel ardChannel=new ArdChannel();
+ ardChannel.setDeviceId(camera.getId());
+ List<ArdChannel> ardChannels = ardChannelMapper.selectArdChannelList(ardChannel);
+ camera.setChannelList(ardChannels);
+ ardCameras.add(camera);
+ }
+ }
+ //杩囨护鍦ㄧ嚎鐩告満
+ List<ArdCameras> onlineList = ardCameras.stream()
+ .filter(ardCamera -> (!ardCamera.getLoginId().equals(-1)))
+ .collect(Collectors.toList());
+ return onlineList;
+ } catch (Exception ex) {
+ log.error("鑾峰彇闄勮繎鐩告満寮傚父:" + ex.getMessage());
+ }
+ return null;
+ }
+ /**
+ * 鑾峰彇鐩戞帶鍦堝唴鎵�鏈夊湪绾垮厜鐢�
+ * 鍒樿嫃涔�
+ * 2023/8/17 13:57:21
+ */
+ @Override
+ public List<ArdCameras> getNearCamerasWithPolygon(SchedulingParam param) {
+ try {
+ Long deptId=SecurityUtils.getLoginUser().getUser().getDeptId();
+ List<Point> partitionLocation = param.getPartitionLocation();
+ if(partitionLocation==null)
+ {
+ log.debug("澶氳竟褰㈠潗鏍囬泦鍚堜负绌�");
+ return null;
+ }
+ String dayNightTime = redisCache.getCacheObject("sys_config:dayNightTime");
+ //鑾峰彇鎵�鏈夊厜鐢�(鎸夐儴闂�)
+ ArdCameras cameras= new ArdCameras();
+ cameras.setDeptId(deptId);
+ List<ArdCameras> ardCamerasList = ardCamerasMapper.selectArdCamerasList(cameras);
+ List<ArdCameras> ardCameras = new ArrayList<>();
+ for (ArdCameras camera : ardCamerasList) {
+ if (camera.getLongitude() == null && camera.getLatitude() == null) {
+ continue;
+ }
+ /*鍒ゆ柇鍧愭爣鏄惁鍦ㄥ杈瑰舰鑼冨洿鍐�*/
+ Point camPosition=new Point();
+ camPosition.setLongitude(camera.getLongitude());
+ camPosition.setLatitude(camera.getLatitude());
+ boolean inPolygon = GisTool.isInPolygon(camPosition, partitionLocation);
+ if (inPolygon) {
+ /*鑾峰彇閫氶亾鍒楄〃*/
+ ArdChannel ardChannel=new ArdChannel();
+ ardChannel.setDeviceId(camera.getId());
+ List<ArdChannel> ardChannels = ardChannelMapper.selectArdChannelList(ardChannel);
+ camera.setChannelList(ardChannels);
ardCameras.add(camera);
}
}
diff --git a/ard-work/src/main/java/com/ruoyi/device/hiksdk/controller/SdkController.java b/ard-work/src/main/java/com/ruoyi/device/hiksdk/controller/SdkController.java
index 8bd7d2f..5ea793d 100644
--- a/ard-work/src/main/java/com/ruoyi/device/hiksdk/controller/SdkController.java
+++ b/ard-work/src/main/java/com/ruoyi/device/hiksdk/controller/SdkController.java
@@ -83,6 +83,7 @@
@Log(title = "鍦ㄧ嚎鐘舵��", businessType = BusinessType.CONTROL)
public @ResponseBody
AjaxResult getOnlineState(@RequestBody CameraCmd cmd) {
+ cmd.setOperator(SecurityUtils.getUserId());
return toAjax(sdk.isOnLine(cmd));
}
@@ -104,6 +105,7 @@
@Log(title = "璋冪敤棰勭疆鐐�", businessType = BusinessType.CONTROL)
public @ResponseBody
AjaxResult gotoPreset(@RequestBody CameraCmd cmd) {
+ cmd.setOperator(SecurityUtils.getUserId());
return toAjax(sdk.gotoPreset(cmd));
}
@@ -113,6 +115,7 @@
@Log(title = "璁剧疆棰勭疆鐐�", businessType = BusinessType.CONTROL)
public @ResponseBody
AjaxResult setPreset(@RequestBody CameraCmd cmd) {
+ cmd.setOperator(SecurityUtils.getUserId());
return toAjax(sdk.setPreset(cmd));
}
@@ -122,6 +125,7 @@
@Log(title = "鑾峰彇鑱氱劍鍊�", businessType = BusinessType.CONTROL)
public @ResponseBody
AjaxResult getFocusPos(@RequestBody CameraCmd cmd) {
+ cmd.setOperator(SecurityUtils.getUserId());
Map<String, Object> Map = sdk.getFocusPos(cmd);
return AjaxResult.success("鑾峰彇鑱氱劍鍊�", Map);
}
@@ -132,6 +136,7 @@
@Log(title = "璁剧疆鑱氱劍鍊�", businessType = BusinessType.CONTROL)
public @ResponseBody
AjaxResult setFocusPos(@RequestBody CameraCmd cmd) {
+ cmd.setOperator(SecurityUtils.getUserId());
return toAjax(sdk.setFocusPos(cmd));
}
@@ -141,6 +146,7 @@
@Log(title = "鑾峰彇PTZ", businessType = BusinessType.CONTROL)
public @ResponseBody
AjaxResult GetPTZ(@RequestBody CameraCmd cmd) {
+ cmd.setOperator(SecurityUtils.getUserId());
Map<String, Object> ptzMap = sdk.getPtz(cmd);
return AjaxResult.success("鑾峰彇ptz", ptzMap);
}
@@ -151,6 +157,7 @@
@ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum"})
public @ResponseBody
AjaxResult GetPTZScope(@RequestBody CameraCmd cmd) {
+ cmd.setOperator(SecurityUtils.getUserId());
Map<String, Object> ptzMap = sdk.getPtzScope(cmd);
return AjaxResult.success("鑾峰彇ptz鑼冨洿", ptzMap);
}
@@ -171,6 +178,7 @@
@ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum", "cmd.targetPosition"})
public @ResponseBody
AjaxResult setTargetPosition(@RequestBody CameraCmd cmd) {
+ cmd.setOperator(SecurityUtils.getUserId());
return toAjax(sdk.guideTargetPosition(cmd));
}
@@ -181,6 +189,7 @@
@ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum"})
public @ResponseBody
AjaxResult SetZeroPTZ(@RequestBody CameraCmd cmd) {
+ cmd.setOperator(SecurityUtils.getUserId());
return toAjax(sdk.setZeroPtz(cmd));
}
@@ -210,6 +219,7 @@
@Log(title = "鑾峰彇浜戝彴閿佸畾淇℃伅", businessType = BusinessType.CONTROL)
public @ResponseBody
AjaxResult getPTZLockInfo(@RequestBody CameraCmd cmd) {
+ cmd.setOperator(SecurityUtils.getUserId());
int byWorkMode = sdk.getPTZLockInfo(cmd);
if (byWorkMode == 0) {
return AjaxResult.success("浜戝彴閿佸畾鐘舵�侊細瑙i攣");
@@ -226,6 +236,7 @@
@ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum", "cmd.enable"})
public @ResponseBody
AjaxResult defogcfg(@RequestBody CameraCmd cmd) {
+ cmd.setOperator(SecurityUtils.getUserId());
return toAjax(sdk.controlDefogcfg(cmd));
}
@@ -235,6 +246,7 @@
@ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum", "cmd.enable"})
public @ResponseBody
AjaxResult infrarecfg(@RequestBody CameraCmd cmd) {
+ cmd.setOperator(SecurityUtils.getUserId());
return toAjax(sdk.controlInfrarecfg(cmd));
}
@@ -244,6 +256,7 @@
@ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum", "cmd.enable"})
public @ResponseBody
AjaxResult enableFocusMode(@RequestBody CameraCmd cmd) {
+ cmd.setOperator(SecurityUtils.getUserId());
return toAjax(sdk.controlFocusMode(cmd));
}
@@ -251,6 +264,7 @@
@PostMapping("/getFocusMode")
public @ResponseBody
AjaxResult getFocusMode(@RequestBody CameraCmd cmd) {
+ cmd.setOperator(SecurityUtils.getUserId());
String focusMode = sdk.getFocusMode(cmd);
return AjaxResult.success(focusMode);
}
@@ -261,6 +275,7 @@
@ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum", "cmd.enable"})
public @ResponseBody
AjaxResult HeateRpwron(@RequestBody CameraCmd cmd) {
+ cmd.setOperator(SecurityUtils.getUserId());
return toAjax(sdk.controlPTHeateRpwron(cmd));
}
@@ -271,12 +286,14 @@
@ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum", "cmd.enable"})
public @ResponseBody
AjaxResult CameraDeicing(@RequestBody CameraCmd cmd) {
+ cmd.setOperator(SecurityUtils.getUserId());
return toAjax(sdk.controlCameraDeicing(cmd));
}
@PostMapping("/captureJPEGPicture")
public @ResponseBody
AjaxResult captureJPEGPicture(@RequestBody CameraCmd cmd) {
+ cmd.setOperator(SecurityUtils.getUserId());
String base64Str = sdk.captureJPEGPicture(cmd);
return toAjaxString(base64Str, "鐩告満鎶撳浘");
}
@@ -287,6 +304,7 @@
@ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum"})
public @ResponseBody
AjaxResult picCutCate(@RequestBody CameraCmd cmd) {
+ cmd.setOperator(SecurityUtils.getUserId());
String path = sdk.picCutCate(cmd);
return toAjaxString(path, "鐩告満鎶撳浘");
}
@@ -297,6 +315,7 @@
@ApiOperationSupport(includeParameters = {"cmd.cameraId", "cmd.channelNum", "cmd.enable"})
public @ResponseBody
AjaxResult record(@RequestBody CameraCmd cmd) {
+ cmd.setOperator(SecurityUtils.getUserId());
String path = sdk.record(cmd);
return toAjaxString(path, "鎵嬪姩褰曞儚");
}
diff --git a/ard-work/src/main/java/com/ruoyi/scheduling/controller/SchedulingController.java b/ard-work/src/main/java/com/ruoyi/scheduling/controller/SchedulingController.java
index 63029af..4727673 100644
--- a/ard-work/src/main/java/com/ruoyi/scheduling/controller/SchedulingController.java
+++ b/ard-work/src/main/java/com/ruoyi/scheduling/controller/SchedulingController.java
@@ -38,7 +38,7 @@
IArdAppPositionService iArdAppPositionService;
@GetMapping("/getNearVehiPersonCam")
- @ApiOperation("鑾峰彇闄勮繎鐨勮溅浜虹浉鏈�")
+ @ApiOperation("鑾峰彇闄勮繎鐨勮溅浜虹浉鏈�(鍗婂緞)")
AjaxResult getNearVehiPersonCam(SchedulingParam param) {
Map<String, Object> nearMap = new HashMap<>();
@@ -51,4 +51,16 @@
return AjaxResult.success(nearMap);
}
+ @PostMapping("/getPolygonVehiPersonCam")
+ @ApiOperation("鑾峰彇闄勮繎鐨勮溅浜虹浉鏈�(澶氳竟褰�)")
+ AjaxResult getPolygonVehiPersonCam(@RequestBody SchedulingParam param) {
+ Map<String, Object> nearMap = new HashMap<>();
+ List<Map<String, Object>> Cars = iArdSyCarService.getNearCarWithPolygon(param);
+ nearMap.put("car", Cars);
+ List<ArdCameras> Cameras = iArdCamerasService.getNearCamerasWithPolygon(param);
+ nearMap.put("camera", Cameras);
+ List<SysUser> AppUsers = iArdAppPositionService.getNearAppUsersWithPolygon(param);
+ nearMap.put("users", AppUsers);
+ return AjaxResult.success(nearMap);
+ }
}
diff --git a/ard-work/src/main/java/com/ruoyi/scheduling/domian/SchedulingParam.java b/ard-work/src/main/java/com/ruoyi/scheduling/domian/SchedulingParam.java
index b75ed90..63840af 100644
--- a/ard-work/src/main/java/com/ruoyi/scheduling/domian/SchedulingParam.java
+++ b/ard-work/src/main/java/com/ruoyi/scheduling/domian/SchedulingParam.java
@@ -1,6 +1,9 @@
package com.ruoyi.scheduling.domian;
+import com.ruoyi.utils.tools.Point;
import lombok.Data;
+
+import java.util.List;
/**
* @Description:
@@ -16,4 +19,6 @@
Integer monitoringRadius;
Double longitude;
Double latitude;
+ //澶氳竟褰㈠潗鏍囬泦鍚�
+ List<Point> partitionLocation;
}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java b/ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java
index 4b7a002..e2d1987 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/service/IArdSyCarService.java
@@ -139,4 +139,8 @@
* 鑾峰彇闄勮繎鑼冨洿鍐呯殑杞﹁締淇℃伅
* */
List<Map<String, Object>> getNearCar(SchedulingParam param);
+ /**
+ * 鑾峰彇闄勮繎鑼冨洿鍐呯殑杞﹁締淇℃伅(澶氳竟褰�)
+ * */
+ List<Map<String, Object>> getNearCarWithPolygon(SchedulingParam param);
}
diff --git a/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java
index bf19a74..4cf89fa 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java
@@ -1,10 +1,12 @@
package com.ruoyi.sy.service.impl;
+import java.awt.geom.Point2D;
import java.io.IOException;
import java.io.InputStream;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
+import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.function.Predicate;
@@ -16,6 +18,7 @@
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
+import com.ruoyi.utils.tools.Point;
import com.ruoyi.scheduling.domian.SchedulingParam;
import com.ruoyi.sy.domain.ArdSyCarDay;
import com.ruoyi.sy.mapper.ArdSyCarDayMapper;
@@ -1032,7 +1035,6 @@
/**
* 鑾峰彇闄勮繎鑼冨洿鍐呯殑杞﹁締淇℃伅
*/
-
@Override
public List<Map<String, Object>> getNearCar(SchedulingParam param) {
Double longitude = param.getLongitude();
@@ -1092,4 +1094,70 @@
}
return filteredList;
}
+ /**
+ * 鑾峰彇鑼冨洿鍐呯殑杞﹁締淇℃伅(澶氳竟褰�)
+ */
+ @Override
+ public List<Map<String, Object>> getNearCarWithPolygon(SchedulingParam param) {
+ List<Map<String, Object>> filteredList = new ArrayList<>();
+ try {
+ List<Point> partitionLocation = param.getPartitionLocation();
+ if (partitionLocation == null) {
+ log.debug("澶氳竟褰㈠潗鏍囬泦鍚堜负绌�");
+ return null;
+ }
+ String userId = SecurityUtils.getUserId();
+ ArdSyUser syUser = new ArdSyUser();
+ syUser.setSysUserId(userId);
+ List<ArdSyUser> ardSyUserList = ardSyUserMapper.selectArdSyUserList(syUser);
+ if (ardSyUserList.size() == 0) {
+ log.debug("鐢ㄦ埛鏈寕鎺ヤ笁涓�杞﹁締");
+ return null;
+ }
+ ArdSyUser ardSyUser = ardSyUserList.get(0);
+ String syUrl = redisCache.getCacheObject("sys_config:syCarPT");
+ String passwordMd5 = DigestUtils.md5Hex(ardSyUser.getPassword());
+ Map<String, Object> LogInResult = sYClient.logIn(syUrl, passwordMd5, ardSyUser.getUserId());
+ String sessionId = (String) LogInResult.get("sessionId");
+
+ Map<String, Object> teamList = sYClient.getTeamList(syUrl, ardSyUser.getUserId(), sessionId);
+ List<Map<String, Object>> listMap = (List<Map<String, Object>>) teamList.get("list");
+ List<Map<String, Object>> allList = new ArrayList<>();
+ for (Map<String, Object> team : listMap) {
+ String teamId = (String) team.get("teamId");
+ Map<String, Object> carListMap = sYClient.getCarList1(syUrl, teamId, ardSyUser.getUserId(), sessionId);
+ if (((String) carListMap.get("rspCode")).equals("1")) {
+ List<Map<String, Object>> list = (List<Map<String, Object>>) carListMap.get("list");
+ allList.addAll(list);
+ }
+ }
+ //杩囨护鍦ㄧ嚎杞﹁締
+ List<Map<String, Object>> onlineList = allList.stream()
+ .filter(map -> !"绂荤嚎".equals(map.get("stateCn")))
+ .collect(Collectors.toList());
+
+ //杩囨护鍗婂緞
+ for (Map<String, Object> carMap : onlineList) {
+ String carId = (String) carMap.get("carId");
+ Map<String, Object> carGPSTrack = sYClient.getCarNearPositionByCarId(syUrl, carId, ardSyUser.getUserId(), sessionId);
+ List<Map<String, Object>> carGPSMap = (List<Map<String, Object>>) carGPSTrack.get("list");
+ Double lng = Double.valueOf((String) carGPSMap.get(0).get("lng"));
+ Double lat = Double.valueOf((String) carGPSMap.get(0).get("lat"));
+ Point point = new Point();
+ point.setLongitude(lng);
+ point.setLatitude(lat);
+ boolean inPolygon = GisTool.isInPolygon(point, partitionLocation);
+ if (inPolygon) {
+ carMap.put("longitude", lng);
+ carMap.put("latitude", lat);
+ filteredList.add(carMap); // 灏嗘弧瓒虫潯浠剁殑杞﹁締娣诲姞鍒扮瓫閫夊垪琛ㄤ腑
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ log.error("鑾峰彇鑼冨洿鍐呯殑杞﹁締淇℃伅(澶氳竟褰�)寮傚父:" + ex.getMessage());
+ }
+ return filteredList;
+ }
}
diff --git a/ard-work/src/main/java/com/ruoyi/utils/tools/GisTool.java b/ard-work/src/main/java/com/ruoyi/utils/tools/GisTool.java
index 661fd91..48c156f 100644
--- a/ard-work/src/main/java/com/ruoyi/utils/tools/GisTool.java
+++ b/ard-work/src/main/java/com/ruoyi/utils/tools/GisTool.java
@@ -4,6 +4,10 @@
import org.gavaghan.geodesy.GeodeticCalculator;
import org.gavaghan.geodesy.GlobalCoordinates;
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* @Description:
* @ClassName: GisTool
@@ -29,4 +33,109 @@
GlobalCoordinates target = new GlobalCoordinates(latitudeTo, longitudeTo);
return geodeticCalculator.calculateGeodeticCurve(Ellipsoid.WGS84, source, target).getEllipsoidalDistance();
}
+
+ public static void main(String[] args) {
+// // 琚娴嬬殑缁忕含搴︾偣
+// Point point= new Point(126.649261,45.687377);
+// // 鍟嗕笟鍖哄煙锛堢櫨搴﹀杈瑰舰鍖哄煙缁忕含搴﹂泦鍚堬級
+// List<Point> partitionLocation = new ArrayList<>();
+// partitionLocation.add(new Point(126.64459,45.688548));
+// partitionLocation.add(new Point(126.653376,45.68938));
+// partitionLocation.add(new Point(126.645776,45.685048));
+// partitionLocation.add(new Point(126.654184,45.685778));
+// System.out.println(isInPolygon(point,partitionLocation));
+ }
+
+ /**
+ * 鍒ゆ柇褰撳墠浣嶇疆鏄惁鍦ㄥ杈瑰舰鍖哄煙鍐�
+ * @param orderLocation 褰撳墠鐐�
+ * @param partitionLocation 鍖哄煙椤剁偣
+ * @return
+ */
+ public static boolean isInPolygon(Point orderLocation,List<Point> partitionLocation){
+
+ double p_x =orderLocation.getLongitude();
+ double p_y =orderLocation.getLatitude();
+ Point2D.Double point = new Point2D.Double(p_x, p_y);
+
+ List<Point2D.Double> pointList= new ArrayList<Point2D.Double>();
+
+ for (Point points : partitionLocation){
+ double polygonPoint_x=points.getLongitude();
+ double polygonPoint_y=points.getLatitude();
+ Point2D.Double polygonPoint = new Point2D.Double(polygonPoint_x,polygonPoint_y);
+ pointList.add(polygonPoint);
+ }
+ return IsPtInPoly(point,pointList);
+ }
+ /**
+ * 鍒ゆ柇鐐规槸鍚﹀湪澶氳竟褰㈠唴锛屽鏋滅偣浣嶄簬澶氳竟褰㈢殑椤剁偣鎴栬竟涓婏紝涔熺畻鍋氱偣鍦ㄥ杈瑰舰鍐咃紝鐩存帴杩斿洖true
+ * @param point 妫�娴嬬偣
+ * @param pts 澶氳竟褰㈢殑椤剁偣
+ * @return 鐐瑰湪澶氳竟褰㈠唴杩斿洖true,鍚﹀垯杩斿洖false
+ */
+ public static boolean IsPtInPoly(Point2D.Double point, List<Point2D.Double> pts){
+
+ int N = pts.size();
+ boolean boundOrVertex = true; //濡傛灉鐐逛綅浜庡杈瑰舰鐨勯《鐐规垨杈逛笂锛屼篃绠楀仛鐐瑰湪澶氳竟褰㈠唴锛岀洿鎺ヨ繑鍥瀟rue
+ int intersectCount = 0;//cross points count of x
+ double precision = 2e-10; //娴偣绫诲瀷璁$畻鏃跺�欎笌0姣旇緝鏃跺�欑殑瀹瑰樊
+ Point2D.Double p1, p2;//neighbour bound vertices
+ Point2D.Double p = point; //褰撳墠鐐�
+
+ p1 = pts.get(0);//left vertex
+ for(int i = 1; i <= N; ++i){//check all rays
+ if(p.equals(p1)){
+ return boundOrVertex;//p is an vertex
+ }
+
+ p2 = pts.get(i % N);
+ if(p.x < Math.min(p1.x, p2.x) || p.x > Math.max(p1.x, p2.x)){
+ p1 = p2;
+ continue;
+ }
+
+ if(p.x > Math.min(p1.x, p2.x) && p.x < Math.max(p1.x, p2.x)){
+ if(p.y <= Math.max(p1.y, p2.y)){
+ if(p1.x == p2.x && p.y >= Math.min(p1.y, p2.y)){
+ return boundOrVertex;
+ }
+
+ if(p1.y == p2.y){
+ if(p1.y == p.y){
+ return boundOrVertex;
+ }else{//before ray
+ ++intersectCount;
+ }
+ }else{
+ double xinters = (p.x - p1.x) * (p2.y - p1.y) / (p2.x - p1.x) + p1.y;
+ if(Math.abs(p.y - xinters) < precision){
+ return boundOrVertex;
+ }
+
+ if(p.y < xinters){
+ ++intersectCount;
+ }
+ }
+ }
+ }else{
+ if(p.x == p2.x && p.y <= p2.y){
+ Point2D.Double p3 = pts.get((i+1) % N);
+ if(p.x >= Math.min(p1.x, p3.x) && p.x <= Math.max(p1.x, p3.x)){
+ ++intersectCount;
+ }else{
+ intersectCount += 2;
+ }
+ }
+ }
+ p1 = p2;
+ }
+
+ if(intersectCount % 2 == 0){//鍋舵暟鍦ㄥ杈瑰舰澶�
+ return false;
+ } else { //濂囨暟鍦ㄥ杈瑰舰鍐�
+ return true;
+ }
+ }
+
}
diff --git a/ard-work/src/main/java/com/ruoyi/utils/tools/Point.java b/ard-work/src/main/java/com/ruoyi/utils/tools/Point.java
new file mode 100644
index 0000000..eb1daf8
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/utils/tools/Point.java
@@ -0,0 +1,18 @@
+package com.ruoyi.utils.tools;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+
+/**
+ * @Description:
+ * @ClassName: Point
+ * @Author: 鍒樿嫃涔�
+ * @Date: 2023骞�08鏈�22鏃�9:56:58
+ * @Version: 1.0
+ **/
+@Data
+public class Point{
+ private static final long serialVersionUID = 1L;
+ private Double longitude;
+ private Double latitude;
+}
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/SdkOperateAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/SdkOperateAspect.java
index 156446a..32d77f4 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/SdkOperateAspect.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/SdkOperateAspect.java
@@ -100,6 +100,10 @@
} else {
/*褰撳墠鎺у埗鑰呬负鏅�氱敤鎴�*/
SysUser sysUser = sysUserService.selectUserById(currentOperator);
+ if(StringUtils.isNull(sysUser))
+ {
+ return true;
+ }
currentLevel = Integer.valueOf(sysUser.getCameraPriority());
}
Integer operatorLevel = 0;//鑾峰彇鐢宠鑰呯殑浼樺厛绾�
--
Gitblit v1.9.3