浏览代码

分组日报表导出格式修改

yanliming 1 年之前
父节点
当前提交
cb1fcf90e2
共有 1 个文件被更改,包括 61 次插入1 次删除
  1. 61 1
      web/src/main/java/com/jpsoft/employment/modules/base/controller/ReportController.java

+ 61 - 1
web/src/main/java/com/jpsoft/employment/modules/base/controller/ReportController.java

@@ -375,7 +375,7 @@ public class ReportController {
 
 
             if (exportFlag) {
-                String filePath = exportXls(mapList);
+                String filePath = groupExportXls(mapList);
                 msgResult.setData(filePath);
             } else {
                 Map<String, Object> dataMap = new HashMap<>();
@@ -395,6 +395,66 @@ public class ReportController {
 
 
 
+    private String groupExportXls(List<Map> mapList) {
+        String downloadUrl = "";
+
+        Workbook workbook = new HSSFWorkbook();
+        Sheet sheet = workbook.createSheet();
+
+        //表头
+        Row rowTitle = sheet.createRow(0);
+
+        String[] titles = new String[]{"序号", "日期", "新增登录人数", "累计登录人数", "今日注册人数","累计注册人数", "新增求职登记人数", "累计求职登记人数", "累计简历数",
+                "新增线上认证企业数量", "累计认证企业数量","新增岗位发布数量","实时发布岗位数","累计发布岗位数","岗位需求人数","累计岗位需求人数","今日报名人数"};
+
+        for (int i = 0; i < titles.length; i++) {
+            Cell cell = rowTitle.createCell(i);
+            cell.setCellValue(titles[i]);
+        }
+
+        for (int i = 0; i < mapList.size(); i++) {
+            Map<String, Object> map = mapList.get(i);
+
+            Row row = sheet.createRow(i + 1);
+
+            int colIndex = 0;
+            row.createCell(colIndex++).setCellValue(i + 1);
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("date"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("loginNum"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("totalLoginNum"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("dailyPersonRegNum"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("totalPersonRegNum"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("personNum"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("totalPersonNum"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("totalJobInformation"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("enterpriseNum"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("totalEnterpriseNum"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("recruitNum"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("totalRecruitNum"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("totalRecruitStatusNum"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("jobRequirementNum"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("totalJobRequirementNum"), ""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("jobInformationNum"), ""));
+        }
+
+        ByteArrayOutputStream output = new ByteArrayOutputStream();
+
+        try {
+            workbook.write(output);
+
+            byte[] buffer = output.toByteArray();
+            ByteArrayInputStream input = new ByteArrayInputStream(buffer);
+
+            downloadUrl = OSSUtil.upload(ossConfig, "personList", "分组统计日报表.xls", input);
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+        }
+
+        return downloadUrl;
+    }
+
+
+
 
     /**
      * 根据一段时间获取该段时间的所有日期  正序排序