package com.ruoyi.chargingPile.api.factory;
|
|
import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient;
|
import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient;
|
import com.ruoyi.chargingPile.api.model.TChargingGun;
|
import com.ruoyi.chargingPile.api.model.TChargingPile;
|
import com.ruoyi.chargingPile.api.vo.SiteNameVO;
|
import com.ruoyi.common.core.domain.R;
|
import org.slf4j.Logger;
|
import org.slf4j.LoggerFactory;
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
import org.springframework.stereotype.Component;
|
|
import java.util.List;
|
|
/**
|
* 充电桩服务降级处理
|
*
|
* @author ruoyi
|
*/
|
@Component
|
public class ChargingGunFallbackFactory implements FallbackFactory<ChargingGunClient>
|
{
|
private static final Logger log = LoggerFactory.getLogger(ChargingGunFallbackFactory.class);
|
|
@Override
|
public ChargingGunClient create(Throwable throwable) {
|
log.error("充电枪调用失败:{}", throwable.getMessage());
|
return new ChargingGunClient() {
|
|
@Override
|
public R<String> getAllName(Integer id) {
|
return R.fail("根据id获取充电枪完整名称失败:" + throwable.getMessage());
|
}
|
|
@Override
|
public R<TChargingGun> getChargingGunById(Integer id) {
|
return R.fail("根据id获取充电枪失败:" + throwable.getMessage());
|
}
|
|
@Override
|
public R<SiteNameVO> getAllInfoById(Integer id) {
|
return R.fail("通过枪id获取站点、桩、枪的名称失败:" + throwable.getMessage());
|
}
|
};
|
}
|
}
|