修复行政区划未移除的问题
parent
d7c1023e9d
commit
7d669f74ec
|
@ -540,4 +540,12 @@ public interface PlatformChannelMapper {
|
||||||
" </script>")
|
" </script>")
|
||||||
Set<Group> queryShareGroup(@Param("platformId") Integer platformId);
|
Set<Group> queryShareGroup(@Param("platformId") Integer platformId);
|
||||||
|
|
||||||
|
@Select(" <script>" +
|
||||||
|
" SELECT wcr.* " +
|
||||||
|
" from wvp_common_region wcr" +
|
||||||
|
" left join wvp_platform_region wpr on wpr.region_id = wcr.id " +
|
||||||
|
" where wpr.platform_id = #{platformId}" +
|
||||||
|
" order by wcr.id DESC" +
|
||||||
|
" </script>")
|
||||||
|
Set<Region> queryShareRegion(Integer id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
package com.genersoft.iot.vmp.gb28181.service;
|
package com.genersoft.iot.vmp.gb28181.service;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.Group;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.Platform;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.PlatformChannel;
|
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -47,4 +44,6 @@ public interface IPlatformChannelService {
|
||||||
CommonGBChannel queryChannelByPlatformIdAndChannelId(Integer platformId, Integer channelId);
|
CommonGBChannel queryChannelByPlatformIdAndChannelId(Integer platformId, Integer channelId);
|
||||||
|
|
||||||
void checkRegionAdd(List<CommonGBChannel> channelList);
|
void checkRegionAdd(List<CommonGBChannel> channelList);
|
||||||
|
|
||||||
|
void checkRegionRemove(List<CommonGBChannel> channelList, List<Region> regionList);
|
||||||
}
|
}
|
||||||
|
|
|
@ -442,6 +442,14 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
|
||||||
}
|
}
|
||||||
int result = commonGBChannelMapper.removeCivilCodeByChannels(channelList);
|
int result = commonGBChannelMapper.removeCivilCodeByChannels(channelList);
|
||||||
|
Region region = regionMapper.queryByDeviceId(civilCode);
|
||||||
|
if (region == null) {
|
||||||
|
platformChannelService.checkRegionRemove(channelList, null);
|
||||||
|
}else {
|
||||||
|
List<Region> regionList = new ArrayList<>();
|
||||||
|
regionList.add(region);
|
||||||
|
platformChannelService.checkRegionRemove(channelList, regionList);
|
||||||
|
}
|
||||||
// TODO 发送通知
|
// TODO 发送通知
|
||||||
// if (result > 0) {
|
// if (result > 0) {
|
||||||
// try {
|
// try {
|
||||||
|
@ -460,6 +468,8 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
|
||||||
}
|
}
|
||||||
int result = commonGBChannelMapper.removeCivilCodeByChannels(channelList);
|
int result = commonGBChannelMapper.removeCivilCodeByChannels(channelList);
|
||||||
|
|
||||||
|
platformChannelService.checkRegionRemove(channelList, null);
|
||||||
// TODO 发送通知
|
// TODO 发送通知
|
||||||
// if (result > 0) {
|
// if (result > 0) {
|
||||||
// try {
|
// try {
|
||||||
|
@ -499,6 +509,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
|
||||||
}
|
}
|
||||||
int result = commonGBChannelMapper.removeCivilCodeByChannels(channelList);
|
int result = commonGBChannelMapper.removeCivilCodeByChannels(channelList);
|
||||||
|
platformChannelService.checkRegionRemove(channelList, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -52,8 +52,6 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
|
||||||
private ISIPCommanderForPlatform sipCommanderFroPlatform;
|
private ISIPCommanderForPlatform sipCommanderFroPlatform;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageInfo<PlatformChannel> queryChannelList(int page, int count, String query, Integer channelType, Boolean online, Integer platformId, Boolean hasShare) {
|
public PageInfo<PlatformChannel> queryChannelList(int page, int count, String query, Integer channelType, Boolean online, Integer platformId, Boolean hasShare) {
|
||||||
PageHelper.startPage(page, count);
|
PageHelper.startPage(page, count);
|
||||||
|
@ -94,8 +92,6 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
|
||||||
return regionMapper.queryNotShareRegionForPlatformByRegionList(allRegion, platformId);
|
return regionMapper.queryNotShareRegionForPlatformByRegionList(allRegion, platformId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 移除空的共享,并返回移除的分组
|
* 移除空的共享,并返回移除的分组
|
||||||
*/
|
*/
|
||||||
|
@ -474,6 +470,44 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void checkRegionRemove(List<CommonGBChannel> channelList, List<Region> regionList) {
|
||||||
|
List<Integer> channelIds = new ArrayList<>();
|
||||||
|
channelList.stream().forEach(commonGBChannel -> {
|
||||||
|
channelIds.add(commonGBChannel.getGbId());
|
||||||
|
});
|
||||||
|
// 获取关联这些通道的平台
|
||||||
|
List<Platform> platformList = platformChannelMapper.queryPlatFormListByChannelList(channelIds);
|
||||||
|
if (platformList.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (Platform platform : platformList) {
|
||||||
|
Set<Region> regionSet;
|
||||||
|
if (regionList == null || regionList.isEmpty()) {
|
||||||
|
regionSet = platformChannelMapper.queryShareRegion(platform.getId());
|
||||||
|
}else {
|
||||||
|
regionSet = new HashSet<>(regionList);
|
||||||
|
}
|
||||||
|
// 清理空的分组并发送消息
|
||||||
|
Set<Region> deleteRegion = deleteEmptyRegion(regionSet, platform.getId());
|
||||||
|
|
||||||
|
List<CommonGBChannel> channelListForEvent = new ArrayList<>();
|
||||||
|
if (!deleteRegion.isEmpty()) {
|
||||||
|
for (Region region : deleteRegion) {
|
||||||
|
channelListForEvent.add(0, CommonGBChannel.build(region));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 发送消息
|
||||||
|
try {
|
||||||
|
// 发送catalog
|
||||||
|
eventPublisher.catalogEventPublish(platform.getId(), channelListForEvent, CatalogEvent.DEL);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("[移除关联通道] 发送失败,数量:{}", channelList.size(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void checkGroupAdd(List<CommonGBChannel> channelList) {
|
public void checkGroupAdd(List<CommonGBChannel> channelList) {
|
||||||
|
|
Loading…
Reference in New Issue