package com.ruoyi.other.api.factory;
|
|
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.other.api.domain.Goods;
|
import com.ruoyi.other.api.feignClient.GoodsClient;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
|
import java.util.List;
|
|
/**
|
* @author zhibing.pu
|
* @Date 2024/11/27 19:57
|
*/
|
@Slf4j
|
public class GoodsClientFallbackFactory implements FallbackFactory<GoodsClient> {
|
|
|
@Override
|
public GoodsClient create(Throwable cause) {
|
return new GoodsClient(){
|
|
@Override
|
public R<List<Goods>> getGoodsByType(Integer type) {
|
return R.fail("根据类型(1=服务商品,2=单品商品)获取商品数据失败:" + cause.getMessage());
|
}
|
|
@Override
|
public R<Goods> getGoodsById(Integer id) {
|
return R.fail("根据id获取商品详情失败:" + cause.getMessage());
|
}
|
|
@Override
|
public R<List<Goods>> getGoodsById(String [] ids) {
|
return R.fail("根据ids获取商品详情失败:" + cause.getMessage());
|
}
|
|
@Override
|
public R editGoodsList(List<Goods> goods) {
|
return R.fail("编辑商品信息失败:" + cause.getMessage());
|
}
|
|
@Override
|
public R<Void> editGoodsNum(Integer goodsId, Integer num) {
|
return R.fail();
|
}
|
|
@Override
|
public R<List<Goods>> getAllGoods() {
|
return R.fail("获取所有商品失败:" + cause.getMessage());
|
}
|
};
|
}
|
}
|