예제 #1
0
  /**
   * Calculate all projects.
   *
   * @return the list
   */
  public List<MonthlyProjSum> calculateAllProjects() {
    final PersonService psC = new PersonService();
    final List<UserFolder> list = psC.getAllUserForCodeReview();
    final List<MonthlyProjSum> result = new ArrayList<MonthlyProjSum>();
    for (UserFolder uf : list) {
      final String projectKey = uf.getInfo().getProjectKey();
      final Map<String, String> unitData = calMonthNumByProjectKey(projectKey);
      final MonthlyProjSum unit = new MonthlyProjSum();

      unit.setProjectKey(projectKey);
      unit.setEmpData(uf.getInfo().getEmpdata());

      if (unitData != null) {
        unit.setData(unitData);
      }
      boolean needToInclude = false;
      for (String value : unitData.values()) {
        if (StringUtils.isNotBlank(value)) {
          needToInclude = true;
        }
      }

      if (needToInclude) {
        result.add(unit);
      }
    }

    return result;
  }
예제 #2
0
  public Map<String, List<SumPer2Weeks>> cal2WeeksAllProjectsGroupByDepart() {

    final PersonService psC = new PersonService();
    final List<UserFolder> list = psC.getAllUserForCodeReview();

    final Map<String, List<SumPer2Weeks>> result = new HashMap<String, List<SumPer2Weeks>>();
    JsonClient01 client = new JsonClient01();
    final List<ProjectInfo> allProject = client.getAllProjects();
    final Set<String> allProjectSet = new HashSet<String>();

    for (ProjectInfo info : allProject) {
      allProjectSet.add(info.getK());
    }
    for (UserFolder uf : list) {
      final String projectKey = uf.getInfo().getProjectKey();
      if (!allProjectSet.contains(projectKey)) {
        continue;
      }
      final Map<String, String> unitData = cal2WeekNumProjectKey(projectKey);
      final SumPer2Weeks unit = new SumPer2Weeks();

      unit.setProjectKey(projectKey);
      unit.setEmpData(uf.getInfo().getEmpdata());

      if (unitData != null) {
        unit.setData(unitData);
      }
      boolean needToInclude = false;
      for (String value : unitData.values()) {
        if (StringUtils.isNotBlank(value)) {
          needToInclude = true;
        }
      }

      if (needToInclude) {
        final String depart = unit.getEmpData().getDepart();
        List<SumPer2Weeks> unitlist = result.get(depart);
        if (unitlist == null) {
          unitlist = new ArrayList<SumPer2Weeks>();
        }
        unitlist.add(unit);
        result.put(depart, unitlist);
      }
    }

    return result;
  }