Beispiel #1
0
  /**
   * 查看对象
   *
   * @return
   */
  public String show() {
    // 处理部门名称

    user.setDeptsString("");
    if (user.getOuRelations() != null) {
      StringBuffer sb = new StringBuffer();
      for (OrganizationUserRelation our : user.getOuRelations()) {
        if (our.getOrganization() != null) {
          sb.append(our.getOrganization().getName() + ",");
        }
      }
      user.setDeptsString(
          sb.length() > 0 ? sb.substring(0, sb.length() - 1).toString() : sb.toString());
    }

    /*// 性别
    if (user.getSex() != null && !user.getSex().equals("")) {
    	this.sexMap = dicUtil.getDicList("DICT_SEX");
    	user.setSexString(this.sexMap.get(user.getSex()));
    }*/

    try {
      /*
       * WebApplicationContext wac =
       * WebApplicationContextUtils.getRequiredWebApplicationContext
       * (getRequest().getSession().getServletContext()); PictureService
       * pictureService = (PictureService)wac.getBean("pictureService");
       * //调用webservice方法 AttachmentImpl [] attachments =
       * pictureService.findAttachment(user.getId(), FILE_NAME,FILE_MODEL);
       * if(attachments!=null && attachments.length>0) {
       * getRequest().setAttribute("attachment",attachments[0]); }
       */

      ClientAttachmentService clientAttach = new ClientAttachmentService();
      List<Attachment> attachmentList =
          clientAttach.findAttachmentByXml(user.getId(), FILE_NAME, FILE_MODEL);
      if (attachmentList.size() > 0) {
        getRequest().setAttribute("attachment", attachmentList.get(0));
      }
    } catch (Exception e) {
      // TODO: handle exception
    }
    return SHOW_JSP;
  }
Beispiel #2
0
  /**
   * 加载用户列表,用于选择用户组件
   *
   * @return
   */
  @SuppressWarnings("unchecked")
  public String loadUserList() {
    query.setDf("0");
    // 如果是取某分区下的用户,根据分区下的组织机构取得所有用户
    if (partitionId != null && !"".equals(partitionId)) {
      Partition partition = partitionManager.getById(partitionId);
      if (partition != null) {
        query.setOrganizIds(organizationManager.findAllChildByPartition(partition));
      }
    }

    Page page = this.organizationUserRelationManager.findByUserPage(query);
    page = userManager.findPage(query);

    List<User> users = page.getResult();
    // 处理部门列表
    for (User user : users) {
      user.setDeptsString("");
      if (user.getOuRelations() != null) {
        StringBuffer sb = new StringBuffer();
        for (OrganizationUserRelation our : user.getOuRelations()) {
          if (our.getOrganization() != null) {
            sb.append(our.getOrganization().getName() + ",");
          }
        }
        user.setDeptsString(sb.toString());
      }
    }
    // 性别
    for (User user : users) {
      /*if (user.getSex() != null && !user.getSex().equals("")) {
      	this.sexMap = this.dicUtil.getDicList("DICT_SEX");
      	user.setSexString(this.sexMap.get(user.getSex()));
      }*/
    }
    this.saveCurrentPage(page, query);
    return "loadUserList";
  }
Beispiel #3
0
  /**
   * 执行搜索
   *
   * @return
   */
  @SuppressWarnings("unchecked")
  public String list() {

    // Flash.current().clear();

    /*// 删除标记的不显示
    query.setDf("0");
    // 启用状态
    query.setAbledFlag(this.abledFlag);
    // 如果是取某分区下的用户,根据分区下的组织机构取得所有用户
    if (partitionId != null && !"".equals(partitionId)) {
    	Partition partition = partitionManager.getById(partitionId);
    	if (partition != null) {
    		query.setOrganizIds(organizationManager.findAllChildByPartition(partition));
    	}
    }*/

    Page page = this.organizationUserRelationManager.findByUserPage(query);

    List<User> users = page.getResult();
    // 处理部门列表
    for (User user : users) {
      user.setDeptsString("");
      if (user.getOuRelations() != null) {
        StringBuffer sb = new StringBuffer();
        for (OrganizationUserRelation our : user.getOuRelations()) {
          if (our.getOrganization() != null) {
            sb.append(our.getOrganization().getName() + ",");
          }
        }
        user.setDeptsString(sb.toString());
      }
    }

    this.saveCurrentPage(page, query);
    return LIST_JSP;
  }
