IUser.java 5.68 KB
package com.dituhui.pea.user;

import com.dituhui.pea.common.PageResult;
import com.dituhui.pea.common.Result;
import com.dituhui.pea.enums.ThirdPartyEnum;
import com.dituhui.pea.pojo.*;
import com.dituhui.pea.pojo.user.OrgInfo;
import com.dituhui.pea.pojo.user.UserMenuSettingInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 用户相关接口
 *
 * @author
 */
@FeignClient(value = "project-user", contextId = "user")
public interface IUser {

    /**
     * 登录接口
     *
     * @param user
     * @return
     */
    @RequestMapping(value = "/pea-user/login", method = RequestMethod.POST)
    public Result<UserLoginDTO> userLogin(@RequestBody UserLoginParam user);

    /**
     * 获取用户信息
     *
     * @param userId
     * @return
     */
    @RequestMapping(value = "/pea-user/userInfo", method = RequestMethod.GET)
    public Result<UserLoginDTO> getUserInfo(@RequestHeader(name = "userId", required = true) String userId);

    /**
     * 刷新appkey接口<br>
     * 初始化系统ak缓存,例如系统上线,新ak入库的时候
     *
     * @return
     */
    @RequestMapping(value = "/pea-user/refreshAppkey", method = RequestMethod.POST)
    public Result<Boolean> refreshAppkey();

    /**
     * 获取指定ak 并刷新所有ak至redis
     *
     * @param key ak值
     * @return ak 对应的密钥等信息
     */
    @GetMapping("/pea-user/appkey")
    AppDTO getAppKeyInfo(@RequestParam(name = "key") String key);

    /**
     * 获取当前登陆用户信息
     *
     * @param token        登录token
     * @param needTeamInfo 是否返回团队信息
     * @return
     */
    @RequestMapping(value = "/pea-user/getCurrentUserInfo", method = RequestMethod.GET)
    WebResult<UserInfo> getCurrentUserInfo(@RequestParam(name = "userToken") String userToken,
                                           @RequestParam(name = "needTeamInfo", required = false) Boolean needTeamInfo);

    /**
     * 获取用户信息
     *
     * @param id 用户ID
     * @return
     */
    @RequestMapping(value = "/pea-user/get", method = RequestMethod.GET)
    WebResult<UserInfo> queryUserById(@RequestParam("id") String id);

    /**
     * 获取用户信息
     *
     * @param account 用户账号
     * @return
     */
    @RequestMapping(value = "/pea-user/getByAccount", method = RequestMethod.GET)
    WebResult<UserInfo> queryUserByAccount(@RequestParam("account") String account);

    /**
     * 获取用户信息
     *
     * @param phone 用户电话
     * @return
     */
    @RequestMapping(value = "/pea-user/getByPhone", method = RequestMethod.GET)
    WebResult<UserInfo> queryUserByPhone(@RequestParam("phone") String phone);

    /**
     * 获取用户信息
     *
     * @param id   第三方标志
     * @param type 第三方类型
     * @return
     */
    @RequestMapping(value = "/pea-user/getByThirdParty", method = RequestMethod.GET)
    WebResult<UserInfo> queryUserByThirdParty(@RequestParam("id") String id, @RequestParam("type") ThirdPartyEnum type);


    /**
     * 添加用户
     *
     * @param userInfo 用户信息
     * @return
     */
    @RequestMapping(value = "/pea-user/add", method = RequestMethod.POST)
    Result<UserInfo> addUser(@RequestBody UserInfo userInfo);


    /**
     * 更新用户
     *
     * @param userInfo 用户信息
     * @return
     */
    @RequestMapping(value = "/pea-user/update", method = RequestMethod.POST)
    Result<UserInfo> updateUser(@RequestBody UserInfo userInfo);

    /**
     * 删除用户
     *
     * @param userId 用户ID
     * @return
     */
    @RequestMapping(value = "/pea-user/delete", method = RequestMethod.POST)
    Result<Boolean> deleteUser(@RequestBody UserInfoSearch search);

    /**
     * 注册用户
     *
     * @param userInfo 用户信息
     * @return
     */
    @RequestMapping(value = "/pea-user/register", method = RequestMethod.POST)
    WebResult<UserInfo> register(@RequestBody UserInfo userInfo);

    /**
     * 第三方用户注册
     *
     * @param thirdUserInfo 第三方用户信息
     * @return
     */
    @RequestMapping(value = "/pea-user/thirdRegister", method = RequestMethod.POST)
    WebResult<UserInfo> thirdRegister(@RequestBody ThirdUserInfo thirdUserInfo);


    /**
     * 用户列表
     *
     * @param search 查询条件
     * @return
     */
    @RequestMapping(value = "/pea-user/list", method = RequestMethod.GET)
    Result<PageResult<UserInfoSearch>> list(UserInfoSearch search);


    /**
     * 禁用用户
     *
     * @param search 查询条件
     * @return
     */
    @RequestMapping(value = "/pea-user/ban", method = RequestMethod.POST)
    Result<Boolean> ban(@RequestBody UserInfoSearch search);


    /**
     * 获取用户组织
     *
     * @param userId 查询条件
     * @return
     */
    @RequestMapping(value = "/pea-user/orgs", method = RequestMethod.GET)
    Result<List<OrgInfo>> orgs(@RequestParam("userId") String userId);

    /**
     * 获取用户组织
     *
     * @param userId 查询条件
     * @return
     */
    @RequestMapping(value = "/pea-user/orgsNoName", method = RequestMethod.GET)
    Result<List<OrgInfo>> orgsNoName(@RequestParam("userId") String userId);

    /**
     * 获取用户组织
     *
     * @param userId 查询条件
     * @return
     */
    @RequestMapping(value = "/pea-user/getSettings", method = RequestMethod.GET)
    Result<List<UserMenuSettingInfo>> getSettings(@RequestHeader("userId") String userId);

    /**
     * 获取用户组织
     *
     * @return
     */
    @RequestMapping(value = "/pea-user/saveSetting", method = RequestMethod.POST)
    Result saveSetting(@RequestBody UserMenuSettingInfo menuSettingInfo);

}