huliguo
2025-04-23 f2070facdb5715e7349df69cfe257289c680d292
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
package com.ruoyi.other.api.factory;
 
import com.ruoyi.common.core.domain.R;
import com.ruoyi.other.api.domain.SystemConfig;
import com.ruoyi.other.api.feignClient.SystemConfigClient;
import org.springframework.cloud.openfeign.FallbackFactory;
 
import java.math.BigDecimal;
 
/**
 * @author zhibing.pu
 * @Date 2024/11/29 15:58
 */
public class SystemConfigClientFallbackFactory implements FallbackFactory<SystemConfigClient> {
    @Override
    public SystemConfigClient create(Throwable cause) {
        return new SystemConfigClient() {
            @Override
            public R<SystemConfig> getSystemConfig(Integer type) {
                return R.fail("根据类型获取系统配置失败:" + cause.getMessage());
            }
 
            @Override
            public R<BigDecimal> redPackegeSet() {
                return R.fail("根据红包配置失败:" + cause.getMessage());
            }
        };
    }
}