huangjiayang
2025-05-15 918eb3afde4886ab9d87e9f2fafbde1bf9e83587
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.aps.system.api.factory;
 
import com.aps.common.core.domain.R;
import com.aps.system.api.RemoteJobService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
 
/**
 * 用户服务降级处理
 * 
 * @author ruoyi
 */
@Component
public class RemoteJobFallbackFactory implements FallbackFactory<RemoteJobService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteJobFallbackFactory.class);
 
    @Override
    public RemoteJobService create(Throwable throwable)
    {
 
        log.error("任务服务调用失败:{}", throwable.getMessage());
        return new RemoteJobService()
        {
            @Override
            public R<Boolean> refreshBomData(String source)
            {
                return R.fail("刷新全量BOM数据失败:" + throwable.getMessage());
            }
 
            @Override
            public R<Boolean> refreshProcessRouteData(String source)
            {
                return R.fail("刷新全量工艺路线数据失败:" + throwable.getMessage());
            }
        };
    }
}