package com.xiaopeng.automaticPilot.controller; import com.xiaopeng.api.vo.automaticPilot.proto.down.ResponseMessage; import com.xiaopeng.api.vo.automaticPilot.proto.down.StatusCode; import com.xiaopeng.api.vo.automaticPilot.proto.down.cloudCreateOrder.RTTask; import com.xiaopeng.api.vo.automaticPilot.proto.down.cloudCreateOrder.TaskStatus; import com.xiaopeng.api.vo.automaticPilot.proto.down.cloudCreateOrder.TaskType; import com.xiaopeng.automaticPilot.util.XPUUtil; import com.xiaopeng.common.core.domain.R; import io.swagger.annotations.Api; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @Slf4j @RestController @RequestMapping("") @Api(tags = "订单任务Api") public class OrderMissionController { private final XPUUtil xpuUtil; public OrderMissionController(XPUUtil xpuUtil) { this.xpuUtil = xpuUtil; } @PostMapping("/inner/pushOrder") public R pushOrder(@RequestParam Long orderId) { RTTask task = new RTTask(); task.setOrder_id(orderId.toString()); // TODO id处理 已经数据是否存储 task.setTask_id(System.currentTimeMillis()+ ""); task.setTask_type(TaskType.ROBOTAXI); task.setStatus(TaskStatus.PENDING); ResponseMessage responseMessage = xpuUtil.cloudCreateOrder(task); if (responseMessage.getCode()== StatusCode.OK) { return R.ok(true); } return R.ok(false); } }