浏览代码

为推流列表增加搜索功能

648540858 3 年之前
父节点
当前提交
e0028a87cb

+ 2 - 4
src/main/java/com/genersoft/iot/vmp/service/IStreamPushService.java

@@ -30,11 +30,9 @@ public interface IStreamPushService {
 
 
     /**
     /**
      * 获取
      * 获取
-     * @param page
-     * @param count
-     * @return
      */
      */
-    PageInfo<StreamPushItem> getPushList(Integer page, Integer count);
+    PageInfo<StreamPushItem> getPushList(Integer page, Integer count, String query, Boolean pushing, String mediaServerId);
+
     List<StreamPushItem> getPushList(String mediaSererId);
     List<StreamPushItem> getPushList(String mediaSererId);
 
 
     StreamPushItem transform(MediaItem item);
     StreamPushItem transform(MediaItem item);

+ 2 - 2
src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java

@@ -110,9 +110,9 @@ public class StreamPushServiceImpl implements IStreamPushService {
     }
     }
 
 
     @Override
     @Override
-    public PageInfo<StreamPushItem> getPushList(Integer page, Integer count) {
+    public PageInfo<StreamPushItem> getPushList(Integer page, Integer count, String query, Boolean pushing, String mediaServerId) {
         PageHelper.startPage(page, count);
         PageHelper.startPage(page, count);
-        List<StreamPushItem> all = streamPushMapper.selectAll();
+        List<StreamPushItem> all = streamPushMapper.selectAllForList(query, pushing, mediaServerId);
         return new PageInfo<>(all);
         return new PageInfo<>(all);
     }
     }
 
 

+ 1 - 2
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java

