package com.crunii.micro.service.sysmgr.api.factory;

import com.crunii.micro.common.dto.Result;
import com.crunii.micro.domain.dto.Worker;
import com.crunii.micro.service.sysmgr.api.OrgTreeAuthorityClient;
import com.crunii.micro.service.sysmgr.api.domain.dto.OrgTreeAuthorityReqDto;
import com.crunii.micro.service.sysmgr.api.domain.dto.OrgTreeDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

@Slf4j
@Component
public class OrgTreeAuthorityFallbackFactory implements FallbackFactory<OrgTreeAuthorityClient> {
    @Override
    public OrgTreeAuthorityClient create(Throwable cause) {
        return new OrgTreeAuthorityClient() {
            @Override
            public Result<List<OrgTreeDto>> getOrgTreeAuthority(OrgTreeAuthorityReqDto dto) {
                log.error("调用接口异常:{}", dto);
                return Result.ofFail("接口调用异常");
            }
        };
    }
}
