package com.ruoyi.order.api.factory; import com.ruoyi.common.core.domain.R; import com.ruoyi.order.api.feignClient.AccountingStrategyDetailOrderClient; import com.ruoyi.order.api.feignClient.ChargingOrderAccountingStrategyClient; import com.ruoyi.order.api.model.AccountingStrategyDetailOrder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import java.util.List; import java.util.Map; import java.util.Set; /** * 充电订单服务降级处理 * * @author ruoyi */ @Component public class AccountingStrategyDetailOrderFallbackFactory implements org.springframework.cloud.openfeign.FallbackFactory { private static final Logger log = LoggerFactory.getLogger(AccountingStrategyDetailOrderFallbackFactory.class); @Override public AccountingStrategyDetailOrderClient create(Throwable throwable) { log.error("计费策略调用失败:{}", throwable.getMessage()); return new AccountingStrategyDetailOrderClient() { @Override public R getNowAccountingStrategyDetailOrder(Long orderId) { return R.fail("根据订单id获取当前有效的策略失败:" + throwable.getMessage()); } @Override public R> getAllAccountingStrategyDetailOrder(Long orderId) { return R.fail("获取订单对应的计费策略数据失败:" + throwable.getMessage()); } }; } }