Commit 842f40df34de7405567469c8454dd5d3011358fa
1 parent
7be636f8
修复更新通道是更新各个坐标系的位置信息
Showing
2 changed files
with
16 additions
and
3 deletions
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java
| ... | ... | @@ -19,6 +19,7 @@ import org.springframework.stereotype.Service; |
| 19 | 19 | import java.util.ArrayList; |
| 20 | 20 | import java.util.HashMap; |
| 21 | 21 | import java.util.List; |
| 22 | +import java.util.concurrent.CopyOnWriteArrayList; | |
| 22 | 23 | |
| 23 | 24 | /** |
| 24 | 25 | * @author lin |
| ... | ... | @@ -179,11 +180,13 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService { |
| 179 | 180 | @Override |
| 180 | 181 | public boolean updateAllGps(Device device) { |
| 181 | 182 | List<DeviceChannel> deviceChannels = channelMapper.getChannelsWithoutTransform(device.getDeviceId()); |
| 182 | - List<DeviceChannel> result = new ArrayList<>(); | |
| 183 | + List<DeviceChannel> result = new CopyOnWriteArrayList<>(); | |
| 183 | 184 | if (deviceChannels.size() == 0) { |
| 184 | 185 | return true; |
| 185 | 186 | } |
| 187 | + String now = DateUtil.getNow(); | |
| 186 | 188 | deviceChannels.parallelStream().forEach(deviceChannel -> { |
| 189 | + deviceChannel.setUpdateTime(now); | |
| 187 | 190 | result.add(updateGps(deviceChannel, device)); |
| 188 | 191 | }); |
| 189 | 192 | int limitCount = 300; | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
| ... | ... | @@ -358,7 +358,17 @@ public interface DeviceChannelMapper { |
| 358 | 358 | @Select("select count(1) as total, sum(status) as online from device_channel") |
| 359 | 359 | ResourceBaceInfo getOverview(); |
| 360 | 360 | |
| 361 | - @Select("select * from device_channel where deviceId = #{deviceId} " + | |
| 362 | - "and latitude * longitude > 0 and latitudeGcj02 * latitudeWgs84 * longitudeWgs84 * longitudeGcj02 = 0") | |
| 361 | + @Select("select channelId" + | |
| 362 | + ", deviceId" + | |
| 363 | + ", latitude" + | |
| 364 | + ", longitude" + | |
| 365 | + ", latitudeWgs84" + | |
| 366 | + ", longitudeWgs84" + | |
| 367 | + ", latitudeGcj02" + | |
| 368 | + ", longitudeGcj02 " + | |
| 369 | + "from device_channel where deviceId = #{deviceId} " + | |
| 370 | + "and latitude != 0 " + | |
| 371 | + "and longitude != 0 " + | |
| 372 | + "and (latitudeGcj02 = 0 or latitudeWgs84 = 0 or longitudeWgs84 = 0 or longitudeGcj02 = 0)") | |
| 363 | 373 | List<DeviceChannel> getChannelsWithoutTransform(String deviceId); |
| 364 | 374 | } | ... | ... |