package com.yida.data.system.fallback;

import com.yida.data.common.core.annotation.Fallback;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.agent.EduAgentWxPublicReceiver;
import com.yida.data.system.feign.RemoteAgentService;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * RemoteAgentService fallback处理类
 *
 * @author ZYJ
 * @date 2022/8/26
 */
@Slf4j
@Fallback
public class RemoteAgentServiceFallback implements FallbackFactory<RemoteAgentService> {

    @Override
    public RemoteAgentService create(Throwable throwable) {
        log.error("RemoteAgentService fallback reason:{}", throwable.getMessage());

        return new RemoteAgentService() {
            @Override
            public ResultBean<List<EduAgentWxPublicReceiver>> listReceiverBySchool(Long schoolId) {
                log.error("查询学校设备掉线通知人员失败, schoolId: {}", schoolId);
                return null;
            }
        };
    }
}
