车辆轨迹

develop
hanrenchun 9 months ago
parent d19527ab41
commit ffe7447747

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

Loading…
Cancel
Save