Merge branch 'refs/heads/master' into dev/1078-newUI

This commit is contained in:
648540858 2025-05-13 21:22:01 +08:00
commit 1a7f517c5a
13 changed files with 129 additions and 130 deletions

View File

@ -1,27 +1,16 @@
package com.genersoft.iot.vmp.gb28181.bean; package com.genersoft.iot.vmp.gb28181.bean;
import lombok.Data;
import javax.sip.Dialog; import javax.sip.Dialog;
import java.util.EventObject; import java.util.EventObject;
public class DeviceNotFoundEvent extends EventObject { @Data
public class DeviceNotFoundEvent {
private String callId; private String callId;
/** public DeviceNotFoundEvent(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) {
this.callId = callId; this.callId = callId;
} }
} }

View File

@ -83,17 +83,17 @@ public class SipSubscribe {
failedResult failedResult
} }
public static class EventResult<EventObject>{ public static class EventResult<T>{
public int statusCode; public int statusCode;
public EventResultType type; public EventResultType type;
public String msg; public String msg;
public String callId; public String callId;
public EventObject event; public T event;
public EventResult() { public EventResult() {
} }
public EventResult(EventObject event) { public EventResult(T event) {
this.event = event; this.event = event;
if (event instanceof ResponseEvent) { if (event instanceof ResponseEvent) {
ResponseEvent responseEvent = (ResponseEvent)event; ResponseEvent responseEvent = (ResponseEvent)event;

View File

@ -120,85 +120,83 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
List<DeviceChannel> updateChannels = new ArrayList<>(); List<DeviceChannel> updateChannels = new ArrayList<>();
HashMap<String, DeviceChannel> channelsInStore = new HashMap<>(); HashMap<String, DeviceChannel> channelsInStore = new HashMap<>();
int result = 0; int result = 0;
if (channels != null && !channels.isEmpty()) { List<DeviceChannel> channelList = channelMapper.queryChannelsByDeviceDbId(device.getId());
List<DeviceChannel> channelList = channelMapper.queryChannelsByDeviceDbId(device.getId()); if (channelList.isEmpty()) {
if (channelList.isEmpty()) { for (DeviceChannel channel : channels) {
for (DeviceChannel channel : channels) { channel.setDataDeviceId(device.getId());
channel.setDataDeviceId(device.getId()); InviteInfo inviteInfo = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, channel.getId());
InviteInfo inviteInfo = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, channel.getId()); if (inviteInfo != null && inviteInfo.getStreamInfo() != null) {
if (inviteInfo != null && inviteInfo.getStreamInfo() != null) { channel.setStreamId(inviteInfo.getStreamInfo().getStream());
channel.setStreamId(inviteInfo.getStreamInfo().getStream()); }
} String now = DateUtil.getNow();
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); channel.setUpdateTime(now);
updateChannels.add(channel);
}else {
channel.setCreateTime(now); channel.setCreateTime(now);
channel.setUpdateTime(now);
addChannels.add(channel); 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<>(); }
// 滤重 Set<String> channelSet = new HashSet<>();
List<DeviceChannel> addChannelList = new ArrayList<>(); // 滤重
List<DeviceChannel> updateChannelList = new ArrayList<>(); List<DeviceChannel> addChannelList = new ArrayList<>();
addChannels.forEach(channel -> { List<DeviceChannel> updateChannelList = new ArrayList<>();
if (channelSet.add(channel.getDeviceId())) { addChannels.forEach(channel -> {
addChannelList.add(channel); if (channelSet.add(channel.getDeviceId())) {
} addChannelList.add(channel);
}); }
channelSet.clear(); });
updateChannels.forEach(channel -> { channelSet.clear();
if (channelSet.add(channel.getDeviceId())) { updateChannels.forEach(channel -> {
updateChannelList.add(channel); if (channelSet.add(channel.getDeviceId())) {
} updateChannelList.add(channel);
}); }
});
int limitCount = 500; int limitCount = 500;
if (!addChannelList.isEmpty()) { if (!addChannelList.isEmpty()) {
if (addChannelList.size() > limitCount) { if (addChannelList.size() > limitCount) {
for (int i = 0; i < addChannelList.size(); i += limitCount) { for (int i = 0; i < addChannelList.size(); i += limitCount) {
int toIndex = i + limitCount; int toIndex = i + limitCount;
if (i + limitCount > addChannelList.size()) { if (i + limitCount > addChannelList.size()) {
toIndex = addChannelList.size(); toIndex = addChannelList.size();
}
result += channelMapper.batchAdd(addChannelList.subList(i, toIndex));
} }
}else { result += channelMapper.batchAdd(addChannelList.subList(i, toIndex));
result += channelMapper.batchAdd(addChannelList);
} }
}else {
result += channelMapper.batchAdd(addChannelList);
} }
if (!updateChannelList.isEmpty()) { }
if (updateChannelList.size() > limitCount) { if (!updateChannelList.isEmpty()) {
for (int i = 0; i < updateChannelList.size(); i += limitCount) { if (updateChannelList.size() > limitCount) {
int toIndex = i + limitCount; for (int i = 0; i < updateChannelList.size(); i += limitCount) {
if (i + limitCount > updateChannelList.size()) { int toIndex = i + limitCount;
toIndex = updateChannelList.size(); if (i + limitCount > updateChannelList.size()) {
} toIndex = updateChannelList.size();
result += channelMapper.batchUpdate(updateChannelList.subList(i, toIndex));
} }
}else { result += channelMapper.batchUpdate(updateChannelList.subList(i, toIndex));
result += channelMapper.batchUpdate(updateChannelList);
} }
}else {
result += channelMapper.batchUpdate(updateChannelList);
} }
} }
return result; return result;

View File

@ -293,7 +293,7 @@ public class DeviceServiceImpl implements IDeviceService {
} }
} }
}else { }else {
log.info("[移除移动位置订阅]失败,设备已经离线 : {}", device.getDeviceId()); log.info("[移除目录订阅订阅]失败,设备已经离线 : {}", device.getDeviceId());
if (callback != null) { if (callback != null) {
callback.run(false); callback.run(false);
} }

View File

@ -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) { 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 -> { SipEvent sipEvent = SipEvent.getInstance(key, eventResult -> {
sipSubscribe.removeSubscribe(key); sipSubscribe.removeSubscribe(key);
if(okEvent != null) { if(okEvent != null) {
@ -87,30 +87,34 @@ public class SIPSender {
}), timeout == null ? sipConfig.getTimeout() : timeout); }), timeout == null ? sipConfig.getTimeout() : timeout);
sipSubscribe.addSubscribe(key, sipEvent); 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)) { } else if ("UDP".equals(transport)) {
SipProviderImpl tcpSipProvider = sipLayer.getTcpSipProvider(ip); SipProviderImpl sipProvider = sipLayer.getUdpSipProvider(ip);
if (tcpSipProvider == null) { if (sipProvider == null) {
log.error("[发送信息失败] 未找到tcp://{}的监听信息", ip); log.error("[发送信息失败] 未找到udp://{}的监听信息", ip);
return; return;
} }
if (message instanceof Request) { if (message instanceof Request) {
tcpSipProvider.sendRequest((Request) message); sipProvider.sendRequest((Request) message);
} else if (message instanceof Response) { } else if (message instanceof Response) {
tcpSipProvider.sendResponse((Response) message); 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;
} }
} }

View File

@ -70,8 +70,6 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen
/** /**
* 收到注册请求 处理 * 收到注册请求 处理
*
* @param evt
*/ */
@Override @Override
public void process(RequestEvent evt) { public void process(RequestEvent evt) {

View File

@ -98,8 +98,7 @@ public class MessageRequestProcessor extends SIPRequestProcessorParent implement
log.warn("[设备未找到 ]deviceId: {}, callId: {}", deviceId, callIdHeader.getCallId()); log.warn("[设备未找到 ]deviceId: {}, callId: {}", deviceId, callIdHeader.getCallId());
SipEvent sipEvent = sipSubscribe.getSubscribe(callIdHeader.getCallId() + cSeqHeader.getSeqNumber()); SipEvent sipEvent = sipSubscribe.getSubscribe(callIdHeader.getCallId() + cSeqHeader.getSeqNumber());
if (sipEvent != null && sipEvent.getErrorEvent() != null){ if (sipEvent != null && sipEvent.getErrorEvent() != null){
DeviceNotFoundEvent deviceNotFoundEvent = new DeviceNotFoundEvent(evt.getDialog()); DeviceNotFoundEvent deviceNotFoundEvent = new DeviceNotFoundEvent(callIdHeader.getCallId());
deviceNotFoundEvent.setCallId(callIdHeader.getCallId());
SipSubscribe.EventResult eventResult = new SipSubscribe.EventResult(deviceNotFoundEvent); SipSubscribe.EventResult eventResult = new SipSubscribe.EventResult(deviceNotFoundEvent);
sipEvent.getErrorEvent().response(eventResult); sipEvent.getErrorEvent().response(eventResult);
} }

View File

@ -14,8 +14,8 @@
"test:ci": "npm run lint && npm run test:unit" "test:ci": "npm run lint && npm run test:unit"
}, },
"dependencies": { "dependencies": {
"@wchbrad/vue-easy-tree": "^1.0.13",
"@femessage/log-viewer": "^1.5.0", "@femessage/log-viewer": "^1.5.0",
"@wchbrad/vue-easy-tree": "^1.0.13",
"axios": "^0.24.0", "axios": "^0.24.0",
"core-js": "3.6.5", "core-js": "3.6.5",
"dayjs": "^1.11.13", "dayjs": "^1.11.13",
@ -31,6 +31,7 @@
"strip-ansi": "^7.1.0", "strip-ansi": "^7.1.0",
"v-charts": "^1.19.0", "v-charts": "^1.19.0",
"vue": "2.6.10", "vue": "2.6.10",
"vue-clipboard2": "^0.3.3",
"vue-clipboards": "^1.3.0", "vue-clipboards": "^1.3.0",
"vue-contextmenujs": "^1.4.11", "vue-contextmenujs": "^1.4.11",
"vue-router": "3.0.6", "vue-router": "3.0.6",

View File

@ -16,7 +16,8 @@ import '@/icons' // icon
import '@/permission' // permission control import '@/permission' // permission control
import VueClipboards from 'vue-clipboards' 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 * If you don't want to use mock-server
@ -34,6 +35,7 @@ if (process.env.NODE_ENV === 'production') {
Vue.use(ElementUI) Vue.use(ElementUI)
Vue.use(VueClipboards) Vue.use(VueClipboards)
Vue.use(Contextmenu) Vue.use(Contextmenu)
Vue.use(VueClipboard)
Vue.config.productionTip = false Vue.config.productionTip = false

View File

@ -60,7 +60,7 @@ export const constantRoutes = [
component: Layout, component: Layout,
redirect: '/live', redirect: '/live',
children: [{ children: [{
path: 'live', path: '',
name: 'Live', name: 'Live',
component: () => import('@/views/live/index'), component: () => import('@/views/live/index'),
meta: { title: '分屏监控', icon: 'live' } 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 !!! // 404 page must be placed at the end !!!
{ path: '*', redirect: '/404', hidden: true } { path: '*', redirect: '/404', hidden: true }
] ]

View File

@ -116,9 +116,6 @@ export default {
height = clientHeight height = clientHeight
width = (16 / 9) * height width = (16 / 9) * height
} }
this.$refs.playerBox.style.width = width + 'px'
this.$refs.playerBox.style.height = height + 'px'
this.playerWidth = width this.playerWidth = width
this.playerHeight = height this.playerHeight = height
if (this.playing) { if (this.playing) {

View File

@ -111,10 +111,10 @@
<el-input v-model="getPlayerShared.sharedUrl" :disabled="true"> <el-input v-model="getPlayerShared.sharedUrl" :disabled="true">
<template slot="append"> <template slot="append">
<i <i
v-clipboard="getPlayerShared.sharedUrl"
class="cpoy-btn el-icon-document-copy" class="cpoy-btn el-icon-document-copy"
title="点击拷贝" title="点击拷贝"
@success="$message({type:'success', message:'成功拷贝到粘贴板'})" style="cursor: pointer"
@click="copyUrl(getPlayerShared.sharedUrl)"
/> />
</template> </template>
</el-input> </el-input>
@ -124,10 +124,10 @@
<el-input v-model="getPlayerShared.sharedIframe" :disabled="true"> <el-input v-model="getPlayerShared.sharedIframe" :disabled="true">
<template slot="append"> <template slot="append">
<i <i
v-clipboard="getPlayerShared.sharedIframe"
class="cpoy-btn el-icon-document-copy" class="cpoy-btn el-icon-document-copy"
title="点击拷贝" title="点击拷贝"
@success="$message({type:'success', message:'成功拷贝到粘贴板'})" style="cursor: pointer"
@click="copyUrl(getPlayerShared.sharedIframe)"
/> />
</template> </template>
</el-input> </el-input>
@ -137,10 +137,10 @@
<el-input v-model="getPlayerShared.sharedRtmp" :disabled="true"> <el-input v-model="getPlayerShared.sharedRtmp" :disabled="true">
<el-button <el-button
slot="append" slot="append"
v-clipboard="getPlayerShared.sharedRtmp"
icon="el-icon-document-copy" icon="el-icon-document-copy"
title="点击拷贝" 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-dropdown v-if="streamInfo" slot="prepend" trigger="click" @command="copyUrl">
<el-button> <el-button>
@ -362,7 +362,7 @@
<script> <script>
import elDragDialog from '@/directive/el-drag-dialog' import elDragDialog from '@/directive/el-drag-dialog'
import crypto from 'crypto' import crypto from 'crypto'
import rtcPlayer from '../dialog/rtcPlayer.vue' import rtcPlayer from '../common/rtcPlayer.vue'
import jessibucaPlayer from '../common/jessibuca.vue' import jessibucaPlayer from '../common/jessibuca.vue'
import PtzPreset from '../common/ptzPreset.vue' import PtzPreset from '../common/ptzPreset.vue'
import PtzCruising from '../common/ptzCruising.vue' import PtzCruising from '../common/ptzCruising.vue'