public String getProjectByCompanyId() throws Exception {
    String content = "<option value=\"\">" + CommonUtils.ALL + "</option>"; // 默认值

    String companyId = request.getParameter("companyId");
    try {

      LinkedHashMap<String, String> projectMap =
          HengDaUtils.getProjectsByCompanyId(Integer.parseInt(companyId));

      StringBuffer sb = new StringBuffer();

      if (projectMap.keySet().size() > 1) {
        Set<String> keys = projectMap.keySet();
        for (String key : keys) {
          String value = projectMap.get(key);
          sb.append("<option value=\"").append(key).append("\">").append(value).append("</option>");
        }
      }

      String getContent = sb.toString();
      if (!CustomerUtils.isStrEmpty(getContent)) {
        content = getContent;
      }

    } catch (Exception e) {

    }

    CustomerUtils.writeResponse(response, content);

    return null;
  }
Exemple #2
0
  private void initSelProject(boolean isGet) {
    selProject = new LinkedHashMap<String, String>();
    selProject.put("", CommonUtils.ALL);

    if (isGet) {
      String getCompanyId = saleWeekCond.getCompanyId();
      if (!CustomerUtils.isStrEmpty(getCompanyId) && !"0".equals(getCompanyId)) {
        selProject = HengDaUtils.getProjectsByCompanyId(Integer.parseInt(getCompanyId));
      }
    }
  }