优化notify性能,增加notify超出处理能力时直接回复错误码,不做处理。

This commit is contained in:
648540858
2023-04-19 11:09:26 +08:00
parent cf1696e0d6
commit db2ccfedfa
9 changed files with 451 additions and 40 deletions

View File

@@ -56,4 +56,35 @@ public interface IDeviceChannelService {
* 查询通道所属的设备
*/
List<Device> getDeviceByChannelId(String channelId);
/**
* 批量删除通道
* @param deleteChannelList 待删除的通道列表
*/
int deleteChannels(List<DeviceChannel> deleteChannelList);
/**
* 批量上线
*/
int channelsOnline(List<DeviceChannel> channels);
/**
* 批量下线
*/
int channelsOffline(List<DeviceChannel> channels);
/**
* 获取一个通道
*/
DeviceChannel getOne(String deviceId, String channelId);
/**
* 直接批量更新通道
*/
void batchUpdateChannel(List<DeviceChannel> channels);
/**
* 直接批量添加
*/
void batchAddChannel(List<DeviceChannel> deviceChannels);
}

View File

@@ -209,6 +209,47 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
@Override
public List<Device> getDeviceByChannelId(String channelId) {
return channelMapper.getDeviceByChannelId(channelId);
}
@Override
public int deleteChannels(List<DeviceChannel> deleteChannelList) {
return channelMapper.batchDel(deleteChannelList);
}
@Override
public int channelsOnline(List<DeviceChannel> channels) {
return channelMapper.batchOnline(channels);
}
@Override
public int channelsOffline(List<DeviceChannel> channels) {
return channelMapper.batchOffline(channels);
}
@Override
public DeviceChannel getOne(String deviceId, String channelId){
return channelMapper.queryChannel(deviceId, channelId);
}
@Override
public void batchUpdateChannel(List<DeviceChannel> channels) {
channelMapper.batchUpdate(channels);
for (DeviceChannel channel : channels) {
if (channel.getParentId() != null) {
channelMapper.updateChannelSubCount(channel.getDeviceId(), channel.getParentId());
}
}
}
@Override
public void batchAddChannel(List<DeviceChannel> channels) {
channelMapper.batchAdd(channels);
for (DeviceChannel channel : channels) {
if (channel.getParentId() != null) {
channelMapper.updateChannelSubCount(channel.getDeviceId(), channel.getParentId());
}
}
}
}

View File

@@ -644,4 +644,6 @@ public class DeviceServiceImpl implements IDeviceService {
public List<Device> getAll() {
return deviceMapper.getAll();
}
}