工程管理
This commit is contained in:
parent
4324d5c731
commit
9d33094a2a
|
|
@ -0,0 +1,50 @@
|
||||||
|
package com.securitycontrol.system.base.controller;
|
||||||
|
|
||||||
|
import com.securitycontrol.common.log.annotation.Log;
|
||||||
|
import com.securitycontrol.common.log.enums.OperationType;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.poi.util.IOUtils;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.servlet.ServletOutputStream;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author:cwchen
|
||||||
|
* @date:2024-03-11-14:54
|
||||||
|
* @version:1.0
|
||||||
|
* @description:文件模板下载-web层
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/sys/download/")
|
||||||
|
@Slf4j
|
||||||
|
public class DownLoadFileController {
|
||||||
|
|
||||||
|
@GetMapping("proFile")
|
||||||
|
@Log(title = "基础管理", menu = "基础管理->工程管理", grade = OperationType.DOWNLOAD_BUSINESS, details = "工程模板下载", type = "业务日志")
|
||||||
|
public void downLoadExcelModel2(HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
InputStream inputStream = null;
|
||||||
|
ServletOutputStream servletOutputStream = null;
|
||||||
|
try {
|
||||||
|
String path = "download/" + "pro_model.xlsx";
|
||||||
|
inputStream = this.getClass().getClassLoader().getResourceAsStream(path);
|
||||||
|
response.setContentType("application/vnd.ms-excel");
|
||||||
|
response.addHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
||||||
|
response.addHeader("charset", "utf-8");
|
||||||
|
response.addHeader("Pragma", "no-cache");
|
||||||
|
String encodeName = URLEncoder.encode("pro_model.xlsx", StandardCharsets.UTF_8.toString());
|
||||||
|
response.setHeader("Content-Disposition", "attachment; filename=\"" + encodeName + "\"; filename*=utf-8''" + encodeName);
|
||||||
|
servletOutputStream = response.getOutputStream();
|
||||||
|
IOUtils.copy(inputStream, servletOutputStream);
|
||||||
|
response.flushBuffer();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("工程模板-下载失败",e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.securitycontrol.system.base.controller;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author:cwchen
|
||||||
|
* @date:2024-03-11-14:55
|
||||||
|
* @version:1.0
|
||||||
|
* @description:导出文件-web层
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/sys/export/")
|
||||||
|
public class ExportFileController {
|
||||||
|
|
||||||
|
}
|
||||||
Binary file not shown.
Loading…
Reference in New Issue