Commit e0028a87cb4fc37759c9c33ecd20591fe6dd0aa7

Authored by 648540858
1 parent ea85a620

为推流列表增加搜索功能

src/main/java/com/genersoft/iot/vmp/service/IStreamPushService.java
@@ -30,11 +30,9 @@ public interface IStreamPushService { @@ -30,11 +30,9 @@ public interface IStreamPushService {
30 30
31 /** 31 /**
32 * 获取 32 * 获取
33 - * @param page  
34 - * @param count  
35 - * @return  
36 */ 33 */
37 - PageInfo<StreamPushItem> getPushList(Integer page, Integer count); 34 + PageInfo<StreamPushItem> getPushList(Integer page, Integer count, String query, Boolean pushing, String mediaServerId);
  35 +
38 List<StreamPushItem> getPushList(String mediaSererId); 36 List<StreamPushItem> getPushList(String mediaSererId);
39 37
40 StreamPushItem transform(MediaItem item); 38 StreamPushItem transform(MediaItem item);
src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java
@@ -110,9 +110,9 @@ public class StreamPushServiceImpl implements IStreamPushService { @@ -110,9 +110,9 @@ public class StreamPushServiceImpl implements IStreamPushService {
110 } 110 }
111 111
112 @Override 112 @Override
113 - public PageInfo<StreamPushItem> getPushList(Integer page, Integer count) { 113 + public PageInfo<StreamPushItem> getPushList(Integer page, Integer count, String query, Boolean pushing, String mediaServerId) {
114 PageHelper.startPage(page, count); 114 PageHelper.startPage(page, count);
115 - List<StreamPushItem> all = streamPushMapper.selectAll(); 115 + List<StreamPushItem> all = streamPushMapper.selectAllForList(query, pushing, mediaServerId);
116 return new PageInfo<>(all); 116 return new PageInfo<>(all);
117 } 117 }
118 118
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java
@@ -32,8 +32,7 @@ public interface PlatformGbStreamMapper { @@ -32,8 +32,7 @@ public interface PlatformGbStreamMapper {
32 "LEFT JOIN parent_platform pp ON pp.serverGBId = pgs.platformId " + 32 "LEFT JOIN parent_platform pp ON pp.serverGBId = pgs.platformId " +
33 "WHERE " + 33 "WHERE " +
34 "pgs.app =#{app} " + 34 "pgs.app =#{app} " +
35 - "AND pgs.stream =#{stream} " +  
36 - "GROUP BY pp.serverGBId") 35 + "AND pgs.stream =#{stream} ")
37 List<ParentPlatform> selectByAppAndStream(String app, String stream); 36 List<ParentPlatform> selectByAppAndStream(String app, String stream);
38 37
39 @Select("SELECT pgs.*, gs.gbId FROM platform_gb_stream pgs " + 38 @Select("SELECT pgs.*, gs.gbId FROM platform_gb_stream pgs " +
src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java
@@ -48,6 +48,27 @@ public interface StreamPushMapper { @@ -48,6 +48,27 @@ public interface StreamPushMapper {
48 "</script>") 48 "</script>")
49 int delAll(List<StreamPushItem> streamPushItems); 49 int delAll(List<StreamPushItem> streamPushItems);
50 50
  51 +
  52 +
  53 +
  54 + @Select(value = {" <script>" +
  55 + "SELECT " +
  56 + "st.*, " +
  57 + "pgs.gbId, pgs.status, pgs.name, pgs.longitude, pgs.latitude " +
  58 + "from " +
  59 + "stream_push st " +
  60 + "LEFT JOIN gb_stream pgs " +
  61 + "on st.app = pgs.app AND st.stream = pgs.stream " +
  62 + "WHERE " +
  63 + "1=1 " +
  64 + " <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> " +
  65 + " <if test='pushing == true' > AND (pgs.gbId is null OR pgs.status=1)</if>" +
  66 + " <if test='pushing == false' > AND pgs.status=0</if>" +
  67 + " <if test='mediaServerId != null' > AND st.mediaServerId=#{mediaServerId} </if>" +
  68 + "order by st.createStamp desc" +
  69 + " </script>"})
  70 + List<StreamPushItem> selectAllForList(String query, Boolean pushing, String mediaServerId);
  71 +
51 @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") 72 @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")
52 List<StreamPushItem> selectAll(); 73 List<StreamPushItem> selectAll();
53 74
src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java
@@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired; @@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
24 import org.springframework.http.HttpStatus; 24 import org.springframework.http.HttpStatus;
25 import org.springframework.http.ResponseEntity; 25 import org.springframework.http.ResponseEntity;
26 import org.springframework.stereotype.Controller; 26 import org.springframework.stereotype.Controller;
  27 +import org.springframework.util.StringUtils;
27 import org.springframework.web.bind.annotation.*; 28 import org.springframework.web.bind.annotation.*;
28 import org.springframework.web.context.request.async.DeferredResult; 29 import org.springframework.web.context.request.async.DeferredResult;
29 import org.springframework.web.multipart.MultipartFile; 30 import org.springframework.web.multipart.MultipartFile;
@@ -57,16 +58,24 @@ public class StreamPushController { @@ -57,16 +58,24 @@ public class StreamPushController {
57 @ApiImplicitParam(name="page", value = "当前页", required = true, dataTypeClass = Integer.class), 58 @ApiImplicitParam(name="page", value = "当前页", required = true, dataTypeClass = Integer.class),
58 @ApiImplicitParam(name="count", value = "每页查询数量", required = true, dataTypeClass = Integer.class), 59 @ApiImplicitParam(name="count", value = "每页查询数量", required = true, dataTypeClass = Integer.class),
59 @ApiImplicitParam(name="query", value = "查询内容", dataTypeClass = String.class), 60 @ApiImplicitParam(name="query", value = "查询内容", dataTypeClass = String.class),
60 - @ApiImplicitParam(name="online", value = "是否在线", dataTypeClass = Boolean.class), 61 + @ApiImplicitParam(name="pushing", value = "是否正在推流", dataTypeClass = Boolean.class),
  62 + @ApiImplicitParam(name="mediaServerId", value = "流媒体ID", dataTypeClass = String.class),
61 }) 63 })
62 @GetMapping(value = "/list") 64 @GetMapping(value = "/list")
63 @ResponseBody 65 @ResponseBody
64 public PageInfo<StreamPushItem> list(@RequestParam(required = false)Integer page, 66 public PageInfo<StreamPushItem> list(@RequestParam(required = false)Integer page,
65 @RequestParam(required = false)Integer count, 67 @RequestParam(required = false)Integer count,
66 @RequestParam(required = false)String query, 68 @RequestParam(required = false)String query,
67 - @RequestParam(required = false)Boolean online ){ 69 + @RequestParam(required = false)Boolean pushing,
  70 + @RequestParam(required = false)String mediaServerId ){
68 71
69 - PageInfo<StreamPushItem> pushList = streamPushService.getPushList(page, count); 72 + if (StringUtils.isEmpty(query)) {
  73 + query = null;
  74 + }
  75 + if (StringUtils.isEmpty(mediaServerId)) {
  76 + mediaServerId = null;
  77 + }
  78 + PageInfo<StreamPushItem> pushList = streamPushService.getPushList(page, count, query, pushing, mediaServerId);
70 return pushList; 79 return pushList;
71 } 80 }
72 81
web_src/src/components/PushVideoList.vue
@@ -9,15 +9,33 @@ @@ -9,15 +9,33 @@
9 <span style="font-size: 1rem; font-weight: bold;">推流列表</span> 9 <span style="font-size: 1rem; font-weight: bold;">推流列表</span>
10 </div> 10 </div>
11 <div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;font-size: 14px;"> 11 <div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;font-size: 14px;">
  12 +
  13 + 搜索: <el-input @input="getPushList" style="margin-right: 1rem; width: auto;" size="mini" placeholder="关键字" prefix-icon="el-icon-search" v-model="searchSrt" clearable> </el-input>
  14 +
  15 + 流媒体: <el-select size="mini" @change="getPushList" style="margin-right: 1rem;" v-model="mediaServerId" placeholder="请选择" default-first-option>
  16 + <el-option label="全部" value=""></el-option>
  17 + <el-option
  18 + v-for="item in mediaServerList"
  19 + :key="item.id"
  20 + :label="item.id"
  21 + :value="item.id">
  22 + </el-option>
  23 + </el-select>
  24 + 推流状态: <el-select size="mini" style="margin-right: 1rem;" @change="getPushList" v-model="pushing" placeholder="请选择" default-first-option>
  25 + <el-option label="全部" value=""></el-option>
  26 + <el-option label="推流进行中" value="true"></el-option>
  27 + <el-option label="推流未进行" value="false"></el-option>
  28 + </el-select>
12 <el-button icon="el-icon-upload2" size="mini" style="margin-right: 1rem;" type="primary" @click="importChannel">通道导入</el-button> 29 <el-button icon="el-icon-upload2" size="mini" style="margin-right: 1rem;" type="primary" @click="importChannel">通道导入</el-button>
13 <el-button icon="el-icon-download" size="mini" style="margin-right: 1rem;" type="primary" > 30 <el-button icon="el-icon-download" size="mini" style="margin-right: 1rem;" type="primary" >
14 <a style="color: #FFFFFF; text-align: center; text-decoration: none" href="/static/file/推流通道导入.zip" download='推流通道导入.zip' >下载模板</a> 31 <a style="color: #FFFFFF; text-align: center; text-decoration: none" href="/static/file/推流通道导入.zip" download='推流通道导入.zip' >下载模板</a>
15 </el-button> 32 </el-button>
16 -  
17 </div> 33 </div>
18 <devicePlayer ref="devicePlayer"></devicePlayer> 34 <devicePlayer ref="devicePlayer"></devicePlayer>
19 <addStreamTOGB ref="addStreamTOGB"></addStreamTOGB> 35 <addStreamTOGB ref="addStreamTOGB"></addStreamTOGB>
20 <el-table :data="pushList" border style="width: 100%" :height="winHeight"> 36 <el-table :data="pushList" border style="width: 100%" :height="winHeight">
  37 + <el-table-column prop="name" label="名称" width="180" align="center">
  38 + </el-table-column>
21 <el-table-column prop="app" label="APP" width="180" align="center"> 39 <el-table-column prop="app" label="APP" width="180" align="center">
22 </el-table-column> 40 </el-table-column>
23 <el-table-column prop="stream" label="流ID" width="240" align="center"> 41 <el-table-column prop="stream" label="流ID" width="240" align="center">
@@ -73,6 +91,7 @@ @@ -73,6 +91,7 @@
73 import addStreamTOGB from './dialog/addStreamTOGB.vue' 91 import addStreamTOGB from './dialog/addStreamTOGB.vue'
74 import uiHeader from './UiHeader.vue' 92 import uiHeader from './UiHeader.vue'
75 import importChannel from './dialog/importChannel.vue' 93 import importChannel from './dialog/importChannel.vue'
  94 + import MediaServer from './service/MediaServer'
76 export default { 95 export default {
77 name: 'pushVideoList', 96 name: 'pushVideoList',
78 components: { 97 components: {
@@ -89,9 +108,14 @@ @@ -89,9 +108,14 @@
89 updateLooper: 0, //数据刷新轮训标志 108 updateLooper: 0, //数据刷新轮训标志
90 currentDeviceChannelsLenth:0, 109 currentDeviceChannelsLenth:0,
91 winHeight: window.innerHeight - 200, 110 winHeight: window.innerHeight - 200,
  111 + mediaServerObj : new MediaServer(),
92 currentPage:1, 112 currentPage:1,
93 count:15, 113 count:15,
94 total:0, 114 total:0,
  115 + searchSrt: "",
  116 + pushing: "",
  117 + mediaServerId: "",
  118 + mediaServerList: [],
95 getDeviceListLoading: false 119 getDeviceListLoading: false
96 }; 120 };
97 }, 121 },
@@ -106,6 +130,10 @@ @@ -106,6 +130,10 @@
106 }, 130 },
107 methods: { 131 methods: {
108 initData: function() { 132 initData: function() {
  133 + this.mediaServerObj.getOnlineMediaServerList((data)=>{
  134 + console.log(data)
  135 + this.mediaServerList = data.data;
  136 + })
109 this.getPushList(); 137 this.getPushList();
110 }, 138 },
111 currentChange: function(val){ 139 currentChange: function(val){
@@ -124,7 +152,10 @@ @@ -124,7 +152,10 @@
124 url:`/api/push/list`, 152 url:`/api/push/list`,
125 params: { 153 params: {
126 page: that.currentPage, 154 page: that.currentPage,
127 - count: that.count 155 + count: that.count,
  156 + query: that.searchSrt,
  157 + pushing: that.pushing,
  158 + mediaServerId: that.mediaServerId,
128 } 159 }
129 }).then(function (res) { 160 }).then(function (res) {
130 that.total = res.data.total; 161 that.total = res.data.total;