package com.muyu.common.system.remote.factory;

import com.muyu.common.core.domain.Result;
import com.muyu.common.core.exception.ServiceException;
import com.muyu.common.system.domain.Firm;
import com.muyu.common.system.remote.RemoteFirmService;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @Author：张腾
 * @Package：com.muyu.common.system.remote.factory
 * @Project：cloud-server-8
 * @name：RemoteFirmFallbackFactory
 * @Date：2024/9/25 22:22
 */
@Component
public class RemoteFirmFallbackFactory implements FallbackFactory<RemoteFirmService> {
    @Override
    public RemoteFirmService create(Throwable cause) {

        return new RemoteFirmService() {
            @Override
            public Result<Firm> findByFirmName(String firmName) {
                throw new ServiceException(cause.getCause().toString());
            }
        };
    }
}
