车辆轨迹

develop
hanrenchun 9 months ago
parent d19527ab41
commit ffe7447747

@ -79,23 +79,38 @@ public class TransitVehicleRecordController extends BaseController {
return getDataTable(list);
}
@GetMapping("/track")
@ApiOperation("查询车辆轨迹")
public TableDataInfo<TransitVehicleRecordVO> trackList(TransitVehicleRecord transitVehicleRecord) {
List<TransitVehicleRecord> list = transitVehicleRecordService.list(new QueryWrapper<>(transitVehicleRecord));
List<TransitVehicleRecord> collect = list.stream()
.sorted(Comparator.comparing(TransitVehicleRecord::getPassTime))
.collect(Collectors.toList());
TransitVehicleRecordVO transitVehicleRecordVO = new TransitVehicleRecordVO();
public AjaxResult trackList(String plateNo) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime now = LocalDateTime.now()
.withHour(0)
.withMinute(0)
.withSecond(0)
.withNano(0);
LocalDateTime localDateTime = now.plusDays(1);
String format = now.format(formatter);
String format1 = localDateTime.format(formatter);
List<TransitVehicleRecord> list = transitVehicleRecordService
.lambdaQuery().eq(TransitVehicleRecord::getPlateNo,plateNo)
.between(TransitVehicleRecord::getPartitionField,format,format1).list();
ArrayList<TransitVehicleRecordVO> transitVehicleRecordVOS = new ArrayList<>();
for (TransitVehicleRecord transitVehicleRecord1 : collect){
for (TransitVehicleRecord transitVehicleRecord1 : list){
TransitVehicleRecordVO transitVehicleRecordVO = new TransitVehicleRecordVO();
BeanUtils.copyProperties(transitVehicleRecord1,transitVehicleRecordVO);
DevopsDeviceInfo deviceInfo = devopsDeviceInfoService.lambdaQuery().eq(DevopsDeviceInfo::getGbsChannelNo, transitVehicleRecord1.getDoorwayCode()).list().get(0);
transitVehicleRecordVO.setLongitude(deviceInfo.getLongitude());
transitVehicleRecordVO.setLatitude(deviceInfo.getLatitude());
transitVehicleRecordVOS.add(transitVehicleRecordVO);
DevopsDeviceInfo deviceInfo = devopsDeviceInfoService.lambdaQuery()
.eq(DevopsDeviceInfo::getGbsChannelNo, transitVehicleRecord1.getDoorwayCode()).list().get(0);
if (deviceInfo != null){
transitVehicleRecordVO.setLongitude(deviceInfo.getLongitude());
transitVehicleRecordVO.setLatitude(deviceInfo.getLatitude());
transitVehicleRecordVOS.add(transitVehicleRecordVO);
}
}
return getDataTable(transitVehicleRecordVOS);
List<TransitVehicleRecordVO> collect = transitVehicleRecordVOS.stream()
.sorted(Comparator.comparing(TransitVehicleRecordVO::getPassTime))
.collect(Collectors.toList());
return AjaxResult.success(collect);
}
@PostMapping

Loading…
Cancel
Save