Commit fb77158b by 向延琳

增加返回值

1 parent 7284de37
......@@ -25,7 +25,7 @@ public class VehicleMonitorConvert {
public static StayPointListVO buildStayPointListVO(StayPointRecordDTO stayPointRecordDTO,
VehicleDeviceWorkOrder vehicleDeviceWorkOrder,
String sn) {
String sn, String address) {
StayPointListVO stayPointListVO = new StayPointListVO();
Optional.ofNullable(vehicleDeviceWorkOrder)
.map(VehicleDeviceWorkOrder::getWorkOrderNo)
......@@ -64,6 +64,7 @@ public class VehicleMonitorConvert {
.map(StayPointRecordDTO::getStayGps)
.map(GpsLocation::getElng)
.ifPresent(stayPointListVO::setElng);
stayPointListVO.setAddress(address);
return stayPointListVO;
}
......@@ -143,7 +144,7 @@ public class VehicleMonitorConvert {
return residentRequest;
}
public static ResidentListVO buildResidentListVO(ResidentDTO residentDTO, VehicleDeviceWorkOrder common) {
public static ResidentListVO buildResidentListVO(ResidentDTO residentDTO, VehicleDeviceWorkOrder common, String address) {
ResidentListVO residentListVO = new ResidentListVO();
Optional.ofNullable(common)
.map(VehicleDeviceWorkOrder::getWorkOrderNo)
......@@ -178,6 +179,7 @@ public class VehicleMonitorConvert {
residentListVO.setBlng(residentDTO.getBlng());
residentListVO.setElat(residentDTO.getElat());
residentListVO.setElng(residentDTO.getElng());
residentListVO.setAddress(address);
return residentListVO;
}
......
......@@ -95,4 +95,10 @@ public class ResidentListVO implements Serializable {
*/
@ApiModelProperty(value = "经度偏移")
private String elng;
/**
* 停留地址
* */
@ApiModelProperty(value = "停留地址")
private String address;
}
......@@ -82,4 +82,10 @@ public class StayPointListVO implements Serializable {
* */
@ApiModelProperty(value = "停留经度")
private String elng;
/**
* 停留地址
* */
@ApiModelProperty(value = "停留地址")
private String address;
}
......@@ -384,8 +384,55 @@ public class VehicleMonitorService {
List<StayPointRecordDTO> stayPointRecord = getStayPointList(search, request);
//获取车辆,工单信息
VehicleDeviceWorkOrder commonInfo = vehicleDeviceService.getVehicleDeviceWorkOrderBySn(search.getSn());
//获取地址信息
List<LngLatDTO> lngLats = stayPointRecord.stream()
.filter(e -> Objects.nonNull(e.getStayGps()))
.map(e -> new LngLatDTO(e.getStayGps().getElng(), e.getStayGps().getElat()))
.collect(Collectors.toList());
LngLatAddressDTO addressDTO = remoteGpsBsService.getAddressMap(lngLats);
Map<String, String> addressMap = Optional.ofNullable(addressDTO)
.map(LngLatAddressDTO::getAddress)
.orElse(Maps.newHashMap());
return stayPointRecord.stream()
.map(stayPoint -> VehicleMonitorConvert.buildStayPointListVO(stayPoint, commonInfo, search.getSn(), Optional.ofNullable(stayPoint.getStayGps())
.map(e -> e.getElat() + e.getElng())
.map(addressMap::get)
.orElse(Constants.EMPTY_CONTENT_EXCEL)))
.collect(Collectors.toList());
}
/**
* 停留点列表导出
*/
public List<StayPointListExport> exportStayPointList(StayPointSearch search) {
StayPointRequest request = VehicleMonitorConvert.buildStayPointRequest(search);
//获取停留点列表
List<StayPointRecordDTO> stayPointRecord = getStayPointList(search, request);
//获取地址信息
List<LngLatDTO> lngLats = stayPointRecord.stream()
.filter(e -> Objects.nonNull(e.getStayGps()))
.map(e -> new LngLatDTO(e.getStayGps().getElng(), e.getStayGps().getElat()))
.collect(Collectors.toList());
LngLatAddressDTO addressDTO = remoteGpsBsService.getAddressMap(lngLats);
Map<String, String> addressMap = Optional.ofNullable(addressDTO)
.map(LngLatAddressDTO::getAddress)
.orElse(Maps.newHashMap());
//获取车辆,工单信息
VehicleDeviceWorkOrder commonInfo = vehicleDeviceService.getVehicleDeviceWorkOrderBySn(search.getSn());
return stayPointRecord.stream()
.map(stayPoint -> VehicleMonitorConvert.buildStayPointListVO(stayPoint, commonInfo, search.getSn()))
.filter(Objects::nonNull)
.map(stayPoint -> {
String address = Optional.ofNullable(stayPoint.getStayGps())
.map(e -> e.getElat() + e.getElng())
.map(addressMap::get)
.orElse(Constants.EMPTY_CONTENT_EXCEL);
return VehicleMonitorConvert.buildStayPointListExport(stayPoint, commonInfo, search.getSn(), address);
})
.collect(Collectors.toList());
}
......@@ -417,42 +464,41 @@ public class VehicleMonitorService {
return stayPointRecord;
}
/**
* 停留点列表导出
* 常驻地列表
*/
public List<StayPointListExport> exportStayPointList(StayPointSearch search) {
StayPointRequest request = VehicleMonitorConvert.buildStayPointRequest(search);
//获取停留点列表
List<StayPointRecordDTO> stayPointRecord = getStayPointList(search, request);
public List<ResidentListVO> queryResidentList(ResidentSearch search) {
ResidentRequest request = buildResidentRequest(search);
List<ResidentDTO> residentList = remoteFeignResidentService.getResidentList(request);
if (CollectionUtils.isEmpty(residentList)) {
return Lists.newArrayList();
}
//查询设备,车辆,工单等信息
VehicleDeviceWorkOrder commonInfo = vehicleDeviceService.getVehicleDeviceWorkOrderBySn(search.getSn());
//获取地址信息
List<LngLatDTO> lngLats = stayPointRecord.stream()
.filter(e -> Objects.nonNull(e.getStayGps()))
.map(e -> new LngLatDTO(e.getStayGps().getElng(), e.getStayGps().getElat()))
List<LngLatDTO> lngLats = residentList.stream()
.map(e -> new LngLatDTO(e.getElng(), e.getElat()))
.collect(Collectors.toList());
LngLatAddressDTO addressDTO = remoteGpsBsService.getAddressMap(lngLats);
Map<String, String> addressMap = Optional.ofNullable(addressDTO)
.map(LngLatAddressDTO::getAddress)
.orElse(Maps.newHashMap());
//获取车辆,工单信息
VehicleDeviceWorkOrder commonInfo = vehicleDeviceService.getVehicleDeviceWorkOrderBySn(search.getSn());
return stayPointRecord.stream()
.filter(Objects::nonNull)
.map(stayPoint -> {
String address = Optional.ofNullable(stayPoint.getStayGps())
.map(e -> e.getElat() + e.getElng())
.map(addressMap::get)
.orElse(Constants.EMPTY_CONTENT_EXCEL);
return VehicleMonitorConvert.buildStayPointListExport(stayPoint, commonInfo, search.getSn(), address);
})
return residentList.stream()
.map(e -> VehicleMonitorConvert.buildResidentListVO(e, commonInfo, addressMap.get(e.getElat() + e.getElng())))
.collect(Collectors.toList());
}
/**
* 常驻地列表
* 导出常驻地
*/
public List<ResidentListVO> queryResidentList(ResidentSearch search) {
public List<ResidentListExport> exportResidentList(ResidentSearch search) {
ResidentRequest request = buildResidentRequest(search);
List<ResidentDTO> residentList = remoteFeignResidentService.getResidentList(request);
......@@ -463,8 +509,18 @@ public class VehicleMonitorService {
//查询设备,车辆,工单等信息
VehicleDeviceWorkOrder commonInfo = vehicleDeviceService.getVehicleDeviceWorkOrderBySn(search.getSn());
//获取地址信息
List<LngLatDTO> lngLats = residentList.stream()
.map(e -> new LngLatDTO(e.getElng(), e.getElat()))
.collect(Collectors.toList());
LngLatAddressDTO addressDTO = remoteGpsBsService.getAddressMap(lngLats);
Map<String, String> addressMap = Optional.ofNullable(addressDTO)
.map(LngLatAddressDTO::getAddress)
.orElse(Maps.newHashMap());
return residentList.stream()
.map(e -> VehicleMonitorConvert.buildResidentListVO(e, commonInfo))
.filter(Objects::nonNull)
.map(resident -> VehicleMonitorConvert.buildResidentListExport(resident, commonInfo, addressMap.get(resident.getElat() + resident.getElng())))
.collect(Collectors.toList());
}
......@@ -524,33 +580,4 @@ public class VehicleMonitorService {
}
return new ImmutablePair<>(startDate, endDate);
}
/**
* 导出常驻地
*/
public List<ResidentListExport> exportResidentList(ResidentSearch search) {
ResidentRequest request = buildResidentRequest(search);
List<ResidentDTO> residentList = remoteFeignResidentService.getResidentList(request);
if (CollectionUtils.isEmpty(residentList)) {
return Lists.newArrayList();
}
//查询设备,车辆,工单等信息
VehicleDeviceWorkOrder commonInfo = vehicleDeviceService.getVehicleDeviceWorkOrderBySn(search.getSn());
//获取地址信息
List<LngLatDTO> lngLats = residentList.stream()
.map(e -> new LngLatDTO(e.getElng(), e.getElat()))
.collect(Collectors.toList());
LngLatAddressDTO addressDTO = remoteGpsBsService.getAddressMap(lngLats);
Map<String, String> addressMap = Optional.ofNullable(addressDTO)
.map(LngLatAddressDTO::getAddress)
.orElse(Maps.newHashMap());
return residentList.stream()
.filter(Objects::nonNull)
.map(resident -> VehicleMonitorConvert.buildResidentListExport(resident, commonInfo, addressMap.get(resident.getElat() + resident.getElng())))
.collect(Collectors.toList());
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!