广州市综治平台后端
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
package cn.huge.module.pauser.controller.web;
 
import cn.huge.base.common.utils.ReturnFailUtils;
import cn.huge.base.common.utils.ReturnSucUtils;
import cn.huge.module.pauser.domain.po.PaUser;
import cn.huge.module.pauser.service.PaUserService;
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.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
 
/**
 * @title: 公众用户表接口api-web端
 * @description: 公众用户表接口api-web端
 * @company: hugeinfo
 * @author: liyj
 * @time: 2024-08-19 20:04:19
 * @version: 1.0.0
 */
@Slf4j
@RestController
@RequestMapping("/api/web/paUser")
public class PaUserWebController {
 
    @Autowired(required = false)
    private HttpServletRequest request;
 
    @Autowired
    private PaUserService 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 trueName = request.getParameter("trueName");
        if (StringUtils.isNotBlank(trueName)){
            terms.put("trueName", trueName);
        }
        // 性别
        String sex = request.getParameter("sex");
        if (StringUtils.isNotBlank(sex)){
            terms.put("sex", sex);
        }
        // 性别名称
        String sexName = request.getParameter("sexName");
        if (StringUtils.isNotBlank(sexName)){
            terms.put("sexName", sexName);
        }
        // 手机号码
        String mobile = request.getParameter("mobile");
        if (StringUtils.isNotBlank(mobile)){
            terms.put("mobile", mobile);
        }
        // 身份证号码
        String idcard = request.getParameter("idcard");
        if (StringUtils.isNotBlank(idcard)){
            terms.put("idcard", idcard);
        }
        // 电子邮箱
        String email = request.getParameter("email");
        if (StringUtils.isNotBlank(email)){
            terms.put("email", email);
        }
        // 微信号
        String wechat = request.getParameter("wechat");
        if (StringUtils.isNotBlank(wechat)){
            terms.put("wechat", wechat);
        }
        // QQ号
        String qq = request.getParameter("qq");
        if (StringUtils.isNotBlank(qq)){
            terms.put("qq", qq);
        }
        // 现居地省
        String prov = request.getParameter("prov");
        if (StringUtils.isNotBlank(prov)){
            terms.put("prov", prov);
        }
        // 现居地省名称
        String provName = request.getParameter("provName");
        if (StringUtils.isNotBlank(provName)){
            terms.put("provName", provName);
        }
        // 现居地市
        String city = request.getParameter("city");
        if (StringUtils.isNotBlank(city)){
            terms.put("city", city);
        }
        // 现居地市名称
        String cityName = request.getParameter("cityName");
        if (StringUtils.isNotBlank(cityName)){
            terms.put("cityName", cityName);
        }
        // 现居地区
        String area = request.getParameter("area");
        if (StringUtils.isNotBlank(area)){
            terms.put("area", area);
        }
        // 现居地区名称
        String areaName = request.getParameter("areaName");
        if (StringUtils.isNotBlank(areaName)){
            terms.put("areaName", areaName);
        }
        // 现居地街道
        String road = request.getParameter("road");
        if (StringUtils.isNotBlank(road)){
            terms.put("road", road);
        }
        // 现居地街道名称
        String roadName = request.getParameter("roadName");
        if (StringUtils.isNotBlank(roadName)){
            terms.put("roadName", roadName);
        }
        // 现居地社区
        String village = request.getParameter("village");
        if (StringUtils.isNotBlank(village)){
            terms.put("village", village);
        }
        // 现居地社区名称
        String villageName = request.getParameter("villageName");
        if (StringUtils.isNotBlank(villageName)){
            terms.put("villageName", villageName);
        }
        // 现居地详细地址
        String addr = request.getParameter("addr");
        if (StringUtils.isNotBlank(addr)){
            terms.put("addr", addr);
        }
        // 头像
        String avatar = request.getParameter("avatar");
        if (StringUtils.isNotBlank(avatar)){
            terms.put("avatar", avatar);
        }
        // 实名认证状态,0:未认证,1:已认证
        String realStatus = request.getParameter("realStatus");
        if (StringUtils.isNotBlank(realStatus)){
            terms.put("realStatus", realStatus);
        }
        // 用户状态,0:停用,1:启用
        String status = request.getParameter("status");
        if (StringUtils.isNotBlank(status)){
            terms.put("status", status);
        }
        // 关注纠纷类型,多个用,隔开
        String followCaseType = request.getParameter("followCaseType");
        if (StringUtils.isNotBlank(followCaseType)){
            terms.put("followCaseType", followCaseType);
        }
        // 删除状态,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/web/paUser/listQuery
    * @return Object
    */
    @GetMapping("/listQuery")
    public Object listQuery() {
        try {
            Map<String, Object> terms = getParameter();
            return ReturnSucUtils.getRepInfo(service.listTerms(terms));
        } catch (Exception e) {
            return ReturnFailUtils.getRepInfo();
        }
    }
 
    /**
    * 条件分页查询
    * @url {ctx}/api/web/paUser/pageQuery
    * @param page 页码
    * @param size 每页数量
    * @return Object
    */
    @GetMapping("/pageQuery")
    public Object pageQuery(@RequestParam(value = "page") int page, @RequestParam(value = "size") int size) {
        try {
            Map<String, Object> terms = getParameter();
            Sort sort = Sort.by(Sort.Direction.DESC, "create_time");
            PageRequest pageRequest = PageRequest.of(page-1, size, sort);
            Page<PaUser> paUserPage = service.pageQuery(pageRequest, terms);
            return ReturnSucUtils.getRepInfo( "处理成功", paUserPage);
        } catch (Exception e) {
            return ReturnFailUtils.getRepInfo();
        }
    }
 
    /**
    * 根据编号查询单个
    * @url {ctx}/api/web/paUser/getById
    * @param id 主键编号
    * @return Object
    */
    @GetMapping("/getById")
    public Object getById(@RequestParam(value = "id") String id) {
        try {
            return ReturnSucUtils.getRepInfo(service.getById(id));
        } catch (Exception e) {
            return ReturnFailUtils.getRepInfo();
        }
    }
 
    /**
    * 根据主键单个
    * @url {ctx}/api/web/paUser/deleteById
    * @param id 主键编号
    * @return Object
    */
    @GetMapping("/deleteById")
    public Object deleteById(@RequestParam(value = "id") String id) {
        try {
            service.removeById(id);
            return ReturnSucUtils.getRepInfo();
        } catch (Exception e) {
            return ReturnFailUtils.getRepInfo();
        }
    }
 
    /**
    * 新增或更新对象
    * @url {ctx}/api/web/paUser/savePaUser
    * @param paUser 实体对象
    * @return Object
    */
    @PostMapping("/savePaUser")
    public Object savePaUser(@RequestBody PaUser paUser) {
        try {
            service.savePaUser(paUser);
            return ReturnSucUtils.getRepInfo();
        } catch (Exception e) {
            return ReturnFailUtils.getRepInfo();
        }
    }
 
}