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

import com.baomidou.mybatisplus.plugins.Page;
import com.sptg.common.core.beans.PageBean;
import com.sptg.common.core.beans.ResultBean;
import com.sptg.common.core.beans.ResultEnum;
import com.sptg.device.api.entity.InstructPublishLog;
import com.sptg.device.api.feigns.InstructPublishLogFeign;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author zwx
 * @create 2020/7/26 16:22
 */
@Component
@Slf4j
public class InstructPublishLogFeignFallbackFactory implements FallbackFactory<InstructPublishLogFeign> {
    @Override
    public InstructPublishLogFeign create(Throwable cause) {
        return new InstructPublishLogFeign() {
            @Override
            public ResultBean<Boolean> instructCallback(InstructPublishLog publishLog) {
                log.error(cause.getMessage());
                return new ResultBean<>(ResultEnum.ERROR);
            }

            @Override
            public ResultBean<Boolean> instructBizCallback(InstructPublishLog publishLog) {
                log.error(cause.getMessage());
                return new ResultBean<>(ResultEnum.ERROR);
            }

            @Override
            public ResultBean<Boolean> instructHandleCallback(InstructPublishLog publishLog) {
                log.error(cause.getMessage());
                return new ResultBean<>(ResultEnum.ERROR);
            }

            @Override
            public ResultBean<Boolean> dhInstructCallback(InstructPublishLog publishLog) {
                log.error(cause.getMessage());
                return new ResultBean<>(ResultEnum.ERROR);
            }

            @Override
            public ResultBean<Page> pagingQuery(PageBean<InstructPublishLog, InstructPublishLog> pageBean) {
                log.error(cause.getMessage(),cause);
                return new ResultBean<>(ResultEnum.ERROR,pageBean);
            }

            @Override
            public ResultBean<Page> pageFace(PageBean<InstructPublishLog, InstructPublishLog> pageBean) {
                log.error(cause.getMessage(),cause);
                return new ResultBean<>(ResultEnum.ERROR,pageBean);
            }

            @Override
            public ResultBean<Page> pageCard(PageBean<InstructPublishLog, InstructPublishLog> pageBean) {
                log.error(cause.getMessage(),cause);
                return new ResultBean<>(ResultEnum.ERROR,pageBean);
            }

            @Override
            public ResultBean<Page> pageAppPackage(PageBean<InstructPublishLog, InstructPublishLog> pageBean) {
                log.error(cause.getMessage(),cause);
                return new ResultBean<>(ResultEnum.ERROR,pageBean);
            }

            @Override
            public InstructPublishLog getById(Long id) {
                log.error(cause.getMessage());
                return null;
            }

            @Override
            public List<InstructPublishLog> getListPutBin(InstructPublishLog instructPublishLog) {
                log.error(cause.getMessage());
                return null;
            }

            @Override
            public ResultBean<Boolean> deletePutBinList(List<InstructPublishLog> logList) {
                log.error(cause.getMessage());
                return new ResultBean<>(ResultEnum.ERROR);
            }

            @Override
            public List<InstructPublishLog> findInstructPublishLogByCondition(InstructPublishLog instructPublishLog) {
                log.error(cause.getMessage());
                return null;
            }

            @Override
            public ResultBean<Boolean> create(InstructPublishLog instructPublishLog) {
                log.error(cause.getMessage());
                return new ResultBean<>(ResultEnum.ERROR);
            }
        };
    }
}
