From 62163826a35e905a9f3c126886374cbfc510ea34 Mon Sep 17 00:00:00 2001 From: hanrenchun Date: Sat, 24 Feb 2024 09:48:51 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=A6=E8=BE=86=E8=BD=A8=E8=BF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TransitVehicleRecordController.java | 27 +++++++++++++------ .../domain/vo/TransitVehicleRecordVO.java | 7 +++++ 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/gather-app/src/main/java/com/ruoyi/database/controller/TransitVehicleRecordController.java b/gather-app/src/main/java/com/ruoyi/database/controller/TransitVehicleRecordController.java index 8766a1c..0d8b0e2 100644 --- a/gather-app/src/main/java/com/ruoyi/database/controller/TransitVehicleRecordController.java +++ b/gather-app/src/main/java/com/ruoyi/database/controller/TransitVehicleRecordController.java @@ -30,6 +30,7 @@ import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.ArrayList; +import java.util.Comparator; import java.util.Date; import java.util.List; import java.util.stream.Collectors; @@ -78,14 +79,24 @@ public class TransitVehicleRecordController extends BaseController { return getDataTable(list); } -// @GetMapping("/track") -// @ApiOperation("查询车辆轨迹") -// public TableDataInfo trackList(TransitVehicleRecord transitVehicleRecord) { -// List list = transitVehicleRecordService.list(new QueryWrapper<>(transitVehicleRecord)); -// for (TransitVehicleRecord transitVehicleRecord1 : list){ -// -// } -// } + @GetMapping("/track") + @ApiOperation("查询车辆轨迹") + public TableDataInfo trackList(TransitVehicleRecord transitVehicleRecord) { + List list = transitVehicleRecordService.list(new QueryWrapper<>(transitVehicleRecord)); + List collect = list.stream() + .sorted(Comparator.comparing(TransitVehicleRecord::getPassTime)) + .collect(Collectors.toList()); + TransitVehicleRecordVO transitVehicleRecordVO = new TransitVehicleRecordVO(); + ArrayList transitVehicleRecordVOS = new ArrayList<>(); + for (TransitVehicleRecord transitVehicleRecord1 : collect){ + 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); + } + return getDataTable(transitVehicleRecordVOS); + } @PostMapping @ApiOperation("新增车辆记录表") diff --git a/gather-app/src/main/java/com/ruoyi/database/domain/vo/TransitVehicleRecordVO.java b/gather-app/src/main/java/com/ruoyi/database/domain/vo/TransitVehicleRecordVO.java index a365ed4..61d6063 100644 --- a/gather-app/src/main/java/com/ruoyi/database/domain/vo/TransitVehicleRecordVO.java +++ b/gather-app/src/main/java/com/ruoyi/database/domain/vo/TransitVehicleRecordVO.java @@ -152,4 +152,11 @@ public class TransitVehicleRecordVO extends BaseEntity { private Date partitionField; + @ApiModelProperty("设备经度") + @Excel(name = "设备经度") + private Double longitude; + + @ApiModelProperty("设备纬度") + @Excel(name = "设备纬度") + private Double latitude; }