@RequestMapping("/submit.json") @ResponseBody public ActionResult register(@RequestBody RegParam param) { UsrAccount account = userService.findAccount(param.getUsername()); if (account != null) { return ActionResult.errorResult("用户名" + param.getUsername() + "已存在。"); } account = new UsrAccount(); account.setAttrs("{}"); boolean username = setUsername(param.getUsername(), account); if (username == false) { return ActionResult.errorResult("用户名不合规范,可以选择的有邮箱带@和后缀,QQ或手机号码。"); } account.setRegisterTime(new Timestamp(System.currentTimeMillis())); userDao.persist(UsrAccount.class, account); UUID uuid = account.getAccountId(); String encoded = userService.encodePassword(uuid.toString(), param.getPassword()); account.setPwd(encoded); userDao.update(account); return ActionResult.successResult(); }