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.system.EduApp;
import com.yida.data.common.core.entity.system.EduAppTemplate;
import com.yida.data.common.core.entity.system.EduQywxServiceProvider;
import com.yida.data.system.feign.RemoteAppService;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

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

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

        return new RemoteAppService() {
            @Override
            public ResultBean<EduApp> getAppBySchoolOrCorpIdAndCode(Long schoolId, String corpId, String code) {
                return null;
            }

            @Override
            public ResultBean<EduAppTemplate> getAppTemplateByTemplateId(String templateId, String serviceCorpId) {
                return null;
            }

            @Override
            public ResultBean<EduQywxServiceProvider> getServiceProviderByServiceCorpId(String serviceCorpId) {
                return null;
            }
        };
    }
}
