|
@@ -1,5 +1,8 @@
|
|
|
package com.ozs.web.controller.plan;
|
|
|
|
|
|
+import com.alibaba.excel.EasyExcel;
|
|
|
+import com.alibaba.excel.ExcelWriter;
|
|
|
+import com.alibaba.excel.write.metadata.WriteSheet;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.ozs.common.annotation.Log;
|
|
@@ -41,7 +44,9 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.ByteArrayOutputStream;
|
|
|
import java.io.InputStream;
|
|
|
+import java.io.OutputStream;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
@@ -161,8 +166,24 @@ public class PlanYearsController extends BaseController {
|
|
|
public void exportPlanExamine(HttpServletResponse response, @RequestBody PlanYearsStandardVo yearsStandardVo, HttpServletRequest request) throws Exception {
|
|
|
LoginUser loginUser = tokenService.getLoginUser(request);
|
|
|
List<PlanYearsResponseVo> list = planYearsService.selectPlanYearsExamineListEXP(yearsStandardVo, loginUser);
|
|
|
- ExcelUtil<PlanYearsResponseVo> util = new ExcelUtil<>(PlanYearsResponseVo.class);
|
|
|
- util.exportExcel(response, list, "年度计划数据(审核单位)");
|
|
|
+ InputStream resourceAsStream = this.getClass().getResourceAsStream("/template/plan_year.xlsx");
|
|
|
+ OutputStream outputStream = null;
|
|
|
+ InputStream inputStream = null;
|
|
|
+ try {
|
|
|
+ outputStream = response.getOutputStream();
|
|
|
+ ExcelWriter excelWriter = EasyExcel.write(outputStream).withTemplate(resourceAsStream).autoCloseStream(true).build();
|
|
|
+ WriteSheet writeSheet = EasyExcel.writerSheet().build();
|
|
|
+// FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();
|
|
|
+// excelWriter.fill(list, fillConfig, writeSheet);
|
|
|
+ excelWriter.fill(list, writeSheet);
|
|
|
+ excelWriter.finish();
|
|
|
+ outputStream.flush();
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage());
|
|
|
+ throw new BaseException("下载异常");
|
|
|
+ }
|
|
|
+// ExcelUtil<PlanYearsResponseVo> util = new ExcelUtil<>(PlanYearsResponseVo.class);
|
|
|
+// util.exportExcel(response, list, "年度计划数据(审核单位)");
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "创建年度计划")
|