44323
2024-05-16 80870e154d7755c36cdb345147532c131858e270
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
35
36
37
38
39
40
package com.ruoyi.management.api.factory;
 
import com.ruoyi.common.core.domain.R;
import com.ruoyi.management.api.feignClient.TApproveConfigClient;
import com.ruoyi.management.api.vo.ApproveConfigClientVO;
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 TApproveConfigFallbackFactory implements FallbackFactory<TApproveConfigClient>
{
    private static final Logger log = LoggerFactory.getLogger(TApproveConfigFallbackFactory.class);
 
    @Override
    public TApproveConfigClient create(Throwable throwable)
    {
        log.error("审批服务调用失败:{}", throwable.getMessage());
        return new TApproveConfigClient()
        {
            @Override
            public R<Boolean> add(Integer companyId) {
                return R.fail("默认添加审批流配置失败:" + throwable.getMessage());
            }
 
            @Override
            public R<List<ApproveConfigClientVO>> queryConfigByCompanyId(Integer companyId) {
                return R.fail("查询公司审批流配置通过公司id失败:" + throwable.getMessage());
            }
        };
    }
}