jiangqs
2023-06-08 6cca89c41aea52ae6b23909bb9fbd2834f0094d5
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
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.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.service.RemoteGoodsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
 
/**
 * @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());
            }
        };
    }
}