| | |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | |
| | | /** |
| | | * 车辆详情-车辆调度-发车 收车 |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @ApiOperation(value = "车辆运维-车辆调度-发车/收车", tags = {"运维APP-车辆管理"}) |
| | | @PostMapping("/api/v1/vehicle/vehicleDispatchDeparture") |
| | | public R<String> vehicleDispatchDeparture(@RequestBody VehicleDispatchDepartureDTO dto) { |
| | |
| | | if(xpVehicle.getState()==1){ |
| | | return R.fail("车辆正在接单中"); |
| | | } |
| | | xpVehicle.setOperatingStatus(dto.getDepartureStatus()); |
| | | xpVehicleClient.updateVehicleById(xpVehicle); |
| | | |
| | | VehiclePosition vehiclePosition = mongoTemplate.findOne(new Query(Criteria.where("vin").is(xpVehicle.getVehicleVin())), VehiclePosition.class); |
| | | if(vehiclePosition==null || vehiclePosition.getPoint()==null){ |
| | | return R.fail("车辆位置信息不存在"); |
| | | } |
| | | xpVehicle.setOperatingStatus(dto.getDepartureStatus()); |
| | | xpVehicleClient.updateVehicleById(xpVehicle); |
| | | // 发车 |
| | | if(dto.getDepartureStatus()==1){ |
| | | // 找车辆的任务 生成巡游单子 下发命令 |