修复行政区划未插入的问题

pull/1652/head
648540858 2024-10-20 08:13:01 +08:00
parent 7430679d57
commit d7c1023e9d
3 changed files with 34 additions and 0 deletions

View File

@ -45,4 +45,6 @@ public interface IPlatformChannelService {
List<Platform> queryPlatFormListByChannelDeviceId(Integer channelId, List<String> platforms); List<Platform> queryPlatFormListByChannelDeviceId(Integer channelId, List<String> platforms);
CommonGBChannel queryChannelByPlatformIdAndChannelId(Integer platformId, Integer channelId); CommonGBChannel queryChannelByPlatformIdAndChannelId(Integer platformId, Integer channelId);
void checkRegionAdd(List<CommonGBChannel> channelList);
} }

View File

@ -414,6 +414,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
int result = commonGBChannelMapper.updateRegion(civilCode, channelList); int result = commonGBChannelMapper.updateRegion(civilCode, channelList);
// 发送通知 // 发送通知
if (result > 0) { if (result > 0) {
platformChannelService.checkRegionAdd(channelList);
try { try {
// 发送catalog // 发送catalog
eventPublisher.catalogEventPublish(null, channelList, CatalogEvent.UPDATE); eventPublisher.catalogEventPublish(null, channelList, CatalogEvent.UPDATE);

View File

@ -7,6 +7,7 @@ import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
import com.genersoft.iot.vmp.gb28181.service.IPlatformChannelService; import com.genersoft.iot.vmp.gb28181.service.IPlatformChannelService;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
import com.genersoft.iot.vmp.jt1078.proc.request.Re;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -505,6 +506,36 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
} }
} }
@Override
public void checkRegionAdd(List<CommonGBChannel> channelList) {
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> addRegion = getRegionNotShareByChannelList(channelList, platform.getId());
List<CommonGBChannel> channelListForEvent = new ArrayList<>();
if (!addRegion.isEmpty()) {
for (Region region : addRegion) {
channelListForEvent.add(0, CommonGBChannel.build(region));
}
platformChannelMapper.addPlatformRegion(new ArrayList<>(addRegion), platform.getId());
// 发送消息
try {
// 发送catalog
eventPublisher.catalogEventPublish(platform.getId(), channelListForEvent, CatalogEvent.ADD);
} catch (Exception e) {
log.warn("[移除关联通道] 发送失败,数量:{}", channelList.size(), e);
}
}
}
}
@Override @Override
public List<Platform> queryPlatFormListByChannelDeviceId(Integer channelId, List<String> platforms) { public List<Platform> queryPlatFormListByChannelDeviceId(Integer channelId, List<String> platforms) {
return platformChannelMapper.queryPlatFormListForGBWithGBId(channelId, platforms); return platformChannelMapper.queryPlatFormListForGBWithGBId(channelId, platforms);