コード例 #1
0
  /**
   * 保存工作组添加用户
   *
   * @return
   * @throws Exception
   */
  @Action("work-group-workgroupAddUser")
  public String workgroupAddUser() throws Exception {
    if (StringUtils.isNotEmpty(ids)) {
      userIds = new ArrayList<Long>();
      User user = userManager.getUserById(ContextUtils.getUserId());
      if ("ALLCOMPANYID".equals(ids)) { // 全公司
        userIds.add(0l);
      } else {
        if (roleManager.hasSystemAdminRole(user)) {
          for (String str : ids.split(",")) {
            userIds.add(Long.valueOf(str));
          }
        } else if (roleManager.hasBranchAdminRole(user)) {
          userIds = ApiFactory.getAcsService().getTreeUserIds(ids);
        }
      }

      String addUsers = workGroupManager.workgroupAddUser(workGroupId, userIds, 0);

      if (StringUtils.isNotEmpty(addUsers))
        ApiFactory.getBussinessLogService()
            .log("工作组管理", "工作组添加人员:" + addUsers, ContextUtils.getSystemId("acs"));
    }
    this.renderText("ok");
    return null;
  }
コード例 #2
0
 /**
  * 工作组用户列表
  *
  * @return
  * @throws Exception
  */
 @Action("work-group-getUserByWorkGroup")
 public String getUserByWorkGroup() throws Exception {
   containBranches = departmentManager.containBranches();
   if (userPage.getPageSize() <= 1) {
     User user = userManager.getUserById(ContextUtils.getUserId());
     if (!roleManager.hasSystemAdminRole(user) && roleManager.hasBranchAdminRole(user)) {
       List<BranchAuthority> branchesList =
           branchAuthorityManager.getBranchByUser(ContextUtils.getUserId());
       for (BranchAuthority branches : branchesList) {
         if (StringUtils.isNotEmpty(manageBranchesIds)) {
           manageBranchesIds += ",";
         }
         manageBranchesIds += branches.getBranchesId();
       }
     }
     return "work-group-users";
   } else {
     if (workGroupId != null) {
       userPage = userInfoManager.queryUsersByWorkGroup(userPage, workGroupId);
     }
     renderHtml(PageUtils.pageToJson(userPage));
     return null;
   }
 }