| 
					
				 | 
			
			
				@@ -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; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -9,8 +12,10 @@ import com.ozs.common.core.domain.AjaxResult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ozs.common.core.domain.model.LoginUser; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ozs.common.enums.BusinessType; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ozs.common.enums.DataIsDelete; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ozs.common.exception.base.BaseException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ozs.common.utils.DateUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ozs.common.utils.PageUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ozs.common.utils.file.FileUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ozs.common.utils.poi.ExcelUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ozs.framework.web.service.TokenService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ozs.plan.doman.PlanQuarter; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -22,8 +27,10 @@ import io.swagger.annotations.Api; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import io.swagger.annotations.ApiOperation; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import lombok.extern.slf4j.Slf4j; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.http.MediaType; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.security.access.prepost.PreAuthorize; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.util.ObjectUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.web.bind.annotation.GetMapping; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.web.bind.annotation.PostMapping; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.web.bind.annotation.RequestBody; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.web.bind.annotation.RequestMapping; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -32,6 +39,9 @@ import org.springframework.web.bind.annotation.RestController; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import javax.servlet.http.HttpServletRequest; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import javax.servlet.http.HttpServletResponse; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.io.InputStream; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.io.OutputStream; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.math.BigDecimal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.net.URLEncoder; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.text.SimpleDateFormat; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.ArrayList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.Date; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -274,19 +284,34 @@ public class PlanQuarterController extends BaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     //    return success(message); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     //} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //季度计划不能进行导入 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //@ApiOperation("模板下载") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //@GetMapping("/downloaExcel") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //public void downloadZip(HttpServletResponse response) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //    try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //        InputStream resourceAsStream = this.getClass().getResourceAsStream("/template/planQuarter.xlsx"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //        response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //        FileUtils.setAttachmentResponseHeader(response, "季度计划导入模板.xlsx"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //        FileUtils.writeBytesByInput(resourceAsStream, response.getOutputStream()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //    } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //        log.error("下载文件失败", e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @ApiOperation("模板下载") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @GetMapping("/downloaExcel") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void downloadZip(HttpServletResponse response) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<PlanQuarterResponseVo> list = new ArrayList<PlanQuarterResponseVo>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        list.add(new PlanQuarterResponseVo(1L, "单位1", "环太平洋项目", "物资服务类", "徒步环太平洋", new BigDecimal(12.23), "单位1,单位2", "科目一", "2023-02", "2023-03", "2023-04", "重点采购项目,重大规划任务项目", "计划作废", "")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        list.add(new PlanQuarterResponseVo(2L, "单位2", "环北冰洋项目", "工程类", "徒步环北冰洋", new BigDecimal(15.88), "单位1", "科目二", "2023-01", "2023-05", "2023-08", "重点采购项目", "审核失误,紧急退回", "")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        InputStream resourceAsStream = this.getClass().getResourceAsStream("/template/plan_quarter.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"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            outputStream = response.getOutputStream(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ExcelWriter excelWriter = EasyExcel.write(outputStream) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .withTemplate(resourceAsStream).autoCloseStream(true).build(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            WriteSheet writeSheet = EasyExcel.writerSheet().build(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            excelWriter.fill(list, writeSheet); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            excelWriter.finish(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            outputStream.flush(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            outputStream.close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            log.error(e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw new BaseException("下载异常"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @ApiOperation(value = "导入年度计划数据") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @PostMapping("/importPlanYearsData") 
			 |