From 9050833f2096f16f1a0aa26341287c552af00739 Mon Sep 17 00:00:00 2001
From: buhuazhen <hua100783@gmail.com>
Date: 星期四, 28 五月 2026 16:39:41 +0800
Subject: [PATCH] fix(ProductionPrintOrderExcel):没有图片不进行处理
---
src/main/java/com/ruoyi/basic/excel/ProductionPrintOrderExcel.java | 28 ++++++++++++++++------------
1 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/src/main/java/com/ruoyi/basic/excel/ProductionPrintOrderExcel.java b/src/main/java/com/ruoyi/basic/excel/ProductionPrintOrderExcel.java
index e8bdd25..a3eb0e6 100644
--- a/src/main/java/com/ruoyi/basic/excel/ProductionPrintOrderExcel.java
+++ b/src/main/java/com/ruoyi/basic/excel/ProductionPrintOrderExcel.java
@@ -132,25 +132,29 @@
Sheet sheet = workbook.getSheetAt(0);
// ===== 鎻掑叆鍥剧墖 =====
- byte[] imageBytes = printOrderDto.getCuttingImage();
+ if(printOrderDto.getCuttingImage() != null){
+ byte[] imageBytes = printOrderDto.getCuttingImage();
- int pictureIdx = workbook.addPicture(imageBytes, Workbook.PICTURE_TYPE_JPEG);
- CreationHelper helper = workbook.getCreationHelper();
- Drawing<?> drawing = sheet.createDrawingPatriarch();
+ int pictureIdx = workbook.addPicture(imageBytes, Workbook.PICTURE_TYPE_JPEG);
+ CreationHelper helper = workbook.getCreationHelper();
+ Drawing<?> drawing = sheet.createDrawingPatriarch();
- ClientAnchor anchor = helper.createClientAnchor();
- anchor.setCol1(6); // 绗�7鍒楋紙G鍒楋級
- anchor.setRow1(7);
- anchor.setDx1(142700); // 鍚戝彸绉诲姩锛堢害鍗婃牸锛�
- anchor.setDy1(222700);
+ ClientAnchor anchor = helper.createClientAnchor();
+ anchor.setCol1(6); // 绗�7鍒楋紙G鍒楋級
+ anchor.setRow1(7);
+ anchor.setDx1(142700); // 鍚戝彸绉诲姩锛堢害鍗婃牸锛�
+ anchor.setDy1(222700);
- anchor.setCol2(8); // 瀹藉害缁堢偣
- anchor.setRow2(9); // 楂樺害缁堢偣
+ anchor.setCol2(8); // 瀹藉害缁堢偣
+ anchor.setRow2(9); // 楂樺害缁堢偣
- Picture picture = drawing.createPicture(anchor, pictureIdx);
+ Picture picture = drawing.createPicture(anchor, pictureIdx);
// picture.resize(0.5);
+ }
+
+
// 杩涜鍚堝苟鎿嶄綔 鍒囨枡绀烘剰鍥鹃儴鍒�
int startRow = 7;
--
Gitblit v1.9.3