许鹏程
2023-05-24 34ff70bc904e68548b5996561d5da52a67a46d24
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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
package com.product.admin.controller;
 
import com.alibaba.fastjson.JSONObject;
import com.product.admin.config.CmnConst;
import com.product.admin.config.SystemCode;
import com.product.admin.service.PersonalCenterService;
import com.product.admin.service.idel.IPersonalCenterService;
import com.product.common.lang.StringUtils;
import com.product.core.cache.DataPoolCacheImpl;
import com.product.core.config.CoreConst;
import com.product.core.config.Global;
import com.product.core.controller.support.AbstractBaseController;
import com.product.core.entity.FieldSetEntity;
import com.product.core.entity.RequestParameterEntity;
import com.product.core.exception.BaseException;
import com.product.core.permission.PermissionService;
import com.product.core.rsa.GenerateRSAKey;
import com.product.core.spring.context.SpringMVCContextHolder;
import com.product.core.sso.SingleSignOnOauthService;
import com.product.module.sys.config.SystemErrorCode;
import com.product.module.sys.service.UserService;
import com.product.module.sys.version.ApiVersion;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.text.ParseException;
import java.util.Date;
 
/**
 * Copyright  LX-BASE
 *
 * @Title: PersonalCenterController
 * @Project: LX-BASE-SERVER
 * @Date: 2020-05-30 17:25
 * @Author: ZhouJie
 * @Description: 个人中心、及密码问题
 */
@RestController
@RequestMapping("/api/personalcenter")
public class PersonalCenterController extends AbstractBaseController {
 
    @Autowired
    private PersonalCenterService personalCenterService;
    @Autowired
    UserService userService;
    @Autowired
    SingleSignOnOauthService singleSignOnOauthService;
    @Autowired
    IPersonalCenterService ipersonalCenterService;
    /**
     * 数据权限验证
     */
    @Autowired
    PermissionService permissionService;
 
    @PostMapping("/update-user-avatar/{version}")
    @ApiVersion(1)
    public String updateUserAvatar(HttpServletRequest request) {
        try {
            FieldSetEntity fse = null;
            Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
            if (bean != null) {
                RequestParameterEntity reqp = (RequestParameterEntity) bean;
                fse = reqp.getFormData();
            }
            if (bean == null || fse == null) {
                SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
                return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
            }
 
            // 判断表名是否正常
            if (fse.getTableName() == null || !CmnConst.PRODUCT_SYS_USERS.equals(fse.getTableName())) {
                SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
                return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
            }
            String uuid = SpringMVCContextHolder.getCurrentUser().getUuid();
            fse.setValue(CmnConst.UUID, uuid);
            personalCenterService.updateUserAvatar(fse);
            return OK();
        } catch (BaseException e) {
            SpringMVCContextHolder.getSystemLogger().error(e);
            return error(e.getCode(), e.getMessageInfo());
        } catch (Exception e) {
            e.printStackTrace();
            SpringMVCContextHolder.getSystemLogger().error(e);
            return error(SystemCode.GET_USER_INFO_FIAL.getValue(), SystemCode.GET_USER_INFO_FIAL.getText() + e.getMessage());
        }
    }
 
    @PostMapping("/update-personal-info/{version}")
    @ApiVersion(1)
    public String updatePersonalInfo(HttpServletRequest request) {
        try {
            FieldSetEntity fse = null;
            Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
            if (bean != null) {
                RequestParameterEntity reqp = (RequestParameterEntity) bean;
                fse = reqp.getFormData();
            }
            if (bean == null || fse == null) {
                SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
                return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
            }
 
            // 判断表名是否正常
            if (fse.getTableName() == null || !CmnConst.PRODUCT_SYS_USERS.equals(fse.getTableName())) {
                SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
                return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
            }
            IPersonalCenterService service = (IPersonalCenterService) getProxyInstance(this.personalCenterService);
            service.updatePersonalInfo(fse);
            return OK();
        } catch (BaseException e) {
            SpringMVCContextHolder.getSystemLogger().error(e);
            return error(e.getCode(), e.getMessageInfo());
        } catch (Exception e) {
            e.printStackTrace();
            SpringMVCContextHolder.getSystemLogger().error(e);
            return error(SystemCode.GET_USER_INFO_FIAL.getValue(), SystemCode.GET_USER_INFO_FIAL.getText() + e.getMessage());
        }
    }
 
