From ef4d2c69e38aec3a1531377dbf7accf0fc8e43fa Mon Sep 17 00:00:00 2001
From: longyvfengyun <496960745@qq.com>
Date: 星期二, 19 七月 2022 16:48:08 +0800
Subject: [PATCH] excel解析

---
 src/main/java/com/whyc/service/ProductBomApprovingService.java |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/src/main/java/com/whyc/service/ProductBomApprovingService.java b/src/main/java/com/whyc/service/ProductBomApprovingService.java
index 20d7b17..6e4a11e 100644
--- a/src/main/java/com/whyc/service/ProductBomApprovingService.java
+++ b/src/main/java/com/whyc/service/ProductBomApprovingService.java
@@ -34,7 +34,7 @@
         //鍙栫涓夎,骞朵互绗笁琛屽紑濮�
         Row row2 = sheet.getRow(1);
         short lastCellNum = row2.getLastCellNum();
-        for (int i = 2; i < lastRowNum; i++) {
+        for (int i = 2; i < lastRowNum+1; i++) {
             ProductBomApproving bomApproving = new ProductBomApproving();
             for (int j = 1; j < lastCellNum; j++) {
                 Row row = sheet.getRow(i);
@@ -76,17 +76,15 @@
                                 provingFile.mkdirs();
                             }
                             String suffix = pictureData.suggestFileExtension();
-                            String picturePath = approvingPath + File.separator + bomApproving.getSubModel() + File.separator + suffix;
+                            String picturePath = approvingPath + File.separator + bomApproving.getSubModel() + "." + suffix;
+                            String picturePathFront = "doc_file" + File.separator + "product_approving" + File.separator + user.getName() + File.separator + dateFormat + File.separator + bomApproving.getSubModel() + "." + suffix;
                             byte[] data = pictureData.getData();
                             FileOutputStream fileOutputStream = null;
-                            try {
-                                File pictureFile = new File(picturePath);
-                                fileOutputStream = new FileOutputStream(pictureFile);
-                                fileOutputStream.write(data);
-                            }finally {
-                                fileOutputStream.close();
-                            }
-                            bomApproving.setPictureUrl(picturePath);
+                            File pictureFile = new File(picturePath);
+                            fileOutputStream = new FileOutputStream(pictureFile);
+                            fileOutputStream.write(data);
+
+                            bomApproving.setPictureUrl(picturePathFront);
                         }
                     }break;
                 }

--
Gitblit v1.9.1