package com.yida.data.system.fallback;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yida.data.common.core.annotation.Fallback;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.system.Dept;
import com.yida.data.system.feign.RemoteDeptService;
import com.yida.data.system.vo.AreaVO;
import com.yida.data.system.vo.SchoolClassInfoVO;
import feign.hystrix.FallbackFactory;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Slf4j
@Fallback
public class RemoteDeptUserviceFallback implements FallbackFactory<RemoteDeptService> {

    @Override
    public RemoteDeptService create(Throwable cause) {
        log.error("fallback reason:{}", cause.getMessage());
        return new RemoteDeptService() {
            @Override
            public ResultBean<List<Dept>> deptList(Long deptId) {
                log.error("获取下属部门失败,deptId:{}", deptId);
                return null;
            }

            @Override
            public ResultBean<Dept> findSchoolByDept(Long deptId) {
                log.error("获取学校失败,deptId:{}", deptId);
                return null;
            }

            @Override
            public ResultBean<Dept> getInfoById(Long deptId) {
                return null;
            }

            @Override
            public ResultBean<Dept> getInfoByIdNoPermission(Long deptId) {
                return null;
            }

            @Override
            public ResultBean<List<Dept>> getSchoolByArea(Long areaId, String schoolName) {
                return null;
            }

            @Override
            public ResultBean<Dept> getSchoolByCorp(String deptId) {
                return null;
            }

            @Override
            public ResultBean<Dept> getSchoolByAppId(String appId) {
                return null;
            }

            @Override
            public ResultBean<Dept> getSchoolByName(String schoolName) {
                return null;
            }

            @Override
            public ResultBean<Dept> getParentById(Long id) {
                return null;
            }

            @Override
            public ResultBean<Dept> getDeptBySchoolAndName(Long schoolId, String deptName) {
                return null;
            }

            @Override
            public ResultBean<SchoolClassInfoVO> getSchoolAreaInfo(Long schoolId) {
                return null;
            }

            @Override
            public ResultBean<IPage<Dept>> getPageSchoolByArea(
                    @ApiParam("类型") @RequestParam(required = false) Long areaId,
                    @ApiParam("搜索关键词 学校名") @RequestParam(required = false) String schoolName,
                    @ApiParam("当前页码") @RequestParam(defaultValue = "1") Integer pageNum,
                    @ApiParam("页面大小") @RequestParam(defaultValue = "10") Integer pageSize) {
                return null;
            }

            @Override
            public ResultBean<AreaVO> findAreaById(Long id) {
                return null;
            }

            @Override
            public ResultBean<List<Dept>> findChildByParent(Long deptId, Integer type) {
                return null;
            }

            @Override
            public ResultBean<List<Dept>> listSchoolBySchoolType(String schoolType) {
                return null;
            }

            @Override
            public ResultBean syncQywxDept() {
                return null;
            }

            @Override
            public ResultBean dealNoParentDept() {
                return null;
            }

            @Override
            public ResultBean<Dept> getDeptBySchoolAndWxId(Long schoolId, Long wxId) {
                return null;
            }

            @Override
            public ResultBean<List<Dept>> listDept(List<Long> ids) {
                return null;
            }

            @Override
            public ResultBean<List<Dept>> listParentDeptByChild(List<Long> ids) {
                return null;
            }

            @Override
            public ResultBean<List> getDeptTree(List<Long> deptIds) {
                return null;
            }
        };
    }
}
