|
@@ -254,6 +254,8 @@ public class PassengerApiController {
|
|
|
//班次信息
|
|
|
ShiftInfo shiftInfo = shiftInfoList.get(0);
|
|
|
|
|
|
+ DriverInfo driverInfo = driverInfoService.get(shiftInfo.getDriverId());
|
|
|
+
|
|
|
//车辆信息
|
|
|
VehicleInfo vehicleInfo = vehicleInfoService.get(id);
|
|
|
|
|
@@ -282,6 +284,8 @@ public class PassengerApiController {
|
|
|
map.put("endTime", routeInfo.getEndTime());
|
|
|
map.put("routeName", routeInfo.getName());
|
|
|
map.put("mapPath", routeInfo.getMapPath());
|
|
|
+ map.put("driver",driverInfo);
|
|
|
+ map.put("licensePlateNumber",vehicleInfo.getLicensePlateNumber());
|
|
|
// map.put("stationList",vehicleStationDTOList);
|
|
|
messageResult.setData(map);
|
|
|
messageResult.setResult(true);
|
|
@@ -948,6 +952,8 @@ public class PassengerApiController {
|
|
|
|
|
|
nearbyStationDTO.setStationId(stationInfo.getId());
|
|
|
nearbyStationDTO.setStationName(stationInfo.getName());
|
|
|
+ nearbyStationDTO.setLatitude(stationInfo.getLatitude());
|
|
|
+ nearbyStationDTO.setLongitude(stationInfo.getLongitude());
|
|
|
|
|
|
for (int n = 0; n < 2; n++) {
|
|
|
String startStationId = stationInfoList1.get(0).getId();
|
|
@@ -1124,6 +1130,103 @@ public class PassengerApiController {
|
|
|
return messageResult;
|
|
|
}
|
|
|
|
|
|
+ @PostMapping("vehicleStationDis")
|
|
|
+ @ApiOperation(value = "站点车辆距离")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "routeId", value = "线路id", required = true, paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "startStationId", value = "开始站点id", required = true, paramType = "form"),
|
|
|
+ @ApiImplicitParam(name = "currentStationId", value = "当前站点id", required = true, paramType = "form")
|
|
|
+ })
|
|
|
+ public MessageResult<String> vehicleStationDis(String routeId, String startStationId,String currentStationId) {
|
|
|
+ MessageResult<String> messageResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(routeId) || StringUtils.isBlank(startStationId)) {
|
|
|
+ throw new Exception("参数错误");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<StationInfo> stationInfoList = stationInfoService.findByRouteId(routeId);
|
|
|
+ //是否顺路
|
|
|
+ Boolean tmp = true;
|
|
|
+ if (!startStationId.equals(stationInfoList.get(0).getId())){
|
|
|
+ tmp = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<ShiftInfo> shiftInfoList = shiftInfoService.findByRouteIdAndStatusAndStartStationId(routeId,"1",startStationId);
|
|
|
+ //查询的当前站
|
|
|
+ StationInfo currentStation = stationInfoService.get(currentStationId);
|
|
|
+
|
|
|
+ String des = null;
|
|
|
+ if (shiftInfoList.size()>0){
|
|
|
+ String vehicleId = "";
|
|
|
+ int n = 1000;
|
|
|
+ for (ShiftInfo shiftInfo : shiftInfoList){
|
|
|
+ //班次当前站
|
|
|
+ StationInfo stationInfo = stationInfoService.get(shiftInfo.getCurrentStationId());
|
|
|
+ int stationInfoIndex = stationInfoList.indexOf(stationInfo);
|
|
|
+
|
|
|
+ int currentStationIndex = stationInfoList.indexOf(currentStation);
|
|
|
+ if (tmp){
|
|
|
+ if (stationInfoIndex<=currentStationIndex){
|
|
|
+ int m = currentStationIndex - stationInfoIndex;
|
|
|
+ if (m<n){
|
|
|
+ n = m;
|
|
|
+ vehicleId = shiftInfo.getVehicleId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ if (!tmp){
|
|
|
+ if (stationInfoIndex >= currentStationIndex){
|
|
|
+ int m = stationInfoIndex - currentStationIndex;
|
|
|
+ if (m<n){
|
|
|
+ n = m;
|
|
|
+ vehicleId = shiftInfo.getVehicleId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(vehicleId)){
|
|
|
+ //车辆
|
|
|
+ VehicleInfo vehicleInfo = vehicleInfoService.get(vehicleId);
|
|
|
+ //距离
|
|
|
+ GlobalCoordinates source = new GlobalCoordinates(Double.valueOf(vehicleInfo.getLatitude()), Double.valueOf(vehicleInfo.getLongitude()));
|
|
|
+ GlobalCoordinates target = new GlobalCoordinates(Double.valueOf(currentStation.getLatitude()), Double.valueOf(currentStation.getLongitude()));
|
|
|
+
|
|
|
+ double meter1 = CommonUtil.getDistanceMeter(source, target, Ellipsoid.Sphere);
|
|
|
+
|
|
|
+ int intMeter = (new Double(meter1)).intValue();
|
|
|
+ //距离详情
|
|
|
+ String distanceStr = null;
|
|
|
+ if (intMeter >= 1000) {
|
|
|
+ distanceStr = intMeter / 1000 + "公里";
|
|
|
+ } else {
|
|
|
+ distanceStr = intMeter + "米";
|
|
|
+ }
|
|
|
+ des = n + "站 "+ distanceStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ messageResult.setData(des);
|
|
|
+ messageResult.setCode(200);
|
|
|
+ messageResult.setResult(true);
|
|
|
+
|
|
|
+
|
|
|
+ } catch (Exception ex) {
|
|
|
+ log.error(ex.getMessage(), ex);
|
|
|
+ messageResult.setCode(400);
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
@PostMapping("routeList")
|
|
|
@ApiOperation(value = "乘客查询线路列表")
|
|
@@ -1411,6 +1514,8 @@ public class PassengerApiController {
|
|
|
passengerRecordDTO.setGoodTicket(orderInfo.getGoodsTicket());
|
|
|
passengerRecordDTO.setPayTime(DateUtil.format(orderInfo.getPayTime(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
passengerRecordDTO.setTotalFee(orderInfo.getTotalFee());
|
|
|
+ passengerRecordDTO.setStatus(passengerInfo.getStatus());
|
|
|
+ passengerRecordDTO.setStatusName(passengerRecordDTO.getStatusName(passengerInfo.getStatus()));
|
|
|
list.add(passengerRecordDTO);
|
|
|
|
|
|
}
|
|
@@ -1459,8 +1564,19 @@ public class PassengerApiController {
|
|
|
ShiftInfo shiftInfo = shiftInfoService.get(passengerInfo.getVehicleShiftId());
|
|
|
//开始站
|
|
|
StationInfo startStation = stationInfoService.get(shiftInfo.getStartStationId());
|
|
|
+ LonLatDTO lonLatDTO1 = new LonLatDTO();
|
|
|
+ lonLatDTO1.setLatitude(startStation.getLatitude());
|
|
|
+ lonLatDTO1.setLongitude(startStation.getLongitude());
|
|
|
//终点站
|
|
|
StationInfo endStation = stationInfoService.get(shiftInfo.getEndStationId());
|
|
|
+ LonLatDTO lonLatDTO2 = new LonLatDTO();
|
|
|
+ lonLatDTO2.setLatitude(endStation.getLatitude());
|
|
|
+ lonLatDTO2.setLongitude(endStation.getLongitude());
|
|
|
+
|
|
|
+ List<LonLatDTO> routeStationLonLat = new ArrayList<>();
|
|
|
+ routeStationLonLat.add(lonLatDTO1);
|
|
|
+ routeStationLonLat.add(lonLatDTO2);
|
|
|
+
|
|
|
|
|
|
shiftInfo.setStartStationName(startStation.getName());
|
|
|
shiftInfo.setEndStationName(endStation.getName());
|
|
@@ -1468,13 +1584,27 @@ public class PassengerApiController {
|
|
|
//线路
|
|
|
RouteInfo routeInfo = routeInfoService.get(shiftInfo.getRouteId());
|
|
|
|
|
|
+ //车辆
|
|
|
+ VehicleInfo vehicleInfo = vehicleInfoService.get(shiftInfo.getVehicleId());
|
|
|
+
|
|
|
//司机
|
|
|
DriverInfo driverInfo = driverInfoService.get(shiftInfo.getDriverId());
|
|
|
|
|
|
//购票上车站点
|
|
|
StationInfo ticketUpStation = stationInfoService.get(orderInfo.getTicketUpStationId());
|
|
|
+ LonLatDTO lonLatDTO3 = new LonLatDTO();
|
|
|
+ lonLatDTO3.setLatitude(ticketUpStation.getLatitude());
|
|
|
+ lonLatDTO3.setLongitude(ticketUpStation.getLongitude());
|
|
|
+
|
|
|
//购票下次站点
|
|
|
StationInfo ticketDownStation = stationInfoService.get(orderInfo.getTicketDownStationId());
|
|
|
+ LonLatDTO lonLatDTO4 = new LonLatDTO();
|
|
|
+ lonLatDTO4.setLatitude(ticketDownStation.getLatitude());
|
|
|
+ lonLatDTO4.setLongitude(ticketDownStation.getLongitude());
|
|
|
+
|
|
|
+ List<LonLatDTO> ticketUpDownLonLat = new ArrayList<>();
|
|
|
+ ticketUpDownLonLat.add(lonLatDTO3);
|
|
|
+ ticketUpDownLonLat.add(lonLatDTO4);
|
|
|
|
|
|
//购票类型
|
|
|
String ticketTypeName = "成人票";
|
|
@@ -1495,6 +1625,9 @@ public class PassengerApiController {
|
|
|
passengerRecordDetailDTO.setTicketStatus(passengerInfo.getStatus());
|
|
|
passengerRecordDetailDTO.setTicketStatusName(passengerRecordDetailDTO.getTicketStatusName(passengerRecordDetailDTO.getTicketStatus()));
|
|
|
passengerRecordDetailDTO.setShiftInfo(shiftInfo);
|
|
|
+ passengerRecordDetailDTO.setVehicleInfo(vehicleInfo);
|
|
|
+ passengerRecordDetailDTO.setRouteStationLonLat(routeStationLonLat);
|
|
|
+ passengerRecordDetailDTO.setTicketUpDownLonLat(ticketUpDownLonLat);
|
|
|
|
|
|
messageResult.setData(passengerRecordDetailDTO);
|
|
|
messageResult.setCode(200);
|