Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangxinjiang
yifu-mvp
Commits
706274bd
Commit
706274bd
authored
Mar 25, 2026
by
hongguangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.7.21-优化临时文件
parent
7bd483fd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
ExcelToImage.java
...com/yifu/cloud/plus/v1/yifu/social/util/ExcelToImage.java
+5
-2
No files found.
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/util/ExcelToImage.java
View file @
706274bd
...
@@ -55,10 +55,10 @@ public class ExcelToImage {
...
@@ -55,10 +55,10 @@ public class ExcelToImage {
String
projectRoot
=
System
.
getProperty
(
CommonConstants
.
USER_DIR
);
String
projectRoot
=
System
.
getProperty
(
CommonConstants
.
USER_DIR
);
File
tempFile
=
null
;
File
tempFile
=
null
;
File
compressedTempFile
=
null
;
File
compressedTempFile
=
null
;
//加载Excel工作表
Workbook
wb
=
new
Workbook
();
try
{
try
{
//加载Excel工作表
Workbook
wb
=
new
Workbook
();
wb
.
loadFromHtml
(
inputStream
);
wb
.
loadFromHtml
(
inputStream
);
//获取工作表
//获取工作表
Worksheet
sheet
=
wb
.
getWorksheets
().
get
(
0
);
Worksheet
sheet
=
wb
.
getWorksheets
().
get
(
0
);
...
@@ -89,6 +89,9 @@ public class ExcelToImage {
...
@@ -89,6 +89,9 @@ public class ExcelToImage {
e
.
printStackTrace
();
e
.
printStackTrace
();
return
R
.
failed
(
CommonConstants
.
RESULT_DATA_FAIL
+
toImagConvertError
+
e
.
getMessage
());
return
R
.
failed
(
CommonConstants
.
RESULT_DATA_FAIL
+
toImagConvertError
+
e
.
getMessage
());
}
finally
{
}
finally
{
if
(
wb
!=
null
)
{
wb
.
dispose
();
// 重要:释放资源并删除临时文件
}
if
(
tempFile
!=
null
&&
tempFile
.
exists
()){
if
(
tempFile
!=
null
&&
tempFile
.
exists
()){
tempFile
.
delete
();
tempFile
.
delete
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment