修复国标级联全部添加与全部删除

pull/1270/head
648540858 2024-01-15 15:31:20 +08:00
parent 2b2efb59a6
commit 0371f5a96e
7 changed files with 30 additions and 24 deletions

View File

@ -66,17 +66,17 @@ public class SIPSender {
// 添加错误订阅 // 添加错误订阅
if (errorEvent != null) { if (errorEvent != null) {
sipSubscribe.addErrorSubscribe(callIdHeader.getCallId(), (eventResult -> { sipSubscribe.addErrorSubscribe(callIdHeader.getCallId(), (eventResult -> {
errorEvent.response(eventResult);
sipSubscribe.removeErrorSubscribe(eventResult.callId); sipSubscribe.removeErrorSubscribe(eventResult.callId);
sipSubscribe.removeOkSubscribe(eventResult.callId); sipSubscribe.removeOkSubscribe(eventResult.callId);
errorEvent.response(eventResult);
})); }));
} }
// 添加订阅 // 添加订阅
if (okEvent != null) { if (okEvent != null) {
sipSubscribe.addOkSubscribe(callIdHeader.getCallId(), eventResult -> { sipSubscribe.addOkSubscribe(callIdHeader.getCallId(), eventResult -> {
okEvent.response(eventResult);
sipSubscribe.removeOkSubscribe(eventResult.callId); sipSubscribe.removeOkSubscribe(eventResult.callId);
sipSubscribe.removeErrorSubscribe(eventResult.callId); sipSubscribe.removeErrorSubscribe(eventResult.callId);
okEvent.response(eventResult);
}); });
} }
if ("TCP".equals(transport)) { if ("TCP".equals(transport)) {

View File

@ -579,6 +579,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
sendNotify(parentPlatform, catalogXmlContent, subscribeInfo, eventResult -> { sendNotify(parentPlatform, catalogXmlContent, subscribeInfo, eventResult -> {
logger.error("发送NOTIFY通知消息失败。错误{} {}", eventResult.statusCode, eventResult.msg); logger.error("发送NOTIFY通知消息失败。错误{} {}", eventResult.statusCode, eventResult.msg);
}, (eventResult -> { }, (eventResult -> {
logger.info("[发送NOTIFY通知]类型: {},发送成功: {}", type, channels.size());
try { try {
sendNotifyForCatalogAddOrUpdate(type, parentPlatform, deviceChannels, subscribeInfo, sendNotifyForCatalogAddOrUpdate(type, parentPlatform, deviceChannels, subscribeInfo,
finalIndex + parentPlatform.getCatalogGroup()); finalIndex + parentPlatform.getCatalogGroup());

View File

@ -77,8 +77,6 @@ public class GbStreamServiceImpl implements IGbStreamService {
} }
try { try {
List<DeviceChannel> deviceChannelList = new ArrayList<>(); List<DeviceChannel> deviceChannelList = new ArrayList<>();
for (int i = 0; i < gbStreams.size(); i++) { for (int i = 0; i < gbStreams.size(); i++) {
GbStream gbStream = gbStreams.get(i); GbStream gbStream = gbStreams.get(i);
gbStream.setCatalogId(catalogId); gbStream.setCatalogId(catalogId);
@ -250,16 +248,18 @@ public class GbStreamServiceImpl implements IGbStreamService {
if (platform == null) { if (platform == null) {
return ; return ;
} }
if (platformGbStreamMapper.delByPlatformAndCatalogId(platformId, catalogId) > 0) { if (ObjectUtils.isEmpty(catalogId)) {
List<GbStream> gbStreams = platformGbStreamMapper.queryChannelInParentPlatformAndCatalog(platformId, catalogId); catalogId = null;
List<DeviceChannel> deviceChannelList = new ArrayList<>();
for (GbStream gbStream : gbStreams) {
DeviceChannel deviceChannel = new DeviceChannel();
deviceChannel.setChannelId(gbStream.getGbId());
deviceChannelList.add(deviceChannel);
}
eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.DEL);
} }
List<GbStream> gbStreams = platformGbStreamMapper.queryChannelInParentPlatformAndCatalog(platformId, catalogId);
List<DeviceChannel> deviceChannelList = new ArrayList<>();
for (GbStream gbStream : gbStreams) {
DeviceChannel deviceChannel = new DeviceChannel();
deviceChannel.setChannelId(gbStream.getGbId());
deviceChannelList.add(deviceChannel);
}
eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.DEL);
platformGbStreamMapper.delByPlatformAndCatalogId(platformId, catalogId);
} }
@Override @Override

View File

@ -165,10 +165,9 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
catalogId = null; catalogId = null;
} }
if ((result = platformChannelMapper.delChannelForGBByCatalogId(platformId, catalogId)) > 0) { List<DeviceChannel> deviceChannels = platformChannelMapper.queryAllChannelInCatalog(platformId, catalogId);
List<DeviceChannel> deviceChannels = platformChannelMapper.queryAllChannelInCatalog(platformId, catalogId); eventPublisher.catalogEventPublish(platformId, deviceChannels, CatalogEvent.DEL);
eventPublisher.catalogEventPublish(platformId, deviceChannels, CatalogEvent.DEL);
} return platformChannelMapper.delChannelForGBByCatalogId(platformId, catalogId);
return result;
} }
} }

View File

@ -58,7 +58,10 @@ public interface PlatformChannelMapper {
@Select("SELECT dc.* from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE dc.channel_id=#{channelId} and pgc.platform_id=#{platformId}") @Select("SELECT dc.* from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE dc.channel_id=#{channelId} and pgc.platform_id=#{platformId}")
List<DeviceChannel> queryChannelInParentPlatform(@Param("platformId") String platformId, @Param("channelId") String channelId); List<DeviceChannel> queryChannelInParentPlatform(@Param("platformId") String platformId, @Param("channelId") String channelId);
@Select("SELECT dc.* from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE pgc.platform_id=#{platformId} and pgc.catalog_id=#{catalogId}") @Select("<script> "+
"SELECT dc.* from wvp_platform_gb_channel pgc left join wvp_device_channel dc on dc.id = pgc.device_channel_id WHERE pgc.platform_id=#{platformId} " +
" <if test='catalogId != null' > and pgc.catalog_id=#{catalogId}</if>" +
"</script>")
List<DeviceChannel> queryAllChannelInCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId); List<DeviceChannel> queryAllChannelInCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId);
@Select(" select dc.channel_id as id, dc.name as name, pgc.platform_id as platform_id, pgc.catalog_id as parent_id, 0 as children_count, 1 as type " + @Select(" select dc.channel_id as id, dc.name as name, pgc.platform_id as platform_id, pgc.catalog_id as parent_id, 0 as children_count, 1 as type " +

View File

@ -53,11 +53,14 @@ public interface PlatformGbStreamMapper {
"WHERE gs.app=#{app} AND gs.stream=#{stream} AND pgs.platform_id=#{platformId}") "WHERE gs.app=#{app} AND gs.stream=#{stream} AND pgs.platform_id=#{platformId}")
StreamProxyItem selectOne(@Param("app") String app, @Param("stream") String stream, @Param("platformId") String platformId); StreamProxyItem selectOne(@Param("app") String app, @Param("stream") String stream, @Param("platformId") String platformId);
@Select("select gs.* \n" + @Select("<script> " +
"from wvp_gb_stream gs\n" + "select gs.* " +
" from wvp_gb_stream gs\n" +
" left join wvp_platform_gb_stream pgs\n" + " left join wvp_platform_gb_stream pgs\n" +
" on gs.gb_stream_id = pgs.gb_stream_id\n" + " on gs.gb_stream_id = pgs.gb_stream_id\n" +
"where pgs.platform_id=#{platformId} and pgs.catalog_id=#{catalogId}") " where pgs.platform_id=#{platformId} " +
" <if test='catalogId != null' > and pgs.catalog_id=#{catalogId}</if>" +
"</script>")
List<GbStream> queryChannelInParentPlatformAndCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId); List<GbStream> queryChannelInParentPlatformAndCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId);
@Select("select gs.gb_id as id, gs.name as name, pgs.platform_id as platform_id, pgs.catalog_id as catalog_id , 0 as children_count, 2 as type\n" + @Select("select gs.gb_id as id, gs.name as name, pgs.platform_id as platform_id, pgs.catalog_id as catalog_id , 0 as children_count, 2 as type\n" +

View File

@ -84,7 +84,7 @@ public class GbStreamController {
@ResponseBody @ResponseBody
public void del(@RequestBody GbStreamParam gbStreamParam){ public void del(@RequestBody GbStreamParam gbStreamParam){
if (gbStreamParam.getGbStreams() == null || gbStreamParam.getGbStreams().size() == 0) { if (gbStreamParam.getGbStreams() == null || gbStreamParam.getGbStreams().isEmpty()) {
if (gbStreamParam.isAll()) { if (gbStreamParam.isAll()) {
gbStreamService.delAllPlatformInfo(gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId()); gbStreamService.delAllPlatformInfo(gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId());
} }
@ -103,7 +103,7 @@ public class GbStreamController {
@PostMapping(value = "/add") @PostMapping(value = "/add")
@ResponseBody @ResponseBody
public void add(@RequestBody GbStreamParam gbStreamParam){ public void add(@RequestBody GbStreamParam gbStreamParam){
if (gbStreamParam.getGbStreams() == null || gbStreamParam.getGbStreams().size() == 0) { if (gbStreamParam.getGbStreams() == null || gbStreamParam.getGbStreams().isEmpty()) {
if (gbStreamParam.isAll()) { if (gbStreamParam.isAll()) {
List<GbStream> allGBChannels = gbStreamService.getAllGBChannels(gbStreamParam.getPlatformId()); List<GbStream> allGBChannels = gbStreamService.getAllGBChannels(gbStreamParam.getPlatformId());
gbStreamService.addPlatformInfo(allGBChannels, gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId()); gbStreamService.addPlatformInfo(allGBChannels, gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId());