无关风月
2025-02-07 2fa4850f1197b17c9ed1882a4a88e09581f95bac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package com.ruoyi.other.api.factory;
 
import com.ruoyi.common.core.domain.R;
import com.ruoyi.other.api.domain.TIntegralRule;
import com.ruoyi.other.api.feignClient.IntegralRuleClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
 
 
/**
 * 商品服务降级处理
 * 
 * @author ruoyi
 */
@Component
public class IntegralRuleFallbackFactory implements FallbackFactory<IntegralRuleClient>
{
    private static final Logger log = LoggerFactory.getLogger(IntegralRuleFallbackFactory.class);
 
    @Override
    public IntegralRuleClient create(Throwable throwable) {
        log.error("积分规则调用失败:{}", throwable.getMessage());
        return new IntegralRuleClient() {
    
    
            @Override
            public R<TIntegralRule> getSet() {
                return R.fail("获取积分设置失败:" + throwable.getMessage());
            }
        };
    }
}