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; }