From 8e89f95b9db4039f0cb8b4b8dc7974c247366c4c Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期四, 21 五月 2026 15:14:46 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_天津_阳光彩印' into dev_天津_阳光彩印
---
src/main/java/com/ruoyi/production/controller/ProductionPrintOrderController.java | 24 +++++++++++++++++++-----
1 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/src/main/java/com/ruoyi/production/controller/ProductionPrintOrderController.java b/src/main/java/com/ruoyi/production/controller/ProductionPrintOrderController.java
index 436c2d0..94a5cb7 100644
--- a/src/main/java/com/ruoyi/production/controller/ProductionPrintOrderController.java
+++ b/src/main/java/com/ruoyi/production/controller/ProductionPrintOrderController.java
@@ -6,7 +6,12 @@
import com.ruoyi.production.service.ProductionPrintOrderService;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
+import lombok.SneakyThrows;
import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+import java.net.URLEncoder;
/**
* @author buhuazhen
@@ -22,20 +27,29 @@
private final ProductionPrintOrderService productionPrintOrderService;
@PostMapping("/save")
- public R save(@RequestBody SaveProductionPrintOrderDto dto){
+ public R save(@RequestBody SaveProductionPrintOrderDto dto) {
productionPrintOrderService.save(dto);
return R.ok();
}
@PostMapping("/getByProductWordId/{id}")
- public ProductionPrintOrder getByProductWordId(@PathVariable Long id){
+ public ProductionPrintOrder getByProductWordId(@PathVariable Long id) {
return productionPrintOrderService.getByProductWordId(id);
}
@PostMapping("/export/{id}")
- public R export(@PathVariable Long id){
- productionPrintOrderService.exportPrintExcelByWordId(id);
- return R.ok();
+ @SneakyThrows
+ public void export(@PathVariable Long id, HttpServletResponse response) {
+ byte[] bytes = productionPrintOrderService.exportPrintExcelByWordId(id);
+ String fileName = "鍗板埛瀹氬嵃鍗�.xlsx";
+ response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+ response.setCharacterEncoding("utf-8");
+ // 瑙e喅涓枃鏂囦欢鍚嶄贡鐮�
+ response.setHeader("Content-Disposition",
+ "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
+ ServletOutputStream out = response.getOutputStream();
+ out.write(bytes);
+ out.flush();
}
}
--
Gitblit v1.9.3