@ResponseBody @RequestMapping(value = "/user/cpasswd.htm", method = RequestMethod.POST) public BizResponse cpasswd(String no, String opasswd, String passwd, String passwd2) { this.setWebData("no", no); // 操作结果 BizResponse response = this.newBizResponse(); try { // 查找 UserModel user = this.userService.findByNo(no); if (user == null) { this.buildResponse(response, BizResponseEnum.OBJECT_NOT_EXIST); return response; } // 原密码 if (!StringUtils.equals(user.getPasswd(), MD5Utils.digest(opasswd))) { this.buildResponse(response, BizResponseEnum.INVALID_PASSWD); return response; } // 新密码 if (!StringUtils.equals(passwd, passwd2)) { this.buildResponse(response, BizResponseEnum.INVALID_PASSWD); return response; } // 长度 user.setPasswd(MD5Utils.digest(passwd)); // 更新 this.userService.update(user); } catch (Exception e) { logger.error("修改登录用户密码异常!", e); this.buildResponse(response, BizResponseEnum.SYSTEM_ERROR); } // JSON返回 return response; }