Commit 95b1cbba657e0e871a8405dcd83fd0691587bf33

Authored by mk1990
Committed by GitHub
2 parents 2d7a2020 ec749de7

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

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 @@ -12,6 +12,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorP
12 import com.genersoft.iot.vmp.service.IDeviceService; 12 import com.genersoft.iot.vmp.service.IDeviceService;
13 import com.genersoft.iot.vmp.storager.IRedisCatchStorage; 13 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
14 import com.genersoft.iot.vmp.storager.IVideoManagerStorage; 14 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
  15 +import com.genersoft.iot.vmp.utils.DateUtil;
15 import gov.nist.javax.sip.RequestEventExt; 16 import gov.nist.javax.sip.RequestEventExt;
16 import gov.nist.javax.sip.address.AddressImpl; 17 import gov.nist.javax.sip.address.AddressImpl;
17 import gov.nist.javax.sip.address.SipUri; 18 import gov.nist.javax.sip.address.SipUri;
@@ -176,6 +177,7 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen @@ -176,6 +177,7 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen
176 // 保存到redis 177 // 保存到redis
177 if (registerFlag) { 178 if (registerFlag) {
178 logger.info("[{}] 注册成功! deviceId:" + deviceId, requestAddress); 179 logger.info("[{}] 注册成功! deviceId:" + deviceId, requestAddress);
  180 + device.setRegisterTime(DateUtil.getNow());
179 deviceService.online(device); 181 deviceService.online(device);
180 } else { 182 } else {
181 logger.info("[{}] 注销成功! deviceId:" + deviceId, requestAddress); 183 logger.info("[{}] 注销成功! deviceId:" + deviceId, requestAddress);
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 @@ -72,6 +72,7 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp
72 device.setPort(rPort); 72 device.setPort(rPort);
73 device.setHostAddress(received.concat(":").concat(String.valueOf(rPort))); 73 device.setHostAddress(received.concat(":").concat(String.valueOf(rPort)));
74 } 74 }
  75 + device.setKeepaliveTime(DateUtil.getNow());
75 deviceService.online(device); 76 deviceService.online(device);
76 // 回复200 OK 77 // 回复200 OK
77 responseAck(evt, Response.OK); 78 responseAck(evt, Response.OK);
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
@@ -76,12 +76,7 @@ public class DeviceServiceImpl implements IDeviceService { @@ -76,12 +76,7 @@ public class DeviceServiceImpl implements IDeviceService {
76 redisCatchStorage.clearCatchByDeviceId(device.getDeviceId()); 76 redisCatchStorage.clearCatchByDeviceId(device.getDeviceId());
77 77
78 } 78 }
79 - if (device.getRegisterTime() == null) {  
80 - device.setRegisterTime(now);  
81 - }  
82 - if(device.getUpdateTime() == null) {  
83 - device.setUpdateTime(now);  
84 - } 79 + device.setUpdateTime(now);
85 device.setOnline(1); 80 device.setOnline(1);
86 81
87 // 第一次上线 82 // 第一次上线
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
@@ -257,4 +257,8 @@ public interface DeviceChannelMapper { @@ -257,4 +257,8 @@ public interface DeviceChannelMapper {
257 257
258 @Update(value = {"UPDATE device_channel SET latitude=${latitude}, longitude=${longitude} WHERE deviceId=#{deviceId} AND channelId=#{channelId}"}) 258 @Update(value = {"UPDATE device_channel SET latitude=${latitude}, longitude=${longitude} WHERE deviceId=#{deviceId} AND channelId=#{channelId}"})
259 void updatePotion(String deviceId, String channelId, double longitude, double latitude); 259 void updatePotion(String deviceId, String channelId, double longitude, double latitude);
  260 +
  261 + @Select("SELECT * FROM device_channel WHERE length(trim(streamId)) > 0")
  262 + List<DeviceChannel> getAllChannelInPlay();
  263 +
260 } 264 }
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java
@@ -28,6 +28,7 @@ import org.springframework.transaction.annotation.Transactional; @@ -28,6 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
28 import org.springframework.util.StringUtils; 28 import org.springframework.util.StringUtils;
29 29
30 import java.util.*; 30 import java.util.*;
  31 +import java.util.concurrent.ConcurrentHashMap;
31 32
32 /** 33 /**
33 * 视频设备数据存储-jdbc实现 34 * 视频设备数据存储-jdbc实现
@@ -197,17 +198,27 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { @@ -197,17 +198,27 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
197 if (deviceChannelList == null) { 198 if (deviceChannelList == null) {
198 return false; 199 return false;
199 } 200 }
  201 + List<DeviceChannel> allChannelInPlay = deviceChannelMapper.getAllChannelInPlay();
  202 + Map<String,DeviceChannel> allChannelMapInPlay = new ConcurrentHashMap<>();
  203 + if (allChannelInPlay.size() > 0) {
  204 + for (DeviceChannel deviceChannel : allChannelInPlay) {
  205 + allChannelMapInPlay.put(deviceChannel.getChannelId(), deviceChannel);
  206 + }
  207 + }
200 TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); 208 TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition);
201 // 数据去重 209 // 数据去重
202 List<DeviceChannel> channels = new ArrayList<>(); 210 List<DeviceChannel> channels = new ArrayList<>();
203 StringBuilder stringBuilder = new StringBuilder(); 211 StringBuilder stringBuilder = new StringBuilder();
204 Map<String, Integer> subContMap = new HashMap<>(); 212 Map<String, Integer> subContMap = new HashMap<>();
205 - if (deviceChannelList != null && deviceChannelList.size() > 1) { 213 + if (deviceChannelList.size() > 1) {
206 // 数据去重 214 // 数据去重
207 Set<String> gbIdSet = new HashSet<>(); 215 Set<String> gbIdSet = new HashSet<>();
208 for (DeviceChannel deviceChannel : deviceChannelList) { 216 for (DeviceChannel deviceChannel : deviceChannelList) {
209 if (!gbIdSet.contains(deviceChannel.getChannelId())) { 217 if (!gbIdSet.contains(deviceChannel.getChannelId())) {
210 gbIdSet.add(deviceChannel.getChannelId()); 218 gbIdSet.add(deviceChannel.getChannelId());
  219 + if (allChannelMapInPlay.containsKey(deviceChannel.getChannelId())) {
  220 + deviceChannel.setStreamId(allChannelMapInPlay.get(deviceChannel.getChannelId()).getStreamId());
  221 + }
211 channels.add(deviceChannel); 222 channels.add(deviceChannel);
212 if (!StringUtils.isEmpty(deviceChannel.getParentId())) { 223 if (!StringUtils.isEmpty(deviceChannel.getParentId())) {
213 if (subContMap.get(deviceChannel.getParentId()) == null) { 224 if (subContMap.get(deviceChannel.getParentId()) == null) {
web_src/src/components/control.vue
@@ -576,7 +576,7 @@ export default { @@ -576,7 +576,7 @@ export default {
576 let that = this; 576 let that = this;
577 this.$axios({ 577 this.$axios({
578 method: 'get', 578 method: 'get',
579 - url: '/zlm/' + that.mediaServerChoose + '/index/api/kick_session&id=' + id 579 + url: '/zlm/' + that.mediaServerChoose + '/index/api/kick_session?id=' + id
580 }).then(function (res) { 580 }).then(function (res) {
581 that.getAllSession(); 581 that.getAllSession();
582 that.$message({ 582 that.$message({