    @PostMapping("/personal-info/{version}")
    @ApiVersion(1)
    public String personalCenterInfo(HttpServletRequest request) {
        try {
            return OK_List(personalCenterService.personalCenterInfo());
        } catch (BaseException e) {
            SpringMVCContextHolder.getSystemLogger().error(e);
            return error(e.getCode(), e.getMessageInfo());
        } catch (Exception e) {
            e.printStackTrace();
            SpringMVCContextHolder.getSystemLogger().error(e);
            return error(SystemCode.GET_USER_INFO_FIAL.getValue(), SystemCode.GET_USER_INFO_FIAL.getText() + e.getMessage());
        }
    }
 
    /**
     * @Date: 2020-05-30 13:58
     * @Author: ZhouJie
     * @Description: 查询个人基本信息
     */
    @RequestMapping(value = "/find-userinfo/{version}", method = RequestMethod.POST)
    @ApiVersion(1)
    public String findUerInfo(HttpServletRequest request) {
        try {
            FieldSetEntity fse = null;
            Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
            if (bean != null) {
                RequestParameterEntity reqp = (RequestParameterEntity) bean;
                fse = reqp.getFormData();
            }
            if (bean == null || fse == null) {
                SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
                return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
            }
            String uuid = SpringMVCContextHolder.getCurrentUser().getUuid();
            //判断是否获取到当前登录用户ID
            //周杰 2020年12月17日 上午11:16
            if (StringUtils.isEmpty(uuid)) {
                SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
                return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
            }
            //数据操作的权限验证
            if (!permissionService.validDataPermission(CmnConst.PRODUCT_SYS_USERS, uuid, CoreConst.DATA_PERMISSION_VALID_TYPE_USER)) {
                SpringMVCContextHolder.getSystemLogger().error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(),
                        SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText());
                return this.error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(), SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText());
            }
            FieldSetEntity fs = personalCenterService.findUserInfoByUserUuid(fse.getString("uuid"));
            return OK_List(fs);
        } catch (BaseException e) {
            SpringMVCContextHolder.getSystemLogger().error(e);
            return this.error(e);
        } catch (Exception e) {
            SpringMVCContextHolder.getSystemLogger().error(e);
            return this.error(SystemCode.SYSTEM_ACQUIRE_PARAM_FAIL.getValue(), SystemCode.SYSTEM_ACQUIRE_PARAM_FAIL.getText());
        }
 
    }
 
    /**
     * @Date: 2020-05-30 13:59
     * @Author: ZhouJie
     * @Description: 修改个人基本信息
     */
    @RequestMapping(value = "/update-userinfo/{version}", method = RequestMethod.POST)
    @ApiVersion(1)
    public String updateUserInfo(HttpServletRequest request) {
        try {
            FieldSetEntity fse = null;
            Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
            if (bean != null) {
                RequestParameterEntity reqp = (RequestParameterEntity) bean;
                fse = reqp.getFormData();
            }
            //判断传参是否为空
            if (bean == null || fse == null) {
                SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
                return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
            }
            //数据操作的权限验证
            if (!permissionService.validDataPermission(fse, CoreConst.DATA_PERMISSION_VALID_TYPE_USER)) {
                SpringMVCContextHolder.getSystemLogger().error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(),
                        SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText());
                return this.error(SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getValue(), SystemErrorCode.SYSTEM_NOT_OPER_PERMISSION.getText());
            }
            //增加创建者和创建时间
            fse.setValue("updated_by", SpringMVCContextHolder.getCurrentUser().getUser_id());// 获取登录帐号
            fse.setValue("updated_utc_datetime", new Date());// 创建时间
            boolean success = personalCenterService.update(fse);
            if (success) {
                return OK();
            }
            SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_USER_UPDATE_FAIL.getValue(), SystemCode.SYSTEM_USER_UPDATE_FAIL.getText());
            return error(SystemCode.SYSTEM_USER_UPDATE_FAIL.getValue(), SystemCode.SYSTEM_USER_UPDATE_FAIL.getText());
        } catch (BaseException e) {
            SpringMVCContextHolder.getSystemLogger().error(e);
            return this.error(e);
        } catch (Exception e) {
            SpringMVCContextHolder.getSystemLogger().error(e);
            return this.error(SystemCode.SYSTEM_USER_UPDATE_FAIL.getValue(), SystemCode.SYSTEM_USER_UPDATE_FAIL.getText());
        }
    }
 
    /**
     * @Date: 2020-05-30 13:59
     * @Author: ZhouJie
     * @Description: 修改密码(发送修改邮件) 后端通过token和userId 生成一个接口链接,发送给用户邮箱
     */
    @RequestMapping(value = "/send-updatePwdEmail/{version}", method = {RequestMethod.POST})
    @ApiVersion(1)
    public String sendUpdatePwdEmail(HttpServletRequest request) {
        try {
            FieldSetEntity fse = null;
            Object userName = null;
            Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
            if (bean != null) {
                RequestParameterEntity reqp = (RequestParameterEntity) bean;
                fse = reqp.getFormData();
                userName = reqp.getFormData().getObject(CmnConst.USER_ACCOUNT);
                //是否启用登录用户名密码的非对称加密
                boolean isEnable = Global.getPropertyToBoolean("login.ecc.isEnable", "false");
                if (userName != null && isEnable) {
                    //用户名解密
                    userName = GenerateRSAKey.decrypt_str(userName.toString());
                    reqp.getFormData().setValue(CmnConst.USER_ACCOUNT, userName);
                }
            }
            //判断传参是否为空
            if (bean == null || fse == null) {
                SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
                return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
            }
            //发送修改密码邮件请求
            personalCenterService.sendPasswordResetEmail(fse);
 
            JSONObject result = new JSONObject();
            result.put("data", fse.getString(CmnConst.USER_ACCOUNT));
            result.put("code", "200");
            result.put("status", "success");
            result.put("msg", SystemCode.SYSTEM_OPERATION_SUCCESS.getText());
            return result.toJSONString();
        } catch (BaseException e) {
            SpringMVCContextHolder.getSystemLogger().error(e);
            return this.error(e);
        } catch (Exception e) {
            SpringMVCContextHolder.getSystemLogger().error(e);
            return this.error(SystemCode.SYSTEM_PASSWORD_EMAIL_FAIL.getValue(), SystemCode.SYSTEM_PASSWORD_EMAIL_FAIL.getText());
        }
    }
 
    /**
     * @Date: 2020-08-19 18:59
     * @Author: ZhouJie
     * @Description: token验证
     */
    @RequestMapping(value = "/check-token/{version}", method = {RequestMethod.POST})
    @ApiVersion(1)
    public String checkToken(HttpServletRequest request, HttpServletResponse response, HttpSession session) throws ParseException, IOException {
        Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
        String token = null;
        FieldSetEntity fse = null;
        try {
            RequestParameterEntity reqp = (RequestParameterEntity) bean;
            if (bean != null) {
                token = reqp.getToken();
                fse = reqp.getFormData();
            }
            if (bean == null || fse == null) {
                SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
                return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
            }
            if (singleSignOnOauthService.oauth(token, request, response)) {
                return this.OKToken(response);
            } else {
                SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_AUTHENTICATION_ERROR.getValue(), SystemCode.SYSTEM_AUTHENTICATION_ERROR.getText());
                return this.error(SystemCode.SYSTEM_AUTHENTICATION_ERROR.getValue(), SystemCode.SYSTEM_AUTHENTICATION_ERROR.getText());
            }
        } catch (BaseException e) {
            SpringMVCContextHolder.getSystemLogger().error(e);
            return this.error(e);
        } catch (Exception e) {
            SpringMVCContextHolder.getSystemLogger().error(e);
            return this.error(SystemCode.SYSTEM_AUTHENTICATION_ERROR.getValue(), SystemCode.SYSTEM_AUTHENTICATION_ERROR.getText());
        }
    }
 
    /**
     * 通用操作成功、修改成功、删除成功
     */
    public String OKToken(HttpServletResponse response) {
        JSONObject result = new JSONObject();
        result.put(CoreConst.API_RETURN_KEY_CODE, CoreConst.API_RETURN_VALUE_CODE_200);
        result.put(CoreConst.API_RETURN_KEY_STATUS, CoreConst.API_RETURN_VALUE_STATUS_SUCCESS);
        result.put(CoreConst.API_RETURN_KEY_MSG, CoreConst.API_RETURN_VALUE_MSG_SUCCESS);
        result.put(CoreConst.ACCESS_TOKEN, response.getHeader(CoreConst.ACCESS_TOKEN));
        result.put(CoreConst.REFRESH_TOKEN, response.getHeader(CoreConst.REFRESH_TOKEN));
        return result.toJSONString();
    }
 
    /**
     * @Date: 2020-05-30 15:30
     * @Author: ZhouJie
     * @Description: 保存新密码(登录修改密码 , 需要输入旧密码验证)
     */
    @RequestMapping(value = "/save-updatepwd/{version}", method = {RequestMethod.POST})
    @ApiVersion(1)
    public String saveUpdatePwd(HttpServletRequest request) {
        Object userName = null;
        Object pwd = null;
        Object old_pwd = null;
        try {
            FieldSetEntity fse = null;
            Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
            RequestParameterEntity reqp = null;
            if (bean != null) {
                reqp = (RequestParameterEntity) bean;
                fse = reqp.getFormData();
                userName = reqp.getFormData().getObject(CmnConst.USER_ACCOUNT);
                //是否启用登录用户名密码的非对称加密
                boolean isEnable = Global.getPropertyToBoolean("login.ecc.isEnable", "false");
                if (userName != null && isEnable) {
                    //用户名解密
                    userName = GenerateRSAKey.decrypt_str(userName.toString());
                    reqp.getFormData().setValue(CmnConst.USER_ACCOUNT, userName);
                }
                pwd = reqp.getFormData().getObject("user_pwd");
                if (pwd != null && isEnable) {
                    //密码解密
                    pwd = GenerateRSAKey.decrypt_str(pwd.toString());
                    reqp.getFormData().setValue("user_pwd", pwd);
                }
                old_pwd = reqp.getFormData().getObject("old_pwd");
                if (old_pwd != null && isEnable) {
                    //旧密码解密
                    old_pwd = GenerateRSAKey.decrypt_str(old_pwd.toString());
                    reqp.getFormData().setValue("old_pwd", old_pwd);
                }
            }
            if (bean == null || fse == null) {
                SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
                return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
            }
            IPersonalCenterService service = (IPersonalCenterService) getProxyInstance(ipersonalCenterService);
            boolean success = service.saveUpdatePwd(fse);
            if (success) {
                //退出后清除缓存的中的用户信息
                DataPoolCacheImpl.getInstance().removeSessionUser();
                return OK();
            }
            SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_PASSWORD_UPDATE_FAIL.getValue(), SystemCode.SYSTEM_PASSWORD_UPDATE_FAIL.getText());
            return error(SystemCode.SYSTEM_PASSWORD_UPDATE_FAIL.getValue(), SystemCode.SYSTEM_PASSWORD_UPDATE_FAIL.getText());
        } catch (BaseException e) {
            SpringMVCContextHolder.getSystemLogger().error(e);
            return this.error(e);
        } catch (Exception e) {
            SpringMVCContextHolder.getSystemLogger().error(e);
            return this.error(SystemCode.SYSTEM_PASSWORD_UPDATE_FAIL.getValue(), SystemCode.SYSTEM_PASSWORD_UPDATE_FAIL.getText());
        }
    }
 
 
    /**
     * @Date: 2020-08-18 17:30
     * @Author: ZhouJie
     * @Description: 保存新密码(忘记密码 , 直接保存新密码)
     */
    @RequestMapping(value = "/save-newpwd/{version}", method = {RequestMethod.POST})
    @ApiVersion(1)
    public String saveNewPwd(HttpServletRequest request) {
        try {
            FieldSetEntity fse = null;
            Object pwd = null;
            Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
            RequestParameterEntity reqp = null;
            if (bean != null) {
                reqp = (RequestParameterEntity) bean;
                fse = reqp.getFormData();
                //是否启用登录密码的非对称加密
                boolean isEnable = Global.getPropertyToBoolean("login.ecc.isEnable", "false");
                pwd = reqp.getFormData().getObject("user_pwd");
                if (pwd != null && isEnable) {
                    //密码解密
                    pwd = GenerateRSAKey.decrypt_str(pwd.toString());
                    reqp.getFormData().setValue("user_pwd", pwd);
                }
            }
            if (bean == null || fse == null) {
                SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
                return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
            }
            IPersonalCenterService service = (IPersonalCenterService) getProxyInstance(ipersonalCenterService);
            boolean success = service.saveNewPwd(fse);
            if (success) {
                //清除用户登录失败的锁定信息
                userService.loginSuccessProcess(SpringMVCContextHolder.getCurrentUser());
                //退出后清除缓存的中的用户信息
                DataPoolCacheImpl.getInstance().removeSessionUser();
                return OK();
            }
            SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_PASSWORD_UPDATE_FAIL.getValue(), SystemCode.SYSTEM_PASSWORD_UPDATE_FAIL.getText());
            return error(SystemCode.SYSTEM_PASSWORD_UPDATE_FAIL.getValue(), SystemCode.SYSTEM_PASSWORD_UPDATE_FAIL.getText());
        } catch (BaseException e) {
            SpringMVCContextHolder.getSystemLogger().error(e);
            return this.error(e);
        } catch (Exception e) {
            SpringMVCContextHolder.getSystemLogger().error(e);
            return this.error(SystemCode.SYSTEM_PASSWORD_UPDATE_FAIL.getValue(), SystemCode.SYSTEM_PASSWORD_UPDATE_FAIL.getText());
        }
    }
 
    /**
     * @Date: 2020-08-24 18:30
     * @Author: ZhouJie
     * @Description: 返回密码强度正则表达式
     */
    @RequestMapping(value = "/return-security/{version}", method = {RequestMethod.POST})
    @ApiVersion(1)
    public String returnPwdSecurity(HttpServletRequest request) {
        try {
            FieldSetEntity fse = null;
            Object language_uuid = null;
            Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
            if (bean != null) {
                RequestParameterEntity reqp = (RequestParameterEntity) bean;
                language_uuid = reqp.getOther().get(CoreConst.SYSTEM_LANGUAGE_CODE_);
                fse = reqp.getFormData();
 
            }
            //判断参数是否为空
            if (bean == null || fse == null) {
                SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
                return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
            }
            FieldSetEntity returnPasswordSecurity = personalCenterService.returnPwdSecurity(language_uuid);
            if (returnPasswordSecurity == null) {
                SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_ACQUIRE_PARAM_FAIL.getValue(), SystemCode.SYSTEM_ACQUIRE_PARAM_FAIL.getText());
                return this.error(SystemCode.SYSTEM_ACQUIRE_PARAM_FAIL.getValue(), SystemCode.SYSTEM_ACQUIRE_PARAM_FAIL.getText());
            }
            return OK_List(returnPasswordSecurity);
        } catch (BaseException e) {
            SpringMVCContextHolder.getSystemLogger().error(e);
            return this.error(e);
        } catch (Exception e) {
            e.printStackTrace();
            SpringMVCContextHolder.getSystemLogger().error(e);
            return this.error(SystemCode.SYSTEM_ACQUIRE_PARAM_FAIL.getValue(), SystemCode.SYSTEM_ACQUIRE_PARAM_FAIL.getText());
        }
    }
 
}