修复国标级联时添加目录不同平台无法使用同一个目录的问题
parent
19533c8f4d
commit
9cd63f0105
|
@ -153,7 +153,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
|||
// 查询平台下是否有该通道
|
||||
DeviceChannel channel = storager.queryChannelInParentPlatform(requesterId, channelId);
|
||||
GbStream gbStream = storager.queryStreamInParentPlatform(requesterId, channelId);
|
||||
PlatformCatalog catalog = storager.getCatalog(channelId);
|
||||
PlatformCatalog catalog = storager.getCatalog(requesterId, channelId);
|
||||
|
||||
MediaServerItem mediaServerItem = null;
|
||||
StreamPushItem streamPushItem = null;
|
||||
|
|
|
@ -262,6 +262,7 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
|
|||
}
|
||||
|
||||
private void executeSave(){
|
||||
executeSaveForAdd();
|
||||
executeSaveForUpdate();
|
||||
executeSaveForDelete();
|
||||
executeSaveForOnline();
|
||||
|
|
|
@ -114,7 +114,7 @@ public class GbStreamServiceImpl implements IGbStreamService {
|
|||
|
||||
deviceChannel.setRegisterWay(1);
|
||||
|
||||
PlatformCatalog catalog = catalogMapper.select(catalogId);
|
||||
PlatformCatalog catalog = catalogMapper.selectByPlatFormAndCatalogId(platform.getServerGBId(), catalogId);
|
||||
if (catalog != null) {
|
||||
deviceChannel.setCivilCode(catalog.getCivilCode());
|
||||
deviceChannel.setParentId(catalog.getParentId());
|
||||
|
@ -216,7 +216,7 @@ public class GbStreamServiceImpl implements IGbStreamService {
|
|||
deviceChannel.setStatus(status != null && status);
|
||||
|
||||
deviceChannel.setRegisterWay(1);
|
||||
PlatformCatalog catalog = catalogMapper.select(catalogId);
|
||||
PlatformCatalog catalog = catalogMapper.selectByPlatFormAndCatalogId(platform.getServerGBId(), catalogId);
|
||||
if (catalog != null) {
|
||||
deviceChannel.setCivilCode(catalog.getCivilCode());
|
||||
deviceChannel.setParentId(catalog.getParentId());
|
||||
|
|
|
@ -125,7 +125,7 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
|
|||
private List<DeviceChannel> getDeviceChannelListByChannelReduceList(List<ChannelReduce> channelReduces, String catalogId, ParentPlatform platform) {
|
||||
List<DeviceChannel> deviceChannelList = new ArrayList<>();
|
||||
if (channelReduces.size() > 0){
|
||||
PlatformCatalog catalog = catalogManager.select(catalogId);
|
||||
PlatformCatalog catalog = catalogManager.selectByPlatFormAndCatalogId(platform.getServerGBId(),catalogId);
|
||||
if (catalog == null || !catalogId.equals(platform.getDeviceGBId())) {
|
||||
logger.warn("未查询到目录{}的信息", catalogId);
|
||||
return null;
|
||||
|
|
|
@ -342,9 +342,9 @@ public interface IVideoManagerStorage {
|
|||
|
||||
int addCatalog(PlatformCatalog platformCatalog);
|
||||
|
||||
PlatformCatalog getCatalog(String id);
|
||||
PlatformCatalog getCatalog(String platformId, String id);
|
||||
|
||||
int delCatalog(String id);
|
||||
int delCatalog(String platformId, String id);
|
||||
|
||||
int updateCatalog(PlatformCatalog platformCatalog);
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@ public interface PlatformCatalogMapper {
|
|||
"(#{id}, #{name}, #{platformId}, #{parentId}, #{civilCode}, #{businessGroupId})")
|
||||
int add(PlatformCatalog platformCatalog);
|
||||
|
||||
@Delete("DELETE from wvp_platform_catalog WHERE id=#{id}")
|
||||
int del(String id);
|
||||
@Delete("DELETE from wvp_platform_catalog WHERE platform_id=#{platformId} and id=#{id}")
|
||||
int del(String platformId, String id);
|
||||
|
||||
@Delete("DELETE from wvp_platform_catalog WHERE platform_id=#{platformId}")
|
||||
int delByPlatformId(String platformId);
|
||||
|
@ -28,13 +28,10 @@ public interface PlatformCatalogMapper {
|
|||
"group by pc.id, pc.name, pc.platform_id, pc.business_group_id, pc.civil_code, pc.parent_id")
|
||||
List<PlatformCatalog> selectByParentId(String platformId, String parentId);
|
||||
|
||||
@Select("SELECT *, (SELECT COUNT(1) from wvp_platform_catalog where parent_id = pc.id) as children_count from wvp_platform_catalog pc WHERE pc.id=#{id}")
|
||||
PlatformCatalog select(String id);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
"UPDATE wvp_platform_catalog " +
|
||||
"SET name=#{name}" +
|
||||
"WHERE id=#{id}"+
|
||||
"WHERE id=#{id} and platform_id=#{platformId}"+
|
||||
"</script>"})
|
||||
int update(PlatformCatalog platformCatalog);
|
||||
|
||||
|
@ -44,11 +41,13 @@ public interface PlatformCatalogMapper {
|
|||
@Select("SELECT pc.* FROM wvp_platform_catalog pc WHERE pc.id = (SELECT pp.catalog_id from wvp_platform pp WHERE pp.server_gb_id=#{platformId})")
|
||||
PlatformCatalog selectDefaultByPlatFormId(String platformId);
|
||||
|
||||
|
||||
@Select("SELECT pc.* FROM wvp_platform_catalog pc WHERE pc.id = #{id}")
|
||||
PlatformCatalog selectParentCatalog(String id);
|
||||
|
||||
@Select("SELECT pc.id as channel_id, pc.name, pc.civil_code, pc.business_group_id,'1' as parental, pc.parent_id " +
|
||||
" from wvp_platform_catalog pc WHERE pc.platform_id=#{platformId}")
|
||||
List<DeviceChannel> queryCatalogInPlatform(String platformId);
|
||||
|
||||
@Select("SELECT *, " +
|
||||
"(SELECT COUNT(1) from wvp_platform_catalog where parent_id = pc.id) as children_count " +
|
||||
" from wvp_platform_catalog pc " +
|
||||
" WHERE pc.id=#{id} and pc.platform_id=#{platformId}")
|
||||
PlatformCatalog selectByPlatFormAndCatalogId(String platformId, String id);
|
||||
}
|
||||
|
|
|
@ -73,9 +73,9 @@ public interface PlatformChannelMapper {
|
|||
List<Device> queryVideoDeviceByPlatformIdAndChannelId(String platformId, String channelId);
|
||||
|
||||
@Delete("<script> "+
|
||||
"DELETE from wvp_platform_gb_channel WHERE catalog_id=#{id}" +
|
||||
"DELETE from wvp_platform_gb_channel WHERE platform_id=#{platformId} and catalog_id=#{id}" +
|
||||
"</script>")
|
||||
int delByCatalogId(String id);
|
||||
int delByCatalogId(String platformId, String id);
|
||||
|
||||
@Delete("<script> "+
|
||||
"DELETE from wvp_platform_gb_channel WHERE catalog_id=#{parentId} AND platform_id=#{platformId} AND channel_id=#{id}" +
|
||||
|
|
|
@ -50,8 +50,8 @@ public interface PlatformGbStreamMapper {
|
|||
|
||||
@Select("SELECT pgs.*, gs.gb_id from wvp_platform_gb_stream pgs " +
|
||||
"LEFT join wvp_gb_stream gs ON pgs.gb_stream_id = gs.gb_stream_id " +
|
||||
"WHERE gs.app=#{app} AND gs.stream=#{stream} AND pgs.platform_id=#{serverGBId}")
|
||||
StreamProxyItem selectOne(String app, String stream, String serverGBId);
|
||||
"WHERE gs.app=#{app} AND gs.stream=#{stream} AND pgs.platform_id=#{platformId}")
|
||||
StreamProxyItem selectOne(String app, String stream, String platformId);
|
||||
|
||||
@Select("select gs.* \n" +
|
||||
"from wvp_gb_stream gs\n" +
|
||||
|
@ -67,9 +67,6 @@ public interface PlatformGbStreamMapper {
|
|||
"where pgs.platform_id=#{platformId} and pgs.catalog_id=#{catalogId}")
|
||||
List<PlatformCatalog> queryChannelInParentPlatformAndCatalogForCatalog(String platformId, String catalogId);
|
||||
|
||||
@Delete("DELETE from wvp_platform_gb_stream WHERE catalog_id=#{id}")
|
||||
int delByCatalogId(String id);
|
||||
|
||||
@Select("<script> " +
|
||||
"SELECT " +
|
||||
"pp.* " +
|
||||
|
|
|
@ -813,7 +813,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
|||
if (platformCatalog.getParentId().length() <= 8) {
|
||||
platformCatalog.setCivilCode(platformCatalog.getParentId());
|
||||
}else {
|
||||
PlatformCatalog catalog = catalogMapper.select(platformCatalog.getParentId());
|
||||
PlatformCatalog catalog = catalogMapper.selectByPlatFormAndCatalogId(platformCatalog.getPlatformId(), platformCatalog.getParentId());
|
||||
if (catalog != null) {
|
||||
platformCatalog.setCivilCode(catalog.getCivilCode());
|
||||
}
|
||||
|
@ -823,7 +823,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
|||
if (platformCatalog.getParentId().length() <= 8) {
|
||||
platformCatalog.setCivilCode(platformCatalog.getParentId());
|
||||
}else {
|
||||
PlatformCatalog catalog = catalogMapper.select(platformCatalog.getParentId());
|
||||
PlatformCatalog catalog = catalogMapper.selectByPlatFormAndCatalogId(platformCatalog.getPlatformId(),platformCatalog.getParentId());
|
||||
if (catalog == null) {
|
||||
logger.warn("[添加目录] 无法获取目录{}的CivilCode和BusinessGroupId", platformCatalog.getPlatformId());
|
||||
break;
|
||||
|
@ -852,7 +852,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
|||
}
|
||||
|
||||
private PlatformCatalog getTopCatalog(String id, String platformId) {
|
||||
PlatformCatalog catalog = catalogMapper.selectParentCatalog(id);
|
||||
PlatformCatalog catalog = catalogMapper.selectByPlatFormAndCatalogId(platformId, id);
|
||||
if (catalog.getParentId().equals(platformId)) {
|
||||
return catalog;
|
||||
}else {
|
||||
|
@ -861,27 +861,16 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
|||
}
|
||||
|
||||
@Override
|
||||
public PlatformCatalog getCatalog(String id) {
|
||||
return catalogMapper.select(id);
|
||||
public PlatformCatalog getCatalog(String platformId, String id) {
|
||||
return catalogMapper.selectByPlatFormAndCatalogId(platformId, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delCatalog(String id) {
|
||||
PlatformCatalog platformCatalog = catalogMapper.select(id);
|
||||
if (platformCatalog.getChildrenCount() > 0) {
|
||||
List<PlatformCatalog> platformCatalogList = catalogMapper.selectByParentId(platformCatalog.getPlatformId(), platformCatalog.getId());
|
||||
for (PlatformCatalog catalog : platformCatalogList) {
|
||||
if (catalog.getChildrenCount() == 0) {
|
||||
delCatalogExecute(catalog.getId(), catalog.getPlatformId());
|
||||
}else {
|
||||
delCatalog(catalog.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
return delCatalogExecute(id, platformCatalog.getPlatformId());
|
||||
public int delCatalog(String platformId, String id) {
|
||||
return delCatalogExecute(id, platformId);
|
||||
}
|
||||
private int delCatalogExecute(String id, String platformId) {
|
||||
int delresult = catalogMapper.del(id);
|
||||
int delresult = catalogMapper.del(platformId, id);
|
||||
DeviceChannel deviceChannelForCatalog = new DeviceChannel();
|
||||
if (delresult > 0){
|
||||
deviceChannelForCatalog.setChannelId(id);
|
||||
|
@ -898,7 +887,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
|||
}
|
||||
eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.DEL);
|
||||
}
|
||||
int delStreamresult = platformGbStreamMapper.delByCatalogId(id);
|
||||
int delStreamresult = platformGbStreamMapper.delByPlatformAndCatalogId(platformId,id);
|
||||
List<PlatformCatalog> platformCatalogs = platformChannelMapper.queryChannelInParentPlatformAndCatalog(platformId, id);
|
||||
if (platformCatalogs.size() > 0){
|
||||
List<DeviceChannel> deviceChannelList = new ArrayList<>();
|
||||
|
@ -909,7 +898,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
|||
}
|
||||
eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.DEL);
|
||||
}
|
||||
int delChannelresult = platformChannelMapper.delByCatalogId(id);
|
||||
int delChannelresult = platformChannelMapper.delByCatalogId(platformId, id);
|
||||
return delresult + delChannelresult + delStreamresult;
|
||||
}
|
||||
|
||||
|
|
|
@ -428,7 +428,7 @@ public class PlatformController {
|
|||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("添加目录,{}", JSON.toJSONString(platformCatalog));
|
||||
}
|
||||
PlatformCatalog platformCatalogInStore = storager.getCatalog(platformCatalog.getId());
|
||||
PlatformCatalog platformCatalogInStore = storager.getCatalog(platformCatalog.getPlatformId(), platformCatalog.getId());
|
||||
|
||||
if (platformCatalogInStore != null) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), platformCatalog.getId() + " already exists");
|
||||
|
@ -453,7 +453,7 @@ public class PlatformController {
|
|||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("编辑目录,{}", JSON.toJSONString(platformCatalog));
|
||||
}
|
||||
PlatformCatalog platformCatalogInStore = storager.getCatalog(platformCatalog.getId());
|
||||
PlatformCatalog platformCatalogInStore = storager.getCatalog(platformCatalog.getPlatformId(), platformCatalog.getId());
|
||||
|
||||
if (platformCatalogInStore == null) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), platformCatalog.getId() + " not exists");
|
||||
|
@ -486,7 +486,7 @@ public class PlatformController {
|
|||
throw new ControllerException(ErrorCode.ERROR400);
|
||||
}
|
||||
|
||||
int delResult = storager.delCatalog(id);
|
||||
int delResult = storager.delCatalog(platformId, id);
|
||||
// 如果删除的是默认目录则根目录设置为默认目录
|
||||
PlatformCatalog parentPlatform = storager.queryDefaultCatalogInPlatform(platformId);
|
||||
|
||||
|
|
Loading…
Reference in New Issue