广州市综治平台后端
xusd
2025-06-07 36306491396230522fa20585c2621a7fc899849a
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
package cn.huge.module.pauser.controller.wechat;
 
import cn.huge.base.common.utils.ReturnFailUtils;
import cn.huge.base.common.utils.ReturnSucUtils;
import cn.huge.module.pauser.dto.WeChatEmpowerDTO;
import cn.huge.module.pauser.service.PaAccountService;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
 
/**
 * @title: 公众用户账号表接口api-wechat端
 * @description: 公众用户账号表接口api-wechat端
 * @company: hugeinfo
 */
@Slf4j
@RestController
@RequestMapping("/api/wechat/paAccount")
public class PaAccountWechatController {
 
    @Autowired(required = false)
    private HttpServletRequest request;
 
    @Autowired
    private PaAccountService service;
 
    /**
    * 获取请求URL参数
    * @return Map<String, Object>
    */
    private Map<String, Object> getParameter(){
        Map<String, Object> terms = Maps.newHashMap();
        // 账号编号
        String id = request.getParameter("id");
        if (StringUtils.isNotBlank(id)){
            terms.put("id", id);
        }
        // 当事人编号
        String userId = request.getParameter("userId");
        if (StringUtils.isNotBlank(userId)){
            terms.put("userId", userId);
        }
        // 帐号类型,1:平台web端,2:平台小程序
        String accType = request.getParameter("accType");
        if (StringUtils.isNotBlank(accType)){
            terms.put("accType", accType);
        }
        // 身份唯一标识(存储唯一标识,比如账号、邮箱、手机号、第三方获取的唯一标识等)
        String acc = request.getParameter("acc");
        if (StringUtils.isNotBlank(acc)){
            terms.put("acc", acc);
        }
        // 授权凭证(比如密码 、第三方登录的token、授权账号等)
        String cipher = request.getParameter("cipher");
        if (StringUtils.isNotBlank(cipher)){
            terms.put("cipher", cipher);
        }
        // 授权凭证明文
        String cipherOpen = request.getParameter("cipherOpen");
        if (StringUtils.isNotBlank(cipherOpen)){
            terms.put("cipherOpen", cipherOpen);
        }
        // 密码最新更新时间
        String cipherTime = request.getParameter("cipherTime");
        if (StringUtils.isNotBlank(cipherTime)){
            terms.put("cipherTime", cipherTime);
        }
        // 最新登录时间
        String loginTime = request.getParameter("loginTime");
        if (StringUtils.isNotBlank(loginTime)){
            terms.put("loginTime", loginTime);
        }
        // 限制登录时间(密码错误次数超过限制,默认30分钟)
        String limitTime = request.getParameter("limitTime");
        if (StringUtils.isNotBlank(limitTime)){
            terms.put("limitTime", limitTime);
        }
        // 删除状态,0:未删除,1:已删除
        String deleteStatus = request.getParameter("deleteStatus");
        if (StringUtils.isNotBlank(deleteStatus)){
            terms.put("deleteStatus", deleteStatus);
        }
        // 客户编号
        String custId = request.getParameter("custId");
        if (StringUtils.isNotBlank(custId)){
            terms.put("custId", custId);
        }
        // 创建时间区间
        String createStart = request.getParameter("createStart");
        String createEnd = request.getParameter("createEnd");
        if(StringUtils.isNotBlank(createStart) && StringUtils.isNotBlank(createEnd)) {
            terms.put("createStart", createStart);
            terms.put("createEnd", createEnd);
        }
        // 更新时间区间
        String updateStart = request.getParameter("updateStart");
        String updateEnd = request.getParameter("updateEnd");
        if(StringUtils.isNotBlank(updateStart) && StringUtils.isNotBlank(updateEnd)) {
            terms.put("updateStart", updateStart);
            terms.put("updateEnd", updateEnd);
        }
        return terms;
    }
 
 
    /**
     * 当事人小程序-微信用户授权
     * url: {ctx}/api/weChat/paAccount/empower
     * type: post
     */
    @PostMapping(value = "/empower")
    public Object empower(@RequestBody WeChatEmpowerDTO weChatEmpowerDTO) {
        if (StringUtils.isBlank(weChatEmpowerDTO.getCode())) {
            return ReturnSucUtils.getRepInfo("code不能为空!");
        }
        try {
            return ReturnSucUtils.getRepInfo(service.wechatEmpower(weChatEmpowerDTO));
        } catch (Exception e) {
            log.error("Controller接口[PaAccountWechatController.empower]请求异常:"+e, e);
            return ReturnFailUtils.getRepInfo(e.getMessage());
        }
    }
 
    /**
     * 当事人小程序-微信用户授权获取手机号码
     * url: {ctx}/api/wechat/paAccount/getUserPhone
     * type: post
     */
    @PostMapping(value = "/getUserPhone")
    public Object getUserPhone(@RequestBody WeChatEmpowerDTO weChatEmpowerDTO) {
        if (StringUtils.isBlank(weChatEmpowerDTO.getCode())) {
            return ReturnSucUtils.getRepInfo("code不能为空!");
        }
        try {
            return ReturnSucUtils.getRepInfo(service.wechatGetPhone(weChatEmpowerDTO));
        } catch (Exception e) {
            log.error("Controller接口[WeChatPaAccountController.wechatGetPhone]请求异常:"+e, e);
            return ReturnFailUtils.getRepInfo(e.getMessage());
        }
    }
 
}