修复NOTIFY消息中通道的状态变化

pull/1642/head
648540858 2024-09-19 16:20:03 +08:00
parent dc12bcf8f1
commit 43a2344ad0
4 changed files with 14 additions and 18 deletions

View File

@ -624,21 +624,21 @@ public interface DeviceChannelMapper {
"DELETE FROM wvp_device_channel WHERE id=#{item.id}" +
"</foreach>" +
"</script>"})
int batchDel(@Param("deleteChannelList") List<DeviceChannel> deleteChannelList);
int batchDel(List<DeviceChannel> deleteChannelList);
@Update({"<script>" +
"<foreach collection='channels' item='item' separator=';'>" +
"UPDATE wvp_device_channel SET status='ON' WHERE id=#{item.id}" +
"UPDATE wvp_device_channel SET status='ON' WHERE device_id=#{item.deviceId}" +
"</foreach>" +
"</script>"})
int batchOnline(@Param("channels") List<DeviceChannel> channels);
int batchOnlineForNotify(List<DeviceChannel> channels);
@Update({"<script>" +
"<foreach collection='channels' item='item' separator=';'>" +
"UPDATE wvp_device_channel SET status='OFF' WHERE id=#{item.id}" +
"UPDATE wvp_device_channel SET status='OFF' WHERE device_id=#{item.deviceId}" +
"</foreach>" +
"</script>"})
int batchOffline(List<DeviceChannel> channels);
int batchOfflineForNotify(List<DeviceChannel> channels);
@Select("select count(1) from wvp_device_channel where status = 'ON'")

View File

@ -50,12 +50,12 @@ public interface IDeviceChannelService {
/**
* 线
*/
int channelsOnline(List<DeviceChannel> channels);
int channelsOnlineForNotify(List<DeviceChannel> channels);
/**
* 线
*/
int channelsOffline(List<DeviceChannel> channels);
int channelsOfflineForNotify(List<DeviceChannel> channels);
/**
*

View File

@ -198,8 +198,8 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
}
@Override
public int channelsOnline(List<DeviceChannel> channels) {
return channelMapper.batchOnline(channels);
public int channelsOnlineForNotify(List<DeviceChannel> channels) {
return channelMapper.batchOnlineForNotify(channels);
}
@Override
@ -208,8 +208,8 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
}
@Override
public int channelsOffline(List<DeviceChannel> channels) {
return channelMapper.batchOffline(channels);
public int channelsOfflineForNotify(List<DeviceChannel> channels) {
return channelMapper.batchOfflineForNotify(channels);
}

View File

@ -112,6 +112,7 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
log.info("[解析CatalogChannelEvent]成功:但是解析通道信息失败, 原文如下: \n{}", new String(evt.getRequest().getRawContent()));
continue;
}
catalogChannelEvent.getChannel().setDeviceDbId(device.getId());
} catch (InvocationTargetException | NoSuchMethodException | InstantiationException |
IllegalAccessException e) {
log.error("[解析CatalogChannelEvent]失败,", e);
@ -305,20 +306,15 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
private void executeSaveForOnline(){
if (!updateChannelOnlineList.isEmpty()) {
deviceChannelService.channelsOnline(updateChannelOnlineList);
deviceChannelService.channelsOnlineForNotify(updateChannelOnlineList);
updateChannelOnlineList.clear();
}
}
private void executeSaveForOffline(){
if (!updateChannelOfflineList.isEmpty()) {
deviceChannelService.channelsOffline(updateChannelOfflineList);
deviceChannelService.channelsOfflineForNotify(updateChannelOfflineList);
updateChannelOfflineList.clear();
}
}
// @Scheduled(fixedRate = 10000) //每1秒执行一次
// public void execute(){
// logger.info("[待处理Notify-目录订阅消息数量]: {}", taskQueue.size());
// }
}