Commit 5a6e45d9 by 杨林龙

1.70.0 皖新获取定位接口增加设备类型

1 parent 724659cf
......@@ -33,4 +33,9 @@ public class AddrVerifyBatchDTO {
* 经纬度类型 0:GPS 1:基站
*/
private Integer locationType;
/**
* 设备有线无线 1有线 0无线
*/
private Integer source;
}
......@@ -11,9 +11,11 @@ import cn.com.glsx.stdinterface.common.exception.StdInterfaceException;
import cn.com.glsx.stdinterface.dto.DevicesComposeVerifyBO;
import cn.com.glsx.stdinterface.dto.VehicleDto;
import cn.com.glsx.stdinterface.modules.converter.VehicleConverter;
import cn.com.glsx.stdinterface.modules.entity.Device;
import cn.com.glsx.stdinterface.modules.entity.Vehicle;
import cn.com.glsx.stdinterface.modules.entity.VehicleDevice;
import cn.com.glsx.stdinterface.modules.entity.VehicleDeviceOperator;
import cn.com.glsx.stdinterface.modules.mapper.DeviceMapper;
import cn.com.glsx.stdinterface.modules.mapper.VehicleDeviceMapper;
import cn.com.glsx.stdinterface.modules.mapper.VehicleMapper;
import cn.com.glsx.stdinterface.modules.model.*;
......@@ -56,6 +58,8 @@ public class VehicleService {
@Autowired
private DeviceFeignService deviceFeignService;
@Autowired
private DeviceMapper deviceMapper;
public Vehicle getVehicleInfoBySn(String sn) {
Vehicle vehicle = vehicleMapper.getVehicleBySn(sn);
......@@ -74,16 +78,12 @@ public class VehicleService {
if (CollectionUtils.isEmpty(vehicleList)) {
return Maps.newHashMap();
}
return vehicleList.stream()
.filter(Objects::nonNull)
.collect(Collectors.toMap(VehicleDeviceOperator::getSn, Function.identity(), (o1, o2) -> o2));
return vehicleList.stream().filter(Objects::nonNull).collect(Collectors.toMap(VehicleDeviceOperator::getSn, Function.identity(), (o1, o2) -> o2));
}
public Long getVdId(String sn) {
VehicleDevice vehicleDevice = vehicleDeviceMapper.selectVehicleDevcieBySn(sn);
return Optional.ofNullable(vehicleDevice)
.map(VehicleDevice::getId)
.orElse(null);
return Optional.ofNullable(vehicleDevice).map(VehicleDevice::getId).orElse(null);
}
/**
......@@ -94,8 +94,7 @@ public class VehicleService {
if (CollectionUtils.isEmpty(vehicleDevice)) {
return Maps.newHashMap();
}
return vehicleDevice.stream()
.collect(Collectors.toMap(VehicleDevice::getSn, VehicleDevice::getId, (o1, o2) -> o2));
return vehicleDevice.stream().collect(Collectors.toMap(VehicleDevice::getSn, VehicleDevice::getId, (o1, o2) -> o2));
}
public Vehicle getVehicleInfoByWorkOrderIdAndVin(Long workOrderId, String vin) {
......@@ -225,6 +224,14 @@ public class VehicleService {
sw.stop();
log.info(sw.getLastTaskName() + "耗时:" + sw.getLastTaskTimeMillis() + "ms");
//查询设备类型
sw.start("selectBySns");
List<Device> devices = deviceMapper.selectBySns(snList);
//转为设备号->有线无线map
Map<String, Integer> sourceMap = devices.stream().collect(Collectors.toMap(Device::getSn, Device::getSource));
sw.stop();
log.info(sw.getLastTaskName() + "耗时:" + sw.getLastTaskTimeMillis() + "ms");
sw.start("merge");
snList.forEach(sn -> {
AddrVerifyBatchDTO addressItem = new AddrVerifyBatchDTO();
......@@ -248,6 +255,8 @@ public class VehicleService {
addressItem.setTime(bsLocation.getDateTime());
addressItem.setLocationType(GeoLocationEnum.BS.getLocationType());
}
// 设置设备有线无线
addressItem.setSource(sourceMap.get(sn));
list.add(addressItem);
}
});
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!