修复更新通道是更新各个坐标系德位置信息

This commit is contained in:
648540858
2023-02-15 18:30:35 +08:00
parent 2c7ed82b3e
commit 7be636f8b8
7 changed files with 99 additions and 16 deletions

View File

@@ -46,4 +46,9 @@ public interface IDeviceChannelService {
* @return
*/
List<ChannelReduce> queryAllChannelList(String platformId);
/**
* 数据位置信息格式处理
*/
boolean updateAllGps(Device device);
}

View File

@@ -176,5 +176,29 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
return channelMapper.queryChannelListInAll(null, null, null, platformId, null);
}
@Override
public boolean updateAllGps(Device device) {
List<DeviceChannel> deviceChannels = channelMapper.getChannelsWithoutTransform(device.getDeviceId());
List<DeviceChannel> result = new ArrayList<>();
if (deviceChannels.size() == 0) {
return true;
}
deviceChannels.parallelStream().forEach(deviceChannel -> {
result.add(updateGps(deviceChannel, device));
});
int limitCount = 300;
if (result.size() > limitCount) {
for (int i = 0; i < result.size(); i += limitCount) {
int toIndex = i + limitCount;
if (i + limitCount > result.size()) {
toIndex = result.size();
}
channelMapper.batchUpdate(result.subList(i, toIndex));
}
}else {
channelMapper.batchUpdate(result);
}
return true;
}
}