IUser.java 3.27 KB
package com.dituhui.mp.user;

import com.dituhui.mp.enums.ThirdPartyEnum;
import com.dituhui.mp.pojo.ThirdUserInfo;
import com.dituhui.mp.pojo.UserInfo;
import com.dituhui.mp.pojo.WebResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

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

    /**
     * 获取当前登陆用户信息
     *
     * @param token        登录token
     * @param needTeamInfo 是否返回团队信息
     * @return
     */
    @RequestMapping(value = "/v1/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 = "/v1/user/get", method = RequestMethod.GET)
    WebResult<UserInfo> queryUserById(@RequestParam("id") String id);

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

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

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


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


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

    /**
     * 删除用户
     * @param userId 用户ID
     * @return
     */
    @RequestMapping(value = "/v1/user/delete", method = RequestMethod.POST)
    WebResult<Boolean> deleteUser(@RequestParam("id") String userId);

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

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

}