aijinhui
2023-09-07 2fa66c208202f420a5f001cf0d67e5aa1bf94578
Merge remote-tracking branch 'origin/master'
已修改13个文件
326 ■■■■■ 文件已修改
ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/QueueTaskExecutor.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/java/com/ruoyi/device/camera/domain/CameraCmd.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/java/com/ruoyi/device/hiksdk/service/impl/HikClientServiceImpl.java 110 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/java/com/ruoyi/inspect/service/impl/ArdVideoInspectTaskServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/java/com/ruoyi/inspect/service/impl/InspectionTaskManager.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/java/com/ruoyi/media/service/impl/MediaServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/resources/templates/preview.html 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/resources/templates/test.html 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lib/mediamtx/mediamtx.yml 77 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lib/webrtc/webrtc-streamer.exe 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/SdkTask.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java
@@ -1025,9 +1025,13 @@
        //获取雷达所在塔上的大光电
        String cameraIdWithTower = ardEquipRadarMapper.getCameraByRadar(radarId);
        if (StringUtils.isNotNull(cameraIdWithTower) && StringUtils.isNotEmpty(cameraIdWithTower)) {
            log.info("获取到雷达塔上的光电:" + cameraIdWithTower);
            log.debug("获取到雷达塔上的光电:" + cameraIdWithTower);
            //如果雷达塔上有光电
            messagesEnqueued(cameraIdWithTower, alarmId, alarmType, createTime, 1, 1, coordinate);
        }
        else
        {
            log.debug("未获取到雷达塔上的光电");
        }
        //获取报警点关联的大光电
        ArdAlarmpointsWell ardAlarmpointsWell = ardAlarmpointsWellMapper.selectArdAlarmpointsWellByWellId(alarmpointName);
