package com.ruoyi.order.api.factory;
|
|
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.order.api.feignClient.ChargingOrderClient;
|
import org.slf4j.Logger;
|
import org.slf4j.LoggerFactory;
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
import org.springframework.stereotype.Component;
|
|
/**
|
* 充电订单服务降级处理
|
*
|
* @author ruoyi
|
*/
|
@Component
|
public class ChargingOrderFallbackFactory implements FallbackFactory<ChargingOrderClient>
|
{
|
private static final Logger log = LoggerFactory.getLogger(ChargingOrderFallbackFactory.class);
|
|
@Override
|
public ChargingOrderClient create(Throwable throwable) {
|
log.error("充电订单调用失败:{}", throwable.getMessage());
|
return new ChargingOrderClient() {
|
|
@Override
|
public R<Long> useOrderCount(Long userId) {
|
return R.fail("订单计数:" + throwable.getMessage());
|
|
}
|
};
|
}
|
}
|