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

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;

import com.dituhui.pea.common.Result;
import com.dituhui.pea.enums.ThirdPartyEnum;
import com.dituhui.pea.pojo.ThirdUserInfo;
import com.dituhui.pea.pojo.UserInfo;
import com.dituhui.pea.pojo.UserLoginParam;
import com.dituhui.pea.pojo.WebResult;

/**
 * 用户相关接口
 * @author
 */
@FeignClient(value = "user")
public interface IUser {
	
	@RequestMapping(value = "/pea-user/login", method = RequestMethod.POST)
	public Result<?> userLogin(@RequestBody UserLoginParam user);
	
	@RequestMapping(value = "/pea-user/userInfo", method = RequestMethod.GET)
	public Result<?> getUserInfo(@RequestParam(name = "token") String token);

    /**
     * 获取当前登陆用户信息
     *
     * @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)
    WebResult<UserInfo> addUser(@RequestBody UserInfo userInfo);


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

    /**
     * 删除用户
     * @param userId 用户ID
     * @return
     */
    @RequestMapping(value = "/pea-user/delete", method = RequestMethod.POST)
    WebResult<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);

}