From 7be636f8b850c2554d9071876820579ce631dc25 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期三, 15 二月 2023 18:30:35 +0800 Subject: [PATCH] 修复更新通道是更新各个坐标系德位置信息 --- src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java | 35 ++++++++++++++++++++++++++++++++++- 1 files changed, 34 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java index 41b55dd..7527631 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java @@ -10,6 +10,7 @@ import com.genersoft.iot.vmp.storager.dao.DeviceMapper; import com.genersoft.iot.vmp.utils.DateUtil; import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo; +import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -98,7 +99,7 @@ HashMap<String, DeviceChannel> channelsInStore = new HashMap<>(); Device device = deviceMapper.getDeviceByDeviceId(deviceId); if (channels != null && channels.size() > 0) { - List<DeviceChannel> channelList = channelMapper.queryChannels(deviceId, null, null, null, null); + List<DeviceChannel> channelList = channelMapper.queryChannels(deviceId, null, null, null, null,null); if (channelList.size() == 0) { for (DeviceChannel channel : channels) { channel.setDeviceId(deviceId); @@ -168,4 +169,36 @@ public ResourceBaceInfo getOverview() { return channelMapper.getOverview(); } + + + @Override + public List<ChannelReduce> queryAllChannelList(String platformId) { + 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; + } } -- Gitblit v1.8.0