优化级联时的异常处理

This commit is contained in:
panlinlin
2021-04-26 18:38:57 +08:00
parent bc2b288547
commit 39078225f1
25 changed files with 226 additions and 31 deletions

View File

@@ -6,6 +6,7 @@ import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch;
import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
import java.util.List;
import java.util.Map;
public interface IRedisCatchStorage {
@@ -91,6 +92,8 @@ public interface IRedisCatchStorage {
*/
SendRtpItem querySendRTPServer(String platformGbId, String channelId);
List<SendRtpItem> querySendRTPServer(String platformGbId);
/**
* 删除RTP推送信息缓存
* @param platformGbId

View File

@@ -135,6 +135,13 @@ public interface IVideoManagerStorager {
*/
public boolean outline(String deviceId);
/**
* 更新所有设备离线
*
* @return true更新成功 false更新失败
*/
public boolean outlineForAll();
/**
* 查询子设备
@@ -352,4 +359,10 @@ public interface IVideoManagerStorager {
* @param streamId
*/
void mediaOutline(String app, String streamId);
/**
* 设置平台在线/离线
* @param online
*/
void updateParentPlatformStatus(String platformGbID, boolean online);
}

View File

@@ -65,4 +65,7 @@ public interface DeviceMapper {
@Delete("DELETE FROM device WHERE deviceId=#{deviceId}")
int del(String deviceId);
@Update("UPDATE device SET online=0")
int outlineForAll();
}

View File

@@ -66,5 +66,8 @@ public interface ParentPlatformMapper {
ParentPlatform getParentPlatById(int id);
@Update("UPDATE parent_platform SET status=false" )
void outlineForAllParentPlatform();
int outlineForAllParentPlatform();
@Update("UPDATE parent_platform SET status=#{online} WHERE serverGBId=#{platformGbID}" )
int updateParentPlatformStatus(String platformGbID, boolean online);
}

View File

@@ -233,6 +233,20 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
return (SendRtpItem)redis.get(key);
}
@Override
public List<SendRtpItem> querySendRTPServer(String platformGbId) {
String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + platformGbId + "_*";
List<Object> queryResult = redis.scan(key);
List<SendRtpItem> result= new ArrayList<>();
for (int i = 0; i < queryResult.size(); i++) {
String keyItem = (String) queryResult.get(i);
result.add((SendRtpItem)redis.get(keyItem));
}
return result;
}
/**
* 删除RTP推送信息缓存
* @param platformGbId

View File

@@ -256,6 +256,18 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
return deviceMapper.update(device) > 0;
}
/**
* 更新所有设备离线
*
* @return true更新成功 false更新失败
*/
@Override
public synchronized boolean outlineForAll() {
logger.info("更新所有设备离线");
int result = deviceMapper.outlineForAll();
return result > 0;
}
/**
* 清空通道
* @param deviceId
@@ -575,5 +587,8 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
gbStreamMapper.setStatus(app, streamId, false);
}
@Override
public void updateParentPlatformStatus(String platformGbID, boolean online) {
platformMapper.updateParentPlatformStatus(platformGbID, online);
}
}