Beispiel #4
0
  /**
   * 进入更新页面
   *
   * @return
   */
  public String edit() {
    getRequest().setAttribute(DEPTS, organizationManager.findAllByDf());
    // 性别
    this.sexMap = dicUtil.getDicList("DICT_SEX");
    // 组织机构IDS
    StringBuffer sbId = new StringBuffer();
    StringBuffer sbText = new StringBuffer();
    for (OrganizationUserRelation our : user.getOuRelations()) {

      if (our.getOrganization() != null) {
        sbId.append(our.getOrganization().getId() + ",");
        sbText.append(our.getOrganization().getName() + ",");
      }
    }
    try {
      // 创建一个webservice
      /*
       * WebApplicationContext wac =
       * WebApplicationContextUtils.getRequiredWebApplicationContext
       * (getRequest().getSession().getServletContext()); PictureService
       * pictureService = (PictureService)wac.getBean("pictureService");
       * AttachmentImpl [] attachments =
       * pictureService.findAttachment(user.getId(),
       * FILE_NAME,FILE_MODEL);
       */
      ClientAttachmentService clientAttach = new ClientAttachmentService();
      List<Attachment> attachments =
          clientAttach.findAttachmentByXml(user.getId(), FILE_NAME, FILE_MODEL);
      if (attachments != null && attachments.size() > 0) {
        getRequest().setAttribute("attachment", attachments.get(0));
      }
    } catch (Exception e) {
      getRequest().setAttribute("attachment", null);
    }

    String ids = sbId.toString();
    String texts = sbText.toString();
    if (ids != null && !ids.equals("")) {
      user.setDeptIDs(ids.substring(0, ids.length() - 1));
      user.setDeptsString(texts.substring(0, texts.length() - 1));
    }
    return EDIT_JSP;
  }
Beispiel #5
0
  /**
   * 修改个人设置页面
   *
   * @return
   */
  public String editPersonPage() {
    user = userManager.getById(getCurrUser().getUserID());
    // getRequest().setAttribute("depts", deptManager.findAll());
    // getRequest().setAttribute(DEPTS, organizationManager.findAllByDf());

    // 性别
    this.sexMap = dicUtil.getDicList("DICT_SEX");
    // 组织机构IDS
    StringBuffer sbId = new StringBuffer();
    StringBuffer sbText = new StringBuffer();
    for (OrganizationUserRelation our : user.getOuRelations()) {
      sbId.append(our.getOrganization().getId() + ",");
      sbText.append(our.getOrganization().getName() + ",");
    }
    String ids = sbId.toString();
    String texts = sbText.toString();
    if (ids != null && !ids.equals("")) {
      user.setDeptIDs(ids.substring(0, ids.length() - 1));
      user.setDeptsString(texts.substring(0, texts.length() - 1));
    }
    return EDIT_PERSON_INFO;
  }
  @Override
  public String[][] getAllData(
      String code, String username, String password, int startIndex, int endIndex) {
    // 操作流程
    // 首先根据code,查找到对应的数据记录,判断username和password是否匹配,如果匹配则返回关联的用户列表
    com.opendata.sys.model.System system = this.systemManager.findByDf("code", code);
    if (system != null) {
      // 判断username和password是否匹配
      if (system.getUsername().equals(username) && system.getPassword().equals(password)) {
        Set<User> users = new HashSet<User>();
        // 支持分页
        if (startIndex == 0 && endIndex == 0) {
          // 用户列表
          users = system.getUsers();
        } else {
          users = this.systemManager.findAllData(system.getUsers(), startIndex, endIndex);
        }

        if (users != null && users.size() > 0) {
          String[][] userList = new String[users.size()][4];
          int row = 0;
          for (User user : users) {
            userList[row][0] = user.getId(); // 唯一标示
            userList[row][1] = user.getUsername(); // 用户名
            userList[row][2] = null; // 组织机构ids
            userList[row][3] = null; // 组织机构名称
            // 组织机构
            Set<OrganizationUserRelation> ours = user.getOuRelations();
            StringBuffer organizationIds = new StringBuffer();
            StringBuffer organizationNames = new StringBuffer();
            for (OrganizationUserRelation our : ours) {
              if (our.getOrganization() != null) {
                organizationIds.append(our.getOrganization().getId() + ",");
                organizationNames.append(our.getOrganization().getName() + ",");
              }
            }
            if (organizationIds.toString().length() > 0) {
              String _organizationIds =
                  organizationIds.toString().substring(0, organizationIds.toString().length() - 1);
              userList[row][2] = _organizationIds; // 组织机构ids
            }
            if (organizationNames.toString().length() > 0) {
              String _organizationNames =
                  organizationNames
                      .toString()
                      .substring(0, organizationNames.toString().length() - 1);
              userList[row][3] = _organizationNames; // 组织机构名称
            }
          }

          return userList;
        }
      } else {
        // 用户名或密码错误
      }
    } else {
      // 没有匹配的数据
    }

    return null;
  }