Pu Zhibing
2025-03-26 7f26677ab7f9b83697370fa142dd1686cdf4082a
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
package com.ruoyi.other.api.factory;
 
import com.ruoyi.common.core.domain.R;
import com.ruoyi.other.api.domain.Shop;
import com.ruoyi.other.api.feignClient.StoreClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
 
/**
 * 充电订单服务降级处理
 * 
 * @author ruoyi
 */
@Component
public class StoreFallbackFactory implements FallbackFactory<StoreClient>
{
    private static final Logger log = LoggerFactory.getLogger(StoreFallbackFactory.class);
 
 
    @Override
    public StoreClient create(Throwable cause) {
        log.error("商品订单调用失败:{}", cause.getMessage());
        return new StoreClient() {
 
 
            @Override
            public R<Shop> getStoreById(Integer id) {
                return R.fail("根据门店id查询详情:" + cause.getMessage());
            }
        };
    }
}