public String cbry037Analyse2() { Map<String, Object> session = (Map<String, Object>) ActionContext.getContext().get("session"); String userName = (String) session.get("userName"); System.out.println("action userName" + userName); if (!userName.equals("admin")) district = userName; else { if (district == null) district = ""; } if (year == null || year.equals("")) year = ""; if (multiple == 0) multiple = 1; statisticList = cbry037Service.statistic(district, multiple); cbry037List = cbry037Service.analyse2(district, year); if (statisticList != null && statisticList.size() > 0) { state = statisticList.get(0).toString(); String[] state1 = state.split("其中:2013年"); String[] state2 = state1[1].split("其中:2014年"); state = state1[0] + "</br>" + "     其中:2013年" + state2[0] + "</br>" + "     其中:2014年" + state2[1]; System.out.println("说明语句:" + state); } else { state = "您可能出现以下问题:</br>1.输入的倍数范围过大,请修改参数后再试!</br>2.数据量太少,无法生成情况说明。"; } districtList = cbry037Service.getDistrictList(); return "analyse2"; }
public String cbry037Analyse1() { Map<String, Object> session = (Map<String, Object>) ActionContext.getContext().get("session"); String userName = (String) session.get("userName"); System.out.println("action userName" + userName); if (userName.equals("admin")) district = ""; else district = userName; cbry037List = cbry037Service.analyse1(district); districtList = cbry037Service.getDistrictList(); return "analyse1"; }
public String download() throws Exception { // 创建类以确定泛型类型 ExportExcel<Cbry037> ex = new ExportExcel<Cbry037>(new Cbry037()); // 创建excel SXSSFWorkbook workbook = new SXSSFWorkbook(100); // 获取记录总数 int cbry037ListCount = (int) cbry037Service.analyse3(district, year) / 40000 + 1; // 获取需要下载的数据list for (int i = 0; i < cbry037ListCount; ++i) { cbry037List = cbry037Service.analyse3(district, year, i); workbook = ex.creatExcel(workbook, cbry037List); } excelFile = ex.downLoadExcel(workbook); return "excel"; }