private void initSearchDate() { if (propertyUnitCond == null) { propertyUnitCond = new PropertyUnitCond(); propertyUnitCond.addPermissionCompanyProjectIds( PermissionUtils.getUserProjectIdList(EnumPrivCode.REPORT_SALEUNIT_STAT)); propertyUnitCond.setSearchCompanyProjectIds(propertyUnitCond.getPrivCompanyProjectIds()); // propertyUnitCond.setDate1(CommonUtils.getMonthFirstForString()); propertyUnitCond.setDate2(CommonUtils.getMonthEndForString()); } else if (propertyUnitCond.getPrivCompanyProjectIds() == null) { propertyUnitCond.addPermissionCompanyProjectIds( PermissionUtils.getUserProjectIdList(EnumPrivCode.REPORT_SALEUNIT_STAT)); } }
/** 查看项目列定义 */ public String queryXshlfxLcL() { // 增加报表子分类的条件 ReportDefineColumnCond condColumn = new ReportDefineColumnCond(); // 从缓存当中取选择的项目 PropertyUnitCond cond = new PropertyUnitCond(); cond = (PropertyUnitCond) request.getSession().getAttribute("cond"); if (cond == null) { return "suc"; } CompanyProjectCond conds = new CompanyProjectCond(); conds.setProjectIds(cond.getSearchCompanyProjectIds()); List<CompanyProject> project = companyProjectServices.findCompanyProjectByCond(conds); condColumn.setReportName(ContReportName.XSHLFX_LC); if (cond.getSearchCompanyProjectIds().size() > 1) { int companyId = DescUtils.getCompanyIdByProjectId(cond.getSearchCompanyProjectIds().get(0)); condColumn.setCompanyId(String.valueOf(companyId)); condColumn.setProjectId(""); } else if (cond.getSearchCompanyProjectIds().size() == 1) { int companyId = DescUtils.getCompanyIdByProjectId(cond.getSearchCompanyProjectIds().get(0)); condColumn.setProjectId(String.valueOf(cond.getSearchCompanyProjectIds().get(0))); } else { return "suc"; // 没有选择项目或者公司,直接不查询数据库输出 } List<Map> listReportDefineColumn = reportDefineColumnServices.findReportDefineColumnAndType(condColumn); // 步骤1:进行List的定义,直接对应于html页面的Table ArrayList<ReportShowTR> trList = new ArrayList(); for (int i = 0; i < project.size(); i++) { CompanyProject pro = project.get(i); for (int j = 0; j < listReportDefineColumn.size(); j++) { if (listReportDefineColumn.get(j).get("projectId") == null) continue; if (pro.getId() == Integer.parseInt(listReportDefineColumn.get(j).get("projectId").toString())) { ReportShowTR showTR = new ReportShowTR(); ReportShowTD td1 = new ReportShowTD(); td1.setXyValueText(pro.getProjectName()); showTR.addTD(td1); ReportShowTD td2 = new ReportShowTD(); if (!listReportDefineColumn.get(j).get("companyId").toString().equals("0")) { td2.setXyValueText("项目定义列"); } else { td2.setXyValueText("公司定义列"); } showTR.addTD(td2); ReportShowTD td4 = new ReportShowTD(); td4.setXyValueText(listReportDefineColumn.get(j).get("typeName").toString()); showTR.addTD(td4); ReportShowTD td3 = new ReportShowTD(); td3.setXyValueText(listReportDefineColumn.get(j).get("showName").toString()); showTR.addTD(td3); trList.add(showTR); } } } String str = ReportShowUtils.getTrsByListTR(trList); ActionContext.getContext().getValueStack().set("showTable", str); return "suc"; }