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

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

import java.util.List;

@Slf4j
@Component
public class OrgFallbackFactory implements FallbackFactory<OrgClient> {
    @Override
    public OrgClient create(Throwable cause) {
        return new OrgClient() {
            @Override
            public Result<List<OrgSimpleVO>> getChildrenByParentOrgIds(List<Long> parentOrgIds) {
                log.error("调用接口异常:{}", parentOrgIds);
                return Result.ofFail("接口调用异常");
            }
        };
    }
}
