huanghongfa
2020-12-11 beacd47b5a174b52602a7c4e4ee431aef4ab48b2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
package com.panzhihua.service_user.api;
 
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.user.ChangePasswordVO;
import com.panzhihua.service_user.service.UserService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
import javax.annotation.Resource;
 
/**
 * @program: springcloud_k8s_panzhihuazhihuishequ
 * @description: 用户
 * @author: huang.hongfa weixin hhf9596 qq 959656820
 * @create: 2020-11-24 09:00
 **/
@RestController("/")
public class UserApi {
    @Resource
    private UserService userService;
 
    /**
     * 新增微信用户
     * @param openid 微信小程序标志
     * @param sessionKey 会话密钥
     * @param unionid 微信平台唯一ID
     * @return 新增结果
     */
    @PostMapping("/addOrUpdate")
    public R addOrUpdate(@RequestParam("openid") String openid, @RequestParam("sessionKey")String sessionKey, @RequestParam("unionid")String unionid){
        return userService.updateInsertUser(openid,sessionKey,unionid);
    }
 
    /**
     * 维护小程序用户基本信息 头像 昵称 性别
     * @param userId 数据库用户ID
     * @param nickName 昵称
     * @param gender 性别
     * @param avatarUrl 头像
     * @return 维护结果
     */
    @PostMapping("/updateUserWeiXinInfo")
    public R updateUserWeiXinInfo(@RequestParam("userId")Long userId, @RequestParam("nickName")String nickName, @RequestParam("gender")int gender, @RequestParam("avatarUrl")String avatarUrl){
        return userService.updateUserWeiXinInfo(userId,nickName,gender,avatarUrl);
    }
 
    /**
     * 维护微信用户手机号
     * @param userId 数据库ID
     * @param purePhoneNumber 没有区号的手机号
     * @return 维护结果
     */
    @PostMapping("/updateUserWeiXinPhone")
    public R updateUserWeiXinPhone(@RequestParam("userId")Long userId, @RequestParam("purePhoneNumber")String purePhoneNumber){
        return userService.updateUserWeiXinPhone(userId,purePhoneNumber);
    }
 
    /**
     * 获取平台用户
     * @param userName 登录账户+_type
     * @return 平台用户信息
     */
    @PostMapping("/getUserInfo")
    public R<LoginUserInfoVO> getUserInfo(@RequestParam("userName") String userName){
        int index = userName.indexOf("_");
        String type = userName.substring(index+1, userName.length());
        String name = userName.substring(0, userName.indexOf("_"));
        return userService.getUserInfo(name,Integer.parseInt(type));
    }
 
    /**
     * 获取平台用户
     * @param userId 用户ID
     * @return 平台用户信息
     */
    @PostMapping("/getUserInfoUserId")
    public R<LoginUserInfoVO> getUserInfoByUserId(@RequestParam("userId") String userId){
        return userService.getUserInfo(userId);
    }
 
    /**
     * 修改用户登录密码
     * @param changePasswordVO 新密码
     * @return 修改结果
     */
    @PostMapping("changepassword")
    public R changePassword(@RequestBody ChangePasswordVO changePasswordVO){
        return userService.changePassword(changePasswordVO);
    }
 
    /**
     * 某社区后台人员查询
     * @param param 名字
     * @param communityId 社区id
     * @return 人员集合
     */
    @PostMapping("listactivitymanager")
    public R listActivityManager(@RequestParam("param") String param, @RequestParam("communityId")Long communityId){
        return userService.listActivityManager(param,communityId);
    }
 
 
}