Day28 工作台与 Apache POI 导出报表

1. 今天做了什么

  1. 工作台
  2. Apache POI
  3. 功能:操作文件
    1. 用法:
    2. 读取
    3. 写入等
  4. 导出运营数据报表
    1. get请求
    2. 不需要请求参数,默认30天
    3. 不需要返回数据,本质是输出流,输出文件
    4. 步骤
      1. 设计模板
      2. 查询数据
      3. 写入文件
      4. 输出流下载到客户端

2. 核心知识点

3. 深度思考

4. 踩过的坑

  1. 要注意的:
    1. 怎样获取模板的输入流InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("template/运营数据报表模板.xlsx");
    2. 怎样获取输出流
      1. @GetMapping("/export") public void export(HttpServletResponse response){}
      2. ServletOutputStream out = response.getOutputStream();

5. 遗留问题 / 想不通