Esempio n. 1
0
  public String editAccountPassword() {
    boolean isSuccess = true;
    String result = "0";

    HttpServletRequest request = ServletActionContext.getRequest();
    HttpSession httpSession = request.getSession();
    Session session = (Session) httpSession.getAttribute("session");
    if (session != null) {
      try {
        Account account = (Account) accountManagerService.queryAccountByAccountId(session.getId());
        if (account != null) oldpassword = account.getPassword();
      } catch (Exception ex) {
        log.error(ex.getMessage(), ex);
        result = "-1";
      }
    }
    StringBuffer msg = new StringBuffer("查询账号");
    switch (Integer.parseInt(result)) {
      case -1:
        msg.append("失败,数据库异常!");
        isSuccess = false;
        break;
      default:
        msg.append("成功。");
        isSuccess = true;
        break;
    }
    commonBean = new CommonBean(result, msg.toString());
    if (isSuccess) {
      return SUCCESS;
    } else {
      return ERROR;
    }
  }
Esempio n. 2
0
 public String editAccount() {
   boolean isSuccess = true;
   String result = "0";
   try {
     account = (Account) accountManagerService.queryAccountByAccountId(id);
     String roleTmp = account.getRoles();
     if (roleTmp != null && roleTmp.length() != 0) {
       String[] roleStrings = roleTmp.split(",");
       seledRoles = new ArrayList<String>(Arrays.asList(roleStrings));
     }
     orgLevAndIdNames = accountManagerService.getOrgLevAndIdNamesByAccountId(id);
     allowedRoles = accountManagerService.getAllowedRolesByAccountId();
   } catch (Exception ex) {
     log.error(ex.getMessage(), ex);
     result = "-1";
   }
   StringBuffer msg = new StringBuffer("查询机构和角色");
   switch (Integer.parseInt(result)) {
     case -1:
       msg.append("失败,数据库异常!");
       isSuccess = false;
       break;
     default:
       msg.append("成功。");
       isSuccess = true;
       break;
   }
   commonBean = new CommonBean(result, msg.toString());
   if (isSuccess) {
     return SUCCESS;
   } else {
     return ERROR;
   }
 }