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.Dict;
import com.yida.data.common.core.entity.system.EduArea;
import com.yida.data.common.core.entity.system.EduDeptWxPublic;
import com.yida.data.common.core.entity.system.EduSysFile;
import com.yida.data.common.core.entity.system.EduWxPublicTemplateMsg;
import com.yida.data.system.feign.RemoteCommonService;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

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

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

        return new RemoteCommonService() {
            /**
             * 上传图片
             *
             * @param code base64
             * @return
             */
            @Override
            public ResultBean<String> uploadImg(String code) {
                return null;
            }

            @Override
            public ResultBean<EduSysFile> uploadFile() {
                return null;
            }

            @Override
            public ResultBean<EduDeptWxPublic> getDeptWxPublic(Long deptId) {
                return null;
            }

            @Override
            public void saveReceiveMsg() {

            }

            /**
             * 查询公众号模板消息
             *
             * @param wxPublicAppId
             * @param templateMsgType
             */
            @Override
            public ResultBean<EduWxPublicTemplateMsg> getWxTemplateMsg(String wxPublicAppId, Integer templateMsgType) {
                return null;
            }

            /**
             * 查询字典值
             *
             * @param type 字典类型
             */
            @Override
            public ResultBean<List<Dict>> getDict(String type) {
                return null;
            }

            /**
             * 查询区域
             *
             * @param id
             * @return
             */
            @Override
            public ResultBean<EduArea> getArea(Long id) {
                return null;
            }
        };
    }
}
