临时提交

This commit is contained in:
lin
2025-10-22 18:19:48 +08:00
parent 24c7bfb756
commit aae673e47e
14 changed files with 367 additions and 69 deletions

View File

@@ -658,7 +658,7 @@ public interface CommonGBChannelMapper {
void saveLevel(List<ChannelForThin> channels);
@SelectProvider(type = ChannelProvider.class, method = "queryCameraChannelByIds")
List<CameraChannel> queryCameraChannelByIds(List<Integer> ids);
List<CameraChannel> queryCameraChannelByIds(List<CommonGBChannel> channelList);
}

View File

@@ -833,13 +833,13 @@ public class ChannelProvider {
sqlBuild.append(BASE_SQL_FOR_CAMERA_DEVICE);
sqlBuild.append(" where wdc.id in ( ");
List<Integer> ids = (List<Integer>)params.get("ids");
List<CommonGBChannel> channelList = (List<CommonGBChannel>)params.get("channelList");
boolean first = true;
for (Integer id : ids) {
for (CommonGBChannel channel : channelList) {
if (!first) {
sqlBuild.append(",");
}
sqlBuild.append(id);
sqlBuild.append(channel.getGbId());
first = false;
}
sqlBuild.append(" )");

View File

@@ -74,7 +74,6 @@ public class EventPublisher {
applicationEventPublisher.publishEvent(channelEvent);
}
public void catalogEventPublish(Platform platform, CommonGBChannel deviceChannel, String type) {
catalogEventPublish(platform, Collections.singletonList(deviceChannel), type);
}

View File

@@ -32,7 +32,7 @@ public class ChannelEvent extends ApplicationEvent {
public enum ChannelEventMessageType {
ADD, UPDATE, DELETE, ONLINE, OFFLINE, VLOST, DEFECT
ADD, UPDATE, DEL, ON, OFF, VLOST, DEFECT
}
public static ChannelEvent getInstance(Object source, ChannelEventMessageType messageType, List<CommonGBChannel> channelList) {

View File

@@ -78,7 +78,7 @@ public interface IDeviceChannelService {
void changeAudio(Integer channelId, Boolean audio);
void updateChannelStatus(DeviceChannel channel);
void updateChannelStatusForNotify(DeviceChannel channel);
void addChannel(DeviceChannel channel);

View File

@@ -613,7 +613,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
}
@Override
public void updateChannelStatus(DeviceChannel channel) {
public void updateChannelStatusForNotify(DeviceChannel channel) {
channelMapper.updateStatus(channel);
}

View File

@@ -98,7 +98,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
commonGBChannelMapper.delete(gbId);
try {
// 发送通知
eventPublisher.channelEventPublish(channel, ChannelEvent.ChannelEventMessageType.DELETE);
eventPublisher.channelEventPublish(channel, ChannelEvent.ChannelEventMessageType.DEL);
} catch (Exception e) {
log.warn("[通道移除通知] 发送失败,{}", channel.getGbDeviceId(), e);
}
@@ -150,21 +150,6 @@ public class GbChannelServiceImpl implements IGbChannelService {
} catch (Exception e) {
log.warn("[更新通道通知] 发送失败,{}", commonGBChannel.getGbDeviceId(), e);
}
MobilePosition mobilePosition = new MobilePosition();
mobilePosition.setLongitude(commonGBChannel.getGbLongitude());
mobilePosition.setLatitude(commonGBChannel.getGbLatitude());
mobilePosition.setCreateTime(DateUtil.getNow());
mobilePosition.setDeviceId(commonGBChannel.getGbDeviceId());
mobilePosition.setTime(DateUtil.getNow());
mobilePosition.setAltitude(0.0);
mobilePosition.setDirection(0.0);
mobilePosition.setSpeed(0.0);
mobilePosition.setChannelId(commonGBChannel.getGbId());
try {
eventPublisher.mobilePositionEventPublish(mobilePosition);
}catch (Exception e) {
log.error("[向上级转发移动位置失败] ", e);
}
}
return result;
}
@@ -179,7 +164,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
if (result > 0) {
try {
// 发送通知
eventPublisher.channelEventPublish(commonGBChannel, ChannelEvent.ChannelEventMessageType.OFFLINE);
eventPublisher.channelEventPublish(commonGBChannel, ChannelEvent.ChannelEventMessageType.OFF);
} catch (Exception e) {
log.warn("[通道离线通知] 发送失败,{}", commonGBChannel.getGbDeviceId(), e);
}
@@ -211,7 +196,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
if (result > 0) {
try {
// 发送catalog
eventPublisher.channelEventPublish(commonGBChannelList, ChannelEvent.ChannelEventMessageType.OFFLINE);
eventPublisher.channelEventPublish(commonGBChannelList, ChannelEvent.ChannelEventMessageType.OFF);
} catch (Exception e) {
log.warn("[多个通道离线] 发送失败,数量:{}", commonGBChannelList.size(), e);
}
@@ -229,7 +214,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
if (result > 0) {
try {
// 发送通知
eventPublisher.channelEventPublish(commonGBChannel, ChannelEvent.ChannelEventMessageType.ONLINE);
eventPublisher.channelEventPublish(commonGBChannel, ChannelEvent.ChannelEventMessageType.ON);
} catch (Exception e) {
log.warn("[通道上线通知] 发送失败,{}", commonGBChannel.getGbDeviceId(), e);
}
@@ -260,7 +245,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
}
try {
// 发送catalog
eventPublisher.channelEventPublish(commonGBChannelList, ChannelEvent.ChannelEventMessageType.ONLINE);
eventPublisher.channelEventPublish(commonGBChannelList, ChannelEvent.ChannelEventMessageType.ON);
} catch (Exception e) {
log.warn("[多个通道上线] 发送失败,数量:{}", commonGBChannelList.size(), e);
}
@@ -417,7 +402,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
// 发送通过更新通知
try {
// 发送通知
eventPublisher.catalogEventPublish(null, channelNew, CatalogEvent.UPDATE);
eventPublisher.channelEventPublishForUpdate(channelNew, channel);
} catch (Exception e) {
log.warn("[通道移除通知] 发送失败,{}", channelNew.getGbDeviceId(), e);
}

View File

@@ -148,7 +148,7 @@ public class GroupServiceImpl implements IGroupService, CommandLineRunner {
CommonGBChannel channel = CommonGBChannel.build(chjildGroup);
try {
// 发送catalog
eventPublisher.catalogEventPublish(null, channel, CatalogEvent.UPDATE);
eventPublisher.channelEventPublishForUpdate(channel, null);
}catch (Exception e) {
log.warn("[业务分组/虚拟组织变化] 发送失败,{}", group.getDeviceId(), e);
}
@@ -160,7 +160,7 @@ public class GroupServiceImpl implements IGroupService, CommandLineRunner {
CommonGBChannel channel = CommonGBChannel.build(group);
try {
// 发送catalog
eventPublisher.catalogEventPublish(null, channel, CatalogEvent.UPDATE);
eventPublisher.channelEventPublishForUpdate(channel, null);
}catch (Exception e) {
log.warn("[业务分组/虚拟组织变化] 发送失败,{}", group.getDeviceId(), e);
}

View File

@@ -8,7 +8,6 @@ import com.genersoft.iot.vmp.gb28181.bean.RegionTree;
import com.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper;
import com.genersoft.iot.vmp.gb28181.dao.RegionMapper;
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.IGbChannelService;
import com.genersoft.iot.vmp.gb28181.service.IRegionService;
import com.genersoft.iot.vmp.utils.CivilCodeUtil;
@@ -125,7 +124,7 @@ public class RegionServiceImpl implements IRegionService {
// 发送变化通知
try {
// 发送catalog
eventPublisher.catalogEventPublish(null, CommonGBChannel.build(region), CatalogEvent.UPDATE);
eventPublisher.channelEventPublishForUpdate(CommonGBChannel.build(region), null);
}catch (Exception e) {
log.warn("[行政区划变化] 发送失败,{}", region.getDeviceId(), e);
}

View File

@@ -49,7 +49,7 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
@Autowired
private IDeviceChannelService deviceChannelService;
// @Scheduled(fixedRate = 2000) //每400毫秒执行一次
// public void showSize(){
// log.warn("[notify-目录订阅] 待处理消息数量: {}", taskQueue.size() );
@@ -282,7 +282,7 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
try {
switch (notifyCatalogChannel.getType()) {
case STATUS_CHANGED:
deviceChannelService.updateChannelStatus(notifyCatalogChannel.getChannel());
deviceChannelService.updateChannelStatusForNotify(notifyCatalogChannel.getChannel());
break;
case ADD:
deviceChannelService.addChannel(notifyCatalogChannel.getChannel());

View File

@@ -81,7 +81,8 @@ public class MessageRequestProcessor extends SIPRequestProcessorParent implement
// 查询设备是否存在
Device device = redisCatchStorage.getDevice(deviceId);
// 查询上级平台是否存在
Platform parentPlatform = platformService.queryPlatformByServerGBId(deviceId);
// Platform parentPlatform = platformService.queryPlatformByServerGBId(deviceId);
Platform parentPlatform = null;
try {
if (device != null && parentPlatform != null) {
String hostAddress = request.getRemoteAddress().getHostAddress();