临时提交

This commit is contained in:
panlinlin
2024-07-11 23:52:34 +08:00
parent 6619c5c53d
commit 0853d7e842
5 changed files with 151 additions and 75 deletions

View File

@@ -105,7 +105,7 @@ public interface IDeviceChannelService {
void cleanChannelsForDevice(int deviceId);
boolean resetChannels(String deviceId, List<DeviceChannel> deviceChannels);
boolean resetChannels(int deviceDbId, List<DeviceChannel> deviceChannels);
PageInfo<DeviceChannel> getSubChannels(int deviceDbId, String channelId, String query, Boolean channelType, Boolean online, int page, int count);

View File

@@ -422,15 +422,11 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
@Override
@Transactional
public boolean resetChannels(String deviceId, List<DeviceChannel> deviceChannelList) {
public boolean resetChannels(int deviceDbId, List<DeviceChannel> deviceChannelList) {
if (CollectionUtils.isEmpty(deviceChannelList)) {
return false;
}
Device device = deviceMapper.getDeviceByDeviceId(deviceId);
if (device == null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到设备: " +deviceId);
}
List<DeviceChannel> allChannels = channelMapper.queryAllChannels(device.getId());
List<DeviceChannel> allChannels = channelMapper.queryAllChannels(deviceDbId);
Map<String,DeviceChannel> allChannelMap = new ConcurrentHashMap<>();
if (!allChannels.isEmpty()) {
for (DeviceChannel deviceChannel : allChannels) {
@@ -507,7 +503,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
}
int limitCount = 50;
boolean result = false;
if (!result && !addChannels.isEmpty()) {
if (!addChannels.isEmpty()) {
if (addChannels.size() > limitCount) {
for (int i = 0; i < addChannels.size(); i += limitCount) {
int toIndex = i + limitCount;