package com.jeeplus.sys.factory;

import com.jeeplus.sys.domain.Office;
import com.jeeplus.sys.feign.IOfficeApi;
import com.jeeplus.sys.service.dto.OfficeDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 机构服务降级处理
 *
 * @author jeeplus
 */

@Slf4j
@Component
public class OfficeApiFallbackFactory implements FallbackFactory <IOfficeApi> {
    @Override
    public IOfficeApi create(Throwable throwable) {
        log.error ( "机构服务调用失败:{}", throwable.getMessage ( ) );
        throwable.printStackTrace ( );
        return new IOfficeApi ( ) {
            @Override
            public OfficeDTO getOfficeDTOByName(String name) {
                return null;
            }

            @Override
            public Office selectById(String id) {
                return null;
            }

            @Override
            public OfficeDTO getOfficeById(String id) {
                return null;
            }

            @Override
            public List<String> getOfficeNameByIds(List<String> ids) {
                return null;
            }

            @Override
            public List<Office> selectListByParentId(String parentId) {
                return null;
            }

            @Override
            public List<Office> selectListByIsPublic(String isPublic) {
                return null;
            }

            @Override
            public OfficeDTO getParentOfficeById(String id) {
                return null;
            }

            @Override
            public List<OfficeDTO> getOfficeByCompany(String company) {
                return null;
            }
        };
    }
}
