jiangqs
2023-05-10 9658e5ca43e617c68c54d7dd7797f873e55311c3
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteShopFallbackFactory.java
@@ -1,16 +1,19 @@
package com.ruoyi.system.api.factory;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.RemoteMemberService;
import com.ruoyi.system.api.RemoteShopService;
import com.ruoyi.system.api.domain.poji.shop.Shop;
import com.ruoyi.system.api.domain.vo.ShopRelUserVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
/**
 * 用户服务降级处理
 *
 * @author ruoyi
 * 商户服务
 *
 * @author jqs
 */
@Component
public class RemoteShopFallbackFactory implements FallbackFactory<RemoteShopService>
@@ -23,7 +26,15 @@
        log.error("商户服务调用失败:{}", throwable.getMessage());
        return new RemoteShopService()
        {
            @Override
            public R<Shop> getShop(Long shopId) {
                return R.fail("获取商户失败:" + throwable.getMessage());
            }
            @Override
            public R<ShopRelUserVo> getShopByUserId(Long userId) {
                return R.fail("获取商户失败:" + throwable.getMessage());
            }
        };
    }
}