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

import com.baomidou.mybatisplus.plugins.Page;

import com.sptg.common.core.beans.ResultBean;
import com.sptg.common.core.beans.ResultEnum;
import com.sptg.estate.api.dto.ApplyPayRefundDto;
import com.sptg.estate.api.entity.ApplyPayRefund;
import com.sptg.estate.api.feigns.ApplyPayRefundFeign;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * title: ApplyPayRefundFeignFallbackFactory
 * package: com.sptg.estate.api.feigns.fallback
 * description: 支付退款申请 服务接口容错处理
 */
@Component
@Slf4j
public class ApplyPayRefundFeignFallbackFactory implements FallbackFactory<ApplyPayRefundFeign> {

    @Override
    public ApplyPayRefundFeign create(Throwable cause) {
        return new ApplyPayRefundFeign() {

            @Override
            public ResultBean<Page<ApplyPayRefund>> showApplyPayRefundPage(ApplyPayRefundDto applyPayRefundDto) {
                log.error(cause.getMessage(), cause);
                return new ResultBean<>(ResultEnum.ERROR);
            }

            @Override
            public ResultBean<Boolean> addApplyPayRefund(ApplyPayRefundDto applyPayRefundDto) {
                log.error(cause.getMessage(), cause);
                return new ResultBean<>(ResultEnum.ERROR);
            }

            @Override
            public ApplyPayRefund findApplyPayRefundById(Long id) {
                log.error(cause.getMessage(), cause);
                return null;
            }

            @Override
            public ResultBean<Boolean> auditApplyPayRefund(ApplyPayRefundDto applyPayRefundDto) {
                return null;
            }

            @Override
            public ApplyPayRefund findApplyPayRefundByCondition(ApplyPayRefundDto applyPayRefundDto) {
                log.error(cause.getMessage(), cause);
                return null;
            }

            @Override
            public Boolean updateApplyPayRefundByRefundNo(ApplyPayRefund applyPayRefund) {
                log.error(cause.getMessage(), cause);
                return null;
            }
        };
    }
}
