Пример #1
0
 public String relatedRightForward() {
   this.logger.debug("enter relatedRight");
   Map<String, Object> map =
       EcsideUtil.getQurey(this.request, "", new Boolean(false).booleanValue());
   QueryConditions qc = getQueryConditions(map);
   String userId = this.request.getParameter("userId");
   User user = this.userService.loadUserById(userId, false, true, false);
   String logonIdString = AclCtrl.getLogonID(this.request);
   User logonUser = this.userService.loadUserById(logonIdString, false, true, false);
   boolean flag = false;
   for (Role role : logonUser.getRoleSet()) {
     if (role.getType().equals(ActionConstant.DEF_SUPERADMIN)) {
       flag = true;
     }
   }
   if (!flag) {
     this.request.setAttribute("roleList", logonUser.getOperateRoleSet());
   } else {
     qc.addCondition(
         "primary.memberNo",
         "=",
         this.request.getSession().getAttribute(ActionConstant.REGISTERID));
     List<Role> roleList = this.roleService.getList(qc, null);
     this.request.setAttribute("roleList", roleList);
   }
   this.request.setAttribute("user", user);
   this.request.setAttribute(
       "ISSUPTERADMIN", this.request.getSession().getAttribute("ISSUPERADMIN"));
   return getReturnValue();
 }
Пример #2
0
  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";
  }