修复NOTIFY消息通道信息的更新

pull/1642/head
648540858 2024-09-19 16:23:11 +08:00
parent 43a2344ad0
commit f38c86092d
4 changed files with 68 additions and 9 deletions

View File

@ -501,6 +501,58 @@ public interface DeviceChannelMapper {
"</script>"})
int batchUpdate(List<DeviceChannel> updateChannels);
@Update({"<script>" +
"<foreach collection='updateChannels' item='item' separator=';'>" +
" UPDATE" +
" wvp_device_channel" +
" SET update_time=#{item.updateTime}" +
", device_id=#{item.deviceId}" +
", device_db_id=#{item.deviceDbId}" +
", name=#{item.name}" +
", manufacturer=#{item.manufacturer}" +
", model=#{item.model}" +
", owner=#{item.owner}" +
", civil_code=#{item.civilCode}" +
", block=#{item.block}" +
", address=#{item.address}" +
", parental=#{item.parental}" +
", parent_id=#{item.parentId}" +
", safety_way=#{item.safetyWay}" +
", register_way=#{item.registerWay}" +
", cert_num=#{item.certNum}" +
", certifiable=#{item.certifiable}" +
", err_code=#{item.errCode}" +
", end_time=#{item.endTime}" +
", secrecy=#{item.secrecy}" +
", ip_address=#{item.ipAddress}" +
", port=#{item.port}" +
", password=#{item.password}" +
", status=#{item.status}" +
", longitude=#{item.longitude}" +
", latitude=#{item.latitude}" +
", ptz_type=#{item.ptzType}" +
", position_type=#{item.positionType}" +
", room_type=#{item.roomType}" +
", use_type=#{item.useType}" +
", supply_light_type=#{item.supplyLightType}" +
", direction_type=#{item.directionType}" +
", resolution=#{item.resolution}" +
", business_group_id=#{item.businessGroupId}" +
", download_speed=#{item.downloadSpeed}" +
", svc_space_support_mod=#{item.svcSpaceSupportMod}" +
", svc_time_support_mode=#{item.svcTimeSupportMode}" +
", sub_count=#{item.subCount}" +
", stream_id=#{item.streamId}" +
", has_audio=#{item.hasAudio}" +
", gps_time=#{item.gpsTime}" +
", stream_identification=#{item.streamIdentification}" +
", channel_type=#{item.channelType}" +
" WHERE device_id=#{item.deviceId}" +
"</foreach>" +
"</script>"})
int batchUpdateForNotify(List<DeviceChannel> updateChannels);
@Update(" update wvp_device_channel" +
" set sub_count = (select *" +
" from (select count(0)" +
@ -626,6 +678,13 @@ public interface DeviceChannelMapper {
"</script>"})
int batchDel(List<DeviceChannel> deleteChannelList);
@Delete({"<script>" +
"<foreach collection='deleteChannelList' item='item' separator=';'>" +
"DELETE FROM wvp_device_channel WHERE device_id=#{item.deviceId}" +
"</foreach>" +
"</script>"})
int batchDelForNotify(List<DeviceChannel> deleteChannelList);
@Update({"<script>" +
"<foreach collection='channels' item='item' separator=';'>" +
"UPDATE wvp_device_channel SET status='ON' WHERE device_id=#{item.deviceId}" +

View File

@ -45,7 +45,7 @@ public interface IDeviceChannelService {
*
* @param deleteChannelList
*/
int deleteChannels(List<DeviceChannel> deleteChannelList);
int deleteChannelsForNotify(List<DeviceChannel> deleteChannelList);
/**
* 线
@ -67,7 +67,7 @@ public interface IDeviceChannelService {
/**
*
*/
void batchUpdateChannel(List<DeviceChannel> channels);
void batchUpdateChannelForNotify(List<DeviceChannel> channels);
/**
*

View File

@ -193,8 +193,8 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
}
@Override
public int deleteChannels(List<DeviceChannel> deleteChannelList) {
return channelMapper.batchDel(deleteChannelList);
public int deleteChannelsForNotify(List<DeviceChannel> deleteChannelList) {
return channelMapper.batchDelForNotify(deleteChannelList);
}
@Override
@ -242,7 +242,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
}
@Override
public synchronized void batchUpdateChannel(List<DeviceChannel> channels) {
public synchronized void batchUpdateChannelForNotify(List<DeviceChannel> channels) {
String now = DateUtil.getNow();
for (DeviceChannel channel : channels) {
channel.setUpdateTime(now);
@ -255,10 +255,10 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
if (i + limitCount > channels.size()) {
toIndex = channels.size();
}
channelMapper.batchUpdate(channels.subList(i, toIndex));
channelMapper.batchUpdateForNotify(channels.subList(i, toIndex));
}
}else {
channelMapper.batchUpdate(channels);
channelMapper.batchUpdateForNotify(channels);
}
}
}

View File

@ -284,7 +284,7 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
if (!updateChannelMap.values().isEmpty()) {
log.info("[存储收到的更新通道], 数量: {}", updateChannelMap.size());
ArrayList<DeviceChannel> deviceChannels = new ArrayList<>(updateChannelMap.values());
deviceChannelService.batchUpdateChannel(deviceChannels);
deviceChannelService.batchUpdateChannelForNotify(deviceChannels);
updateChannelMap.clear();
}
}
@ -299,7 +299,7 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
private void executeSaveForDelete(){
if (!deleteChannelList.isEmpty()) {
deviceChannelService.deleteChannels(deleteChannelList);
deviceChannelService.deleteChannelsForNotify(deleteChannelList);
deleteChannelList.clear();
}
}