package com.yuchen.saas.payment.api.feign;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuchen.saas.payment.api.entity.PmgBatParkPay;
import com.yuchen.saas.payment.api.param.*;
import com.yuchen.saas.payment.api.util.PayFeignFallbackUtils;
import com.yuchen.saas.payment.api.vo.BillSearchVo;
import com.yuchen.saas.payment.api.vo.PmgBatParkPayVo;
import com.yuchen.saas.payment.api.vo.orderCenter.OrderFlagVO;
import com.yuchen.saas.payment.api.vo.orderCenter.UnPaidOrderDataVO;
import feign.hystrix.FallbackFactory;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @ClassName ParkPayFeignServiceFallback
 * @Description 支付远程接口熔断
 * @Author 张逸飞
 * @Date 2022年11月19日 14:34:04
 */
@Component
public class ParkPayFeignServiceFallback implements FallbackFactory<ParkPayFeignService> {

    @Override
    public ParkPayFeignService create(Throwable cause) {

        return new ParkPayFeignService() {

            @Override
            public R createPay(CreatePayParam payParam) {
                return R.error("进入熔断");
            }

            @Override
            public R<Long> verifyOnePayCost(VerifyOnePayCostReqDTO reqDTO) {
                return PayFeignFallbackUtils.printLogAndReturn(cause);
            }

            @Override
            public R<Long> verifyMergePayCost(VerifyMergePayCostReqDTO reqDTO) {
                return PayFeignFallbackUtils.printLogAndReturn(cause);
            }

            @Override
            public R createOrder(CreateOrderPayParam payParam) {
                return PayFeignFallbackUtils.printLogAndReturn(cause);
            }

            @Override
            public R createMergeOrderPay(CreateMergeOrderPayParam payParam) {
                return PayFeignFallbackUtils.printLogAndReturn(cause);
            }

            @Override
            public R<OrderFlagVO> selectUnpaidByBillIds(UnpaidOrderDataStateReqDTO reqDTO) {
                return PayFeignFallbackUtils.printLogAndReturn(cause);
            }

            @Override
            public R<List<UnPaidOrderDataVO>> getUnPaidOrderData(UnpaidOrderDataReqDTO reqDTO) {
                return PayFeignFallbackUtils.printLogAndReturn(cause);
            }

            @Override
            public R orderGoToPay(PayMoreOrderDataReqDTO reqDTO) {
                return PayFeignFallbackUtils.printLogAndReturn(cause);
            }

            @Override
            public R unPaidOrderGoToPay(UnPaidOrderGoToPayReqDTO reqDTO) {
                return PayFeignFallbackUtils.printLogAndReturn(cause);
            }

            @Override
            public R getParkBillPage(BillSearchVo billSearchVo) {
                return R.error("进入熔断");
            }

            @Override
            public PmgBatParkPay getPayById(Long id) {
                return new PmgBatParkPay();
            }

            @Override
            public R<List<PmgBatParkPayVo>> getParkPayList(ParkPay parkPay) {
                return null;
            }

            @Override
            public List<PmgBatParkPay> getParkBillList(String payUserId, String invoicingStatus, String ids) {
                return null;
            }

            @Override
            public Boolean updateInvoicingStatus(String ids, int invoicingStatus) {
                return null;
            }

            @Override
            public R<List<PmgBatParkPay>> getParkPayListByCode(List<Long> billSysCodes) {
                return R.error("进入熔断");
            }

            @Override
            public R<PmgBatParkPay> getPayByOrderNumber(String orderNumber) {
                return R.error("进入熔断");
            }

            @Override
            public R<List<PmgBatParkPay>> getPayListByCode(List<Long> billSysCodes) {
                return R.error("进入熔断");
            }

            @Override
            public R<PmgBatParkPay> getPmgBatParkPayByBillCode(String billCode) {
                return R.error("进入熔断");
            }
        };
    }
}