Merge branch '648540858:wvp-28181-2.0' into wvp-28181-2.0

This commit is contained in:
mk1990 2022-05-13 10:58:33 +08:00 committed by GitHub
commit 8707f4110d
6 changed files with 21 additions and 8 deletions

View File

@ -12,6 +12,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorP
import com.genersoft.iot.vmp.service.IDeviceService; import com.genersoft.iot.vmp.service.IDeviceService;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage; import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage; import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import com.genersoft.iot.vmp.utils.DateUtil;
import gov.nist.javax.sip.RequestEventExt; import gov.nist.javax.sip.RequestEventExt;
import gov.nist.javax.sip.address.AddressImpl; import gov.nist.javax.sip.address.AddressImpl;
import gov.nist.javax.sip.address.SipUri; import gov.nist.javax.sip.address.SipUri;
@ -176,6 +177,7 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen
// 保存到redis // 保存到redis
if (registerFlag) { if (registerFlag) {
logger.info("[{}] 注册成功! deviceId:" + deviceId, requestAddress); logger.info("[{}] 注册成功! deviceId:" + deviceId, requestAddress);
device.setRegisterTime(DateUtil.getNow());
deviceService.online(device); deviceService.online(device);
} else { } else {
logger.info("[{}] 注销成功! deviceId:" + deviceId, requestAddress); logger.info("[{}] 注销成功! deviceId:" + deviceId, requestAddress);

View File

@ -72,6 +72,7 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp
device.setPort(rPort); device.setPort(rPort);
device.setHostAddress(received.concat(":").concat(String.valueOf(rPort))); device.setHostAddress(received.concat(":").concat(String.valueOf(rPort)));
} }
device.setKeepaliveTime(DateUtil.getNow());
deviceService.online(device); deviceService.online(device);
// 回复200 OK // 回复200 OK
responseAck(evt, Response.OK); responseAck(evt, Response.OK);

View File

@ -76,12 +76,7 @@ public class DeviceServiceImpl implements IDeviceService {
redisCatchStorage.clearCatchByDeviceId(device.getDeviceId()); redisCatchStorage.clearCatchByDeviceId(device.getDeviceId());
} }
if (device.getRegisterTime() == null) { device.setUpdateTime(now);
device.setRegisterTime(now);
}
if(device.getUpdateTime() == null) {
device.setUpdateTime(now);
}
device.setOnline(1); device.setOnline(1);
// 第一次上线 // 第一次上线

View File

@ -257,4 +257,8 @@ public interface DeviceChannelMapper {
@Update(value = {"UPDATE device_channel SET latitude=${latitude}, longitude=${longitude} WHERE deviceId=#{deviceId} AND channelId=#{channelId}"}) @Update(value = {"UPDATE device_channel SET latitude=${latitude}, longitude=${longitude} WHERE deviceId=#{deviceId} AND channelId=#{channelId}"})
void updatePotion(String deviceId, String channelId, double longitude, double latitude); void updatePotion(String deviceId, String channelId, double longitude, double latitude);
@Select("SELECT * FROM device_channel WHERE length(trim(streamId)) > 0")
List<DeviceChannel> getAllChannelInPlay();
} }

View File

@ -28,6 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
/** /**
* 视频设备数据存储-jdbc实现 * 视频设备数据存储-jdbc实现
@ -197,17 +198,27 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
if (deviceChannelList == null) { if (deviceChannelList == null) {
return false; return false;
} }
List<DeviceChannel> allChannelInPlay = deviceChannelMapper.getAllChannelInPlay();
Map<String,DeviceChannel> allChannelMapInPlay = new ConcurrentHashMap<>();
if (allChannelInPlay.size() > 0) {
for (DeviceChannel deviceChannel : allChannelInPlay) {
allChannelMapInPlay.put(deviceChannel.getChannelId(), deviceChannel);
}
}
TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition);
// 数据去重 // 数据去重
List<DeviceChannel> channels = new ArrayList<>(); List<DeviceChannel> channels = new ArrayList<>();
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
Map<String, Integer> subContMap = new HashMap<>(); Map<String, Integer> subContMap = new HashMap<>();
if (deviceChannelList != null && deviceChannelList.size() > 1) { if (deviceChannelList.size() > 1) {
// 数据去重 // 数据去重
Set<String> gbIdSet = new HashSet<>(); Set<String> gbIdSet = new HashSet<>();
for (DeviceChannel deviceChannel : deviceChannelList) { for (DeviceChannel deviceChannel : deviceChannelList) {
if (!gbIdSet.contains(deviceChannel.getChannelId())) { if (!gbIdSet.contains(deviceChannel.getChannelId())) {
gbIdSet.add(deviceChannel.getChannelId()); gbIdSet.add(deviceChannel.getChannelId());
if (allChannelMapInPlay.containsKey(deviceChannel.getChannelId())) {
deviceChannel.setStreamId(allChannelMapInPlay.get(deviceChannel.getChannelId()).getStreamId());
}
channels.add(deviceChannel); channels.add(deviceChannel);
if (!StringUtils.isEmpty(deviceChannel.getParentId())) { if (!StringUtils.isEmpty(deviceChannel.getParentId())) {
if (subContMap.get(deviceChannel.getParentId()) == null) { if (subContMap.get(deviceChannel.getParentId()) == null) {

View File

@ -576,7 +576,7 @@ export default {
let that = this; let that = this;
this.$axios({ this.$axios({
method: 'get', method: 'get',
url: '/zlm/' + that.mediaServerChoose + '/index/api/kick_session&id=' + id url: '/zlm/' + that.mediaServerChoose + '/index/api/kick_session?id=' + id
}).then(function (res) { }).then(function (res) {
that.getAllSession(); that.getAllSession();
that.$message({ that.$message({