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 com.ruoyi.system.api.service.RemoteMemberService; 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 { 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 getGoods(String goodsId) { return R.fail("获取商品失败:" + throwable.getMessage()); } @Override public R getGoodsFile(String goodsId) { return R.fail("获取商品图片失败:" + throwable.getMessage()); } @Override public R getShopGoods(AppShopGoodsGetDto appShopGoodsGetDto) { return R.fail("获取商户商品失败:" + throwable.getMessage()); } }; } }