Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
leaf-hlcm
Project
Project
Details
Activity
Releases
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
hlcm
leaf-hlcm
Commits
115862fe
Commit
115862fe
authored
Jul 19, 2023
by
王炜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整产品excel导入并保存文件可能出现流未正常关闭,内存泄露问题
parent
641c6a94
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
37 deletions
+46
-37
ImportExcel.java
src/main/java/leaf/plugin/dataimport/ImportExcel.java
+46
-37
No files found.
src/main/java/leaf/plugin/dataimport/ImportExcel.java
View file @
115862fe
...
...
@@ -147,44 +147,53 @@ public class ImportExcel extends AbstractEntry {
throw
new
IllegalArgumentException
();
}
FileOutputStream
fout
=
new
FileOutputStream
(
savePath
);
byte
[]
buffer
=
new
byte
[
1024
];
int
len
=
0
;
int
size
=
0
;
while
((
len
=
in
.
read
(
buffer
))
>
0
){
fout
.
write
(
buffer
,
0
,
len
);
size
+=
len
;
try
{
byte
[]
buffer
=
new
byte
[
1024
];
int
len
=
0
;
int
size
=
0
;
while
((
len
=
in
.
read
(
buffer
))
>
0
)
{
fout
.
write
(
buffer
,
0
,
len
);
size
+=
len
;
}
fout
.
flush
();
fout
.
close
();
in
.
close
();
// 保存记录到数据库
//fnd_atm_attachment
String
sql
=
"{call fnd_atm_attachment_pkg.insert_fnd_atm_attachment(?,?,?,?,?,?,?,?,?) }"
;
CallableStatement
cstm
=
conn
.
prepareCall
(
sql
);
cstm
.
registerOutParameter
(
1
,
java
.
sql
.
Types
.
NUMERIC
);
cstm
.
setString
(
2
,
"fnd_atm_attachment_multi"
);
// v_source_type_code
cstm
.
setString
(
3
,
"123"
);
// v_source_pk_value
cstm
.
setString
(
4
,
fileTypeCode
);
// v_file_type_code
cstm
.
setString
(
5
,
"application/vnd.ms-excel"
);
// v_mime_type
cstm
.
setString
(
6
,
fileName
);
// v_file_name
cstm
.
setLong
(
7
,
size
);
// v_file_size
cstm
.
setString
(
8
,
savePath
);
// v_file_path
cstm
.
setLong
(
9
,
Long
.
valueOf
(
user_id
));
// v_user_id
cstm
.
execute
();
Long
aid
=
cstm
.
getLong
(
1
);
cstm
.
close
();
//fnd_atm_attachment_multi
sql
=
"{call fnd_atm_attachment_all_pkg.insert_fnd_attachment_multi(?,?,?,?)}"
;
cstm
=
conn
.
prepareCall
(
sql
);
cstm
.
setString
(
1
,
tableName
);
// tableName
cstm
.
setString
(
2
,
tablePkValue
);
// tablePkValue
cstm
.
setLong
(
3
,
aid
);
// attachment_id
cstm
.
setLong
(
4
,
Long
.
valueOf
(
user_id
));
// user_id
cstm
.
execute
();
cstm
.
close
();
}
finally
{
if
(
fout
!=
null
){
fout
.
close
();
}
if
(
in
!=
null
){
in
.
close
();
}
}
fout
.
flush
();
fout
.
close
();
in
.
close
();
// 保存记录到数据库
//fnd_atm_attachment
String
sql
=
"{call fnd_atm_attachment_pkg.insert_fnd_atm_attachment(?,?,?,?,?,?,?,?,?) }"
;
CallableStatement
cstm
=
conn
.
prepareCall
(
sql
);
cstm
.
registerOutParameter
(
1
,
java
.
sql
.
Types
.
NUMERIC
);
cstm
.
setString
(
2
,
"fnd_atm_attachment_multi"
);
// v_source_type_code
cstm
.
setString
(
3
,
"123"
);
// v_source_pk_value
cstm
.
setString
(
4
,
fileTypeCode
);
// v_file_type_code
cstm
.
setString
(
5
,
"application/vnd.ms-excel"
);
// v_mime_type
cstm
.
setString
(
6
,
fileName
);
// v_file_name
cstm
.
setLong
(
7
,
size
);
// v_file_size
cstm
.
setString
(
8
,
savePath
);
// v_file_path
cstm
.
setLong
(
9
,
Long
.
valueOf
(
user_id
));
// v_user_id
cstm
.
execute
();
Long
aid
=
cstm
.
getLong
(
1
);
cstm
.
close
();
//fnd_atm_attachment_multi
sql
=
"{call fnd_atm_attachment_all_pkg.insert_fnd_attachment_multi(?,?,?,?)}"
;
cstm
=
conn
.
prepareCall
(
sql
);
cstm
.
setString
(
1
,
tableName
);
// tableName
cstm
.
setString
(
2
,
tablePkValue
);
// tablePkValue
cstm
.
setLong
(
3
,
aid
);
// attachment_id
cstm
.
setLong
(
4
,
Long
.
valueOf
(
user_id
));
// user_id
cstm
.
execute
();
cstm
.
close
();
}
...
...
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