xp-robotaxi-api/src/main/java/com/xiaopeng/api/factory/automaticPilot/VmpOpenServiceClientFallbackFactory.java
New file @@ -0,0 +1,40 @@ package com.xiaopeng.api.factory.automaticPilot; import com.xiaopeng.api.dto.automaticPilot.VehicleBaseRespDto; import com.xiaopeng.api.feignClient.automaticPilot.OrderMissionClient; import com.xiaopeng.api.feignClient.automaticPilot.VmpOpenServiceClient; import lombok.extern.slf4j.Slf4j; import org.springframework.cloud.openfeign.FallbackFactory; import org.springframework.stereotype.Component; import java.util.Collections; import java.util.List; import java.util.Map; @Slf4j @Component public class VmpOpenServiceClientFallbackFactory implements FallbackFactory<VmpOpenServiceClient> { @Override public VmpOpenServiceClient create(Throwable cause) { return new VmpOpenServiceClient(){ @Override public VehicleBaseRespDto getVehicleInfoByVin(String vin, List<String> respList) { log.info("通过vin获取车辆基本信息失败:" + cause.getMessage()); return null; } @Override public Map<String, String> getVehicleBindInfoByVin(String vin, List<String> typeList) { log.info("查询车辆绑定信息失败:" + cause.getMessage()); return Collections.emptyMap(); } @Override public String getVinByXpuId(String xpuId, Integer type) { log.info("通过车辆绑定信息获取车架号失败:" + cause.getMessage()); return ""; } }; } } xp-robotaxi-api/src/main/java/com/xiaopeng/api/feignClient/automaticPilot/VmpOpenServiceClient.java
@@ -1,6 +1,9 @@ package com.xiaopeng.api.feignClient.automaticPilot; import com.xiaopeng.api.dto.automaticPilot.VehicleBaseRespDto; import com.xiaopeng.api.factory.automaticPilot.OrderMissionClientFallbackFactory; import com.xiaopeng.api.factory.automaticPilot.VmpOpenServiceClientFallbackFactory; import com.xiaopeng.common.core.dto.ServiceNameConstantsEnum; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -8,7 +11,10 @@ import java.util.List; import java.util.Map; @FeignClient(name = "xp-vmp-open-boot") @FeignClient(contextId = "VmpOpenServiceClient", value = "xp-vmp-open-boot", fallbackFactory = VmpOpenServiceClientFallbackFactory.class) public interface VmpOpenServiceClient { /** xp-robotaxi-itinerary-boot/src/main/java/com/xiaopeng/itinerary/service/impl/XpPricingServiceImpl.java
@@ -367,9 +367,9 @@ // 10. 检查等待时间 Integer waitTime = getWaitTime(routeAndFareDto.getOrigin().getLongitude(), routeAndFareDto.getOrigin().getLatitude()); if (waitTime > 3) { throw new ServiceException("当前区域正在等待中,请耐心等待", I18nKeyConstant.WAITING_TIME); } // if (waitTime > 3) { // throw new ServiceException("当前区域正在等待中,请耐心等待", I18nKeyConstant.WAITING_TIME); // } fareVo.setWaitingTime(waitTime); xp-robotaxi-vehicle-convoy-boot/src/main/java/com/xiaopeng/vehicleConvoy/service/impl/XpVehicleServiceImpl.java
@@ -378,7 +378,11 @@ xpVehicle.setWarehousingTime(LocalDateTime.now()); //绑定XPUID String vin = xpVehicle.getVehicleVin(); String xpuid = xpuVinClient.getXpuIdByVin(vin).getData(); R<String> xpuIdByVin = xpuVinClient.getXpuIdByVin(vin); if(200 != xpuIdByVin.getCode()){ throw new RuntimeException(xpuIdByVin.getMsg()); } String xpuid = xpuIdByVin.getData(); xpVehicle.setXpuId(xpuid); this.save(xpVehicle); if (isInfoComplete(xpVehicle)) { @@ -419,7 +423,11 @@ if (vinChanged || existingVehicle == null || StringUtils.isBlank(existingVehicle.getXpuId())) { // 仅在 VIN 变更或原 XPUID 为空时才重新绑定 XPUID,避免不必要的远程调用 String vin = xpVehicle.getVehicleVin(); String xpuid = xpuVinClient.getXpuIdByVin(vin).getData(); R<String> xpuIdByVin = xpuVinClient.getXpuIdByVin(vin); if(200 != xpuIdByVin.getCode()){ throw new RuntimeException(xpuIdByVin.getMsg()); } String xpuid = xpuIdByVin.getData(); xpVehicle.setXpuId(xpuid); } else { xpVehicle.setXpuId(existingVehicle.getXpuId());