Browse Source

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

pull/491/head
mk1990 3 years ago
committed by GitHub
parent
commit
95b1cbba65
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/RegisterRequestProcessor.java
  2. 1
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java
  3. 5
      src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
  4. 4
      src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
  5. 13
      src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java
  6. 2
      web_src/src/components/control.vue

2
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/RegisterRequestProcessor.java

@ -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);

1
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java

@ -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);

5
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java

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

4
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java

@ -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();
} }

13
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java

@ -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) {

2
web_src/src/components/control.vue

@ -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({

Loading…
Cancel
Save