| package com.ruoyi.account.api.factory; | 
|   | 
| import com.ruoyi.account.api.feignClient.AppUserAddressClient; | 
| import com.ruoyi.account.api.model.TAppUserAddress; | 
| import com.ruoyi.account.api.model.TAppUserIntegralChange; | 
| 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; | 
|   | 
| /** | 
|  * @author zhibing.pu | 
|  * @Date 2024/8/16 11:02 | 
|  */ | 
| @Component | 
| public class AppUserAddressFallbackFactory implements FallbackFactory<AppUserAddressClient> { | 
|      | 
|     private static final Logger log = LoggerFactory.getLogger(AppUserAddressFallbackFactory.class); | 
|      | 
|      | 
|     @Override | 
|     public AppUserAddressClient create(Throwable throwable) { | 
|         log.error("用户地址调用失败:{}", throwable.getMessage()); | 
|         return new AppUserAddressClient(){ | 
|              | 
|             @Override | 
|             public R<TAppUserAddress> getAppUserAddressById(Long id) { | 
|                 return R.fail("根据id获取用户地址信息失败:" + throwable.getMessage()); | 
|             } | 
|         }; | 
|     } | 
| } |