Commit 353fb254 by 杨林龙

假性离线优化设备定位查询

1 parent ab776f95
package cn.com.glsx.admin.modules.remote;
import cn.com.glsx.admin.modules.entity.Device;
import cn.com.glsx.admin.modules.mapper.DeviceMapper;
import cn.com.glsx.devicemonitor.api.dto.request.GpsBsFirstBatchRequest;
import cn.com.glsx.devicemonitor.api.dto.LngLatDTO;
import cn.com.glsx.devicemonitor.api.dto.response.GpsBsData;
......@@ -35,6 +37,9 @@ public class RemoteGpsBsService {
@Autowired
private GpsBsFeignService gpsBsFeignService;
@Autowired
private DeviceMapper deviceMapper;
/**
* 将定位集合list 转换成map
*
......@@ -112,8 +117,9 @@ public class RemoteGpsBsService {
}
public Map<String, GpsBsData> getLastGpsBsBySns(List<String> snList) {
Map<String, Integer> snsMap = Maps.newHashMap();
snList.forEach(sn -> snsMap.put(sn, DeviceTypeRelationEnum.GPS.getBizDeviceType()));
List<Device> deviceList = deviceMapper.selectBySns(snList);
//注意这里过滤了设备类型为空的数据,如果设备不在线,要检查设备类型数据是否同步或设置
Map<String, Integer> snsMap = deviceList.stream().filter(m -> m.getDeviceType() != null).collect(Collectors.toMap(Device::getSn, Device::getDeviceType, (o, n) -> n));
R<List<GpsBsData>> listR = gpsBsFeignService.getLastGpsBsBySns(snsMap);
List<GpsBsData> gpsBsDataList = listR.getDataList(new TypeToken<List<GpsBsData>>() {
}.getType());
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!