package com.hw.ems.api.factory;

import com.hw.common.core.domain.R;
import com.hw.ems.api.RemoteEmsService;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @ClassName : RemoteEmsFallbackFactory
 * @Description : zhouhy
 * @Author :
 * @Date: 2023-12-25 17:17
 */
@Component
public class RemoteEmsFallbackFactory implements FallbackFactory<RemoteEmsService> {
    @Override
    public RemoteEmsService create(Throwable throwable) {
        return new RemoteEmsService() {
            @Override
            public R<?> getDnbInstantByJob(String source) {
                return R.fail("调用失败:" + throwable.getMessage());
            }

            @Override
            public R<?> thresholdTimingTask(String source) {
                return R.fail("调用失败:" + throwable.getMessage());

            }

            @Override
            public R<?> deviceOfflineTimingTask(String source) {
                return R.fail("调用失败:" + throwable.getMessage());
            }
        };
    }
}
