Commit 2e9b4b4e5e86c84088c45563cd61d18d8c7e5fea

Authored by 648540858
2 parents 3c8450fd bb97b2a1

Merge remote-tracking branch 'origin/master' into master

src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java
... ... @@ -310,73 +310,76 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
310 310 recordInfo.setSumNum(Integer.parseInt(XmlUtil.getText(rootElement, "SumNum")));
311 311 String sn = XmlUtil.getText(rootElement, "SN");
312 312 Element recordListElement = rootElement.element("RecordList");
313   - if (recordListElement == null) {
  313 + if (recordListElement == null || recordInfo.getSumNum() == 0) {
314 314 logger.info("无录像数据");
315 315 // responseAck(evt);
316   - return;
317   - }
318   -
319   - Iterator<Element> recordListIterator = recordListElement.elementIterator();
320   - List<RecordItem> recordList = new ArrayList<RecordItem>();
321   - if (recordListIterator != null) {
322   - RecordItem record = new RecordItem();
323   - logger.info("处理录像列表数据...");
324   - // 遍历DeviceList
325   - while (recordListIterator.hasNext()) {
326   - Element itemRecord = recordListIterator.next();
327   - Element recordElement = itemRecord.element("DeviceID");
328   - if (recordElement == null) {
329   - logger.info("记录为空,下一个...");
330   - continue;
  316 + // return;
  317 + } else {
  318 + Iterator<Element> recordListIterator = recordListElement.elementIterator();
  319 + List<RecordItem> recordList = new ArrayList<RecordItem>();
  320 + if (recordListIterator != null) {
  321 + RecordItem record = new RecordItem();
  322 + logger.info("处理录像列表数据...");
  323 + // 遍历DeviceList
  324 + while (recordListIterator.hasNext()) {
  325 + Element itemRecord = recordListIterator.next();
  326 + Element recordElement = itemRecord.element("DeviceID");
  327 + if (recordElement == null) {
  328 + logger.info("记录为空,下一个...");
  329 + continue;
  330 + }
  331 + record = new RecordItem();
  332 + record.setDeviceId(XmlUtil.getText(itemRecord, "DeviceID"));
  333 + record.setName(XmlUtil.getText(itemRecord, "Name"));
  334 + record.setFilePath(XmlUtil.getText(itemRecord, "FilePath"));
  335 + record.setAddress(XmlUtil.getText(itemRecord, "Address"));
  336 + record.setStartTime(
  337 + DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(XmlUtil.getText(itemRecord, "StartTime")));
  338 + record.setEndTime(
  339 + DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(XmlUtil.getText(itemRecord, "EndTime")));
  340 + record.setSecrecy(itemRecord.element("Secrecy") == null ? 0
  341 + : Integer.parseInt(XmlUtil.getText(itemRecord, "Secrecy")));
  342 + record.setType(XmlUtil.getText(itemRecord, "Type"));
  343 + record.setRecorderId(XmlUtil.getText(itemRecord, "RecorderID"));
  344 + recordList.add(record);
331 345 }
332   - record = new RecordItem();
333   - record.setDeviceId(XmlUtil.getText(itemRecord, "DeviceID"));
334   - record.setName(XmlUtil.getText(itemRecord, "Name"));
335   - record.setFilePath(XmlUtil.getText(itemRecord, "FilePath"));
336   - record.setAddress(XmlUtil.getText(itemRecord, "Address"));
337   - record.setStartTime(
338   - DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(XmlUtil.getText(itemRecord, "StartTime")));
339   - record.setEndTime(DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(XmlUtil.getText(itemRecord, "EndTime")));
340   - record.setSecrecy(itemRecord.element("Secrecy") == null ? 0
341   - : Integer.parseInt(XmlUtil.getText(itemRecord, "Secrecy")));
342   - record.setType(XmlUtil.getText(itemRecord, "Type"));
343   - record.setRecorderId(XmlUtil.getText(itemRecord, "RecorderID"));
344   - recordList.add(record);
  346 + // recordList.sort(Comparator.naturalOrder());
  347 + recordInfo.setRecordList(recordList);
345 348 }
346   - // recordList.sort(Comparator.naturalOrder());
347   - recordInfo.setRecordList(recordList);
348   - }
349 349  
350   - // 存在录像且如果当前录像明细个数小于总条数,说明拆包返回,需要组装,暂不返回
351   - if (recordInfo.getSumNum() > 0 && recordList.size() > 0 && recordList.size() < recordInfo.getSumNum()) {
352   - // 为防止连续请求该设备的录像数据,返回数据错乱,特增加sn进行区分
353   - String cacheKey = CACHE_RECORDINFO_KEY + deviceId + sn;
354   - // TODO 暂时直接操作redis存储,后续封装专用缓存接口,改为本地内存缓存
355   - if (redis.hasKey(cacheKey)) {
356   - List<RecordItem> previousList = (List<RecordItem>) redis.get(cacheKey);
357   - if (previousList != null && previousList.size() > 0) {
358   - recordList.addAll(previousList);
359   - }
360   - // 本分支表示录像列表被拆包,且加上之前的数据还是不够,保存缓存返回,等待下个包再处理
361   - if (recordList.size() < recordInfo.getSumNum()) {
  350 + // 存在录像且如果当前录像明细个数小于总条数,说明拆包返回,需要组装,暂不返回
  351 + if (recordInfo.getSumNum() > 0 && recordList.size() > 0 && recordList.size() < recordInfo.getSumNum()) {
  352 + // 为防止连续请求该设备的录像数据,返回数据错乱,特增加sn进行区分
  353 + String cacheKey = CACHE_RECORDINFO_KEY + deviceId + sn;
  354 + // TODO 暂时直接操作redis存储,后续封装专用缓存接口,改为本地内存缓存
  355 + if (redis.hasKey(cacheKey)) {
  356 + List<RecordItem> previousList = (List<RecordItem>) redis.get(cacheKey);
  357 + if (previousList != null && previousList.size() > 0) {
  358 + recordList.addAll(previousList);
  359 + }
  360 + // 本分支表示录像列表被拆包,且加上之前的数据还是不够,保存缓存返回,等待下个包再处理
  361 + if (recordList.size() < recordInfo.getSumNum()) {
  362 + logger.info("已获取" + recordList.size() + "项录像数据,共" + recordInfo.getSumNum() + "项");
  363 + redis.set(cacheKey, recordList, 90);
  364 + return;
  365 + } else {
  366 + // 本分支表示录像被拆包,但加上之前的数据够足够,返回响应
  367 + // 因设备心跳有监听redis过期机制,为提高性能,此处手动删除
  368 + logger.info("录像数据已全部获取");
  369 + redis.del(cacheKey);
  370 + }
  371 + } else {
  372 + // 本分支有两种可能:1、录像列表被拆包,且是第一个包,直接保存缓存返回,等待下个包再处理
  373 + // 2、之前有包,但超时清空了,那么这次sn批次的响应数据已经不完整,等待过期时间后redis自动清空数据
362 374 logger.info("已获取" + recordList.size() + "项录像数据,共" + recordInfo.getSumNum() + "项");
  375 + logger.info("等待后续的包...");
  376 +
363 377 redis.set(cacheKey, recordList, 90);
364 378 return;
365   - } else {
366   - // 本分支表示录像被拆包,但加上之前的数据够足够,返回响应
367   - // 因设备心跳有监听redis过期机制,为提高性能,此处手动删除
368   - logger.info("录像数据已全部获取");
369   - redis.del(cacheKey);
370 379 }
371   - } else {
372   - // 本分支有两种可能:1、录像列表被拆包,且是第一个包,直接保存缓存返回,等待下个包再处理
373   - // 2、之前有包,但超时清空了,那么这次sn批次的响应数据已经不完整,等待过期时间后redis自动清空数据
374   - logger.info("等待后续的包...");
375   -
376   - redis.set(cacheKey, recordList, 90);
377   - return;
378 380 }
379   -
  381 + // 自然顺序排序, 元素进行升序排列
  382 + recordInfo.getRecordList().sort(Comparator.naturalOrder());
380 383 }
381 384 // 走到这里,有以下可能:1、没有录像信息,第一次收到recordinfo的消息即返回响应数据,无redis操作
382 385 // 2、有录像数据,且第一次即收到完整数据,返回响应数据,无redis操作
... ... @@ -386,8 +389,8 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
386 389 RequestMessage msg = new RequestMessage();
387 390 msg.setDeviceId(deviceId);
388 391 msg.setType(DeferredResultHolder.CALLBACK_CMD_RECORDINFO);
389   - // 自然顺序排序, 元素进行升序排列
390   - recordInfo.getRecordList().sort(Comparator.naturalOrder());
  392 + // // 自然顺序排序, 元素进行升序排列
  393 + // recordInfo.getRecordList().sort(Comparator.naturalOrder());
391 394 msg.setData(recordInfo);
392 395 deferredResultHolder.invokeResult(msg);
393 396 logger.info("处理完成,返回结果");
... ...
src/main/java/com/genersoft/iot/vmp/storager/redis/VideoManagerRedisStoragerImpl.java
... ... @@ -288,7 +288,7 @@ public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager {
288 288 // devices.add((Device)redis.get((String)deviceIdList.get(i)));
289 289 device =(Device)redis.get((String)deviceIdList.get(i));
290 290 if (redis.scan(VideoManagerConstants.KEEPLIVEKEY_PREFIX+device.getDeviceId()).size() == 0){
291   - outline(device.getDeviceId());
  291 + // outline(device.getDeviceId());
292 292 }
293 293 devices.add(device);
294 294 }
... ... @@ -297,7 +297,7 @@ public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager {
297 297 // devices.add((Device)redis.get(VideoManagerConstants.DEVICE_PREFIX+deviceIds[i]));
298 298 device = (Device)redis.get(VideoManagerConstants.DEVICE_PREFIX+deviceIds[i]);
299 299 if (redis.scan(VideoManagerConstants.KEEPLIVEKEY_PREFIX+device.getDeviceId()).size() == 0){
300   - outline(device.getDeviceId());
  300 + // outline(device.getDeviceId());
301 301 }
302 302 devices.add(device);
303 303 }
... ...
web_src/src/components/control.vue
1 1 <template>
2   - <div id="app">
3   - <el-container>
4   - <el-header>
5   - <uiHeader></uiHeader>
6   - </el-header>
7   - <el-main>
8   - <div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;">
9   - <span style="font-size: 1rem; font-weight: bold;">控制台</span>
10   - <div style="position: absolute; right: 1rem; top: 0.3rem;">
11   - <el-popover placement="bottom" width="750" height="300" trigger="click">
12   - <div style="height: 600px;overflow:auto;">
13   - <table class="table-c" cellspacing="0">
14   - <tr v-for="(value, key, index) in serverConfig">
15   - <td style="width: 18rem; text-align: right;">{{ key }}</td>
16   - <td style="width: 33rem; text-align:left">{{ value }}</td>
17   - </tr>
18   - </table>
19   - </div>
20   - <el-button type="primary" slot="reference" size="mini" @click="getServerConfig()">查看服务器配置</el-button>
21   - </el-popover>
22   - <el-button style="margin-left: 1rem;" type="danger" size="mini" @click="reStartServer()">重启服务器</el-button>
23   - </div>
24   - </div>
25   - <el-row :gutter="30">
26   - <el-col :span="12"><div class="control-table" id="ThreadsLoad">table1</div></el-col>
27   - <el-col :span="12"><div class="control-table" id="WorkThreadsLoad">table2</div></el-col>
28   - </el-row>
29   - <el-table :data="allSessionData" style="margin-top: 1rem;">
30   - <el-table-column prop="peer_ip" label="远端"></el-table-column>
31   - <el-table-column prop="local_ip" label="本地"></el-table-column>
32   - <el-table-column prop="typeid" label="类型"></el-table-column>
33   - <el-table-column align="right">
34   - <template slot="header" slot-scope="scope">
35   - <el-button icon="el-icon-refresh-right" circle @click="getAllSession()"></el-button>
36   - </template>
37   - <template slot-scope="scope">
38   - <el-button @click.native.prevent="deleteRow(scope.$index, allSessionData)" type="text" size="small">移除</el-button>
39   - </template>
40   - </el-table-column>
41   - </el-table>
  2 +<div id="app">
  3 + <el-container>
  4 + <el-header>
  5 + <uiHeader></uiHeader>
  6 + </el-header>
  7 + <el-main>
  8 + <div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;">
  9 + <span style="font-size: 1rem; font-weight: bold;">控制台</span>
  10 + <div style="position: absolute; right: 1rem; top: 0.3rem;">
  11 + <el-popover placement="bottom" width="750" height="300" trigger="click">
  12 + <div style="height: 600px;overflow:auto;">
  13 + <table class="table-c" cellspacing="0">
  14 + <tr v-for="(value, key, index) in serverConfig">
  15 + <td style="width: 18rem; text-align: right;">{{ key }}</td>
  16 + <td style="width: 33rem; text-align:left">{{ value }}</td>
  17 + </tr>
  18 + </table>
  19 + </div>
  20 + <el-button type="primary" slot="reference" size="mini" @click="getServerConfig()">查看服务器配置</el-button>
  21 + </el-popover>
  22 + <el-button style="margin-left: 1rem;" type="danger" size="mini" @click="reStartServer()">重启服务器</el-button>
  23 + </div>
  24 + </div>
  25 + <el-row :gutter="30">
  26 + <el-col :span="12">
  27 + <div class="control-table" id="ThreadsLoad">table1</div>
  28 + </el-col>
  29 + <el-col :span="12">
  30 + <div class="control-table" id="WorkThreadsLoad">table2</div>
  31 + </el-col>
  32 + </el-row>
  33 + <el-table :data="allSessionData" style="margin-top: 1rem;">
  34 + <el-table-column prop="peer_ip" label="远端"></el-table-column>
  35 + <el-table-column prop="local_ip" label="本地"></el-table-column>
  36 + <el-table-column prop="typeid" label="类型"></el-table-column>
  37 + <el-table-column align="right">
  38 + <template slot="header" slot-scope="scope">
  39 + <el-button icon="el-icon-refresh-right" circle @click="getAllSession()"></el-button>
  40 + </template>
  41 + <template slot-scope="scope">
  42 + <el-button @click.native.prevent="deleteRow(scope.$index, allSessionData)" type="text" size="small">移除</el-button>
  43 + </template>
  44 + </el-table-column>
  45 + </el-table>
42 46  
43   - </el-main>
44   - <!-- <el-footer style="position: absolute; bottom: 0; width: 100%;">ZLMediaKit-VUE_UI v1</el-footer> -->
45   - </el-container>
  47 + </el-main>
  48 + <!-- <el-footer style="position: absolute; bottom: 0; width: 100%;">ZLMediaKit-VUE_UI v1</el-footer> -->
  49 + </el-container>
46 50  
47   - </div>
  51 +</div>
48 52 </template>
49 53  
50 54 <script>
51   -
52 55 import uiHeader from './UiHeader.vue'
53 56  
54 57 import echarts from 'echarts';
55 58 export default {
56   - name: 'app',
57   - components: {
58   - echarts,
59   - uiHeader
60   - },
61   - data() {
62   - return {
63   - tableOption: {
64   - // legend: {},
65   - xAxis: {},
66   - yAxis: {},
67   - label: {},
68   - tooltip: {},
69   - dataZoom: [],
70   - series: []
71   - },
72   - table1Option: {
73   - // legend: {},
74   - xAxis: {},
75   - yAxis: {},
76   - label: {},
77   - tooltip: {},
78   - series: []
79   - },
80   - mChart: null,
81   - mChart1: null,
82   - charZoomStart: 0,
83   - charZoomEnd: 100,
84   - chartInterval: 0, //更新图表统计图定时任务标识
85   - allSessionData: [],
86   - visible: false,
87   - serverConfig: {}
88   - };
89   - },
90   - mounted() {
91   - this.getAllSession();
92   - this.initTable();
93   - this.updateData();
94   - this.chartInterval = setInterval(this.updateData, 3000);
95   - },
96   - destroyed() {
97   - clearInterval(this.chartInterval); //释放定时任务
98   - },
99   - methods: {
100   - updateData: function() {
101   - this.getThreadsLoad();
102   - },
103   - /**
104   - * 获取线程状态
105   - */
106   - getThreadsLoad: function() {
107   - let that = this;
108   - this.$axios({
109   - method: 'get',
110   - url: '/zlm/index/api/getThreadsLoad'
111   - }).then(function(res) {
112   - if (res.data.code == 0) {
113   - that.tableOption.xAxis.data.push(new Date().toLocaleTimeString());
114   - that.table1Option.xAxis.data.push(new Date().toLocaleTimeString());
  59 + name: 'app',
  60 + components: {
  61 + echarts,
  62 + uiHeader
  63 + },
  64 + data() {
  65 + return {
  66 + tableOption: {
  67 + // legend: {},
  68 + xAxis: {},
  69 + yAxis: {},
  70 + label: {},
  71 + tooltip: {},
  72 + dataZoom: [],
  73 + series: []
  74 + },
  75 + table1Option: {
  76 + // legend: {},
  77 + xAxis: {},
  78 + yAxis: {},
  79 + label: {},
  80 + tooltip: {},
  81 + series: []
  82 + },
  83 + mChart: null,
  84 + mChart1: null,
  85 + charZoomStart: 0,
  86 + charZoomEnd: 100,
  87 + chartInterval: 0, //更新图表统计图定时任务标识
  88 + allSessionData: [],
  89 + visible: false,
  90 + serverConfig: {}
  91 + };
  92 + },
  93 + mounted() {
  94 + this.getAllSession();
  95 + this.initTable();
  96 + this.updateData();
  97 + this.chartInterval = setInterval(this.updateData, 3000);
  98 + },
  99 + destroyed() {
  100 + clearInterval(this.chartInterval); //释放定时任务
  101 + },
  102 + methods: {
  103 + updateData: function () {
  104 + this.getThreadsLoad();
  105 + },
  106 + /**
  107 + * 获取线程状态
  108 + */
  109 + getThreadsLoad: function () {
  110 + let that = this;
  111 + this.$axios({
  112 + method: 'get',
  113 + url: '/zlm/index/api/getThreadsLoad'
  114 + }).then(function (res) {
  115 + if (res.data.code == 0) {
  116 + that.tableOption.xAxis.data.push(new Date().toLocaleTimeString('chinese', {
  117 + hour12: false
  118 + }));
  119 + that.table1Option.xAxis.data.push(new Date().toLocaleTimeString('chinese', {
  120 + hour12: false
  121 + }));
115 122  
116   - for (var i = 0; i < res.data.data.length; i++) {
117   - if (that.tableOption.series[i] === undefined) {
118   - let data = {
119   - data: [],
120   - type: 'line'
121   - };
122   - let data1 = {
123   - data: [],
124   - type: 'line'
125   - };
126   - data.data.push(res.data.data[i].delay);
127   - data1.data.push(res.data.data[i].load);
128   - that.tableOption.series.push(data);
129   - that.table1Option.series.push(data1);
130   - } else {
131   - that.tableOption.series[i].data.push(res.data.data[i].delay);
132   - that.table1Option.series[i].data.push(res.data.data[i].load);
133   - }
134   - }
135   - that.tableOption.dataZoom[0].start = that.charZoomStart;
136   - that.tableOption.dataZoom[0].end = that.charZoomEnd;
137   - that.table1Option.dataZoom[0].start = that.charZoomStart;
138   - that.table1Option.dataZoom[0].end = that.charZoomEnd;
139   - //that.myChart = echarts.init(document.getElementById('ThreadsLoad'));
140   - that.myChart.setOption(that.tableOption, true);
141   - // that.myChart1 = echarts.init(document.getElementById('WorkThreadsLoad'));
142   - that.myChart1.setOption(that.table1Option, true);
143   - }
144   - });
145   - },
146   - initTable: function() {
147   - let that = this;
148   - this.tableOption.xAxis = {
149   - type: 'category',
150   - data: [], // x轴数据
151   - name: '时间', // x轴名称
152   - // x轴名称样式
153   - nameTextStyle: {
154   - fontWeight: 300,
155   - fontSize: 15
156   - }
157   - };
158   - this.tableOption.yAxis = {
159   - type: 'value',
160   - name: '延迟率', // y轴名称
161   - boundaryGap: [0, '100%'],
162   - max: 100,
163   - axisLabel: {
164   - show: true,
165   - interval: 'auto',
166   - formatter: '{value} %'
167   - },
168   - // y轴名称样式
169   - nameTextStyle: {
170   - fontWeight: 300,
171   - fontSize: 15
172   - }
173   - };
174   - this.tableOption.dataZoom = [
175   - {
176   - show: true,
177   - start: this.charZoomStart,
178   - end: this.charZoomEnd
179   - }
180   - ];
181   - this.myChart = echarts.init(document.getElementById('ThreadsLoad'));
182   - this.myChart.setOption(this.tableOption);
183   - this.myChart.on('dataZoom', function(event) {
184   - if (event.batch) {
185   - that.charZoomStart = event.batch[0].start;
186   - that.charZoomEnd = event.batch[0].end;
187   - } else {
188   - that.charZoomStart = event.start;
189   - that.charZoomEnd = event.end;
190   - }
191   - });
  123 + for (var i = 0; i < res.data.data.length; i++) {
  124 + if (that.tableOption.series[i] === undefined) {
  125 + let data = {
  126 + data: [],
  127 + type: 'line'
  128 + };
  129 + let data1 = {
  130 + data: [],
  131 + type: 'line'
  132 + };
  133 + data.data.push(res.data.data[i].delay);
  134 + data1.data.push(res.data.data[i].load);
  135 + that.tableOption.series.push(data);
  136 + that.table1Option.series.push(data1);
  137 + } else {
  138 + that.tableOption.series[i].data.push(res.data.data[i].delay);
  139 + that.table1Option.series[i].data.push(res.data.data[i].load);
  140 + }
  141 + }
  142 + that.tableOption.dataZoom[0].start = that.charZoomStart;
  143 + that.tableOption.dataZoom[0].end = that.charZoomEnd;
  144 + that.table1Option.dataZoom[0].start = that.charZoomStart;
  145 + that.table1Option.dataZoom[0].end = that.charZoomEnd;
  146 + //that.myChart = echarts.init(document.getElementById('ThreadsLoad'));
  147 + that.myChart.setOption(that.tableOption, true);
  148 + // that.myChart1 = echarts.init(document.getElementById('WorkThreadsLoad'));
  149 + that.myChart1.setOption(that.table1Option, true);
  150 + }
  151 + });
  152 + },
  153 + initTable: function () {
  154 + let that = this;
  155 + this.tableOption.xAxis = {
  156 + type: 'category',
  157 + data: [], // x轴数据
  158 + name: '时间', // x轴名称
  159 + // x轴名称样式
  160 + nameTextStyle: {
  161 + fontWeight: 300,
  162 + fontSize: 15
  163 + }
  164 + };
  165 + this.tableOption.yAxis = {
  166 + type: 'value',
  167 + name: '延迟率', // y轴名称
  168 + boundaryGap: [0, '100%'],
  169 + max: 100,
  170 + axisLabel: {
  171 + show: true,
  172 + interval: 'auto',
  173 + formatter: '{value} %'
  174 + },
  175 + // y轴名称样式
  176 + nameTextStyle: {
  177 + fontWeight: 300,
  178 + fontSize: 15
  179 + }
  180 + };
  181 + this.tableOption.dataZoom = [{
  182 + show: true,
  183 + start: this.charZoomStart,
  184 + end: this.charZoomEnd
  185 + }];
  186 + this.myChart = echarts.init(document.getElementById('ThreadsLoad'));
  187 + this.myChart.setOption(this.tableOption);
  188 + this.myChart.on('dataZoom', function (event) {
  189 + if (event.batch) {
  190 + that.charZoomStart = event.batch[0].start;
  191 + that.charZoomEnd = event.batch[0].end;
  192 + } else {
  193 + that.charZoomStart = event.start;
  194 + that.charZoomEnd = event.end;
  195 + }
  196 + });
192 197  
193   - this.table1Option.xAxis = {
194   - type: 'category',
195   - data: [], // x轴数据
196   - name: '时间', // x轴名称
197   - // x轴名称样式
198   - nameTextStyle: {
199   - fontWeight: 300,
200   - fontSize: 15
201   - }
202   - };
203   - this.table1Option.yAxis = {
204   - type: 'value',
205   - name: '负载率', // y轴名称
206   - boundaryGap: [0, '100%'],
207   - max: 100,
208   - axisLabel: {
209   - show: true,
210   - interval: 'auto',
211   - formatter: '{value} %'
212   - },
213   - // y轴名称样式
214   - nameTextStyle: {
215   - fontWeight: 300,
216   - fontSize: 15
217   - }
218   - };
219   - this.table1Option.dataZoom = [
220   - {
221   - show: true,
222   - start: this.charZoomStart,
223   - end: this.charZoomEnd
224   - }
225   - ];
226   - this.myChart1 = echarts.init(document.getElementById('WorkThreadsLoad'));
227   - this.myChart1.setOption(this.table1Option);
228   - this.myChart1.on('dataZoom', function(event) {
229   - if (event.batch) {
230   - that.charZoomStart = event.batch[0].start;
231   - that.charZoomEnd = event.batch[0].end;
232   - } else {
233   - that.charZoomStart = event.start;
234   - that.charZoomEnd = event.end;
235   - }
236   - });
237   - },
  198 + this.table1Option.xAxis = {
  199 + type: 'category',
  200 + data: [], // x轴数据
  201 + name: '时间', // x轴名称
  202 + // x轴名称样式
  203 + nameTextStyle: {
  204 + fontWeight: 300,
  205 + fontSize: 15
  206 + }
  207 + };
  208 + this.table1Option.yAxis = {
  209 + type: 'value',
  210 + name: '负载率', // y轴名称
  211 + boundaryGap: [0, '100%'],
  212 + max: 100,
  213 + axisLabel: {
  214 + show: true,
  215 + interval: 'auto',
  216 + formatter: '{value} %'
  217 + },
  218 + // y轴名称样式
  219 + nameTextStyle: {
  220 + fontWeight: 300,
  221 + fontSize: 15
  222 + }
  223 + };
  224 + this.table1Option.dataZoom = [{
  225 + show: true,
  226 + start: this.charZoomStart,
  227 + end: this.charZoomEnd
  228 + }];
  229 + this.myChart1 = echarts.init(document.getElementById('WorkThreadsLoad'));
  230 + this.myChart1.setOption(this.table1Option);
  231 + this.myChart1.on('dataZoom', function (event) {
  232 + if (event.batch) {
  233 + that.charZoomStart = event.batch[0].start;
  234 + that.charZoomEnd = event.batch[0].end;
  235 + } else {
  236 + that.charZoomStart = event.start;
  237 + that.charZoomEnd = event.end;
  238 + }
  239 + });
  240 + },
238 241  
239   - getAllSession: function() {
240   - let that = this;
241   - that.allSessionData = [];
242   - console.log("地址:"+'/zlm/index/api/getAllSession');
243   - this.$axios({
244   - method: 'get',
245   - url: '/zlm/index/api/getAllSession'
246   - }).then(function(res) {
247   - res.data.data.forEach(item => {
248   - let data = {
249   - peer_ip: item.peer_ip,
250   - local_ip: item.local_ip,
251   - typeid: item.typeid,
252   - id: item.id
253   - };
254   - that.allSessionData.push(data);
255   - });
256   - });
257   - },
258   - getServerConfig: function() {
259   - let that = this;
260   - this.$axios({
261   - method: 'get',
262   - url: '/zlm/index/api/getServerConfig'
263   - }).then(function(res) {
264   - that.serverConfig = res.data.data[0];
265   - that.visible = true;
266   - });
267   - },
268   - reStartServer: function() {
269   - let that = this;
270   - this.$confirm('此操作将重启媒体服务器, 是否继续?', '提示', {
271   - confirmButtonText: '确定',
272   - cancelButtonText: '取消',
273   - type: 'warning'
274   - }).then(() => {
275   - let that = this;
276   - this.$axios({
277   - method: 'get',
278   - url: '/zlm/index/api/restartServer'
279   - }).then(function(res) {
280   - that.getAllSession();
281   - if (res.data.code == 0) {
282   - that.$message({
283   - type: 'success',
284   - message: '操作完成'
285   - });
286   - }
287   - });
288   - });
289   - },
290   - deleteRow: function(index, tabledata) {
291   - let that = this;
292   - this.$confirm('此操作将断开该通信链路, 是否继续?', '提示', {
293   - confirmButtonText: '确定',
294   - cancelButtonText: '取消',
295   - type: 'warning'
296   - })
297   - .then(() => {
298   - that.deleteSession(tabledata[index].id);
299   - })
300   - .catch(() => {
301   - console.log('id:' + JSON.stringify(tabledata[index]));
302   - this.$message({
303   - type: 'info',
304   - message: '已取消删除'
305   - });
306   - });
307   - console.log(JSON.stringify(tabledata[index]));
308   - },
309   - deleteSession: function(id) {
310   - let that = this;
311   - this.$axios({
312   - method: 'get',
313   - url: '/zlm/index/api/kick_session&id=' + id
314   - }).then(function(res) {
315   - that.getAllSession();
316   - that.$message({
317   - type: 'success',
318   - message: '删除成功!'
319   - });
320   - });
321   - }
322   - }
  242 + getAllSession: function () {
  243 + let that = this;
  244 + that.allSessionData = [];
  245 + console.log("地址:" + '/zlm/index/api/getAllSession');
  246 + this.$axios({
  247 + method: 'get',
  248 + url: '/zlm/index/api/getAllSession'
  249 + }).then(function (res) {
  250 + res.data.data.forEach(item => {
  251 + let data = {
  252 + peer_ip: item.peer_ip,
  253 + local_ip: item.local_ip,
  254 + typeid: item.typeid,
  255 + id: item.id
  256 + };
  257 + that.allSessionData.push(data);
  258 + });
  259 + });
  260 + },
  261 + getServerConfig: function () {
  262 + let that = this;
  263 + this.$axios({
  264 + method: 'get',
  265 + url: '/zlm/index/api/getServerConfig'
  266 + }).then(function (res) {
  267 + that.serverConfig = res.data.data[0];
  268 + that.visible = true;
  269 + });
  270 + },
  271 + reStartServer: function () {
  272 + let that = this;
  273 + this.$confirm('此操作将重启媒体服务器, 是否继续?', '提示', {
  274 + confirmButtonText: '确定',
  275 + cancelButtonText: '取消',
  276 + type: 'warning'
  277 + }).then(() => {
  278 + let that = this;
  279 + this.$axios({
  280 + method: 'get',
  281 + url: '/zlm/index/api/restartServer'
  282 + }).then(function (res) {
  283 + that.getAllSession();
  284 + if (res.data.code == 0) {
  285 + that.$message({
  286 + type: 'success',
  287 + message: '操作完成'
  288 + });
  289 + }
  290 + });
  291 + });
  292 + },
  293 + deleteRow: function (index, tabledata) {
  294 + let that = this;
  295 + this.$confirm('此操作将断开该通信链路, 是否继续?', '提示', {
  296 + confirmButtonText: '确定',
  297 + cancelButtonText: '取消',
  298 + type: 'warning'
  299 + })
  300 + .then(() => {
  301 + that.deleteSession(tabledata[index].id);
  302 + })
  303 + .catch(() => {
  304 + console.log('id:' + JSON.stringify(tabledata[index]));
  305 + this.$message({
  306 + type: 'info',
  307 + message: '已取消删除'
  308 + });
  309 + });
  310 + console.log(JSON.stringify(tabledata[index]));
  311 + },
  312 + deleteSession: function (id) {
  313 + let that = this;
  314 + this.$axios({
  315 + method: 'get',
  316 + url: '/zlm/index/api/kick_session&id=' + id
  317 + }).then(function (res) {
  318 + that.getAllSession();
  319 + that.$message({
  320 + type: 'success',
  321 + message: '删除成功!'
  322 + });
  323 + });
  324 + }
  325 + }
323 326 };
324 327 </script>
325 328  
326 329 <style>
327 330 #app {
328   - height: 100%;
  331 + height: 100%;
329 332 }
  333 +
330 334 .control-table {
331   - background-color: #ffffff;
332   - height: 25rem;
  335 + background-color: #ffffff;
  336 + height: 25rem;
333 337 }
  338 +
334 339 .table-c {
335   - border-right: 1px solid #dcdcdc;
336   - border-bottom: 1px solid #dcdcdc;
  340 + border-right: 1px solid #dcdcdc;
  341 + border-bottom: 1px solid #dcdcdc;
337 342 }
  343 +
338 344 .table-c td {
339   - border-left: 1px solid #dcdcdc;
340   - border-top: 1px solid #dcdcdc;
341   - padding: 0.2rem;
  345 + border-left: 1px solid #dcdcdc;
  346 + border-top: 1px solid #dcdcdc;
  347 + padding: 0.2rem;
342 348 }
  349 +
343 350 .el-table {
344   - width: 99.9% !important;
  351 + width: 99.9% !important;
345 352 }
346 353 </style>
... ...
web_src/src/components/gb28181/devicePlayer.vue
... ... @@ -223,15 +223,15 @@ export default {
223 223 play: function (streamInfo, hasAudio) {
224 224 this.hasaudio = hasAudio;
225 225 // 根据媒体流信息二次判断
  226 + var realHasAudio = false;
226 227 if (!!streamInfo.tracks && streamInfo.tracks.length > 0 && hasAudio) {
227   - var realHasAudio = false;
228 228 for (let i = 0; i < streamInfo.tracks.length; i++) {
229 229 if (streamInfo.tracks[i].codec_type == 1 && streamInfo.tracks[i].codec_id_name == "CodecAAC") { // 判断为AAC音频
230 230 realHasAudio = true;
231 231 }
232 232 }
233   - this.hasaudio = realHasAudio && this.hasaudio;
234 233 }
  234 + this.hasaudio = realHasAudio && this.hasaudio;
235 235 this.ssrc = streamInfo.ssrc;
236 236 // this.$refs.videoPlayer.hasaudio = hasAudio;
237 237 // this.videoUrl = streamInfo.flv + "?" + new Date().getTime();
... ...