| 
					
				 | 
			
			
				@@ -28,6 +28,9 @@ import javax.servlet.http.HttpServletRequest; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import javax.servlet.http.HttpServletResponse; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import javax.validation.Valid; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.io.IOException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.io.InputStream; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.io.OutputStream; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.net.URLEncoder; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.HashMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.Map; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -261,8 +264,24 @@ public class ReimbursementSysController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @GetMapping("import/template") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @ApiOperation(value = "下载模板") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public void importFileTemplate(HttpServletResponse response, HttpServletRequest request) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        ThisLocalityDownloadUtil download = new ThisLocalityDownloadUtil(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        download.download("报销发票导入模板.xlsx",request,response); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            InputStream inputStream = this.getClass().getResourceAsStream("/dot/报销发票导入模板.xlsx"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //强制下载不打开 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            response.setContentType("application/force-download"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            OutputStream out = response.getOutputStream(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //使用URLEncoder来防止文件名乱码或者读取错误 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode("hire_info_template.xlsx", "UTF-8")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            int b = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            byte[] buffer = new byte[1000000]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            while (b != -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                b = inputStream.read(buffer); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (b != -1) out.write(buffer, 0, b); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            inputStream.close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            out.close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            out.flush(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } catch (IOException e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |