package com.persagy.dmp.auth.client;

import com.persagy.dmp.auth.domain.Group;
import com.persagy.dmp.auth.domain.ResultReturn;
import com.persagy.dmp.common.constant.CommonConstant;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class EmsSaasWebFallbackFactory implements FallbackFactory<EmsSaasWebClient> {

    /**
     * 调用失败,返回
     */
    @Override
    public EmsSaasWebClient create(Throwable throwable) {
        return param -> {
            ResultReturn<Group> resultReturn = new ResultReturn<>();
            resultReturn.setResult(CommonConstant.QUERY_FAILURE);
            resultReturn.setResultMsg("请求运维系统失败:"+throwable.getMessage());
            return resultReturn;
        };
    }

}
