Beispiel #1
0
  /**
   * 根据岗位加载对应的用户列表,跳转到设置用户界面
   *
   * @return
   */
  public String setUserForStation() {
    // 准备数据
    Station station = this.stationManager.getById(this.stationId);
    if (station != null) {
      StringBuffer sbIds = new StringBuffer();
      StringBuffer sbNames = new StringBuffer();
      StringBuffer html = new StringBuffer();
      // selectedIds
      // selectedNames
      // selectedUserHTML
      Set<User> users = station.getUsers(); // ,过滤掉是删除状态的用户
      Set<User> users_ = new HashSet<User>(0);
      for (User user : users) {
        if (user.getDf().equals("0")) {
          users_.add(user);
        }
      }

      for (User user : users_) {
        sbIds.append(user.getId() + ",");
        sbNames.append(user.getUsername() + ",");
        html.append("<div class='iframe_name_box' id='" + user.getId() + "'>");
        html.append("<p class='iframe_name_text'>" + user.getUsername() + "</p>");
        html.append("<p class='iframe_name_close'>");
        html.append(
            "<a onclick=\"delItem('" + user.getId() + "', '" + user.getUsername() + "')\">");
        html.append(
            "<img src='"
                + ServletActionContext.getRequest().getContextPath()
                + "/images/component/open_textboxclose.gif' width='11' height='11' />");
        html.append("</a>");
        html.append("</p>");
        html.append("</div>");
      }
      getRequest().setAttribute("selectedUserHTML", html.toString());

      if (sbIds.toString() != null && !sbIds.toString().equals("")) {
        String _sbIds = sbIds.substring(0, sbIds.toString().length() - 1);
        getRequest().setAttribute("selectedIds", _sbIds);
      }
      if (sbNames.toString() != null && !sbNames.toString().equals("")) {
        String _sbNames = sbNames.toString().substring(0, sbNames.toString().length() - 1);
        getRequest().setAttribute("selectedNames", _sbNames);
      }
    }

    return "stationUserMain";
  }
Beispiel #2
0
 public String listForStation() {
   Station station = this.stationManager.getById(this.stationId);
   if (this.selectedUserIds != null && !this.selectedUserIds.equals("")) {
     String[] userIds = this.selectedUserIds.split(",");
     Set<User> users = new HashSet<User>();
     for (String userId : userIds) {
       users.add(this.userManager.getById(userId));
     }
     station.setUsers(users);
     this.stationManager.saveOrUpdate(station);
   } else {
     station.setUsers(null);
     this.stationManager.saveOrUpdate(station);
   }
   return "closeDialog";
 }
Beispiel #3
0
  /**
   * 岗位设置
   *
   * @return
   */
  public String toConfigStation() {
    // 准备数据,过滤掉是删除状态的岗位信息
    Set<Station> stations = this.user.getStations();
    Set<Station> stations_ = new HashSet<Station>(0);
    for (Station station : stations) {
      if (station.getDf().equals("0")) {
        stations_.add(station);
      }
    }

    StringBuffer html = new StringBuffer();
    StringBuffer selectedIds = new StringBuffer();
    StringBuffer selectedNames = new StringBuffer();
    for (Station station : stations_) {
      selectedIds.append(station.getId() + ",");
      selectedNames.append(station.getName() + ",");

      html.append("<div class='iframe_name_box' id='" + station.getId() + "'>");
      html.append("<p class='iframe_name_text'>" + station.getName() + "</p>");
      html.append("<p class='iframe_name_close'>");
      html.append(
          "<a onclick=\"delItem('" + station.getId() + "', '" + station.getName() + "')\">");
      html.append(
          "<img src='"
              + ServletActionContext.getRequest().getContextPath()
              + "/images/component/open_textboxclose.gif' width='11' height='11' />");
      html.append("</a>");
      html.append("</p>");
      html.append("</div>");
    }
    getRequest().setAttribute("selectedHTML", html.toString());

    if (selectedIds.toString() != null && !selectedIds.toString().equals("")) {
      String _selectedIds =
          selectedIds.toString().substring(0, selectedIds.toString().length() - 1);
      getRequest().setAttribute("selectedIds", _selectedIds);
    }
    if (selectedNames.toString() != null && !selectedNames.toString().equals("")) {
      String _selectedNames =
          selectedNames.toString().substring(0, selectedNames.toString().length() - 1);
      getRequest().setAttribute("selectedNames", _selectedNames);
    }

    return "toConfigStation";
  }