package com.yida.data.school.fallback.leave;

import com.yida.data.common.core.annotation.Fallback;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.school.dto.leave.ListStudentRequestDetailDTO;
import com.yida.data.school.dto.userLeave.ListUserRequestDTO;
import com.yida.data.school.feign.leave.RemoteLeaveRequestService;
import com.yida.data.school.vo.userLeave.EduLeaveRequestUserVO;
import feign.hystrix.FallbackFactory;
import java.util.List;
import lombok.extern.slf4j.Slf4j;

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

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

        return new RemoteLeaveRequestService() {

            @Override
            public ResultBean<Boolean> existRequest(ListStudentRequestDetailDTO dto) {
                return null;
            }

            @Override
            public ResultBean<List<EduLeaveRequestUserVO>> findList(ListUserRequestDTO dto) {
                return null;
            }
        };
    }
}
