mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-13 04:46:50 +08:00
提交下载模版接口
This commit is contained in:
@@ -37,7 +37,6 @@ import java.io.OutputStream;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -123,6 +122,27 @@ public class CasesRecommendApi extends ApiBaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下载错误数据
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@PostMapping("/download-template")
|
||||||
|
public void downloadTemplate(HttpServletResponse response) throws Exception {
|
||||||
|
// 通过工具类创建writer,默认创建xls格式
|
||||||
|
ExcelWriter writer = ExcelUtil.getWriter();
|
||||||
|
writer.writeHeadRow(ListUtil.toList("标题"));
|
||||||
|
response.setContentType("application/vnd.ms-excel;charset=utf-8");
|
||||||
|
response.setHeader("Content-Disposition", "attachment;filename=failData.xls");
|
||||||
|
ServletOutputStream out = response.getOutputStream();
|
||||||
|
|
||||||
|
writer.flush(out, true);
|
||||||
|
writer.close();
|
||||||
|
IoUtil.close(out);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下载错误数据
|
* 下载错误数据
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user