/** * @param oldpwd * @param newpwd * @param request * @return @Description:重置密码 */ @ResponseBody @RequestMapping("/rePassword") public String rePassword(String oldpwd, String newpwd, HttpServletRequest request) { SimpleReturnVo vo; User user = WebUtils.getLoginUser(request); String password = MD5Util.getMD5String(PrivilegeConstant.USER_PASSWORD_FRONT + oldpwd); if (!password.equals(user.getPassword())) { vo = new SimpleReturnVo(this.FAIL, "原密码不正确!"); return JsonUtils.toJson(vo); } try { User newUser = new User(); newUser.setId(user.getId()); password = MD5Util.getMD5String(PrivilegeConstant.USER_PASSWORD_FRONT + newpwd); newUser.setPassword(password); this.userService.singleUpdateUser(newUser); vo = new SimpleReturnVo(this.SUCCESS, "成功"); } catch (Exception e) { e.printStackTrace(); logger.debug("UserController-rePassword:"******"异常错误!"); } return JsonUtils.toJson(vo); }
@Override public void insertUser(User user) throws Exception { user.setId(UUIDGenerator.generate()); user.setPassword("888888"); userDao.insertUser(user); String systemIds = user.getSystemIds(); if (StringUtils.isNotBlank(systemIds)) { String[] syses = systemIds.split(","); for (String sys : syses) { UserSystem userSystem = new UserSystem(); userSystem.setSystemId(sys); userSystem.setId(UUIDGenerator.generate()); userSystem.setUserId(user.getId()); this.userSystemDao.insertUserSystem(userSystem); } } }