mirror of
https://gitee.com/pan648540858/wvp-GB28181-pro.git
synced 2026-05-24 22:17:49 +08:00
修复分屏监控地址不一致
This commit is contained in:
parent
9903f25cc1
commit
198db8f684
@ -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;
|
||||||
|
|||||||
@ -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' }
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user