| | |
| | | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.xiaopeng.api.dto.automaticPilot.PushOrderDto; |
| | | import com.xiaopeng.api.dto.operation.NewCruiseOrderDto; |
| | | import com.xiaopeng.api.feignClient.automaticPilot.OrderMissionClient; |
| | | import com.xiaopeng.api.feignClient.operation.XpCruisePlanClient; |
| | | import com.xiaopeng.api.feignClient.order.XpCruiseOrderClient; |
| | | import com.xiaopeng.api.feignClient.vehicleConvoy.XpVehicleClient; |
| | | import com.xiaopeng.api.model.order.XpCruiseOrder; |
| | |
| | | private MongoTemplate mongoTemplate; |
| | | @Resource |
| | | private OrderMissionClient orderMissionClient; |
| | | @Autowired |
| | | private XpCruisePlanClient xpCruisePlanClient; |
| | | |
| | | /** |
| | | * 车辆详情-车辆调度-发车 收车 |
| | |
| | | |
| | | // 发车 |
| | | if(dto.getDepartureStatus()==1){ |
| | | // 找车辆的任务 生成巡游单子 下发命令 TODO v |
| | | |
| | | |
| | | |
| | | |
| | | // 找车辆的任务 生成巡游单子 下发命令 |
| | | R<XpCruiseOrder> newCruiseOrder = xpCruisePlanClient.getNewCruiseOrder(new NewCruiseOrderDto(xpVehicle.getId(),xpVehicle.getVehicleVin(),xpVehicle.getFleetId())); |
| | | if(newCruiseOrder.getData()!=null){ |
| | | // 下发命令 |
| | | orderMissionClient.pushOrder(new PushOrderDto(xpVehicle.getVehicleVin(),newCruiseOrder.getData().getId(),null)); |
| | | } |
| | | |
| | | |
| | | }else if(dto.getDepartureStatus()==3){ |
| | | // 收车 关闭当前巡游单子 生成新的返程单子 找到收车站点 |
| | | xpCruiseOrderClient.updateCruiseOrder(xpVehicle.getVehicleVin()); |
| | | R<String> r = xpCruiseOrderClient.updateCruiseOrder(xpVehicle.getVehicleVin()); |
| | | |
| | | // redis 获取当前最新经纬度位置 |
| | | VehiclePosition vehiclePosition = mongoTemplate.findOne(new Query(Criteria.where("vin").is(xpVehicle.getVehicleVin())), VehiclePosition.class); |
| | | double x = vehiclePosition.getPoint().getX(); |
| | | double y = vehiclePosition.getPoint().getY(); |
| | | XpCruiseOrder xpCruiseOrder = new XpCruiseOrder(); |
| | | if(vehiclePosition!=null){ |
| | | double x = vehiclePosition.getPoint().getX(); |
| | | double y = vehiclePosition.getPoint().getY(); |
| | | xpCruiseOrder.setStartLon(x); |
| | | xpCruiseOrder.setStartLat(y); |
| | | } |
| | | |
| | | xpCruiseOrder.setId("XU"+ IdUtil.fastUUID()); |
| | | xpCruiseOrder.setVehicleId(xpVehicle.getId()); |
| | | xpCruiseOrder.setFleetId(xpVehicle.getFleetId()); |
| | | xpCruiseOrder.setOrderType(2); |
| | | xpCruiseOrder.setStartLon(x); |
| | | xpCruiseOrder.setStartLat(y); |
| | | // TODO v 找到收车站点 |
| | | xpCruiseOrder.setStatus(1); |
| | | xpCruiseOrder.setOrderReverse(1); |
| | | xpCruiseOrder.setLastOrderId(r.getData()); |
| | | |
| | | |
| | | |
| | | xpCruiseOrderClient.addCruiseOrder(xpCruiseOrder); |
| | | |
| | | // 下发命令 |
| | | orderMissionClient.pushOrder(new PushOrderDto( xpCruiseOrder.getVehicleVin(),xpCruiseOrder.getId(),null)); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // 找到收车站点 |
| | | R<XpCruiseOrder> returnCruisePoint = xpCruisePlanClient.findReturnCruisePoint(xpCruiseOrder); |
| | | if(returnCruisePoint!=null){ |
| | | xpCruiseOrderClient.addCruiseOrder(returnCruisePoint.getData()); |
| | | // 下发命令 |
| | | orderMissionClient.pushOrder(new PushOrderDto( xpCruiseOrder.getVehicleVin(),xpCruiseOrder.getId(),null)); |
| | | } |
| | | |
| | | } |
| | | return R.ok(); |