예제 #1
0
  /**
   * 修改用户
   *
   * @return
   */
  @Action(
      value = "updateUser",
      results = {
        @Result(
            type = "json",
            params = {"root", "entityMap", "contentType", "text/html"})
      })
  public String updateUser() {
    try {
      logger.debug("userRoles	:" + multiUserRoles);
      logger.debug("begin update user " + portalUser);
      // 地市管理员编辑用户分配角色硬编码
      Set<RoleVO> rSet = new HashSet<RoleVO>();
      if (users.getUserType() == ApSmsConstants.USER_TYPE_CITY_ADMIN) {
        RoleVO roleVO = new RoleVO();
        roleVO.setId(ApSmsConstants.UNION_CORP_ADMIN_ROLEID);
        roleVO.setCreateBy(users.getId());
        rSet.add(roleVO);
      } else {
        String[] roles = multiUserRoles.split(", ");
        RoleVO roleVO = null;
        for (String _role : roles) {
          roleVO = new RoleVO();
          roleVO.setId(Long.parseLong(_role));
          roleVO.setCreateBy(users.getId());
          rSet.add(roleVO);
        }
      }
      // 添加解锁~加锁
      isLockFlag(portalUser);

      portalUser.setRoles(rSet);
      portalUser.setUpdateBy(users.getId()); // 这里是登录用户的ID;
      userService.updateUser(portalUser);

      // 更新用户扩展信息(不含发送条数,统计时间)
      portalUserExt.setId(portalUser.getId());
      portalUserExt.setSmsSendCount(null);
      portalUserExt.setCountTime(null);
      portalUserExtService.update(portalUserExt);

      // 地市管理员更新企业管理员,需要同步至业务节点 20130926
      if (users.getUserType() == ApSmsConstants.USER_TYPE_CITY_ADMIN) {
        addUserToNode(portalUser, portalUserExt);
      }
      entityMap = new HashMap<String, Object>();
      entityMap.put("flag", SUCCESS);
    } catch (Exception exception) {
      entityMap = new HashMap<String, Object>();
      entityMap.put("flag", ERROR);
      logger.error("update user error", exception);
      return ERROR;
    }
    return SUCCESS;
  }
예제 #2
0
  /**
   * 设置短信验证码
   *
   * @return
   */
  @Action(
      value = "smsCheckSetting",
      results = {
        @Result(
            type = "json",
            params = {"root", "entityMap", "contentType", "text/html"})
      })
  public String smsCheckSetting() {
    try {
      entityMap = new HashMap<String, Object>();
      String smsCheckServer =
          (String)
              getSession()
                  .getAttribute(
                      ApSmsConstants
                          .SESSION_SMS_CHECKING_NUMBER); // .get(ApSmsConstants.SESSION_SMS_CHECKING_NUMBER);
      if (!smsCheckServer.equalsIgnoreCase(smsCheckContent)) {
        entityMap.put("flag", false);
        entityMap.put("resultMsg", "短信验证码错误!");
        return SUCCESS;
      }
      //			UserVO sessionUser = (UserVO)
      // getSession().getAttribute(ApSmsConstants.SESSION_USER_INFO);
      if (!users
          .getPassword()
          .equalsIgnoreCase(MasPasswordTool.getEncString(userPsw, users.getAccount()))) {
        entityMap.put("flag", false);
        entityMap.put("resultMsg", "管理员密码错误!");
        return SUCCESS;
      }
      PortalUserExtBean tempUserExt = portalUserExtService.getByPk(portalUserExt.getId());
      tempUserExt.setSmsMobile(portalUserExt.getSmsMobile());
      portalUserExtService.update(tempUserExt);
      ActionContext.getContext().getSession().remove(ApSmsConstants.SESSION_SMS_CHECKING_NUMBER);
      // 地市管理员更新企业管理员,需要同步至业务节点 20130926
      if (users.getUserType() == ApSmsConstants.USER_TYPE_CITY_ADMIN) {
        try {
          updateUserExtToNode(portalUser, tempUserExt);
        } catch (Exception e) {
          logger.error("Add sms mobile to node faile", e);
        }
      }
      entityMap.put("flag", true);
      entityMap.put("resultMsg", "短信验证码绑定成功!");
    } catch (Exception e) {
      logger.error("delete user error", e);
    }

    return SUCCESS;
  }