liusuyi
2026-06-01 a2e7e8ff9cfaa69b001d483710bddbda50d55c91
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
41
42
43
44
45
46
47
48
package com.ard.work.api.factory;
 
import com.ard.common.core.domain.R;
import com.ard.work.api.RemoteRadarService;
import com.ard.work.api.RemoteTubesService;
import com.ard.work.api.domian.ArdRadar;
import com.ard.work.api.domian.ArdTubes;
import com.ard.work.api.domian.ArdTubesDetails;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
 
import java.util.List;
 
/**
 * 雷达服务降级处理
 * 
 * @author ard
 */
@Component
public class RemoteRadarFallbackFactory implements FallbackFactory<RemoteRadarService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteRadarFallbackFactory.class);
 
    @Override
    public RemoteRadarService create(Throwable throwable)
    {
        log.error("雷达服务调用失败:{}", throwable.getMessage());
        return new RemoteRadarService()
        {
            @Override
            public R<List<ArdRadar>> listRpc(ArdRadar ardRadar, String source) {
                return R.fail(" 雷达管理列表:" + throwable.getMessage());
            }
            @Override
            public R<ArdRadar> getInfoRpc(String id, String source) {
                return R.fail(" 雷达详情:" + throwable.getMessage());
            }
            @Override
            public R<Integer> editRpc(ArdRadar ardRadar, String source) {
                return R.fail(" 雷达修改:" + throwable.getMessage());
            }
        };
    }
}