package com.ho.business.feignclient;

import com.ho.common.tools.exception.BaseResponseCode;
import com.ho.common.tools.exception.BusinessException;
import com.ho.common.tools.exception.DataResult;
import com.ho.user.api.entity.SysDept;
import com.ho.user.api.entity.SysLog;
import com.ho.user.api.entity.SysUser;
import com.ho.user.api.vo.req.QueryDeptReqVO;
import com.ho.user.api.vo.req.QueryUserReqVO;
import com.ho.user.api.vo.req.SysSubDictVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;
import java.util.Map;

/**
 * @描述 UserClient失败回调
 * @创建时间 2021/8/9
 * @修改人
 */
@Component
public class UserFeignClientFallback implements UserFeignClient {

    Logger log = LoggerFactory.getLogger(getClass());

    @Override
    public DataResult<SysDept> getTopDept(QueryDeptReqVO vo) {
        log.error("调用 [UserClient.getTopDept] 异常!");
        throw new BusinessException(BaseResponseCode.FEIGN_CALL_FAIL);
    }

    @Override
    public DataResult<List<SysDept>> queryDept(@RequestBody List<QueryDeptReqVO> queryDeptReqVO) {
        log.error("调用 [UserClient.queryDept] 异常!");
        throw new BusinessException(BaseResponseCode.FEIGN_CALL_FAIL);
    }

    @PostMapping("/api/outerApi/getUsers")
    @Override
    public DataResult<List<SysUser>> queryUser(List<QueryUserReqVO> queryUserReqVO) {
        log.error("调用 [UserClient.queryUser] 异常!");
        throw new BusinessException(BaseResponseCode.FEIGN_CALL_FAIL);
    }

    //用户名查询多个
    @Override
    public DataResult<List<SysUser>> getUserByNameConcat(QueryUserReqVO queryUserReqVO) {
        log.error("调用 [UserClient.getUserByNameConcat] 异常!");
        throw new BusinessException(BaseResponseCode.FEIGN_CALL_FAIL);
    }

    @Override
    public DataResult insertLog(SysLog sysLog) {
        log.error("调用 [UserClient.insertLog] 异常!");
        throw new BusinessException(BaseResponseCode.FEIGN_CALL_FAIL);
    }

    @Override
    public Map<String, String> getSysSubDict(SysSubDictVO vo) {
        log.error("调用 [UserClient.getSysSubDict] 异常!");
        throw new BusinessException(BaseResponseCode.FEIGN_CALL_FAIL);
    }

    @Override
    public DataResult<SysUser> getUserById(String userId) {
        log.error("调用 [UserClient.getUserById] 异常!");
        throw new BusinessException(BaseResponseCode.FEIGN_CALL_FAIL);
    }

    @Override
    public List<SysDept> getSysDeptByDeptId(Integer deptId) {
        log.error("调用 [UserClient.getSysDeptByDeptId] 异常!");
        throw new BusinessException(BaseResponseCode.FEIGN_CALL_FAIL);
    }
}
