package com.yida.data.system.fallback;

import com.yida.data.common.core.annotation.Fallback;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.system.EduHoliday;
import com.yida.data.system.feign.RemoteHolidayService;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * RemoteHolidayService fallback处理类
 *
 * @author ZYJ
 * @date 2022/8/26
 */
@Slf4j
@Fallback
public class RemoteHolidayServiceFallback implements FallbackFactory<RemoteHolidayService> {

    @Override
    public RemoteHolidayService create(Throwable throwable) {
        log.error("RemoteHolidayService fallback reason:{}", throwable.getMessage());

        return new RemoteHolidayService() {
            /**
             * 查询所有节假日
             *
             * @return
             */
            @Override
            public ResultBean<List<EduHoliday>> listAllHoliday() {
                return null;
            }
        };
    }
}