@@ -32,8 +32,7 @@ public interface PlatformGbStreamMapper {
             "LEFT JOIN parent_platform pp ON pp.serverGBId = pgs.platformId " +
             "LEFT JOIN parent_platform pp ON pp.serverGBId = pgs.platformId " +
             "WHERE " +
             "WHERE " +
             "pgs.app =#{app} " +
             "pgs.app =#{app} " +
-            "AND pgs.stream =#{stream} " +
-            "GROUP BY pp.serverGBId")
+            "AND pgs.stream =#{stream} ")
     List<ParentPlatform> selectByAppAndStream(String app, String stream);
     List<ParentPlatform> selectByAppAndStream(String app, String stream);
 
 
     @Select("SELECT pgs.*, gs.gbId  FROM platform_gb_stream pgs " +
     @Select("SELECT pgs.*, gs.gbId  FROM platform_gb_stream pgs " +

+ 21 - 0
src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java

@@ -48,6 +48,27 @@ public interface StreamPushMapper {
             "</script>")
             "</script>")
     int delAll(List<StreamPushItem> streamPushItems);
     int delAll(List<StreamPushItem> streamPushItems);
 
 
+    
+
+
+    @Select(value = {" <script>" +
+            "SELECT " +
+            "st.*, " +
+            "pgs.gbId, pgs.status, pgs.name, pgs.longitude, pgs.latitude " +
+            "from " +
+            "stream_push st " +
+            "LEFT JOIN gb_stream pgs " +
+            "on st.app = pgs.app AND st.stream = pgs.stream " +
+            "WHERE " +
+            "1=1 " +
+            " <if test='query != null'> AND (st.app LIKE '%${query}%' OR st.stream LIKE '%${query}%' OR pgs.gbId LIKE '%${query}%' OR pgs.name LIKE '%${query}%')</if> " +
+            " <if test='pushing == true' > AND (pgs.gbId is null OR pgs.status=1)</if>" +
+            " <if test='pushing == false' > AND pgs.status=0</if>" +
+            " <if test='mediaServerId != null' > AND st.mediaServerId=#{mediaServerId} </if>" +
+            "order by st.createStamp desc" +
+            " </script>"})
+    List<StreamPushItem> selectAllForList(String query, Boolean pushing, String mediaServerId);
+
     @Select("SELECT st.*, pgs.gbId, pgs.status, pgs.name, pgs.longitude, pgs.latitude FROM stream_push st LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream order by st.createStamp desc")
     @Select("SELECT st.*, pgs.gbId, pgs.status, pgs.name, pgs.longitude, pgs.latitude FROM stream_push st LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream order by st.createStamp desc")
     List<StreamPushItem> selectAll();
     List<StreamPushItem> selectAll();
 
 

+ 12 - 3
src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java

@@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Controller;
 import org.springframework.stereotype.Controller;
+import org.springframework.util.StringUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.context.request.async.DeferredResult;
 import org.springframework.web.context.request.async.DeferredResult;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
@@ -57,16 +58,24 @@ public class StreamPushController {
             @ApiImplicitParam(name="page", value = "当前页", required = true, dataTypeClass = Integer.class),
             @ApiImplicitParam(name="page", value = "当前页", required = true, dataTypeClass = Integer.class),
             @ApiImplicitParam(name="count", value = "每页查询数量", required = true, dataTypeClass = Integer.class),
             @ApiImplicitParam(name="count", value = "每页查询数量", required = true, dataTypeClass = Integer.class),
             @ApiImplicitParam(name="query", value = "查询内容", dataTypeClass = String.class),
             @ApiImplicitParam(name="query", value = "查询内容", dataTypeClass = String.class),
-            @ApiImplicitParam(name="online", value = "是否在线", dataTypeClass = Boolean.class),
+            @ApiImplicitParam(name="pushing", value = "是否正在推流", dataTypeClass = Boolean.class),
+            @ApiImplicitParam(name="mediaServerId", value = "流媒体ID", dataTypeClass = String.class),
     })
     })
     @GetMapping(value = "/list")
     @GetMapping(value = "/list")
     @ResponseBody
     @ResponseBody
     public PageInfo<StreamPushItem> list(@RequestParam(required = false)Integer page,
     public PageInfo<StreamPushItem> list(@RequestParam(required = false)Integer page,
                                          @RequestParam(required = false)Integer count,
                                          @RequestParam(required = false)Integer count,
                                          @RequestParam(required = false)String query,
                                          @RequestParam(required = false)String query,
-                                         @RequestParam(required = false)Boolean online ){
+                                         @RequestParam(required = false)Boolean pushing,
+                                         @RequestParam(required = false)String mediaServerId ){
 
 
-        PageInfo<StreamPushItem> pushList = streamPushService.getPushList(page, count);
+        if (StringUtils.isEmpty(query)) {
+            query = null;
+        }
+        if (StringUtils.isEmpty(mediaServerId)) {
+            mediaServerId = null;
+        }
+        PageInfo<StreamPushItem> pushList = streamPushService.getPushList(page, count, query, pushing, mediaServerId);
         return pushList;
         return pushList;
     }
     }
 
 

+ 33 - 2
web_src/src/components/PushVideoList.vue

@@ -9,15 +9,33 @@
 					<span style="font-size: 1rem; font-weight: bold;">推流列表</span>
 					<span style="font-size: 1rem; font-weight: bold;">推流列表</span>
 				</div>
 				</div>
         <div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;font-size: 14px;">
         <div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;font-size: 14px;">
+
+          搜索: <el-input @input="getPushList" style="margin-right: 1rem; width: auto;" size="mini" placeholder="关键字" prefix-icon="el-icon-search" v-model="searchSrt" clearable> </el-input>
+
+          流媒体: <el-select size="mini" @change="getPushList" style="margin-right: 1rem;" v-model="mediaServerId" placeholder="请选择" default-first-option>
+          <el-option label="全部" value=""></el-option>
+          <el-option
+            v-for="item in mediaServerList"
+            :key="item.id"
+            :label="item.id"
+            :value="item.id">
+          </el-option>
+        </el-select>
+          推流状态: <el-select size="mini" style="margin-right: 1rem;" @change="getPushList" v-model="pushing" placeholder="请选择" default-first-option>
+          <el-option label="全部" value=""></el-option>
+          <el-option label="推流进行中" value="true"></el-option>
+          <el-option label="推流未进行" value="false"></el-option>
+        </el-select>
           <el-button icon="el-icon-upload2" size="mini" style="margin-right: 1rem;" type="primary" @click="importChannel">通道导入</el-button>
           <el-button icon="el-icon-upload2" size="mini" style="margin-right: 1rem;" type="primary" @click="importChannel">通道导入</el-button>
           <el-button icon="el-icon-download" size="mini" style="margin-right: 1rem;" type="primary" >
           <el-button icon="el-icon-download" size="mini" style="margin-right: 1rem;" type="primary" >
             <a style="color: #FFFFFF; text-align: center; text-decoration: none" href="/static/file/推流通道导入.zip" download='推流通道导入.zip' >下载模板</a>
             <a style="color: #FFFFFF; text-align: center; text-decoration: none" href="/static/file/推流通道导入.zip" download='推流通道导入.zip' >下载模板</a>
           </el-button>
           </el-button>
