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

import com.yuchen.saas.payment.api.util.PayFeignFallbackUtils;
import feign.hystrix.FallbackFactory;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

@Component
public class OrderStatisticFeignServiceFallBack implements FallbackFactory<OrderStatisticFeignService> {
    @Override
    public OrderStatisticFeignService create(Throwable throwable) {
        return new OrderStatisticFeignService() {
            @Override
            public R<Integer> getParkingPaySum(Long parkingId, Integer orderType, String beginTime, String endTime) {
                return PayFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<Integer> getDeptPaySum(List<Long> parkingIds, Integer orderType, String beginTime, String endTime) {
                return PayFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<List<Map<String, Object>>> getParkingPayTrendList(Long parkingId, Integer orderType, Integer statistType, String beginTime, String endTime) {
                return PayFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<List<Map<String, Object>>> getDeptPayTrendList(List<Long> parkingIds, Integer orderType, Integer statistType, String beginTime, String endTime) {
                return PayFeignFallbackUtils.printLogAndReturn(throwable);
            }

        };
    }
}
