|  |  |  | 
|---|
|  |  |  | package com.genersoft.iot.vmp.storager.impl; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.common.StreamInfo; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.common.VideoManagerConstants; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.bean.*; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper; | 
|---|
|  |  |  | 
|---|
|  |  |  | channelId)); | 
|---|
|  |  |  | if (playLeys == null || playLeys.size() == 0) return null; | 
|---|
|  |  |  | return (StreamInfo)redis.get(playLeys.get(0).toString()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 更新流媒体信息 | 
|---|
|  |  |  | * @param ZLMServerConfig | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public boolean updateMediaInfo(ZLMServerConfig ZLMServerConfig) { | 
|---|
|  |  |  | ZLMServerConfig.setUpdateTime(format.format(new Date(System.currentTimeMillis()))); | 
|---|
|  |  |  | return redis.set(VideoManagerConstants.MEDIA_SERVER_PREFIX, ZLMServerConfig); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取流媒体信息 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public ZLMServerConfig getMediaInfo() { | 
|---|
|  |  |  | return (ZLMServerConfig)redis.get(VideoManagerConstants.MEDIA_SERVER_PREFIX); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void outlineForAll() { | 
|---|
|  |  |  | List<Object> onlineDevices = redis.scan(String.format("%S*", VideoManagerConstants.KEEPLIVEKEY_PREFIX)); | 
|---|
|  |  |  | List<Object> onlineDevices = redis.scan(VideoManagerConstants.KEEPLIVEKEY_PREFIX + "*" ); | 
|---|
|  |  |  | for (int i = 0; i < onlineDevices.size(); i++) { | 
|---|
|  |  |  | String key = (String) onlineDevices.get(i); | 
|---|
|  |  |  | redis.del(key); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<String> getOnlineForAll() { | 
|---|
|  |  |  | List<String> result = new ArrayList<>(); | 
|---|
|  |  |  | List<Object> onlineDevices = redis.scan(VideoManagerConstants.KEEPLIVEKEY_PREFIX + "*" ); | 
|---|
|  |  |  | for (int i = 0; i < onlineDevices.size(); i++) { | 
|---|
|  |  |  | String key = (String) onlineDevices.get(i); | 
|---|
|  |  |  | result.add((String) redis.get(key)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return result; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void updateWVPInfo(JSONObject jsonObject) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|