public String commonUserLogout() throws Exception {
   this.logger.debug("//--[CommonUserController]--enter commonUserLogout()---//");
   String sessionIdinStr = (String) this.request.getSession().getAttribute("LOGINIDS");
   if (sessionIdinStr == null) {
     sessionIdinStr = "-1";
   }
   long sessionId = Long.parseLong(sessionIdinStr);
   ActiveUserManager au = new ActiveUserManager();
   au.logoff(sessionId);
   User u = (User) this.request.getSession().getAttribute("CURRENUSER");
   OperateLog operateLog = new OperateLog();
   operateLog.setOperator(u.getId());
   operateLog.setOperateDate(new Date());
   operateLog.setOperateIp(this.request.getRemoteAddr());
   operateLog.setOperateContent("综合会员端" + u.getId() + "退出了!");
   operateLog.setOperateLogType(3000);
   operateLog.setOperatorType(LogConstant.OPERATORTYPE);
   this.operateLogService.add(operateLog);
   this.request.getSession().removeAttribute("LOGINIDS");
   this.request.getSession().invalidate();
   return "success";
 }
  public String commonUserLogon() throws Exception {
    this.logger.debug("//--[CommonUserController]--enter commonUserLogon()---//");

    User user = new User();
    user.setUserId(this.request.getParameter("username"));

    List<User> userlist =
        this.userService.getList(
            new QueryConditions("primary.userId", "=", this.request.getParameter("username")),
            null);
    if (userlist.size() != 0) {
      List<MemberInfo> memberlist =
          this.memberInfoService.getList(
              new QueryConditions("primary.id", "=", ((User) userlist.get(0)).getMemberNo()), null);
      if (!((MemberInfo) memberlist.get(0)).getStatus().equals("D")) {
        user.setPassword(this.request.getParameter("pwd"));

        String randNumSys = (String) this.request.getSession().getAttribute("RANDOMICITYNUM");
        String randNumInput = this.request.getParameter("randNumInput");
        String resultMsg = this.userService.authenticateUser(user, randNumSys, randNumInput);
        if ("default,gray".contains(resultMsg)) {
          this.request.getSession().invalidate();
          ActiveUserManager au = new ActiveUserManager();
          long sessionId = au.logon(user.getUserId(), this.request.getRemoteAddr());
          User u = this.userService.loadUserById(user.getUserId(), true, true, true);
          u.setSessionId(sessionId);
          this.request.getSession().setAttribute("LOGINIDS", sessionId);
          this.request.getSession().setAttribute("CURRENUSER", u);
          this.request
              .getSession()
              .setAttribute(ActionConstant.REGISTERID, u.getMemberInfo().getId());
          String organizationNoString = "";
          if (u.getOrganization() != null) {
            organizationNoString = u.getOrganization().getOrganizationNO();
          }
          boolean flag = false;
          for (Role role : u.getRoleSet()) {
            if ("DEFAULT_SUPER_ADMIN".equals(role.getType())) {
              flag = true;
            }
          }
          this.request.getSession().setAttribute("ISSUPERADMIN", Boolean.valueOf(flag));
          this.request
              .getSession()
              .setAttribute(ActionConstant.ORGANIZATIONID, organizationNoString);
          this.request.getSession().setAttribute("CURRENUSERID", user.getUserId());
          this.request.getSession().setAttribute("CURRENUSERNAME", u.getName());
          this.request.getSession().setAttribute("skinstyle", resultMsg);
          this.request.getSession().setAttribute("useKey", "Y");
          Map<String, Integer> sessionMap = (Map) SpringContextHelper.getBean("sessionMap");
          Integer sessionTime = (Integer) sessionMap.get("session");
          this.request.getSession().setMaxInactiveInterval(sessionTime.intValue() * 60);
          OperateLog operateLog = new OperateLog();
          operateLog.setOperator(u.getId());
          operateLog.setOperateDate(new Date());
          operateLog.setMark(
              (String) this.request.getSession().getAttribute(ActionConstant.REGISTERID));
          operateLog.setOperateIp(this.request.getRemoteAddr());
          operateLog.setOperateContent("综合会员端" + u.getId() + "登录了!");
          operateLog.setOperateLogType(3000);
          operateLog.setOperatorType(LogConstant.OPERATORTYPE);
          this.operateLogService.add(operateLog);
          return "success";
        }
        OperateLog operateLog = new OperateLog();
        User u = this.userService.loadUserById(user.getUserId(), true, true, true);
        if (u != null) {
          operateLog.setMark(u.getMemberInfo().getMemberNo());
        }
        String id = this.request.getParameter("username");
        operateLog.setOperator(id);
        operateLog.setOperateDate(new Date());
        operateLog.setOperateIp(this.request.getRemoteAddr());
        int num = resultMsg.indexOf(',');
        String resultStr = resultMsg.substring(0, num);
        operateLog.setOperateContent("综合会员端" + id + "由于" + resultStr + "而登录失败!");
        operateLog.setOperateLogType(3000);
        operateLog.setOperatorType(LogConstant.OPERATORTYPE);
        this.operateLogService.add(operateLog);
        this.request.getSession().setAttribute(ActionConstant.RESULTMSG, resultMsg);
        this.request.getSession().setAttribute(ActionConstant.RESULTVAULE, Integer.valueOf(-1));
        this.request.setAttribute("name", this.request.getParameter("username"));
        return "error";
      }
      this.request.getSession().setAttribute(ActionConstant.RESULTMSG, "会员状态异常,无法登录!");
      this.request.getSession().setAttribute(ActionConstant.RESULTVAULE, Integer.valueOf(-1));
      this.request.setAttribute("name", this.request.getParameter("username"));
      return "error";
    }
    this.request.getSession().setAttribute(ActionConstant.RESULTMSG, "用户名不存在,无法登录!");
    this.request.getSession().setAttribute(ActionConstant.RESULTVAULE, Integer.valueOf(-1));
    this.request.setAttribute("name", this.request.getParameter("username"));
    return "error";
  }