| ard-work/src/main/java/com/ruoyi/app/position/controller/ArdAppPositionController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| ard-work/src/main/java/com/ruoyi/media/service/impl/MediaService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| ard-work/src/main/java/com/ruoyi/test/Geo/Geofence.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| ard-work/src/main/java/com/ruoyi/test/Geo/GeofenceCallback.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| ard-work/src/main/java/com/ruoyi/test/Geo/GeofenceManager.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| ard-work/src/main/java/com/ruoyi/test/Geo/main.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| ard-work/src/main/java/com/ruoyi/utils/gis/GisUtil.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| lib/mediamtx/mediamtx.yml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
ard-work/src/main/java/com/ruoyi/app/position/controller/ArdAppPositionController.java
@@ -130,7 +130,17 @@ return AjaxResult.success(list); } /** * 获取所有app用户 */ @ApiOperation("获取所有app用户") @GetMapping("/getAppUserList") public AjaxResult getAppUserList(Long deptId) { SysUser user = new SysUser(); user.setDeptId(deptId); List<SysUser> list = sysUserService.selectAllAppUserList(user); return AjaxResult.success(list); } /** * 获取所有app用户 */ @@ -186,6 +196,7 @@ lists.add(offlineMap); return AjaxResult.success(lists); } /** * 获取用户详情 */ ard-work/src/main/java/com/ruoyi/media/service/impl/MediaService.java
@@ -109,9 +109,9 @@ //GPU硬解码编码 -hwaccel cuvid -c:v h264_cuvid 使用cuda解码 -c:v h264_nvenc 使用cuda编码 //String cmd = rootPath + "/lib/mediamtx/" + "ffmpeg -hwaccel cuvid -c:v h264_cuvid -rtsp_transport udp -i " + rtspPath + " -c:v h264_nvenc -r 25 -threads 4 -b:v 2048k -bf 0 -f rtsp rtsp://localhost:$RTSP_PORT/$MTX_PATH"; if (isCode.equals("1")) { String cmd = rootPath + "/lib/mediamtx/" + "ffmpeg -rtsp_transport tcp -i " + rtspPath + " -vcodec libx264 -preset:v ultrafast -r 25 -threads 4 -b:v 2048k -f rtsp rtsp://localhost:$RTSP_PORT/$MTX_PATH"; String cmd = rootPath + "/lib/mediamtx/" + "ffmpeg -rtsp_transport tcp -i " + rtspPath + " -vcodec libx264 -preset:v ultrafast -r 25 -threads 6 -b:v 1024k -f rtsp rtsp://localhost:$RTSP_PORT/$MTX_PATH"; if (!softwareDecoding) { cmd = rootPath + "/lib/mediamtx/" + "ffmpeg -hwaccel cuvid -c:v h264_cuvid -rtsp_transport udp -i " + rtspPath + " -c:v h264_nvenc -r 25 -threads 4 -b:v 2048k -bf 0 -f rtsp rtsp://localhost:$RTSP_PORT/$MTX_PATH"; cmd = rootPath + "/lib/mediamtx/" + "ffmpeg -hwaccel cuvid -c:v h264_cuvid -rtsp_transport tcp -i " + rtspPath + " -c:v h264_nvenc -r 25 -threads 6 -b:v 2048k -bf 0 -f rtsp rtsp://localhost:$RTSP_PORT/$MTX_PATH"; } if (mode.equals("1")) { mediaInfo.setRunondemand(cmd); @@ -123,7 +123,7 @@ } else { mediaInfo.setSource(rtspPath); } mediaInfo.setSourceprotocol("udp"); mediaInfo.setSourceprotocol("tcp"); mediaClient.addPath(name, mediaInfo); return rtspUrl; } @@ -141,7 +141,7 @@ info.setMode("1"); } else { runoninit = item.getConf().getRunoninit(); info.setMode("2"); info.setMode("0"); } //RTSP源地址 String regex = "rtsp://[^\\s\"]+"; ard-work/src/main/java/com/ruoyi/test/Geo/Geofence.java
对比新文件 @@ -0,0 +1,42 @@ package com.ruoyi.test.Geo; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.utils.gis.GisUtil; import com.ruoyi.utils.gis.Point; import lombok.Data; import java.util.List; /** * @Description: 电子栅栏 * @ClassName: Geofence * @Author: 刘苏义 * @Date: 2023年08月30日9:53:53 **/ @Data public class Geofence { private String id; private List<Point> vertices;//顶点坐标集合 private GeofenceCallback callback;//围栏回调 public Geofence(String id,List<Point> vertices, GeofenceCallback callback) { this.id=id; this.vertices = vertices; this.callback = callback; } public boolean isInside(Point point) { // 实现坐标是否在围栏内的检测逻辑 // 返回 true 如果在围栏内,否则返回 false boolean inPolygon = GisUtil.isInPolygon(point, vertices); return inPolygon ? true : false; } public void checkAndTrigger(String id,Point point, SysUser user) { if (isInside(point)) { callback.onEnter(id,user); } else { callback.onExit(id,user); } } } ard-work/src/main/java/com/ruoyi/test/Geo/GeofenceCallback.java
对比新文件 @@ -0,0 +1,14 @@ package com.ruoyi.test.Geo; import com.ruoyi.common.core.domain.entity.SysUser; /** * @Description: 电子围栏回调 * @ClassName: GeofenceCallback * @Author: 刘苏义 * @Date: 2023年08月30日9:53:14 **/ public interface GeofenceCallback { void onEnter(String id,SysUser user); void onExit(String id,SysUser user); } ard-work/src/main/java/com/ruoyi/test/Geo/GeofenceManager.java
对比新文件 @@ -0,0 +1,31 @@ package com.ruoyi.test.Geo; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.utils.gis.Point; import java.util.ArrayList; import java.util.List; /** * @Description: 电子围栏管理器 * @ClassName: GeofenceManager * @Author: 刘苏义 * @Date: 2023年08月30日9:54:34 **/ class GeofenceManager { private List<Geofence> geofences; public GeofenceManager() { geofences = new ArrayList<>(); } public void addGeofence(Geofence geofence) { geofences.add(geofence); } public void checkCoordinates(Point coordinates, SysUser user) { for (Geofence geofence : geofences) { geofence.checkAndTrigger(geofence.getId(),coordinates,user); } } } ard-work/src/main/java/com/ruoyi/test/Geo/main.java
对比新文件 @@ -0,0 +1,52 @@ package com.ruoyi.test.Geo; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.utils.gis.Point; import java.util.ArrayList; import java.util.List; /** * @Description: * @ClassName: main * @Author: 刘苏义 * @Date: 2023年08月30日9:55:12 **/ class Main { public static void main(String[] args) { GeofenceManager geofenceManager = new GeofenceManager(); GeofenceCallback geofenceCallback= new GeofenceCallback() { @Override public void onEnter(String id,SysUser user) { System.out.println("用户" + user.getUserId() + "进入电子围栏" + id + "区域,触发报警!"); } @Override public void onExit(String id,SysUser user) { System.out.println("用户" + user.getUserId() + "未在电子围栏" + id + "区域。"); } }; List<Point> polygonVertices = new ArrayList<>(); polygonVertices.add(new Point(126.6491, 45.739108)); polygonVertices.add(new Point(126.643458, 45.731584)); polygonVertices.add(new Point(126.654921, 45.726979)); polygonVertices.add(new Point(126.660742, 45.734956)); Geofence geofence = new Geofence("1",polygonVertices, geofenceCallback); geofenceManager.addGeofence(geofence); List<Point> polygonVertices1 = new ArrayList<>(); polygonVertices1.add(new Point(126.655244,45.726576)); polygonVertices1.add(new Point(126.67242,45.720586)); polygonVertices1.add(new Point(126.679606,45.729143)); polygonVertices1.add(new Point(126.660993,45.734881)); Geofence geofence1 = new Geofence("2",polygonVertices1,geofenceCallback); geofenceManager.addGeofence(geofence1); Point userCoordinates = new Point(126.666455,45.727986); SysUser user = new SysUser(); user.setUserId("55555"); geofenceManager.checkCoordinates(userCoordinates, user); } } ard-work/src/main/java/com/ruoyi/utils/gis/GisUtil.java
@@ -108,6 +108,7 @@ } return IsPtInPoly(point,pointList); } /** * 判断点是否在多边形内,如果点位于多边形的顶点或边上,也算做点在多边形内,直接返回true * @param point 检测点 lib/mediamtx/mediamtx.yml
@@ -206,7 +206,7 @@ # STUN servers are used to obtain the public IP of server and clients. They are # needed when server and clients are on different LANs. # TURN/TURNS servers are needed when a direct connection between server and # clients is not possible. All traffic is routed through them. # clients is not possible. All traffic is routed through them. stun:stun.l.google.com:19302 - url: stun:stun.l.google.com:19302 # if user is "AUTH_SECRET", then authentication is secret based. # the secret must be inserted into the password field.