package com.jeeplus.sys.factory;

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

/**
 * 岗位服务降级处理
 *
 * @author jeeplus
 */

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

            @Override
            public PostDTO getPostDTOByName(String name) {
                return null;
            }

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

            @Override
            public PostDTO getPostDTOById(String id) {
                return null;
            }
        };
    }
}
