| | |
| | | package com.xiaopeng.maintenance.controller; |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.xiaopeng.api.dto.automaticPilot.VehicleEventDTO; |
| | | import com.xiaopeng.api.dto.operation.NewCruiseOrderDto; |
| | | import com.xiaopeng.api.feignClient.automaticPilot.VehicleBuriedPointClient; |
| | | import com.xiaopeng.api.feignClient.operation.XpCruisePlanClient; |
| | | import com.xiaopeng.api.feignClient.order.XpCruiseOrderClient; |
| | | import com.xiaopeng.api.feignClient.vehicleConvoy.XpVehicleClient; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private AliOssService aliOssService; |
| | | @Autowired |
| | | private XpCruisePlanClient xpCruisePlanClient; |
| | | @Autowired |
| | | private VehicleBuriedPointClient vehicleBuriedPointClient; |
| | | |
| | | /** |
| | | * 车辆详情-车辆调度-发车 收车 |
| | |
| | | if(vehiclePosition==null || vehiclePosition.getPoint()==null){ |
| | | return R.fail("车辆位置信息不存在"); |
| | | } |
| | | |
| | | Integer departureStatus = dto.getDepartureStatus(); |
| | | XpVehicle vehicle1 = new XpVehicle(); |
| | | vehicle1.setOperatingStatus(dto.getDepartureStatus()); |
| | | vehicle1.setOperatingStatus(departureStatus); |
| | | vehicle1.setId(xpVehicle.getId()); |
| | | xpVehicleClient.updateVehicleById(vehicle1); |
| | | |
| | | // 封装埋点消息实体 |
| | | VehicleEventDTO vehicleEventDTO = new VehicleEventDTO(); |
| | | vehicleEventDTO.setVin(xpVehicle.getVehicleVin()); |
| | | vehicleEventDTO.setXpuId(""); |
| | | vehicleEventDTO.setOrderId(""); |
| | | vehicleEventDTO.setEventKey("RT_web_vehicle_status_changed"); |
| | | vehicleEventDTO.setEventTime(System.currentTimeMillis()); |
| | | Map<String,Object> attributes = new HashMap<>(); |
| | | attributes.put("vin",xpVehicle.getVehicleVin()); |
| | | attributes.put("order_id",""); |
| | | attributes.put("timestamp",vehicleEventDTO.getEventTime()); |
| | | if(departureStatus == 1){ |
| | | attributes.put("main_status","ONLINE"); |
| | | // TODO 预留位置 目前无状态 |
| | | attributes.put("sub_status",""); |
| | | attributes.put("prev_sub_status",""); |
| | | |
| | | }else { |
| | | attributes.put("main_status","OFFLINE"); |
| | | // TODO 预留位置 目前无状态 |
| | | attributes.put("sub_status",""); |
| | | attributes.put("prev_sub_status",""); |
| | | } |
| | | vehicleEventDTO.setAttributes(attributes); |
| | | vehicleBuriedPointClient.sendVehicleEvent(vehicleEventDTO); |
| | | |
| | | // 发车 |
| | | if(dto.getDepartureStatus()==1){ |
| | | // 找车辆的任务 生成巡游单子 下发命令 |
| | |
| | | if(returnCruisePoint!=null){ |
| | | xpCruiseOrderClient.addCruiseOrder(returnCruisePoint); |
| | | } |
| | | |
| | | } |
| | | return R.ok(); |
| | | } |