| | |
| | | // 发车 |
| | | if(dto.getDepartureStatus()==1){ |
| | | // 找车辆的任务 生成巡游单子 下发命令 |
| | | //发车之前,检查所有之前没终止的数据,将其终止 |
| | | xpCruiseOrderClient.stopAllCruiseOrder(xpVehicle.getVehicleVin()); |
| | | R<XpCruiseOrder> newCruiseOrder = xpCruisePlanClient.getNewCruiseOrder(new NewCruiseOrderDto(xpVehicle.getId(),xpVehicle.getVehicleVin(),xpVehicle.getFleetId(),vehiclePosition.getPoint())); |
| | | if(newCruiseOrder.getData()!=null){ |
| | | R<Long> longR = xpCruiseOrderClient.addCruiseOrder(newCruiseOrder.getData()); |
| | | //标记订单为返程类型巡游单 |
| | | //方向为正向 |
| | | XpCruiseOrder cruiseOrder = newCruiseOrder.getData(); |
| | | cruiseOrder.setOrderType(2); |
| | | cruiseOrder.setOrderReverse(1); |
| | | R<Long> longR = xpCruiseOrderClient.addCruiseOrder(cruiseOrder); |
| | | if(200 != longR.getCode()){ |
| | | return R.fail(longR.getMsg()); |
| | | } |
| | | } |
| | | }else if(dto.getDepartureStatus()==3){ |
| | | // 收车 关闭当前巡游单子 生成新的返程单子 找到收车站点 |
| | | R<Long> r = xpCruiseOrderClient.updateCruiseOrder(xpVehicle.getVehicleVin()); |
| | | |
| | | // redis 获取当前最新经纬度位置 |
| | | R<Long> r = xpCruiseOrderClient.cancelCruiseOrderByVin(xpVehicle.getVehicleVin()); |
| | | |
| | | XpCruiseOrder xpCruiseOrder = new XpCruiseOrder(); |
| | | if(vehiclePosition!=null){ |
| | |
| | | XpCruiseOrder returnCruisePoint = xpCruisePlanClient.findReturnCruisePoint(xpCruiseOrder).getData(); |
| | | if(returnCruisePoint!=null){ |
| | | xpCruiseOrderClient.addCruiseOrder(returnCruisePoint); |
| | | // 下发命令 |
| | | PushOrderDto pushOrderDto = new PushOrderDto(); |
| | | pushOrderDto.setVin(returnCruisePoint.getVehicleVin()); |
| | | pushOrderDto.setOrderId("XU" + returnCruisePoint.getId()); |
| | | pushOrderDto.setStartLatitude(returnCruisePoint.getStartLat()); |
| | | pushOrderDto.setStartLongitude(returnCruisePoint.getStartLon()); |
| | | pushOrderDto.setEndLatitude(returnCruisePoint.getEndLat()); |
| | | pushOrderDto.setEndLongitude(returnCruisePoint.getEndLon()); |
| | | pushOrderDto.setOrderType(OrderType.CRUISE_ORDER); |
| | | pushOrderDto.setStage(2); |
| | | orderMissionClient.pushOrder(pushOrderDto); |
| | | } |
| | | |
| | | } |