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

import com.dituhui.pea.common.PageResult;
import com.dituhui.pea.pojo.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.dituhui.pea.common.Result;
import com.dituhui.pea.enums.ThirdPartyEnum;

/**
 * 用户相关接口
 *
 * @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();

    /**
     * 获取当前登陆用户信息
     *
     * @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(@RequestParam("id") String userId);

    /**
     * 注册用户
     *
     * @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.GET)
    Result<Boolean> ban(UserInfoSearch search);

}