luodangjia
2024-09-24 7b55e2cd82647b87d79a778ed70fdbddb39ac00a
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
package com.ruoyi.other.api.factory;
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.other.api.domain.TCompany;
import com.ruoyi.other.api.domain.TCoupon;
import com.ruoyi.other.api.domain.TEnterpriseUserApplication;
import com.ruoyi.other.api.domain.TUserTag;
import com.ruoyi.other.api.dto.TagListQueryDto;
import com.ruoyi.other.api.dto.UnitListQueryDto;
import com.ruoyi.other.api.feignClient.OtherClient;
import com.ruoyi.other.api.vo.CouponListVOVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
 
import java.util.List;
import java.util.Map;
 
/**
 * 商品服务降级处理
 * 
 * @author ruoyi
 */
@Component
public class OtherFallbackFactory implements FallbackFactory<OtherClient>
{
    private static final Logger log = LoggerFactory.getLogger(OtherFallbackFactory.class);
 
    @Override
    public OtherClient create(Throwable throwable) {
        log.error("单位用失败:{}", throwable.getMessage());
        return new OtherClient() {
 
            @Override
            public R<Page<TCompany>> queryUnitPage(UnitListQueryDto unitListQueryDto) {
                return R.fail("查询单位列表失败:" + throwable.getMessage());
            }
 
            @Override
            public R unitAddorUpadate(TCompany tCompany) {
                return R.fail("单位添加失败:" + throwable.getMessage());
            }
 
            @Override
            public R unitDelete(Integer id) {
                return R.fail("删除单位失败:" + throwable.getMessage());
            }
    
            @Override
            public R<TCompany> unitDetail(Integer id) {
                return R.fail("查询单位失败:" + throwable.getMessage());
            }
    
            @Override
            public R<Page<TUserTag>> queryTagPage(TagListQueryDto unitListQueryDto) {
                return R.fail("查询标签:" + throwable.getMessage());
            }
 
            @Override
            public R addorUpdateTag(TUserTag tUserTag) {
                return R.fail("添加标签:" + throwable.getMessage());
            }
 
            @Override
            public R deleteTag(Integer id) {
                return R.fail("查询标签:" + throwable.getMessage());
            }
 
            @Override
            public R<Map<Integer, String>> getTagMap(List<Integer> ids) {
                return R.fail("查询标签map:" + throwable.getMessage());
            }
 
            @Override
            public R<TUserTag> getByIdTag(Integer id) {
                return R.fail("查询标签:" + throwable.getMessage());
            }
 
            @Override
            public R<Map<Integer, String>> getVipMap(List<Integer> ids) {
                return R.fail("获取会员map:" + throwable.getMessage());
            }
 
            @Override
            public R<List<CouponListVOVO>> getCouponInfoByCouponIds(List<CouponListVOVO> list) {
                return R.fail("我的优惠券列表获取信息:"+throwable.getMessage());
            }
 
            @Override
            public R<TCoupon> getCouponById(Integer id) {
                return R.fail("查询优惠卷:"+throwable.getMessage());
            }
 
            @Override
            public R<List<TEnterpriseUserApplication>> getTnterPrise() {
                return R.fail("查询:"+throwable.getMessage());
            }
        };
    }
}