-
         </div>
         </div>
 				<devicePlayer ref="devicePlayer"></devicePlayer>
 				<devicePlayer ref="devicePlayer"></devicePlayer>
 				<addStreamTOGB ref="addStreamTOGB"></addStreamTOGB>
 				<addStreamTOGB ref="addStreamTOGB"></addStreamTOGB>
 				<el-table :data="pushList" border style="width: 100%" :height="winHeight">
 				<el-table :data="pushList" border style="width: 100%" :height="winHeight">
+					<el-table-column prop="name" label="名称" width="180" align="center">
+					</el-table-column>
 					<el-table-column prop="app" label="APP" width="180" align="center">
 					<el-table-column prop="app" label="APP" width="180" align="center">
 					</el-table-column>
 					</el-table-column>
 					<el-table-column prop="stream" label="流ID" width="240" align="center">
 					<el-table-column prop="stream" label="流ID" width="240" align="center">
@@ -73,6 +91,7 @@
 	import addStreamTOGB from './dialog/addStreamTOGB.vue'
 	import addStreamTOGB from './dialog/addStreamTOGB.vue'
 	import uiHeader from './UiHeader.vue'
 	import uiHeader from './UiHeader.vue'
 	import importChannel from './dialog/importChannel.vue'
 	import importChannel from './dialog/importChannel.vue'
+	import MediaServer from './service/MediaServer'
 	export default {
 	export default {
 		name: 'pushVideoList',
 		name: 'pushVideoList',
 		components: {
 		components: {
@@ -89,9 +108,14 @@
 				updateLooper: 0, //数据刷新轮训标志
 				updateLooper: 0, //数据刷新轮训标志
 				currentDeviceChannelsLenth:0,
 				currentDeviceChannelsLenth:0,
 				winHeight: window.innerHeight - 200,
 				winHeight: window.innerHeight - 200,
+        mediaServerObj : new MediaServer(),
 				currentPage:1,
 				currentPage:1,
 				count:15,
 				count:15,
 				total:0,
 				total:0,
+        searchSrt: "",
+        pushing: "",
+        mediaServerId: "",
+        mediaServerList: [],
 				getDeviceListLoading: false
 				getDeviceListLoading: false
 			};
 			};
 		},
 		},
@@ -106,6 +130,10 @@
 		},
 		},
 		methods: {
 		methods: {
 			initData: function() {
 			initData: function() {
+        this.mediaServerObj.getOnlineMediaServerList((data)=>{
+          console.log(data)
+          this.mediaServerList = data.data;
+        })
 				this.getPushList();
 				this.getPushList();
 			},
 			},
 			currentChange: function(val){
 			currentChange: function(val){
@@ -124,7 +152,10 @@
 					url:`/api/push/list`,
 					url:`/api/push/list`,
 					params: {
 					params: {
 						page: that.currentPage,
 						page: that.currentPage,
-						count: that.count
+						count: that.count,
+            query: that.searchSrt,
+            pushing: that.pushing,
+            mediaServerId: that.mediaServerId,
 					}
 					}
 				}).then(function (res) {
 				}).then(function (res) {
 					that.total = res.data.total;
 					that.total = res.data.total;