From 63a661a78e1999423ea7d94277a645ed4b9e7e6d Mon Sep 17 00:00:00 2001 From: ‘liusuyi’ <1951119284@qq.com> Date: 星期五, 25 八月 2023 15:22:23 +0800 Subject: [PATCH] 优化minio工具类和其他工具类位置 优化派警管理列表分页问题 --- ard-work/src/main/java/com/ruoyi/media/service/impl/MediaService.java | 57 +++++++++++++++++++++++++++++---------------------------- 1 files changed, 29 insertions(+), 28 deletions(-) diff --git a/ard-work/src/main/java/com/ruoyi/media/service/impl/MediaService.java b/ard-work/src/main/java/com/ruoyi/media/service/impl/MediaService.java index e493271..578291c 100644 --- a/ard-work/src/main/java/com/ruoyi/media/service/impl/MediaService.java +++ b/ard-work/src/main/java/com/ruoyi/media/service/impl/MediaService.java @@ -6,22 +6,19 @@ import com.ruoyi.media.service.IMediaService; import com.ruoyi.utils.forest.MediaClient; import com.ruoyi.utils.tools.ArdTool; -import com.ruoyi.utils.tools.CmdUtils; +import com.ruoyi.utils.process.CmdUtils; import com.sun.jna.Platform; -import io.minio.messages.Item; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; -import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import javax.annotation.Resource; -import java.io.BufferedReader; import java.io.File; -import java.io.IOException; -import java.io.InputStreamReader; import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -106,7 +103,7 @@ } else { mediaInfo.setSource(rtspPath); } - + mediaInfo.setSourceprotocol("udp"); mediaClient.addPath(name, mediaInfo); return rtspUrl; } @@ -262,7 +259,7 @@ String rtspUrl = "rtsp://" + mediamtxHost + ":7554/" + name; info.setRtspUrl(rtspUrl); Source source = item.getSource(); - if (source.getId().equals("")) { + if (source==null||source.getId().equals("")) { //浼氳瘽ID info.setId("0"); //涓婅娴侀噺 @@ -305,12 +302,13 @@ info.setRtspSource(item.getConf().getSource()); } //浼犺緭鍗忚 - regex = "-rtsp_transport\\s+(\\w+)"; - pattern = Pattern.compile(regex); - matcher = pattern.matcher(runoninit); - if (matcher.find()) { - info.setProtocol(matcher.group(1)); - } +// regex = "-rtsp_transport\\s+(\\w+)"; +// pattern = Pattern.compile(regex); +// matcher = pattern.matcher(runoninit); +// if (matcher.find()) { +// info.setProtocol(matcher.group(1)); +// } + info.setProtocol(item.getConf().getSourceprotocol()); //鎷夋祦鏁伴噺 List<Readers> readers = item.getReaders(); info.setNum(readers.size()); @@ -328,15 +326,15 @@ JsonsRoot jsonsRoot = JSONObject.parseObject(list, JsonsRoot.class); List<Items> items = jsonsRoot.getItems(); for (Items item : items) { - StreamInfo info = new StreamInfo(); - //ID - String name = item.getName(); - info.setName(name); - //RTSP鎾斁鍦板潃 - String rtspUrl = "rtsp://" + mediamtxHost + ":8554/" + name; - info.setRtspUrl(rtspUrl); List<Readers> readers = item.getReaders(); for (Readers reader : readers) { + StreamInfo info = new StreamInfo(); + //ID + String name = item.getName(); + info.setName(name); + //RTSP鎾斁鍦板潃 + String rtspUrl = "rtsp://" + mediamtxHost + ":8554/" + name; + info.setRtspUrl(rtspUrl); RtspSession rtspSession = getRtspSessionById(reader.getId()); //浼氳瘽ID info.setId(rtspSession.getId()); @@ -352,18 +350,21 @@ info.setDownTraffic(formatSentSize); //浼犺緭鍗忚 - String runoninit = item.getConf().getRunondemand(); - String regex = "-rtsp_transport\\s+(\\w+)"; - Pattern pattern = Pattern.compile(regex); - Matcher matcher = pattern.matcher(runoninit); - if (matcher.find()) { - info.setProtocol(matcher.group(1)); - } +// String runoninit = item.getConf().getRunondemand(); +// String regex = "-rtsp_transport\\s+(\\w+)"; +// Pattern pattern = Pattern.compile(regex); +// Matcher matcher = pattern.matcher(runoninit); +// if (matcher.find()) { +// info.setProtocol(matcher.group(1)); +// } + info.setProtocol(item.getConf().getSourceprotocol()); //鎷夋祦鏈嶅姟鍣� info.setRemoteAddr(rtspSession.getRemoteAddr()); PullStreamInfoList.add(info); } } + Comparator<StreamInfo> comparator = Comparator.comparing(streamInfo ->streamInfo.getBeginTime() ); // 浣跨敤Collections.sort鏂规硶杩涜鎺掑簭 Collections.sort(personList, comparator); + Collections.sort(PullStreamInfoList, comparator.reversed()); return PullStreamInfoList; } -- Gitblit v1.9.3