puzhibing
2023-12-13 1772afb069b75871572c9c438bbd2bc403f864df
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
package com.ruoyi.system.api.factory;
 
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.domain.dto.AppShopGoodsGetDto;
import com.ruoyi.system.api.domain.dto.GoodsTotalChangeDto;
import com.ruoyi.system.api.domain.dto.MerGoodsPriceListDto;
import com.ruoyi.system.api.domain.poji.goods.Goods;
import com.ruoyi.system.api.domain.poji.goods.GoodsFile;
import com.ruoyi.system.api.domain.poji.goods.ShopGoods;
import com.ruoyi.system.api.domain.vo.MerGoodsPriceListVo;
import com.ruoyi.system.api.service.RemoteGoodsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
 
import java.util.List;
 
/**
 * @author jqs34
 * @ClassName RemoteGoodsFallbackFactory
 * @description: TODO
 * @date 2023年05月23日
 * @version: 1.0
 */
@Component
public class RemoteGoodsFallbackFactory implements FallbackFactory<RemoteGoodsService> {
 
    private static final Logger log = LoggerFactory.getLogger(RemoteMemberFallbackFactory.class);
 
    @Override
    public RemoteGoodsService create(Throwable throwable)
    {
        log.error("商品服务调用失败:{}", throwable.getMessage());
        return new RemoteGoodsService()
        {
 
 
            @Override
            public R<Goods> getGoods(String goodsId) {
                return R.fail("获取商品失败:" + throwable.getMessage());
            }
 
            @Override
            public R<GoodsFile> getGoodsFile(String goodsId) {
                return R.fail("获取商品图片失败:" + throwable.getMessage());
            }
 
            @Override
            public R<ShopGoods> getShopGoods(AppShopGoodsGetDto appShopGoodsGetDto) {
                return R.fail("获取商户商品失败:" + throwable.getMessage());
            }
 
            @Override
            public R deleteGoodsClass(Long classId) {
                return R.fail("删除商品分类失败:" + throwable.getMessage());
            }
 
            @Override
            public R deleteGoodsTag(String goodsTag) {
                return R.fail("删除商品标签失败:" + throwable.getMessage());
            }
 
            @Override
            public R<List<Goods>> listGoodsByGoodsId(String goodsIds) {
                return R.fail("获取商品列表失败:" + throwable.getMessage());
            }
 
            @Override
            public R<List<MerGoodsPriceListVo>> listGoodsPriceByGoodsId(MerGoodsPriceListDto merGoodsPriceListDto) {
                return R.fail("获取商品列表失败:" + throwable.getMessage());
            }
 
            @Override
            public R changeGoodsTotal(List<GoodsTotalChangeDto> goodsTotalChangeDtoList) {
                return R.fail("改变商品统计失败:" + throwable.getMessage());
            }
 
            @Override
            public R<List<String>> listGoodsNameByGoodsClass(Long classId) {
                return R.fail("获取分类商品列表失败:" + throwable.getMessage());
            }
        };
    }
}