/** * 导出规则统计数据 excel格式 * @param bill * @return */ public String exportExamsignupExamnoExcel ( String tablename ) { try { String filename = System.currentTimeMillis() + ".xls"; ExcelTool excelTool = Global.getInstance().getExcelTool(); ArrayList<EntityBean> rows = new ArrayList<EntityBean>(); SearchParameters par = new SearchParameters(); par.setName("LBIDrulecountbytable"); par.addParameter("tablename", tablename, 11); EntityBean[] beanlst = par.beanSearch(); if ( beanlst != null && beanlst.length > 0 ) { EntityBean bean_tname = new EntityBean(); EntityBean bean_rule = new EntityBean(); EntityBean bean_count = new EntityBean(); EntityBean bean_percent = new EntityBean(); bean_tname.put("tablename", "表名"); bean_rule.put("rule", "规则名"); bean_count.put("counts", "符合规则量"); bean_percent.put("percents", "占比"); for (int i = 0; i < beanlst.length; i++) { EntityBean ubean = beanlst[i]; bean_tname.put("tablename"+i, ubean.getString("tablename")); bean_rule.put("rule"+i, ubean.getString("rule")); bean_count.put("counts"+i, ubean.getString("counts")); bean_percent.put("percents"+i, ubean.getString("percents")); } rows.add(bean_tname); rows.add(bean_rule); rows.add(bean_count); rows.add(bean_percent); excelTool.addValue("list", rows); if ( !new File(Global.getInstance().getRootPath() + "/ExcelReports/").exists() ) { new File(Global.getInstance().getRootPath() + "/ExcelReports/").mkdirs(); } File file = new File(Global.getInstance().getRootPath() + "/ExcelReports/" + filename); if ( file != null && file.exists() ) { file.delete(); } if ( this.getContext().getCurrentApplicationSysCode().equals("12.002000000000000000000000000000000") ) { excelTool.export(Global.getInstance().getRootPath() + "/ExcelTemplate/LBIDmodule.xls", Global.getInstance() .getRootPath() + "/ExcelReports/" + filename); } else { excelTool.export(Global.getInstance().getRootPath() + "/ExcelTemplate/LBIDmodule.xls", Global.getInstance() .getRootPath() + "/ExcelReports/" + filename); } return filename; } } catch (Exception e) { Global.getInstance().LogError(this, e); e.printStackTrace(); return null; } return null; }