package com.ruoyi.integration.api.factory;
|
|
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.integration.api.feignClient.IntegrationClient;
|
import com.ruoyi.integration.api.model.*;
|
import org.slf4j.Logger;
|
import org.slf4j.LoggerFactory;
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
import org.springframework.stereotype.Component;
|
|
/**
|
* 充电桩服务降级处理
|
*
|
* @author ruoyi
|
*/
|
@Component
|
public class IntegrationFallbackFactory implements FallbackFactory<IntegrationClient>
|
{
|
private static final Logger log = LoggerFactory.getLogger(IntegrationFallbackFactory.class);
|
|
@Override
|
public IntegrationClient create(Throwable throwable) {
|
log.error("充电桩调用失败:{}", throwable.getMessage());
|
return new IntegrationClient() {
|
|
@Override
|
public R<String> setupBillingModel1(String deviceId, String json) {
|
return R.fail("远程更新硬件:" + throwable.getMessage());
|
}
|
};
|
}
|
}
|