package com.jeeplus.sys.factory;

import com.jeeplus.sys.feign.IRoleApi;
import com.jeeplus.sys.service.dto.RoleDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 角色服务降级处理
 *
 * @author jeeplus
 */

@Slf4j
@Component
public class RoleApiFallbackFactory implements FallbackFactory <IRoleApi> {
    @Override
    public IRoleApi create(Throwable throwable) {
        log.error ( "角色服务调用失败:{}", throwable.getMessage ( ) );
        throwable.printStackTrace ( );
        return new IRoleApi ( ) {

            @Override
            public RoleDTO getRoleDTOByName(String name) {
                return null;
            }

            @Override
            public RoleDTO getRoleDTOById(String id) {
                return null;
            }
        };
    }
}
