|
@@ -348,16 +348,16 @@ public class PlanYearsController extends BaseController {
|
|
|
@GetMapping("/downloaExcel")
|
|
|
public void downloadZip(HttpServletResponse response) {
|
|
|
List<PlanYearsResponseVo> list = new ArrayList<PlanYearsResponseVo>();
|
|
|
- list.add(new PlanYearsResponseVo("军犬大队", "环太平洋项目", "物资服务类", "徒步环太平洋", new BigDecimal(12.23), "军犬大队", "科目一", "2023-02", "2023-03", "2023-04", "重点采购项目,重大规划任务项目", ""));
|
|
|
- list.add(new PlanYearsResponseVo("军犬大队", "环北冰洋项目", "工程类", "徒步环北冰洋", new BigDecimal(15.88), "军犬大队", "科目二", "2023-01", "2023-05", "2023-08", "重点采购项目", ""));
|
|
|
+ list.add(new PlanYearsResponseVo(0L, "军犬大队" , "环太平洋项目" , "物资服务类" , "徒步环太平洋" , new BigDecimal(12.23), "军犬大队" , "科目一" , "2023-02" , "2023-03" , "2023-04" , "重点采购项目,重大规划任务项目" , ""));
|
|
|
+ list.add(new PlanYearsResponseVo(1L, "军犬大队" , "环北冰洋项目" , "工程类" , "徒步环北冰洋" , new BigDecimal(15.88), "军犬大队" , "科目二" , "2023-01" , "2023-05" , "2023-08" , "重点采购项目" , ""));
|
|
|
InputStream resourceAsStream = this.getClass().getResourceAsStream("/template/plan_year.xlsx");
|
|
|
OutputStream outputStream = null;
|
|
|
try {
|
|
|
response.setContentType("application/vnd.ms-excel");
|
|
|
response.setCharacterEncoding("utf-8");
|
|
|
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系
|
|
|
- String fileName = URLEncoder.encode("年度计划(模板)", "UTF-8").replaceAll("\\+", "%20");
|
|
|
- response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
|
|
|
+ String fileName = URLEncoder.encode("年度计划(模板)" , "UTF-8").replaceAll("\\+" , "%20");
|
|
|
+ response.setHeader("Content-disposition" , "attachment;filename*=utf-8''" + fileName + ".xlsx");
|
|
|
outputStream = response.getOutputStream();
|
|
|
ExcelWriter excelWriter = EasyExcel.write(outputStream)
|
|
|
.withTemplate(resourceAsStream).autoCloseStream(true).build();
|