Commit 95b1cbba657e0e871a8405dcd83fd0691587bf33
Committed by
GitHub
Merge branch '648540858:wvp-28181-2.0' into wvp-28181-2.0
Showing
6 changed files
with
21 additions
and
8 deletions
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 | 12 | import com.genersoft.iot.vmp.service.IDeviceService; |
| 13 | 13 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 14 | 14 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 15 | +import com.genersoft.iot.vmp.utils.DateUtil; | |
| 15 | 16 | import gov.nist.javax.sip.RequestEventExt; |
| 16 | 17 | import gov.nist.javax.sip.address.AddressImpl; |
| 17 | 18 | import gov.nist.javax.sip.address.SipUri; |
| ... | ... | @@ -176,6 +177,7 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen |
| 176 | 177 | // 保存到redis |
| 177 | 178 | if (registerFlag) { |
| 178 | 179 | logger.info("[{}] 注册成功! deviceId:" + deviceId, requestAddress); |
| 180 | + device.setRegisterTime(DateUtil.getNow()); | |
| 179 | 181 | deviceService.online(device); |
| 180 | 182 | } else { |
| 181 | 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 | 72 | device.setPort(rPort); |
| 73 | 73 | device.setHostAddress(received.concat(":").concat(String.valueOf(rPort))); |
| 74 | 74 | } |
| 75 | + device.setKeepaliveTime(DateUtil.getNow()); | |
| 75 | 76 | deviceService.online(device); |
| 76 | 77 | // 回复200 OK |
| 77 | 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 | 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 | 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 | 257 | |
| 258 | 258 | @Update(value = {"UPDATE device_channel SET latitude=${latitude}, longitude=${longitude} WHERE deviceId=#{deviceId} AND channelId=#{channelId}"}) |
| 259 | 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 | 28 | import org.springframework.util.StringUtils; |
| 29 | 29 | |
| 30 | 30 | import java.util.*; |
| 31 | +import java.util.concurrent.ConcurrentHashMap; | |
| 31 | 32 | |
| 32 | 33 | /** |
| 33 | 34 | * 视频设备数据存储-jdbc实现 |
| ... | ... | @@ -197,17 +198,27 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage { |
| 197 | 198 | if (deviceChannelList == null) { |
| 198 | 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 | 208 | TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition); |
| 201 | 209 | // 数据去重 |
| 202 | 210 | List<DeviceChannel> channels = new ArrayList<>(); |
| 203 | 211 | StringBuilder stringBuilder = new StringBuilder(); |
| 204 | 212 | Map<String, Integer> subContMap = new HashMap<>(); |
| 205 | - if (deviceChannelList != null && deviceChannelList.size() > 1) { | |
| 213 | + if (deviceChannelList.size() > 1) { | |
| 206 | 214 | // 数据去重 |
| 207 | 215 | Set<String> gbIdSet = new HashSet<>(); |
| 208 | 216 | for (DeviceChannel deviceChannel : deviceChannelList) { |
| 209 | 217 | if (!gbIdSet.contains(deviceChannel.getChannelId())) { |
| 210 | 218 | gbIdSet.add(deviceChannel.getChannelId()); |
| 219 | + if (allChannelMapInPlay.containsKey(deviceChannel.getChannelId())) { | |
| 220 | + deviceChannel.setStreamId(allChannelMapInPlay.get(deviceChannel.getChannelId()).getStreamId()); | |
| 221 | + } | |
| 211 | 222 | channels.add(deviceChannel); |
| 212 | 223 | if (!StringUtils.isEmpty(deviceChannel.getParentId())) { |
| 213 | 224 | if (subContMap.get(deviceChannel.getParentId()) == null) { | ... | ... |
web_src/src/components/control.vue
| ... | ... | @@ -576,7 +576,7 @@ export default { |
| 576 | 576 | let that = this; |
| 577 | 577 | this.$axios({ |
| 578 | 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 | 580 | }).then(function (res) { |
| 581 | 581 | that.getAllSession(); |
| 582 | 582 | that.$message({ | ... | ... |