Commit ac763579 by 黄小葱

处理位置信息

1 parent ca390aa1
......@@ -7,6 +7,7 @@ import cn.com.glsx.admin.modules.model.OrgVehicleTree;
import cn.com.glsx.admin.modules.model.param.VehicleLocationBo;
import cn.com.glsx.admin.modules.model.param.VehicleTreeSearch;
import cn.com.glsx.devicemonitor.api.dto.response.DeviceLocationBo;
import cn.com.glsx.devicemonitor.api.dto.response.GpsLocation;
import cn.com.glsx.usercenter.api.dto.tree.OrgTreeModel;
import com.glsx.plat.common.model.TreeModel;
import com.glsx.plat.common.utils.TreeModelUtil;
......@@ -194,18 +195,37 @@ public class VehicleMonitorSevice {
log.info("查找到设备定位的数据个数:" + deviceLocationBos.size());
//整合查询车辆数据
for (DeviceLocationBo deviceBo : deviceLocationBos) {
VehicleLocationBo vehicleBo = new VehicleLocationBo();
BeanUtils.copyProperties(deviceBo, vehicleBo);
String sn = deviceBo.getSn();
List<Vehicle> vehicleList = vehicleMapper.findVehicleInfoBySn(sn);
if (CollectionUtils.isNotEmpty(vehicleList) && vehicleList.size() == 1) {
Vehicle vehicle = vehicleList.get(0);
vehicleBo.setVin(vehicle.getVin());
vehicleBo.setOwnerName(vehicle.getOwnerName());
VehicleLocationBo vehicleBo = buildDeviceLocation(deviceBo);
if (vehicleBo == null) {
continue;
}
retVehilceBoList.add(vehicleBo);
}
return retVehilceBoList;
}
/**
* 构建位置信息 无gps、基站、wifi定位的返回null
* @param deviceBo
* @return
*/
public VehicleLocationBo buildDeviceLocation(DeviceLocationBo deviceBo) {
GpsLocation gpsLocation = deviceBo.getGpsLocation();
GpsLocation bsLocation = deviceBo.getBsLocation();
GpsLocation wifiLocation = deviceBo.getWifiLocation();
if (gpsLocation == null && bsLocation == null && wifiLocation == null) {
return null;
}
VehicleLocationBo vehicleBo = new VehicleLocationBo();
BeanUtils.copyProperties(deviceBo, vehicleBo);
String sn = deviceBo.getSn();
List<Vehicle> vehicleList = vehicleMapper.findVehicleInfoBySn(sn);
if (CollectionUtils.isNotEmpty(vehicleList) && vehicleList.size() == 1) {
Vehicle vehicle = vehicleList.get(0);
vehicleBo.setVin(vehicle.getVin());
vehicleBo.setOwnerName(vehicle.getOwnerName());
}
return vehicleBo;
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!