Commit fb77158b by 向延琳

增加返回值

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