fix(稽查流程): 下载导入模板
This commit is contained in:
+5
-9
@@ -29,19 +29,17 @@ import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
@@ -262,14 +260,13 @@ public class ProcessEsInspectPlanServiceImpl extends ServiceImpl<ProcessEsInspec
|
||||
|
||||
@Override
|
||||
public void templateDownloadByStart(HttpServletResponse response) throws IOException {
|
||||
File file = ResourceUtils.getFile("classpath:excelTemplate/企标稽查计划导入模板(稽查联络人发起计划).xls");
|
||||
ClassPathResource resource = new ClassPathResource("excelTemplate/企标稽查计划导入模板(稽查联络人发起计划).xls");
|
||||
// 设置HTTP响应头,包括文件大小和内容类型
|
||||
response.setContentType("application/vnd.ms-excel"); // 根据实际文件类型设置内容类型
|
||||
response.setHeader("Content-Disposition", "attachment; filename=企标稽查计划导入模板.xls");
|
||||
response.setContentLength((int) Files.size(file.toPath()));
|
||||
|
||||
// 将文件内容写入HTTP响应输出流中
|
||||
try (InputStream in = Files.newInputStream(file.toPath());
|
||||
try (InputStream in = resource.getInputStream();
|
||||
ServletOutputStream out = response.getOutputStream()) {
|
||||
byte[] buffer = new byte[4096];
|
||||
int bytesRead;
|
||||
@@ -332,14 +329,13 @@ public class ProcessEsInspectPlanServiceImpl extends ServiceImpl<ProcessEsInspec
|
||||
|
||||
@Override
|
||||
public void templateDownloadByStartByOpinionFill(HttpServletResponse response) throws IOException {
|
||||
File file = ResourceUtils.getFile("classpath:excelTemplate/企标稽查计划导入模板(稽查征求意见对象填写意见).xls");
|
||||
ClassPathResource resource = new ClassPathResource("excelTemplate/企标稽查计划导入模板(稽查征求意见对象填写意见).xls");
|
||||
// 设置HTTP响应头,包括文件大小和内容类型
|
||||
response.setContentType("application/vnd.ms-excel"); // 根据实际文件类型设置内容类型
|
||||
response.setHeader("Content-Disposition", "attachment; filename=企标稽查计划导入模板.xls");
|
||||
response.setContentLength((int) Files.size(file.toPath()));
|
||||
|
||||
// 将文件内容写入HTTP响应输出流中
|
||||
try (InputStream in = Files.newInputStream(file.toPath());
|
||||
try (InputStream in = resource.getInputStream();
|
||||
ServletOutputStream out = response.getOutputStream()) {
|
||||
byte[] buffer = new byte[4096];
|
||||
int bytesRead;
|
||||
|
||||
Reference in New Issue
Block a user