/** * IUNI商城流量统计列表导出至Excel * * @return String */ public String iuniSmsSendNumStat2Excel() { List<Map<String, Object>> smsSendNumSumStatList = null; List<Map<String, Object>> smsSendNumDailyStatList = null; List<String> columnNames = null; List<String> columns = null; try { // 生成查询参数Map Map<String, Object> params = genParamMap("iuniSmsSendNumStat"); smsSendNumSumStatList = iuniSmsSendlogHisService.querySendNumSumByExample(params); smsSendNumDailyStatList = iuniSmsSendlogHisService.querySendNumDailyByExample(params); // 合并汇总项 // netflowDailyStatList.addAll(0, netflowSumByDate); // 生成导出数据列名列表 columnNames = genIuniSmsSendNumStatColNames(); // 生成导出数据列名变量列表 columns = genIuniSmsSendNumStatCols(); if (CollectionUtils.isNotEmpty(smsSendNumDailyStatList) && CollectionUtils.isNotEmpty(columnNames) && CollectionUtils.isNotEmpty(columns)) { // 按Sheet数据列表 Map<String, List<Map<String, Object>>> sheetDataList = new HashMap<String, List<Map<String, Object>>>(); String sheetName_sum = "IUNI SMS发送量汇总统计"; String sheetName_daily = "IUNI SMS发送量每日统计"; String exportDate = dateFormat.format(new Date()); fileName = "IUNI SMS发送量统计报表_" + exportDate; fileName = new String(fileName.getBytes(), "ISO8859-1"); sheetDataList.put(sheetName_sum, smsSendNumSumStatList); sheetDataList.put(sheetName_daily, smsSendNumDailyStatList); XSSFWorkbook workbook = ExcelUtil.getWorkbook4XssfOnSheet(columnNames, columns, sheetDataList); ByteArrayOutputStream baos = null; try { baos = new ByteArrayOutputStream(); workbook.write(baos); byte[] ba = baos.toByteArray(); excelStream = new ByteArrayInputStream(ba); } catch (IOException e) { logger.error("IuniSmsSendlogHisAction.iuniSmsSendNumStat2Excel found IOException.", e); } finally { if (null != baos) { try { baos.close(); } catch (IOException e) { logger.error( "IuniSmsSendlogHisAction.iuniSmsSendNumStat2Excel found IOException.", e); } } } } else { return ERROR; } } catch (DBException dbex) { logger.error("IuniSmsSendlogHisAction.iuniSmsSendNumStat2Excel found DBException", dbex); return ERROR; } catch (Exception ex) { logger.error("IuniSmsSendlogHisAction.iuniSmsSendNumStat2Excel found Exception", ex); return ERROR; } return SUCCESS; }
/** * IUNI订单退款明细按条件统计列表导出至Excel * * @return String */ public String iuniOrderRefundDetails2Excel() { List<Map<String, Object>> iuniOrderRefundDetailsList = null; List<String> columnNames = null; List<String> columns = null; try { // 生成查询参数Map Map<String, Object> params = genParamMap("iuniOrderRefundDetails"); iuniOrderRefundDetailsList = iuniReturnGoodsInfoService.queryIuniOrderRefundDetailsByExample(params); // 生成导出数据列名列表 columnNames = genIuniOrderRefundDetailsColNames(); // 生成导出数据列名变量列表 columns = genIuniOrderRefundDetailsCols(); if (CollectionUtils.isNotEmpty(iuniOrderRefundDetailsList) && CollectionUtils.isNotEmpty(columnNames) && CollectionUtils.isNotEmpty(columns)) { // 按Sheet数据列表 Map<String, List<Map<String, Object>>> sheetDataList = new HashMap<String, List<Map<String, Object>>>(); String sheetName = "IUNI订单退款明细表"; String exportDate = dateFormat.format(new Date()); fileName = sheetName + "_" + exportDate; fileName = new String(fileName.getBytes(), "ISO8859-1"); sheetDataList.put(sheetName, iuniOrderRefundDetailsList); XSSFWorkbook workbook = ExcelUtil.getWorkbook4XssfOnSheet(columnNames, columns, sheetDataList); ByteArrayOutputStream baos = null; try { baos = new ByteArrayOutputStream(); workbook.write(baos); byte[] ba = baos.toByteArray(); excelStream = new ByteArrayInputStream(ba); } catch (IOException e) { logger.error( "IuniReturnGoodsInfoAction.iuniOrderRefundDetails2Excel found IOException.", e); } finally { if (null != baos) { try { baos.close(); } catch (IOException e) { logger.error( "IuniReturnGoodsInfoAction.iuniOrderRefundDetails2Excel found IOException.", e); } } } } else { return ERROR; } } catch (DBException dbex) { logger.error( "IuniReturnGoodsInfoAction.iuniOrderRefundDetails2Excel found DBException", dbex); return ERROR; } catch (Exception ex) { logger.error("IuniReturnGoodsInfoAction.iuniOrderRefundDetails2Excel found Exception", ex); return ERROR; } return SUCCESS; }