| | |
| | | import com.xiaopeng.api.feignClient.vehicleConvoy.XpVehicleClient; |
| | | import com.xiaopeng.api.model.order.XpOrder; |
| | | import com.xiaopeng.api.model.vehicleConvoy.XpVehicle; |
| | | import com.xiaopeng.api.vo.automaticPilot.AppUserPosition; |
| | | import com.xiaopeng.api.vo.automaticPilot.VehiclePosition; |
| | | import com.xiaopeng.api.vo.vehicleConvoy.VehicleDoorStatusVo; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.utils.StringUtils; |
| | | import com.xiaopeng.order.dto.UserOrderListDto; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | |
| | | |
| | | |
| | | /** |
| | | * 8. 查询乘客位置 |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | @GetMapping("/getAppUserLocation/{orderId}") |
| | | @ApiOperation(value = "查询乘客位置", notes = "客服系统对接") |
| | | @ApiImplicitParam(name = "orderId", value = "订单ID", required = true, dataType = "Long", paramType = "path") |
| | | public R<AppUserLocationVo> getAppUserLocation(@PathVariable Long orderId){ |
| | | XpOrder xpOrder = xpOrderService.getById(orderId); |
| | | if(null == xpOrder){ |
| | | return R.ok(); |
| | | } |
| | | AppUserLocationVo vo = new AppUserLocationVo(); |
| | | AppUserPosition userPosition = mongoTemplate.findOne(Query.query(Criteria.where("appUserId").is(xpOrder.getAppUserId())), AppUserPosition.class); |
| | | if(null != userPosition){ |
| | | vo.setPassengerLng(userPosition.getPoint().getX()); |
| | | vo.setPassengerLat(userPosition.getPoint().getY()); |
| | | return R.ok(vo); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 9. 根据 订单查询安全带及座椅传感器状态 |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | @GetMapping("/getVehicleSeatStatus/{orderId}") |
| | | @ApiOperation(value = "根据 订单查询安全带及座椅传感器状态", notes = "客服系统对接") |
| | | @ApiImplicitParam(name = "orderId", value = "订单ID", required = true, dataType = "Long", paramType = "path") |
| | | public R<VehicleSeatStatusVo> getVehicleSeatStatus(@PathVariable Long orderId){ |
| | | XpOrder xpOrder = xpOrderService.getById(orderId); |
| | | if(null == xpOrder){ |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 10. 根据 VIN 查询剩余电量及预估续航 |
| | | * @param vin |
| | | * @return |
| | |
| | | vo.setEstimatedRange(Double.valueOf(vehiclePositions.getMileageRange())); |
| | | return R.ok(vo); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 11. 根据 订单查询四门三盖状态 |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | @GetMapping("/getVehicleDoorStatus/{orderId}") |
| | | @ApiOperation(value = "根据 订单查询四门三盖状态", notes = "客服系统对接") |
| | | @ApiImplicitParam(name = "orderId", value = "订单ID", required = true, dataType = "Long", paramType = "path") |
| | | public R<VehicleDoorStatusVo> getVehicleDoorStatus(@PathVariable Long orderId){ |
| | | VehicleDoorStatusVo data = xpVehicleClient.getVehicleDoorStatus(orderId).getData(); |
| | | return R.ok(data); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 12. 根据 订单查询车辆位置及电子围栏信息 |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | @GetMapping("/getVehicleFenceInformation/{orderId}") |
| | | @ApiOperation(value = "根据 订单查询车辆位置及电子围栏信息", notes = "客服系统对接") |
| | | @ApiImplicitParam(name = "orderId", value = "订单ID", required = true, dataType = "Long", paramType = "path") |
| | | public R<VehicleFenceInformationVo> getVehicleFenceInformation(@PathVariable Long orderId){ |
| | | XpOrder xpOrder = xpOrderService.getById(orderId); |
| | | if(null == xpOrder){ |
| | | return R.ok(); |
| | | } |
| | | XpVehicle xpVehicle = xpVehicleClient.queryById(xpOrder.getVehicleId()).getData(); |
| | | VehiclePosition vehiclePositions = mongoTemplate.findOne(Query.query(Criteria.where("vin").is(xpVehicle.getVehicleVin())), VehiclePosition.class); |
| | | if(null == vehiclePositions){ |
| | | return R.ok(); |
| | | } |
| | | VehicleFenceInformationVo vo = new VehicleFenceInformationVo(); |
| | | vo.setVehicleLng(vehiclePositions.getPoint().getX()); |
| | | vo.setVehicleLat(vehiclePositions.getPoint().getY()); |
| | | vo.setGeofenceBoundary(new ArrayList<>()); |
| | | vo.setIsOutOfGeofence(false); |
| | | return R.ok(vo); |
| | | } |
| | | } |