package com.sptg.estate.api.feigns.fallback;

import com.baomidou.mybatisplus.plugins.Page;
import com.sptg.estate.api.entity.Bills;
import com.sptg.estate.api.entity.BillsItem;
import com.sptg.estate.api.feigns.BillsFeign;
import com.sptg.estate.api.feigns.BillsItemFeign;
import com.sptg.estate.api.vo.BillsVO;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * title: PositionFeignFallbackFactory
 * package: com.sptg.estate.api.feigns.fallback
 * description:竣工验收-服务容错处理类
 */
@Component
@Slf4j
public class BillsItemFeignFallbackFactory implements FallbackFactory<BillsItemFeign> {
    @Override
    public BillsItemFeign create(Throwable throwable) {
        return new BillsItemFeign() {
            @Override
            public List<BillsItem> list(Long billsId) {
                log.error("BillsItemFeign-list 调用错误");
                log.error("错误信息："+throwable.getMessage());
                return new ArrayList<>();
            }

            @Override
            public BillsItem detail(Long id) {
                log.error("BillsItemFeign-detail 调用错误");
                log.error("错误信息："+throwable.getMessage());
                return null;
            }

            @Override
            public boolean delete(Long id) {
                log.error("BillsItemFeign-delete 调用错误");
                log.error("错误信息："+throwable.getMessage());
                return false;
            }

            @Override
            public boolean edit(BillsItem billsItem) {
                log.error("BillsItemFeign-edit 调用错误");
                log.error("错误信息："+throwable.getMessage());
                return false;
            }

            @Override
            public boolean add(BillsItem billsItem) {
                log.error("BillsItemFeign-edit 调用错误");
                log.error("错误信息："+throwable.getMessage());
                return false;
            }


        };
    }
}
