package com.ruoyi.other.api.factory;
|
|
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.other.api.dto.ChargeAuthorizationDTO;
|
import com.ruoyi.other.api.feignClient.ChargeAuthorizationClient;
|
import org.slf4j.Logger;
|
import org.slf4j.LoggerFactory;
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
import org.springframework.stereotype.Component;
|
|
/**
|
* 充电授权配置服务降级处理
|
*
|
* @author mxcd
|
*/
|
@Component
|
public class ChargeAuthorizationFallbackFactory implements FallbackFactory<ChargeAuthorizationClient> {
|
|
private static final Logger log = LoggerFactory.getLogger(ChargeAuthorizationFallbackFactory.class);
|
|
@Override
|
public ChargeAuthorizationClient create(Throwable throwable) {
|
log.error("充电授权配置服务调用失败:{}", throwable.getMessage());
|
return new ChargeAuthorizationClient() {
|
@Override
|
public R<ChargeAuthorizationDTO> getDetailByCompanyId(Integer companyId) {
|
return R.fail("查询充电授权配置失败:" + throwable.getMessage());
|
}
|
};
|
}
|
}
|