package com.yuchen.saas.manage.system.api.feign;

import com.yuchen.saas.manage.system.api.dto.CouponMenuDTO;
import com.yuchen.saas.manage.system.api.entity.DeptPark;
import com.yuchen.saas.manage.system.api.entity.Dept;
import com.yuchen.saas.manage.system.api.entity.NestDeptDetail;
import com.yuchen.saas.manage.system.api.vo.DeptInfoVO;
import com.yuchen.saas.manage.system.api.vo.DeptVO;
import feign.hystrix.FallbackFactory;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Author: 肖润飞
 * @CreateTime: 2022/11/25 13:37
 * @Description: TODO
 * @Version: 1.0
 */
@Component
public class DeptFeignFallback implements FallbackFactory<DeptFeignServer> {

    @Override
    public DeptFeignServer create(Throwable cause) {

        return new DeptFeignServer() {

            @Override
            public R getChildrenIdsByParentId(String tenantId, String parentId, String deptName) {
                return R.error("远程调用失败");
            }

            @Override
            public R getDeptAndRoleByDept(Long deptId, Long userId) {
                return R.error("远程调用失败");
            }

            @Override
            public R getDept(Long deptId) {
                return R.error("远程调用失败");
            }

            @Override
            public R<List<Dept>> getDeptByName(String deptName) {
                return R.error("远程调用失败");
            }

            @Override
            public R<List<Dept>> getAllDeptList() {
                return R.error("远程调用失败");
            }

            @Override
            public R<List<DeptPark>> getListByDeptId(Long id) {
                return R.error("远程调用失败");
            }

            @Override
            public R<Dept> getDeptInfoByCode(String code) {
                return R.error("远程调用失败");
            }

            @Override
            public R<Boolean> verifyIsDeptUser(Long id, Long userId) {
                return R.error("远程调用失败");
            }

            @Override
            public R<Boolean> addCouponMenu(CouponMenuDTO couponMenuDTO) {
                return R.error("远程调用失败");
            }

            @Override
            public R<NestDeptDetail> getDeptDetailByDeptId(Long deptId) {
                return R.error("远程调用失败");
            }
            @Override
            public R<List<DeptVO>> childDeptTreeByDeptIdNei(Long depId) {
                return R.error("远程调用失败");
            }

            @Override
            public R<List<DeptInfoVO>> listDeptInfoByChildId(Long deptId) {
                return R.error("远程调用失败");
            }

            @Override
            public R<List<Dept>> allByParentId(Long depId) {
                return R.error("远程调用失败");
            }

            @Override
            public R<List<Dept>> findDeptListByIds(List<Long> depIdList) {
                return R.error("远程调用失败");
            }

        };
    }
}