package com.ho.flow.feignclient;

import com.ho.common.tools.constant.ContextConstant;
import com.ho.common.tools.entity.OrderDept;
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.SysSubDict;
import com.ho.user.api.entity.SysUser;
import com.ho.user.api.vo.req.OrderUserSelectReqVo;
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.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

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

/**
 * @描述 调用user-center
 * @创建时间 2021/8/9
 * @修改人
 */
@FeignClient(value = ContextConstant.USER_CENTER, fallback = UserFeignClientFallback.class)
public interface UserFeignClient {

    // 根据部门id查对象
    @PostMapping(value = ContextConstant.ROOT_CONTEXT + "outerApi/getTopDept")
    DataResult<SysDept> getTopDept(@RequestBody QueryDeptReqVO vo);

    // 根据部门id查对象
    @PostMapping(value = ContextConstant.ROOT_CONTEXT + "outerApi/getDept")
    DataResult<List<SysDept>> queryDept(@RequestBody List<QueryDeptReqVO> queryDeptReqVOs);

    //根据用户id查询用户
    @PostMapping(value = ContextConstant.ROOT_CONTEXT + "outerApi/getUserById")
    DataResult<SysUser>  getUserById(String userId);

    //根据用户id查询用户
    @PostMapping(value = ContextConstant.ROOT_CONTEXT + "outerApi/getUserByIds")
    DataResult<List<SysUser>> getUserByIds(Set<String> userIds);

    //根据用户查询条件查询用户
    @PostMapping(value = "/api/outerApi/getUsers")
    DataResult<List<SysUser>> queryUser(@RequestBody List<QueryUserReqVO> queryUserReqVO);

    //根据用户名模糊 查询用户
    @PostMapping(value = ContextConstant.ROOT_CONTEXT + "outerApi/getUserByNameConcat")
    DataResult<List<SysUser>> getUserByNameConcat(@RequestBody QueryUserReqVO queryUserReqVO);

    //发送用户中心日志
    @PostMapping(value = ContextConstant.ROOT_CONTEXT + "outerApi/insertLog")
    DataResult insertLog(@RequestBody SysLog sysLog);

    //根据postCodes 进行模糊查询 得到岗位id后进行人员和查询
    @PostMapping(value = ContextConstant.ROOT_CONTEXT + "outerApi/selectByPostCodeTree")
    DataResult<List<OrderDept>> selectByPostCodeTree(OrderUserSelectReqVo vo);

    //根据字典子表id查询到字典子表对象
    @PostMapping(value = ContextConstant.ROOT_CONTEXT + "outerApi/selectBySubId")
    DataResult<SysSubDict> getDictById(@RequestBody Integer priority);

    //根据postCodes 进行模糊查询 得到岗位id后进行人员和查询
    @PostMapping(value = ContextConstant.ROOT_CONTEXT + "outerApi/selectAllPostUser")
    DataResult<List<SysUser>> selectAllPostUser();

    //根据postCodes 进行模糊查询 得到岗位id后进行人员和查询
    @PostMapping(value = ContextConstant.ROOT_CONTEXT + "outerApi/selectByPostIds")
    DataResult<List<SysUser>> selectByPostIds(@RequestBody  List<Integer> postIds);

    //查询字典
    @PostMapping(value = ContextConstant.ROOT_CONTEXT + "outerApi/getSysSubDict")
    Map<String, String> getSysSubDict(@RequestBody SysSubDictVO vo);

    //根据字典子表id集合查询到字典子表对象
    @PostMapping(value = ContextConstant.ROOT_CONTEXT + "outerApi/selectBySubIds")
    DataResult<List<SysSubDict>> getDictByIds(@RequestBody List<Integer> Ids);
}

