Merge branch 'refs/heads/master' into dev/1078-newUI
This commit is contained in:
@@ -1,27 +1,16 @@
|
||||
package com.genersoft.iot.vmp.gb28181.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.sip.Dialog;
|
||||
import java.util.EventObject;
|
||||
|
||||
public class DeviceNotFoundEvent extends EventObject {
|
||||
@Data
|
||||
public class DeviceNotFoundEvent {
|
||||
|
||||
private String callId;
|
||||
|
||||
/**
|
||||
* Constructs a prototypical Event.
|
||||
*
|
||||
* @param dialog
|
||||
* @throws IllegalArgumentException if source is null.
|
||||
*/
|
||||
public DeviceNotFoundEvent(Dialog dialog) {
|
||||
super(dialog);
|
||||
}
|
||||
|
||||
public String getCallId() {
|
||||
return callId;
|
||||
}
|
||||
|
||||
public void setCallId(String callId) {
|
||||
public DeviceNotFoundEvent(String callId) {
|
||||
this.callId = callId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,17 +83,17 @@ public class SipSubscribe {
|
||||
failedResult
|
||||
}
|
||||
|
||||
public static class EventResult<EventObject>{
|
||||
public static class EventResult<T>{
|
||||
public int statusCode;
|
||||
public EventResultType type;
|
||||
public String msg;
|
||||
public String callId;
|
||||
public EventObject event;
|
||||
public T event;
|
||||
|
||||
public EventResult() {
|
||||
}
|
||||
|
||||
public EventResult(EventObject event) {
|
||||
public EventResult(T event) {
|
||||
this.event = event;
|
||||
if (event instanceof ResponseEvent) {
|
||||
ResponseEvent responseEvent = (ResponseEvent)event;
|
||||
|
||||
@@ -120,85 +120,83 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||
List<DeviceChannel> updateChannels = new ArrayList<>();
|
||||
HashMap<String, DeviceChannel> channelsInStore = new HashMap<>();
|
||||
int result = 0;
|
||||
if (channels != null && !channels.isEmpty()) {
|
||||
List<DeviceChannel> channelList = channelMapper.queryChannelsByDeviceDbId(device.getId());
|
||||
if (channelList.isEmpty()) {
|
||||
for (DeviceChannel channel : channels) {
|
||||
channel.setDataDeviceId(device.getId());
|
||||
InviteInfo inviteInfo = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, channel.getId());
|
||||
if (inviteInfo != null && inviteInfo.getStreamInfo() != null) {
|
||||
channel.setStreamId(inviteInfo.getStreamInfo().getStream());
|
||||
}
|
||||
String now = DateUtil.getNow();
|
||||
List<DeviceChannel> channelList = channelMapper.queryChannelsByDeviceDbId(device.getId());
|
||||
if (channelList.isEmpty()) {
|
||||
for (DeviceChannel channel : channels) {
|
||||
channel.setDataDeviceId(device.getId());
|
||||
InviteInfo inviteInfo = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, channel.getId());
|
||||
if (inviteInfo != null && inviteInfo.getStreamInfo() != null) {
|
||||
channel.setStreamId(inviteInfo.getStreamInfo().getStream());
|
||||
}
|
||||
String now = DateUtil.getNow();
|
||||
channel.setUpdateTime(now);
|
||||
channel.setCreateTime(now);
|
||||
addChannels.add(channel);
|
||||
}
|
||||
}else {
|
||||
for (DeviceChannel deviceChannel : channelList) {
|
||||
channelsInStore.put(deviceChannel.getDataDeviceId() + deviceChannel.getDeviceId(), deviceChannel);
|
||||
}
|
||||
for (DeviceChannel channel : channels) {
|
||||
InviteInfo inviteInfo = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, channel.getId());
|
||||
if (inviteInfo != null && inviteInfo.getStreamInfo() != null) {
|
||||
channel.setStreamId(inviteInfo.getStreamInfo().getStream());
|
||||
}
|
||||
String now = DateUtil.getNow();
|
||||
channel.setUpdateTime(now);
|
||||
DeviceChannel deviceChannelInDb = channelsInStore.get(channel.getDataDeviceId() + channel.getDeviceId());
|
||||
if ( deviceChannelInDb != null) {
|
||||
channel.setId(deviceChannelInDb.getId());
|
||||
channel.setUpdateTime(now);
|
||||
updateChannels.add(channel);
|
||||
}else {
|
||||
channel.setCreateTime(now);
|
||||
channel.setUpdateTime(now);
|
||||
addChannels.add(channel);
|
||||
}
|
||||
}else {
|
||||
for (DeviceChannel deviceChannel : channelList) {
|
||||
channelsInStore.put(deviceChannel.getDataDeviceId() + deviceChannel.getDeviceId(), deviceChannel);
|
||||
}
|
||||
for (DeviceChannel channel : channels) {
|
||||
InviteInfo inviteInfo = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, channel.getId());
|
||||
if (inviteInfo != null && inviteInfo.getStreamInfo() != null) {
|
||||
channel.setStreamId(inviteInfo.getStreamInfo().getStream());
|
||||
}
|
||||
String now = DateUtil.getNow();
|
||||
channel.setUpdateTime(now);
|
||||
DeviceChannel deviceChannelInDb = channelsInStore.get(channel.getDataDeviceId() + channel.getDeviceId());
|
||||
if ( deviceChannelInDb != null) {
|
||||
channel.setId(deviceChannelInDb.getId());
|
||||
channel.setUpdateTime(now);
|
||||
updateChannels.add(channel);
|
||||
}else {
|
||||
channel.setCreateTime(now);
|
||||
channel.setUpdateTime(now);
|
||||
addChannels.add(channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
Set<String> channelSet = new HashSet<>();
|
||||
// 滤重
|
||||
List<DeviceChannel> addChannelList = new ArrayList<>();
|
||||
List<DeviceChannel> updateChannelList = new ArrayList<>();
|
||||
addChannels.forEach(channel -> {
|
||||
if (channelSet.add(channel.getDeviceId())) {
|
||||
addChannelList.add(channel);
|
||||
}
|
||||
});
|
||||
channelSet.clear();
|
||||
updateChannels.forEach(channel -> {
|
||||
if (channelSet.add(channel.getDeviceId())) {
|
||||
updateChannelList.add(channel);
|
||||
}
|
||||
});
|
||||
}
|
||||
Set<String> channelSet = new HashSet<>();
|
||||
// 滤重
|
||||
List<DeviceChannel> addChannelList = new ArrayList<>();
|
||||
List<DeviceChannel> updateChannelList = new ArrayList<>();
|
||||
addChannels.forEach(channel -> {
|
||||
if (channelSet.add(channel.getDeviceId())) {
|
||||
addChannelList.add(channel);
|
||||
}
|
||||
});
|
||||
channelSet.clear();
|
||||
updateChannels.forEach(channel -> {
|
||||
if (channelSet.add(channel.getDeviceId())) {
|
||||
updateChannelList.add(channel);
|
||||
}
|
||||
});
|
||||
|
||||
int limitCount = 500;
|
||||
if (!addChannelList.isEmpty()) {
|
||||
if (addChannelList.size() > limitCount) {
|
||||
for (int i = 0; i < addChannelList.size(); i += limitCount) {
|
||||
int toIndex = i + limitCount;
|
||||
if (i + limitCount > addChannelList.size()) {
|
||||
toIndex = addChannelList.size();
|
||||
}
|
||||
result += channelMapper.batchAdd(addChannelList.subList(i, toIndex));
|
||||
int limitCount = 500;
|
||||
if (!addChannelList.isEmpty()) {
|
||||
if (addChannelList.size() > limitCount) {
|
||||
for (int i = 0; i < addChannelList.size(); i += limitCount) {
|
||||
int toIndex = i + limitCount;
|
||||
if (i + limitCount > addChannelList.size()) {
|
||||
toIndex = addChannelList.size();
|
||||
}
|
||||
}else {
|
||||
result += channelMapper.batchAdd(addChannelList);
|
||||
result += channelMapper.batchAdd(addChannelList.subList(i, toIndex));
|
||||
}
|
||||
}else {
|
||||
result += channelMapper.batchAdd(addChannelList);
|
||||
}
|
||||
if (!updateChannelList.isEmpty()) {
|
||||
if (updateChannelList.size() > limitCount) {
|
||||
for (int i = 0; i < updateChannelList.size(); i += limitCount) {
|
||||
int toIndex = i + limitCount;
|
||||
if (i + limitCount > updateChannelList.size()) {
|
||||
toIndex = updateChannelList.size();
|
||||
}
|
||||
result += channelMapper.batchUpdate(updateChannelList.subList(i, toIndex));
|
||||
}
|
||||
if (!updateChannelList.isEmpty()) {
|
||||
if (updateChannelList.size() > limitCount) {
|
||||
for (int i = 0; i < updateChannelList.size(); i += limitCount) {
|
||||
int toIndex = i + limitCount;
|
||||
if (i + limitCount > updateChannelList.size()) {
|
||||
toIndex = updateChannelList.size();
|
||||
}
|
||||
}else {
|
||||
result += channelMapper.batchUpdate(updateChannelList);
|
||||
result += channelMapper.batchUpdate(updateChannelList.subList(i, toIndex));
|
||||
}
|
||||
}else {
|
||||
result += channelMapper.batchUpdate(updateChannelList);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -293,7 +293,7 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
}
|
||||
}
|
||||
}else {
|
||||
log.info("[移除移动位置订阅]失败,设备已经离线 : {}", device.getDeviceId());
|
||||
log.info("[移除目录订阅订阅]失败,设备已经离线 : {}", device.getDeviceId());
|
||||
if (callback != null) {
|
||||
callback.run(false);
|
||||
}
|
||||
|
||||
@@ -70,10 +70,10 @@ public class SIPSender {
|
||||
}
|
||||
}
|
||||
|
||||
CallIdHeader callIdHeader = (CallIdHeader) message.getHeader(CallIdHeader.NAME);
|
||||
CSeqHeader cSeqHeader = (CSeqHeader) message.getHeader(CSeqHeader.NAME);
|
||||
String key = callIdHeader.getCallId() + cSeqHeader.getSeqNumber();
|
||||
if (okEvent != null || errorEvent != null) {
|
||||
CallIdHeader callIdHeader = (CallIdHeader) message.getHeader(CallIdHeader.NAME);
|
||||
CSeqHeader cSeqHeader = (CSeqHeader) message.getHeader(CSeqHeader.NAME);
|
||||
String key = callIdHeader.getCallId() + cSeqHeader.getSeqNumber();
|
||||
SipEvent sipEvent = SipEvent.getInstance(key, eventResult -> {
|
||||
sipSubscribe.removeSubscribe(key);
|
||||
if(okEvent != null) {
|
||||
@@ -87,30 +87,34 @@ public class SIPSender {
|
||||
}), timeout == null ? sipConfig.getTimeout() : timeout);
|
||||
sipSubscribe.addSubscribe(key, sipEvent);
|
||||
}
|
||||
try {
|
||||
if ("TCP".equals(transport)) {
|
||||
SipProviderImpl tcpSipProvider = sipLayer.getTcpSipProvider(ip);
|
||||
if (tcpSipProvider == null) {
|
||||
log.error("[发送信息失败] 未找到tcp://{}的监听信息", ip);
|
||||
return;
|
||||
}
|
||||
if (message instanceof Request) {
|
||||
tcpSipProvider.sendRequest((Request) message);
|
||||
} else if (message instanceof Response) {
|
||||
tcpSipProvider.sendResponse((Response) message);
|
||||
}
|
||||
|
||||
if ("TCP".equals(transport)) {
|
||||
SipProviderImpl tcpSipProvider = sipLayer.getTcpSipProvider(ip);
|
||||
if (tcpSipProvider == null) {
|
||||
log.error("[发送信息失败] 未找到tcp://{}的监听信息", ip);
|
||||
return;
|
||||
}
|
||||
if (message instanceof Request) {
|
||||
tcpSipProvider.sendRequest((Request) message);
|
||||
} else if (message instanceof Response) {
|
||||
tcpSipProvider.sendResponse((Response) message);
|
||||
}
|
||||
|
||||
} else if ("UDP".equals(transport)) {
|
||||
SipProviderImpl sipProvider = sipLayer.getUdpSipProvider(ip);
|
||||
if (sipProvider == null) {
|
||||
log.error("[发送信息失败] 未找到udp://{}的监听信息", ip);
|
||||
return;
|
||||
}
|
||||
if (message instanceof Request) {
|
||||
sipProvider.sendRequest((Request) message);
|
||||
} else if (message instanceof Response) {
|
||||
sipProvider.sendResponse((Response) message);
|
||||
} else if ("UDP".equals(transport)) {
|
||||
SipProviderImpl sipProvider = sipLayer.getUdpSipProvider(ip);
|
||||
if (sipProvider == null) {
|
||||
log.error("[发送信息失败] 未找到udp://{}的监听信息", ip);
|
||||
return;
|
||||
}
|
||||
if (message instanceof Request) {
|
||||
sipProvider.sendRequest((Request) message);
|
||||
} else if (message instanceof Response) {
|
||||
sipProvider.sendResponse((Response) message);
|
||||
}
|
||||
}
|
||||
}catch (SipException e) {
|
||||
sipSubscribe.removeSubscribe(key);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,8 +70,6 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen
|
||||
|
||||
/**
|
||||
* 收到注册请求 处理
|
||||
*
|
||||
* @param evt
|
||||
*/
|
||||
@Override
|
||||
public void process(RequestEvent evt) {
|
||||
|
||||
@@ -98,8 +98,7 @@ public class MessageRequestProcessor extends SIPRequestProcessorParent implement
|
||||
log.warn("[设备未找到 ]deviceId: {}, callId: {}", deviceId, callIdHeader.getCallId());
|
||||
SipEvent sipEvent = sipSubscribe.getSubscribe(callIdHeader.getCallId() + cSeqHeader.getSeqNumber());
|
||||
if (sipEvent != null && sipEvent.getErrorEvent() != null){
|
||||
DeviceNotFoundEvent deviceNotFoundEvent = new DeviceNotFoundEvent(evt.getDialog());
|
||||
deviceNotFoundEvent.setCallId(callIdHeader.getCallId());
|
||||
DeviceNotFoundEvent deviceNotFoundEvent = new DeviceNotFoundEvent(callIdHeader.getCallId());
|
||||
SipSubscribe.EventResult eventResult = new SipSubscribe.EventResult(deviceNotFoundEvent);
|
||||
sipEvent.getErrorEvent().response(eventResult);
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
"test:ci": "npm run lint && npm run test:unit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@wchbrad/vue-easy-tree": "^1.0.13",
|
||||
"@femessage/log-viewer": "^1.5.0",
|
||||
"@wchbrad/vue-easy-tree": "^1.0.13",
|
||||
"axios": "^0.24.0",
|
||||
"core-js": "3.6.5",
|
||||
"dayjs": "^1.11.13",
|
||||
@@ -31,6 +31,7 @@
|
||||
"strip-ansi": "^7.1.0",
|
||||
"v-charts": "^1.19.0",
|
||||
"vue": "2.6.10",
|
||||
"vue-clipboard2": "^0.3.3",
|
||||
"vue-clipboards": "^1.3.0",
|
||||
"vue-contextmenujs": "^1.4.11",
|
||||
"vue-router": "3.0.6",
|
||||
|
||||
@@ -16,7 +16,8 @@ import '@/icons' // icon
|
||||
import '@/permission' // permission control
|
||||
|
||||
import VueClipboards from 'vue-clipboards'
|
||||
import Contextmenu from "vue-contextmenujs"
|
||||
import Contextmenu from 'vue-contextmenujs'
|
||||
import VueClipboard from 'vue-clipboard2'
|
||||
|
||||
/**
|
||||
* If you don't want to use mock-server
|
||||
@@ -34,6 +35,7 @@ if (process.env.NODE_ENV === 'production') {
|
||||
Vue.use(ElementUI)
|
||||
Vue.use(VueClipboards)
|
||||
Vue.use(Contextmenu)
|
||||
Vue.use(VueClipboard)
|
||||
|
||||
Vue.config.productionTip = false
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ export const constantRoutes = [
|
||||
component: Layout,
|
||||
redirect: '/live',
|
||||
children: [{
|
||||
path: 'live',
|
||||
path: '',
|
||||
name: 'Live',
|
||||
component: () => import('@/views/live/index'),
|
||||
meta: { title: '分屏监控', icon: 'live' }
|
||||
@@ -264,6 +264,17 @@ export const constantRoutes = [
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/play/wasm/:url',
|
||||
name: 'wasmPlayer',
|
||||
hidden: true,
|
||||
component: () => import('@/views/common/jessibuca.vue')
|
||||
},
|
||||
{
|
||||
path: '/play/rtc/:url',
|
||||
name: 'rtcPlayer',
|
||||
component: () => import('@/views/common/rtcPlayer.vue')
|
||||
},
|
||||
// 404 page must be placed at the end !!!
|
||||
{ path: '*', redirect: '/404', hidden: true }
|
||||
]
|
||||
|
||||
@@ -116,9 +116,6 @@ export default {
|
||||
height = clientHeight
|
||||
width = (16 / 9) * height
|
||||
}
|
||||
|
||||
this.$refs.playerBox.style.width = width + 'px'
|
||||
this.$refs.playerBox.style.height = height + 'px'
|
||||
this.playerWidth = width
|
||||
this.playerHeight = height
|
||||
if (this.playing) {
|
||||
|
||||
@@ -111,10 +111,10 @@
|
||||
<el-input v-model="getPlayerShared.sharedUrl" :disabled="true">
|
||||
<template slot="append">
|
||||
<i
|
||||
v-clipboard="getPlayerShared.sharedUrl"
|
||||
class="cpoy-btn el-icon-document-copy"
|
||||
title="点击拷贝"
|
||||
@success="$message({type:'success', message:'成功拷贝到粘贴板'})"
|
||||
style="cursor: pointer"
|
||||
@click="copyUrl(getPlayerShared.sharedUrl)"
|
||||
/>
|
||||
</template>
|
||||
</el-input>
|
||||
@@ -124,10 +124,10 @@
|
||||
<el-input v-model="getPlayerShared.sharedIframe" :disabled="true">
|
||||
<template slot="append">
|
||||
<i
|
||||
v-clipboard="getPlayerShared.sharedIframe"
|
||||
class="cpoy-btn el-icon-document-copy"
|
||||
title="点击拷贝"
|
||||
@success="$message({type:'success', message:'成功拷贝到粘贴板'})"
|
||||
style="cursor: pointer"
|
||||
@click="copyUrl(getPlayerShared.sharedIframe)"
|
||||
/>
|
||||
</template>
|
||||
</el-input>
|
||||
@@ -137,10 +137,10 @@
|
||||
<el-input v-model="getPlayerShared.sharedRtmp" :disabled="true">
|
||||
<el-button
|
||||
slot="append"
|
||||
v-clipboard="getPlayerShared.sharedRtmp"
|
||||
icon="el-icon-document-copy"
|
||||
title="点击拷贝"
|
||||
@success="$message({type:'success', message:'成功拷贝到粘贴板'})"
|
||||
style="cursor: pointer"
|
||||
@click="copyUrl(getPlayerShared.sharedIframe)"
|
||||
/>
|
||||
<el-dropdown v-if="streamInfo" slot="prepend" trigger="click" @command="copyUrl">
|
||||
<el-button>
|
||||
@@ -362,7 +362,7 @@
|
||||
<script>
|
||||
import elDragDialog from '@/directive/el-drag-dialog'
|
||||
import crypto from 'crypto'
|
||||
import rtcPlayer from '../dialog/rtcPlayer.vue'
|
||||
import rtcPlayer from '../common/rtcPlayer.vue'
|
||||
import jessibucaPlayer from '../common/jessibuca.vue'
|
||||
import PtzPreset from '../common/ptzPreset.vue'
|
||||
import PtzCruising from '../common/ptzCruising.vue'
|
||||
|
||||
Reference in New Issue
Block a user