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.