@@ -1040,6 +1044,10 @@
            //如果报警点关联了光电
            messagesEnqueued(cameraId, alarmId, alarmType, createTime, 1, 2, coordinate);
        }
        else
        {
            log.debug("未获取到报警点关联的光电");
        }
    }
ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/QueueTaskExecutor.java
@@ -53,7 +53,7 @@
        try {
            CameraCmd cmd = new CameraCmd();
            cmd.setCameraId(guideTask.getCameraId());
            cmd.setChannelNum(guideTask.getChanNum());
            cmd.setChanNo(guideTask.getChanNum());
            cmd.setTargetPosition(guideTask.getTargetPosition());
            cmd.setOperator(guideTask.getAlarmType());
            cmd.setExpired(30);
ard-work/src/main/java/com/ruoyi/device/camera/domain/CameraCmd.java
@@ -2,6 +2,7 @@
import io.swagger.annotations.ApiModel;
import lombok.Data;
import org.springframework.boot.context.properties.bind.DefaultValue;
import java.util.Map;
@@ -13,7 +14,7 @@
    /*相机ID*/
    String cameraId;
    /*相机通道号*/
    Integer channelNum;
    Integer chanNo;
    /*云台代码*/
    Integer code;
    /*云台速度*/
ard-work/src/main/java/com/ruoyi/device/camera/service/impl/ArdCamerasServiceImpl.java
@@ -86,7 +86,18 @@
    @Override
    @DataScope(deptAlias = "d", userAlias = "u")
    public List<ArdCameras> selectArdCamerasList(ArdCameras ardCameras) {
        return ardCamerasMapper.selectArdCamerasList(ardCameras);
        List<ArdCameras> ardCamerasList = ardCamerasMapper.selectArdCamerasList(ardCameras);
        if (ardCamerasList.size() > 0) {
            for (ArdCameras camera : ardCamerasList) {
                ArdChannel ardChannel = new ArdChannel();
                ardChannel.setDeviceId(camera.getId());
                List<ArdChannel> ardChannels = ardChannelMapper.selectArdChannelList(ardChannel);
                if (ardChannels != null) {
                    camera.setChannelList(ardChannels);
                }
            }
        }
        return ardCamerasList;
    }
    /**
@@ -216,11 +227,10 @@
        }
        if (ardCameras.size() > 0) {
            for (ArdCameras camera : ardCameras) {
                ArdChannel ardChannel=new ArdChannel();
                ArdChannel ardChannel = new ArdChannel();
                ardChannel.setDeviceId(camera.getId());
                List<ArdChannel> ardChannels = ardChannelMapper.selectArdChannelList(ardChannel);
                if(ardChannels!=null)
                {
                if (ardChannels != null) {
                    camera.setChannelList(ardChannels);
                }
                Map<String, Object> cameraMap = ArdTool.convertEntityToMap(camera);
@@ -268,7 +278,13 @@
                    camera.setChanNo(ArdTool.getChannelBydayNightTime(dayNightTime));
                    ardCameras.put(distance, camera);
                }
                //获取通道列表
                ArdChannel ardChannel = new ArdChannel();
                ardChannel.setDeviceId(camera.getId());
                List<ArdChannel> ardChannels = ardChannelMapper.selectArdChannelList(ardChannel);
                if (ardChannels != null) {
                    camera.setChannelList(ardChannels);
                }
            }
            return ardCameras;
        } catch (Exception ex) {
@@ -285,7 +301,7 @@
    @Override
    public List<ArdCameras> getNearCameras(SchedulingParam param) {
        try {
            Long deptId=SecurityUtils.getLoginUser().getUser().getDeptId();
            Long deptId = SecurityUtils.getLoginUser().getUser().getDeptId();
            Double longitude = param.getLongitude();
            Double latitude = param.getLatitude();
            if (longitude == null && latitude == null) {
@@ -299,7 +315,7 @@
            }
            String dayNightTime = redisCache.getCacheObject("sys_config:dayNightTime");
            //获取所有光电(按部门)
            ArdCameras cameras= new ArdCameras();
            ArdCameras cameras = new ArdCameras();
            cameras.setDeptId(deptId);
            List<ArdCameras> ardCamerasList = ardCamerasMapper.selectArdCamerasList(cameras);
            //统计所有光电可视范围内与报警点的距离
@@ -312,7 +328,7 @@
                double distance = GisUtil.getDistance(new double[]{longitude, latitude}, camPosition);
                if (distance <= radius) {
                    /*获取通道列表*/
                    ArdChannel ardChannel=new ArdChannel();
                    ArdChannel ardChannel = new ArdChannel();
                    ardChannel.setDeviceId(camera.getId());
                    List<ArdChannel> ardChannels = ardChannelMapper.selectArdChannelList(ardChannel);
                    camera.setChannelList(ardChannels);
@@ -329,6 +345,7 @@
        }
        return null;
    }
    /**
     * 获取监控圈内所有在线光电
     * 刘苏义
@@ -337,16 +354,15 @@
    @Override
    public List<ArdCameras> getNearCamerasWithPolygon(SchedulingParam param) {
        try {
            Long deptId=SecurityUtils.getLoginUser().getUser().getDeptId();
            Long deptId = SecurityUtils.getLoginUser().getUser().getDeptId();
            List<Point> partitionLocation = param.getPartitionLocation();
            if(partitionLocation==null)
            {
            if (partitionLocation == null) {
                log.debug("多边形坐标集合为空");
                return null;
            }
            String dayNightTime = redisCache.getCacheObject("sys_config:dayNightTime");
            //获取所有光电(按部门)
            ArdCameras cameras= new ArdCameras();
            ArdCameras cameras = new ArdCameras();
            cameras.setDeptId(deptId);
            List<ArdCameras> ardCamerasList = ardCamerasMapper.selectArdCamerasList(cameras);
            List<ArdCameras> ardCameras = new ArrayList<>();
@@ -355,11 +371,11 @@
                    continue;
                }
                /*判断坐标是否在多边形范围内*/
                Point camPosition=new Point(camera.getLongitude(),camera.getLatitude());
                Point camPosition = new Point(camera.getLongitude(), camera.getLatitude());
                boolean inPolygon = GisUtil.isInPolygon(camPosition, partitionLocation);
                if (inPolygon) {
                    /*获取通道列表*/
                    ArdChannel ardChannel=new ArdChannel();
                    ArdChannel ardChannel = new ArdChannel();
                    ardChannel.setDeviceId(camera.getId());
                    List<ArdChannel> ardChannels = ardChannelMapper.selectArdChannelList(ardChannel);
                    camera.setChannelList(ardChannels);
ard-work/src/main/java/com/ruoyi/device/hiksdk/service/impl/HikClientServiceImpl.java
@@ -262,7 +262,7 @@
    public boolean pTZControlWithSpeed(CameraCmd cmd) {
        String cameraId = cmd.getCameraId();
        boolean enable = cmd.isEnable();
        Integer channelNum = cmd.getChannelNum();
        Integer channelNum = cmd.getChanNo();
        Integer speed = cmd.getSpeed();
        Integer code = cmd.getCode();
        if (!GlobalVariable.loginMap.containsKey(cameraId)) {
@@ -348,23 +348,31 @@
    @SdkOperate
    public boolean setFocusPos(CameraCmd cmd) {
        String cameraId = cmd.getCameraId();
        Integer channelNum = cmd.getChannelNum();
        Integer channelNum = cmd.getChanNo();
        Integer dwFocusPos = cmd.getDwFocusPos();
        if (!GlobalVariable.loginMap.containsKey(cameraId)) {
            return false;
        }
        // 获取参数
        Integer userId = GlobalVariable.loginMap.get(cameraId);
        NET_DVR_FOCUSMODE_CFG focusmodeCfg = new NET_DVR_FOCUSMODE_CFG();
        Pointer point = focusmodeCfg.getPointer();
        IntByReference ibrBytesReturned = new IntByReference(0);
        focusmodeCfg.dwFocusPos = dwFocusPos;
        boolean bool = hCNetSDK.NET_DVR_GetDVRConfig(userId, NET_DVR_GET_FOCUSMODECFG, channelNum, point, focusmodeCfg.size(), ibrBytesReturned);
        HCNetSDK.NET_DVR_STD_CONFIG struStdCfg = new HCNetSDK.NET_DVR_STD_CONFIG();
        HCNetSDK.NET_DVR_GIS_INFO struGisInfo = new HCNetSDK.NET_DVR_GIS_INFO();
        struGisInfo.struPtzPosEx.dwFocus=dwFocusPos;
        struStdCfg.read();
        IntByReference lchannel = new IntByReference(channelNum);
        struStdCfg.lpInBuffer= struGisInfo.getPointer();
        struStdCfg.lpCondBuffer = lchannel.getPointer();
        struStdCfg.dwCondSize = 4;
        struStdCfg.dwInSize = struGisInfo.size();
        struStdCfg.write();//设置前之前要write()
        boolean bool = hCNetSDK.NET_DVR_SetSTDConfig(userId, NET_DVR_GET_GISINFO, struStdCfg);
        if (!bool) {
            int code = hCNetSDK.NET_DVR_GetLastError();
            log.error("设置聚焦值失败,请稍后重试" + code);
            log.error("设置GIS信息数据失败,请稍后重试" + code);
            return false;
        } else {
            return true;
        }
        return bool;
    }
    /**
@@ -375,31 +383,31 @@
    @Override
    public Map<String, Object> getFocusPos(CameraCmd cmd) {
        String cameraId = cmd.getCameraId();
        Integer channelNum = cmd.getChannelNum();
        Integer channelNum = cmd.getChanNo();
        if (!GlobalVariable.loginMap.containsKey(cameraId)) {
            return new HashMap<>();
        }
        // 获取参数
        Integer userId = GlobalVariable.loginMap.get(cameraId);
        NET_DVR_FOCUSMODE_CFG focusmodeCfg = new NET_DVR_FOCUSMODE_CFG();
        Pointer point = focusmodeCfg.getPointer();
        IntByReference ibrBytesReturned = new IntByReference(0);
        focusmodeCfg.byFocusMode = 1;
        focusmodeCfg.byAutoFocusMode = 0;
        focusmodeCfg.write();
        boolean bool = hCNetSDK.NET_DVR_GetDVRConfig(userId, NET_DVR_GET_FOCUSMODECFG, channelNum, point, focusmodeCfg.size(), ibrBytesReturned);
        if (bool) {
            focusmodeCfg.read();
            Map<String, Object> map = new HashMap<>();
            map.put("dwFocusPos", focusmodeCfg.dwFocusPos);
            map.put("byFocusDefinitionDisplay ", focusmodeCfg.byFocusDefinitionDisplay);
            map.put("dwRelativeFocusPos", focusmodeCfg.dwRelativeFocusPos);
            return map;
        } else {
        HCNetSDK.NET_DVR_STD_CONFIG struStdCfg = new HCNetSDK.NET_DVR_STD_CONFIG();
        HCNetSDK.NET_DVR_GIS_INFO struGisInfo = new HCNetSDK.NET_DVR_GIS_INFO();
        struStdCfg.read();
        IntByReference lchannel = new IntByReference(channelNum);
        struStdCfg.lpCondBuffer = lchannel.getPointer();
        struStdCfg.dwCondSize = 4;
        struStdCfg.lpOutBuffer = struGisInfo.getPointer();
        struStdCfg.dwOutSize = struGisInfo.size();
        struStdCfg.write();//设置前之前要write()
        boolean bool = hCNetSDK.NET_DVR_GetSTDConfig(userId, NET_DVR_GET_GISINFO, struStdCfg);
        if (!bool) {
            int code = hCNetSDK.NET_DVR_GetLastError();
            log.debug("获取聚焦值失败,请稍后重试" + code);
            log.error("获取GIS信息数据失败,请稍后重试" + code);
            return new HashMap<>();
        } else {
            struGisInfo.read();
            Map<String, Object> map = new HashMap<>();
            map.put("dwFocus",struGisInfo.struPtzPosEx.dwFocus);
            return map;
        }
    }
@@ -412,7 +420,7 @@
    @SdkOperate
    public boolean setPreset(CameraCmd cmd) {
        String cameraId = cmd.getCameraId();
        Integer channelNum = cmd.getChannelNum();
        Integer channelNum = cmd.getChanNo();
        Integer PresetIndex = cmd.getPresetIndex();
        if (!GlobalVariable.loginMap.containsKey(cameraId)) {
            return false;
@@ -435,7 +443,7 @@
    @SdkOperate
    public boolean gotoPreset(CameraCmd cmd) {
        String cameraId = cmd.getCameraId();
        Integer channelNum = cmd.getChannelNum();
        Integer channelNum = cmd.getChanNo();
        Integer PresetIndex = cmd.getPresetIndex();
        if (!GlobalVariable.loginMap.containsKey(cameraId)) {
            return false;
@@ -460,7 +468,7 @@
    @Override
    public String getVideoResolution(CameraCmd cmd) {
        String cameraId = cmd.getCameraId();
        Integer channelNum = cmd.getChannelNum();
        Integer channelNum = cmd.getChanNo();
        if (!GlobalVariable.loginMap.containsKey(cameraId)) {
            return " ";
        }
@@ -565,7 +573,7 @@
    @Override
    public Map<String, Object> getPtz(CameraCmd cmd) {
        String cameraId = cmd.getCameraId();
        Integer channelNum = cmd.getChannelNum();
        Integer channelNum = cmd.getChanNo();
        if (!GlobalVariable.loginMap.containsKey(cameraId)) {
            return null;
        }
@@ -616,7 +624,7 @@
    @SdkOperate
    public boolean setPtz(CameraCmd cmd) {
        String cameraId = cmd.getCameraId();
        Integer channelNum = cmd.getChannelNum();
        Integer channelNum = cmd.getChanNo();
        Map<String, Double> ptz = cmd.getPtzMap();
        if (!GlobalVariable.loginMap.containsKey(cameraId)) {
            return false;
@@ -649,7 +657,7 @@
    @SdkOperate
    public boolean guideTargetPosition(CameraCmd cmd) {
        String cameraId = cmd.getCameraId();
        Integer channelNum = cmd.getChannelNum();
        Integer channelNum = cmd.getChanNo();
        if (!GlobalVariable.loginMap.containsKey(cameraId)) {
            return false;
        }
@@ -736,7 +744,7 @@
    @Override
    public int getPTZLockInfo(CameraCmd cmd) {
        String cameraId = cmd.getCameraId();
        Integer channelNum = cmd.getChannelNum();
        Integer channelNum = cmd.getChanNo();
        if (!GlobalVariable.loginMap.containsKey(cameraId)) {
            return -1;
        }
@@ -768,7 +776,7 @@
    @SdkOperate
    public boolean setZeroPtz(CameraCmd cmd) {
        String cameraId = cmd.getCameraId();
        Integer channelNum = cmd.getChannelNum();
        Integer channelNum = cmd.getChanNo();
        if (!GlobalVariable.loginMap.containsKey(cameraId)) {
            return false;
        }
@@ -800,7 +808,7 @@
    @Override
    public Map<String, Object> getPtzScope(CameraCmd cmd) {
        String cameraId = cmd.getCameraId();
        Integer channelNum = cmd.getChannelNum();
        Integer channelNum = cmd.getChanNo();
        if (!GlobalVariable.loginMap.containsKey(cameraId)) {
            return new HashMap<>();
        }
@@ -849,7 +857,7 @@
    public boolean controlDefogcfg(CameraCmd cmd) {
        String cameraId = cmd.getCameraId();
        boolean enable = cmd.isEnable();
        Integer channelNum = cmd.getChannelNum();
        Integer channelNum = cmd.getChanNo();
        if (!GlobalVariable.loginMap.containsKey(cameraId)) {
            return false;
        }
@@ -895,7 +903,7 @@
    public boolean controlInfrarecfg(CameraCmd cmd) {
        String cameraId = cmd.getCameraId();
        boolean enable = cmd.isEnable();
        Integer channelNum = cmd.getChannelNum();
        Integer channelNum = cmd.getChanNo();
        if (!GlobalVariable.loginMap.containsKey(cameraId)) {
            return false;
        }
@@ -943,7 +951,7 @@
    public boolean controlFocusMode(CameraCmd cmd) {
        String cameraId = cmd.getCameraId();
        boolean enable = cmd.isEnable();
        Integer channelNum = cmd.getChannelNum();
        Integer channelNum = cmd.getChanNo();
        if (!GlobalVariable.loginMap.containsKey(cameraId)) {
            return false;
        }
@@ -986,7 +994,7 @@
     */
    public String getFocusMode(CameraCmd cmd) {
        String cameraId = cmd.getCameraId();
        Integer channelNum = cmd.getChannelNum();
        Integer channelNum = cmd.getChanNo();
        if (!GlobalVariable.loginMap.containsKey(cameraId)) {
            return "";
        }
@@ -1016,7 +1024,7 @@
    public boolean controlPTHeateRpwron(CameraCmd cmd) {
        String cameraId = cmd.getCameraId();
        boolean enable = cmd.isEnable();
        Integer channelNum = cmd.getChannelNum();
        Integer channelNum = cmd.getChanNo();
        if (!GlobalVariable.loginMap.containsKey(cameraId)) {
            return false;
        }
@@ -1049,7 +1057,7 @@
    public boolean controlCameraDeicing(CameraCmd cmd) {
        String cameraId = cmd.getCameraId();
        boolean enable = cmd.isEnable();
        Integer channelNum = cmd.getChannelNum();
        Integer channelNum = cmd.getChanNo();
        if (!GlobalVariable.loginMap.containsKey(cameraId)) {
            return false;
        }
@@ -1086,7 +1094,7 @@
     */
    public String captureJPEGPicture(CameraCmd cmd) {
        String cameraId = cmd.getCameraId();
        Integer channelNum = cmd.getChannelNum();
        Integer channelNum = cmd.getChanNo();
        if (!GlobalVariable.loginMap.containsKey(cameraId)) {
            return "";
        }
@@ -1129,7 +1137,7 @@
    @SdkOperate
    public String picCutCate(CameraCmd cmd) {
        String cameraId = cmd.getCameraId();
        Integer channelNum = cmd.getChannelNum();
        Integer channelNum = cmd.getChanNo();
        if (!GlobalVariable.loginMap.containsKey(cameraId)) {
            return "";
        }
@@ -1191,7 +1199,7 @@
    public String record(CameraCmd cmd) {
        try {
            String cameraId = cmd.getCameraId();
            Integer channelNum = cmd.getChannelNum();
            Integer channelNum = cmd.getChanNo();
            String path = FileUtils.createFile("D:/recordTemp/" + cameraId + ".mp4");
            boolean enable = cmd.isEnable();
            if (!GlobalVariable.loginMap.containsKey(cameraId)) {
@@ -1253,7 +1261,7 @@
    public void recordStart(CameraCmd cmd) {
        try {
            String cameraId = cmd.getCameraId();
            Integer channelNum = cmd.getChannelNum();
            Integer channelNum = cmd.getChanNo();
            String path = FileUtils.createFile("D:/recordTemp/" + cameraId + ".mp4");
            if (!GlobalVariable.loginMap.containsKey(cameraId)) {
                return;
@@ -1308,7 +1316,7 @@
        String url = "";
        try {
            String cameraId = cmd.getCameraId();
            Integer channelNum = cmd.getChannelNum();
            Integer channelNum = cmd.getChanNo();
            String path = FileUtils.createFile("D:/recordTemp/" + cameraId + ".mp4");
            if (!GlobalVariable.loginMap.containsKey(cameraId)) {
                return "";
@@ -1362,7 +1370,7 @@
    public void recordStopNotToMinio(CameraCmd cmd) {
        try {
            String cameraId = cmd.getCameraId();
            Integer channelNum = cmd.getChannelNum();
            Integer channelNum = cmd.getChanNo();
            if (!GlobalVariable.loginMap.containsKey(cameraId)) {
                return;
            }
@@ -1446,7 +1454,7 @@
    @Override
    public Map<String, Object> getGisInfo(CameraCmd cmd) {
        String cameraId = cmd.getCameraId();
        Integer channelNum = cmd.getChannelNum();
        Integer channelNum = cmd.getChanNo();
        if (!GlobalVariable.loginMap.containsKey(cameraId)) {
            return new HashMap<>();
        }
ard-work/src/main/java/com/ruoyi/inspect/service/impl/ArdVideoInspectTaskServiceImpl.java
@@ -451,7 +451,7 @@
                    /*控制相机巡检*/
                    CameraCmd cmd = new CameraCmd();
                    cmd.setCameraId(cameraId);
                    cmd.setChannelNum(channel);
                    cmd.setChanNo(channel);
                    cmd.setTargetPosition(targetPositon);
                    cmd.setOperator("sys_patrol_inspect");
                    cmd.setExpired(step.getRecordingTime() * 60);
@@ -509,7 +509,7 @@
                    /*控制相机巡检*/
                    CameraCmd cmd = new CameraCmd();
                    cmd.setCameraId(cameraId);
                    cmd.setChannelNum(channel);
                    cmd.setChanNo(channel);
                    cmd.setTargetPosition(targetPositon);
                    cmd.setOperator("sys_patrol_inspect");
                    cmd.setExpired(step.getRecordingTime() * 60);
@@ -548,7 +548,7 @@
                /*停止录像*/
                CameraCmd cmd = new CameraCmd();
                cmd.setCameraId(cameraId);
                cmd.setChannelNum(channel);
                cmd.setChanNo(channel);
                cmd.setOperator("sys_patrol_inspect");
                cmd.setRecordBucketName("record");
                cmd.setRecordObjectName("inspect_" + IdUtils.fastSimpleUUID());
ard-work/src/main/java/com/ruoyi/inspect/service/impl/InspectionTaskManager.java
@@ -76,7 +76,7 @@
        {   //当前相机正在录像,则停止录像
            CameraCmd cmd = new CameraCmd();
            cmd.setCameraId(ardVideoInspectTask.getCameraId());
            cmd.setChannelNum(ardVideoInspectTask.getChannel());
            cmd.setChanNo(ardVideoInspectTask.getChannel());
            hikClientService.recordStopNotToMinio(cmd);
            GlobalVariable.previewMap.remove(cameraId);
        }
ard-work/src/main/java/com/ruoyi/media/service/impl/MediaServiceImpl.java
@@ -113,6 +113,7 @@
        //-vcodec libx264 //指定视频编码器为 libx264,使用 H.264 编码格式进行视频压缩
        //-preset ultrafast  //--preset的参数主要调节编码速度和质量的平衡,有ultrafast(转码速度最快,视频往往也最模糊)、superfast、veryfast、faster、fast、medium、slow、slower、veryslow、placebo这10个选项,从快到慢
        //-r 25 //设置输出视频的帧率为 25 帧/秒
        //-g 20 //关键帧间隔20
        //-rtsp_transport tcp //这个选项告诉 FFmpeg 使用 TCP 作为 RTSP 的传输协议
        //-threads 4: 指定要使用的线程数为 4。//这允许 FFmpeg 在多核处理器上使用多个线程来进行视频编码,以加快速度。
        // -i //用于指定输入媒体文件或输入流的地址
@@ -123,7 +124,7 @@
        //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 =  "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";
            String cmd =  "ffmpeg -rtsp_transport tcp -i " + rtspPath + " -vcodec libx264 -preset:v ultrafast -r 25 -g 20 -threads 6  -b:v 2048k -f rtsp rtsp://localhost:$RTSP_PORT/$MTX_PATH";
            if (!softwareDecoding) {
                cmd =  "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";
            }
ard-work/src/main/resources/templates/preview.html
@@ -148,7 +148,7 @@
    }
    let mediamtxHost = "192.168.1.12"
    let mediamtxHost = "192.168.1.227"
    var chanMap = new Map();
    window.onload = function () {
        changeGrid(2, 2);
ard-work/src/main/resources/templates/test.html
@@ -308,7 +308,7 @@
    $("#setPreset").click(function () {
        cameraId = $('#select option:selected').val();
        opt = {"cameraId": cameraId, "channelNum": 1, "speed": 8, "presetIndex": 1};
        opt = {"cameraId": cameraId, "chanNo": 1, "speed": 8, "presetIndex": 1};
        $.ajax({
            headers: {
                'Accept': 'application/json',
@@ -326,7 +326,7 @@
    })
    $("#gotoPreset").click(function () {
        cameraId = $('#select option:selected').val();
        opt = {"cameraId": cameraId, "channelNum": 1, "speed": 8, "presetIndex": 1};
        opt = {"cameraId": cameraId, "chanNo": 1, "speed": 8, "presetIndex": 1};
        $.ajax({
            headers: {
                'Accept': 'application/json',
@@ -344,7 +344,7 @@
    })
    $("#getPTZ").click(function () {
        cameraId = $('#select option:selected').val();
        opt = {"cameraId": cameraId, "channelNum": 1};
        opt = {"cameraId": cameraId, "chanNo": 1};
        $.ajax({
            headers: {
                'Accept': 'application/json',
@@ -370,7 +370,7 @@
        var z = $('#z').val();
        //定义一个带有Map字段的实体对象
        var myEntity = {
            channelNum: 1,
            chanNo: 1,
            cameraId: cameraId,
            ptzMap: {
                p: p,
@@ -401,7 +401,7 @@
        var targetP = $('#targetPostion').val();
        //定义一个带有Map字段的实体对象
        var myEntity = {
            channelNum: 1,
            chanNo: 1,
            cameraId: cameraId,
            targetPosition: targetP,
            camPosition: camP,
@@ -424,7 +424,7 @@
    })
    $("#setZeroPTZ").click(function () {
        cameraId = $('#select option:selected').val();
        opt = {"cameraId": cameraId, "channelNum": 1};
        opt = {"cameraId": cameraId, "chanNo": 1};
        $.ajax({
            headers: {
                'Accept': 'application/json',
@@ -442,7 +442,7 @@
    })
    $("#WiperPwron").click(function () {
        cameraId = $('#select option:selected').val();
        opt = {"cameraId": cameraId, "channelNum": 1, "speed": 8, "enable": true, "code": 16};
        opt = {"cameraId": cameraId, "chanNo": 1, "speed": 8, "enable": true, "code": 16};
        $.ajax({
            headers: {
                'Accept': 'application/json',
@@ -461,8 +461,8 @@
    var defogflag = true;
    $("#Defogcfg").click(function () {
        cameraId = $('#select option:selected').val();
        optOpen = {"cameraId": cameraId, "channelNum": 1, "enable": true};
        optClose = {"cameraId": cameraId, "channelNum": 1, "enable": false};
        optOpen = {"cameraId": cameraId, "chanNo": 1, "enable": true};
        optClose = {"cameraId": cameraId, "chanNo": 1, "enable": false};
        if (defogflag) {
            $(this).text("关闭透雾");
            defogflag = false;
@@ -503,8 +503,8 @@
    var infrareflag = true;
    $("#Infrarecfg").click(function () {
        cameraId = $('#select option:selected').val();
        optOpen = {"cameraId": cameraId, "channelNum": 1, "enable": true};
        optClose = {"cameraId": cameraId, "channelNum": 1, "enable": false};
        optOpen = {"cameraId": cameraId, "chanNo": 1, "enable": true};
        optClose = {"cameraId": cameraId, "chanNo": 1, "enable": false};
        if (infrareflag) {
            $(this).text("关闭红外");
            infrareflag = false;
@@ -545,8 +545,8 @@
    var focusModeflag = true;
    $("#FocusMode").click(function () {
        cameraId = $('#select option:selected').val();
        optOpen = {"cameraId": cameraId, "channelNum": 1, "enable": true};
        optClose = {"cameraId": cameraId, "channelNum": 1, "enable": false};
        optOpen = {"cameraId": cameraId, "chanNo": 1, "enable": true};
        optClose = {"cameraId": cameraId, "chanNo": 1, "enable": false};
        if (focusModeflag) {
            $(this).text("自动聚焦");
            focusModeflag = false;
@@ -583,11 +583,30 @@
            })
        }
    })
    $("#getFocusPos").click(function () {
        cameraId = $('#select option:selected').val();
        opt = {"cameraId": cameraId, "chanNo": 1};
        $.ajax({
                headers: {
                    'Accept': 'application/json',
                    'Content-Type': 'application/json',
                    'Authorization': token
                },
                url: "../hik/getFocusPos",
                type: "post",
                dataType: "json",
                data: JSON.stringify(opt),
                success: function (datas) {
                    console.log(datas);
                    $("#focus").val(datas.data.dwFocus);
                }
            })
    })
    var heateRpwronflag = true;
    $("#HeateRpwron").click(function () {
        cameraId = $('#select option:selected').val();
        optOpen = {"cameraId": cameraId, "channelNum": 1, "enable": true};
        optClose = {"cameraId": cameraId, "channelNum": 1, "enable": false};
        optOpen = {"cameraId": cameraId, "chanNo": 1, "enable": true};
        optClose = {"cameraId": cameraId, "chanNo": 1, "enable": false};
        if (heateRpwronflag) {
            $(this).text("关闭云台加热");
            heateRpwronflag = false;
@@ -627,8 +646,8 @@
    var CameraDeicingflag = true;
    $("#CameraDeicing").click(function () {
        cameraId = $('#select option:selected').val();
        optOpen = {"cameraId": cameraId, "channelNum": 1, "enable": true};
        optClose = {"cameraId": cameraId, "channelNum": 1, "enable": false};
        optOpen = {"cameraId": cameraId, "chanNo": 1, "enable": true};
        optClose = {"cameraId": cameraId, "chanNo": 1, "enable": false};
        if (CameraDeicingflag) {
            $(this).text("关闭镜头加热");
            CameraDeicingflag = false;
@@ -666,7 +685,7 @@
    })
    $("#realCutPic").click(function () {
        cameraId = $('#select option:selected').val();
        opt = {"cameraId": cameraId, "channelNum": 1};
        opt = {"cameraId": cameraId, "chanNo": 1};
        $.ajax({
            headers: {
                'Accept': 'application/json',
@@ -685,7 +704,7 @@
    })
    $("#saveCutPic").click(function () {
        cameraId = $('#select option:selected').val();
        opt = {"cameraId": cameraId, "channelNum": 1};
        opt = {"cameraId": cameraId, "chanNo": 1};
        $.ajax({
            headers: {
                'Accept': 'application/json',
@@ -705,8 +724,8 @@
    var recordflag = true;
    $("#record").click(function () {
        cameraId = $('#select option:selected').val();
        optOpen = {"cameraId": cameraId, "channelNum": 1, "enable": true};
        optClose = {"cameraId": cameraId, "channelNum": 1, "enable": false};
        optOpen = {"cameraId": cameraId, "chanNo": 1, "enable": true};
        optClose = {"cameraId": cameraId, "chanNo": 1, "enable": false};
        if (recordflag) {
            $(this).text("停止录像");
            recordflag = false;
@@ -749,7 +768,7 @@
    /*云台公共方法*/
    function commondMethod(url, code, enable) {
        cameraId = $('#select option:selected').val();
        opt = {"cameraId": cameraId, "channelNum": 1, "speed": 8, "enable": enable, "code": code};
        opt = {"cameraId": cameraId, "chanNo": 1, "speed": 8, "enable": enable, "code": code};
        $.ajax({
            headers: {
                'Accept': 'application/json',
@@ -790,7 +809,7 @@
    //预览海康相机
    function realViewHik(serverip, elem, username, password, ipaddr, port) {
       // webRtcServer = new WebRtcStreamer(elem, "http://" + serverip + ":8000");
        webRtcServer = new WebRtcStreamer(elem, "http://192.168.1.227:9000");
        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);
lib/mediamtx/mediamtx.yml
@@ -1,6 +1,6 @@
###############################################
# General parameters
# General settings
# Sets the verbosity of the program; available values are "error", "warn", "info", "debug".
logLevel: info
@@ -13,10 +13,10 @@
readTimeout: 10s
# Timeout of write operations.
writeTimeout: 10s
# Number of read buffers.
# A higher value allows a wider throughput, a lower value allows to save RAM.
readBufferCount: 512
# Maximum size of payload of outgoing UDP packets.
# Size of the queue of outgoing packets.
# A higher value allows to increase throughput, a lower value allows to save RAM.
writeQueueSize: 512
# Maximum size of outgoing UDP packets.
# This can be decreased to avoid fragmentation on networks with a low UDP MTU.
udpMaxPayloadSize: 1472
@@ -40,7 +40,7 @@
# Enable the HTTP API.
api: yes
# Address of the API listener.
apiAddress: 127.0.0.1:9997
apiAddress: 192.168.1.227:9997
# Enable Prometheus-compatible metrics.
metrics: no
@@ -62,9 +62,9 @@
runOnConnectRestart: no
###############################################
# RTSP parameters
# RTSP settings
# Enable support for the RTSP protocol.
# Allow publishing and reading streams with the RTSP protocol.
rtsp: yes
# List of enabled RTSP transport protocols.
# UDP is the most performant, but doesn't work when there's a NAT/firewall between
@@ -102,9 +102,9 @@
authMethods: [basic]
###############################################
# RTMP parameters
# RTMP settings
# Enable support for the RTMP protocol.
# Allow publishing and reading streams with the RTMP protocol.
rtmp: yes
# Address of the RTMP listener. This is needed only when encryption is "no" or "optional".
rtmpAddress: :1935
@@ -122,9 +122,9 @@
rtmpServerCert: server.crt
###############################################
# HLS parameters
# HLS settings
# Enable support for the HLS protocol.
# Allow reading streams with the HLS protocol.
hls: no
# Address of the HLS listener.
hlsAddress: :8888
@@ -178,9 +178,9 @@
hlsDirectory: ''
###############################################
# WebRTC parameters
# WebRTC settings
# Enable support for the WebRTC protocol.
# Allow publishing and reading streams with the WebRTC protocol.
webrtc: yes
# Address of the WebRTC listener.
webrtcAddress: :8889
@@ -206,36 +206,36 @@
  # 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. stun:stun.l.google.com:19302
- url: stun:192.168.1.15:3478
  # clients is not possible. All traffic is routed through them.
- 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.
  username: ''
  password: ''
# List of public IP addresses that are to be used as a host.
# This is used typically for servers that are behind 1:1 D-NAT.
webrtcICEHostNAT1To1IPs: []
webrtcICEHostNAT1To1IPs: [192.168.1.227]
# Address of a ICE UDP listener in format host:port.
# If filled, ICE traffic will pass through a single UDP port,
# allowing the deployment of the server inside a container or behind a NAT.
webrtcICEUDPMuxAddress:
webrtcICEUDPMuxAddress: 192.168.1.227:8189
# Address of a ICE TCP listener in format host:port.
# If filled, ICE traffic will pass through a single TCP port,
# allowing the deployment of the server inside a container or behind a NAT.
# Setting this parameter forces usage of the TCP protocol, which is not
# Using this setting forces usage of the TCP protocol, which is not
# optimal for WebRTC.
webrtcICETCPMuxAddress:
webrtcICETCPMuxAddress: 192.168.1.227:8189
###############################################
# SRT parameters
# SRT settings
# Enables support for the SRT protocol.
# Allow publishing and reading streams with the SRT protocol.
srt: yes
# Address of the SRT listener.
srtAddress: :8890
###############################################
# Path parameters
# Path settings
# These settings are path-dependent, and the map key is the name of the path.
# It's possible to use regular expressions by using a tilde as prefix,
@@ -245,25 +245,24 @@
# another entry.
paths:
  all:
    ###############################################
    # General path settings
    # Source of the stream. This can be:
    # * publisher -> the stream is published by a RTSP, RTMP, WebRTC or SRT client
    # * publisher -> the stream is provided by a RTSP, RTMP, WebRTC or SRT client
    # * rtsp://existing-url -> the stream is pulled from another RTSP server / camera
    # * rtsps://existing-url -> the stream is pulled from another RTSP server / camera with RTSPS
    # * rtmp://existing-url -> the stream is pulled from another RTMP server / camera
    # * rtmps://existing-url -> the stream is pulled from another RTMP server / camera with RTMPS
    # * http://existing-url/stream.m3u8 -> the stream is pulled from another HLS server
    # * https://existing-url/stream.m3u8 -> the stream is pulled from another HLS server with HTTPS
    # * http://existing-url/stream.m3u8 -> the stream is pulled from another HLS server / camera
    # * https://existing-url/stream.m3u8 -> the stream is pulled from another HLS server / camera with HTTPS
    # * udp://ip:port -> the stream is pulled with UDP, by listening on the specified IP and port
    # * srt://existing-url -> the stream is pulled from another SRT server
    # * whep://existing-url -> the stream is pulled from another WebRTC server
    # * wheps://existing-url -> the stream is pulled from another WebRTC server with HTTPS
    # * srt://existing-url -> the stream is pulled from another SRT server / camera
    # * whep://existing-url -> the stream is pulled from another WebRTC server / camera
    # * wheps://existing-url -> the stream is pulled from another WebRTC server / camera with HTTPS
    # * redirect -> the stream is provided by another path or server
    # * rpiCamera -> the stream is provided by a Raspberry Pi Camera
    source: publisher
    ###############################################
    # General path parameters
    # If the source is a URL, and the source certificate is self-signed
    # or invalid, you can provide the fingerprint of the certificate in order to
    # validate it anyway. It can be obtained by running:
@@ -283,7 +282,7 @@
    maxReaders: 0
    ###############################################
    # Authentication path parameters
    # Authentication path settings
    # Username required to publish.
    # SHA256-hashed values can be inserted with the "sha256:" prefix.
@@ -304,7 +303,7 @@
    readIPs: []
    ###############################################
    # Publisher path parameters (when source is "publisher")
    # Publisher path settings (when source is "publisher")
    # allow another client to disconnect the current publisher and publish in its place.
    overridePublisher: yes
@@ -313,7 +312,7 @@
    fallback:
    ###############################################
    # RTSP path parameters (when source is a RTSP or a RTSPS URL)
    # RTSP path settings (when source is a RTSP or a RTSPS URL)
    # protocol used to pull the stream. available values are "automatic", "udp", "multicast", "tcp".
    sourceProtocol: automatic
@@ -333,13 +332,13 @@
    rtspRangeStart:
    ###############################################
    # Redirect path parameters (when source is "redirect")
    # Redirect path settings (when source is "redirect")
    # RTSP URL which clients will be redirected to.
    sourceRedirect:
    ###############################################
    # Raspberry Pi Camera path parameters (when source is "rpiCamera")
    # Raspberry Pi Camera path settings (when source is "rpiCamera")
    # ID of the camera
    rpiCameraCamID: 0
@@ -421,7 +420,7 @@
    rpiCameraTextOverlay: '%Y-%m-%d %H:%M:%S - MediaMTX'
    ###############################################
    # external commands path parameters
    # External commands path settings
    # Command to run when this path is initialized.
    # This can be used to publish a stream and keep it always opened.
lib/webrtc/webrtc-streamer.exe
Binary files differ
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/SdkTask.java
@@ -51,7 +51,7 @@
                    }
                    CameraCmd cmd = new CameraCmd();
                    cmd.setCameraId(camera.getId());
                    cmd.setChannelNum(1);
                    cmd.setChanNo(1);
                    cmd.setOperator(camera.getOperatorId());
                    if (!GlobalVariable.loginMap.containsKey(camera.getId()))//只推送登录成功的相机
                    {