| | |
| | | package com.xiaopeng.maintenance.controller; |
| | | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.sun.xml.internal.bind.v2.TODO; |
| | | import com.xiaopeng.api.dto.automaticPilot.PushOrderDto; |
| | | import com.xiaopeng.api.feignClient.automaticPilot.OrderMissionClient; |
| | | import com.xiaopeng.api.feignClient.order.XpCruiseOrderClient; |
| | | import com.xiaopeng.api.feignClient.vehicleConvoy.XpVehicleClient; |
| | | import com.xiaopeng.api.model.order.XpCruiseOrder; |
| | | import com.xiaopeng.api.model.vehicleConvoy.XpVehicle; |
| | | import com.xiaopeng.api.vo.automaticPilot.VehiclePosition; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.common.redis.service.RedisService; |
| | | import com.xiaopeng.maintenance.dto.VehicleDispatchAcceptDTO; |
| | | import com.xiaopeng.maintenance.dto.VehicleDispatchDepartureDTO; |
| | | import com.xiaopeng.maintenance.model.query.OperationRecordsQuery; |
| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.geo.GeoJsonPoint; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private IXpVehiclePreparationService xpVehiclePreparationService; |
| | | @Autowired |
| | | private XpVehicleClient xpVehicleClient; |
| | | @Autowired |
| | | private XpCruiseOrderClient xpCruiseOrderClient; |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Autowired |
| | | private OrderMissionClient orderMissionClient; |
| | | |
| | | /** |
| | | * 车辆详情-车辆调度-发车 收车 |
| | |
| | | if(dto.getDepartureStatus()==1){ |
| | | // 找车辆的任务 生成巡游单子 下发命令 TODO |
| | | }else if(dto.getDepartureStatus()==3){ |
| | | // 收车 关闭巡游单子 TODO |
| | | // 收车 关闭当前巡游单子 生成新的返程单子 找到收车站点 |
| | | 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(); |
| | | xpCruiseOrder.setId("XU"+ IdUtil.fastUUID()); |
| | | xpCruiseOrder.setVehicleId(xpVehicle.getId()); |
| | | xpCruiseOrder.setOrderType(2); |
| | | xpCruiseOrder.setStartLon(x); |
| | | xpCruiseOrder.setStartLat(y); |
| | | // TODO 找到收车站点 |
| | | xpCruiseOrder.setStatus(1); |
| | | |
| | | |
| | | // 下发命令 |
| | | orderMissionClient.pushOrder(new PushOrderDto( xpCruiseOrder.getVehicleVin(),xpCruiseOrder.getId(),null)); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | return R.ok(); |