修复行政区划未插入的问题
parent
7430679d57
commit
d7c1023e9d
|
@ -45,4 +45,6 @@ public interface IPlatformChannelService {
|
|||
List<Platform> queryPlatFormListByChannelDeviceId(Integer channelId, List<String> platforms);
|
||||
|
||||
CommonGBChannel queryChannelByPlatformIdAndChannelId(Integer platformId, Integer channelId);
|
||||
|
||||
void checkRegionAdd(List<CommonGBChannel> channelList);
|
||||
}
|
||||
|
|
|
@ -414,6 +414,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
|||
int result = commonGBChannelMapper.updateRegion(civilCode, channelList);
|
||||
// 发送通知
|
||||
if (result > 0) {
|
||||
platformChannelService.checkRegionAdd(channelList);
|
||||
try {
|
||||
// 发送catalog
|
||||
eventPublisher.catalogEventPublish(null, channelList, CatalogEvent.UPDATE);
|
||||
|
|
|
@ -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.service.IPlatformChannelService;
|
||||
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.PageInfo;
|
||||
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
|
||||
public List<Platform> queryPlatFormListByChannelDeviceId(Integer channelId, List<String> platforms) {
|
||||
return platformChannelMapper.queryPlatFormListForGBWithGBId(channelId, platforms);
|
||||
|
|
Loading…
Reference in New Issue