Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dc-cost-system
Overview
Overview
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
bltdc
dc-cost-system
Commits
a1ecb4bc
Commit
a1ecb4bc
authored
Jan 09, 2021
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
18bd2ade
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
6 deletions
+4
-6
CostFileUtil.java
...in/java/com/blt/other/module/cost/utils/CostFileUtil.java
+4
-6
No files found.
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/utils/CostFileUtil.java
View file @
a1ecb4bc
...
...
@@ -22,8 +22,6 @@ import java.io.IOException;
import
java.io.OutputStream
;
import
java.util.UUID
;
import
static
com
.
baomidou
.
mybatisplus
.
core
.
toolkit
.
StringPool
.
DOT
;
/**
* 费用模块文件上传、下载工具类
*/
...
...
@@ -35,11 +33,10 @@ public class CostFileUtil {
public
static
String
upload
(
MultipartFile
file
,
String
filePath
)
{
// 获取文件名
String
[]
fileNames
=
file
.
getOriginalFilename
().
split
(
DOT
);
String
suffix
=
fileNames
[
fileNames
.
length
-
1
];
String
fileName
=
file
.
getOriginalFilename
().
replaceAll
(
"_"
,
""
);
// fileName处理
String
fileName
=
filePath
+
IdWorker
.
getIdStr
()
+
"&"
+
IdWorker
.
getIdStr
()
+
"."
+
suffix
;
fileName
=
filePath
+
UUID
.
randomUUID
()
+
"&"
+
fileName
;
// 文件对象
File
dest
=
new
File
(
fileName
);
// 创建路径
...
...
@@ -48,7 +45,8 @@ public class CostFileUtil {
}
try
{
file
.
transferTo
(
dest
);
}
catch
(
IOException
ignored
)
{
}
catch
(
IOException
e
)
{
// logger.error("affirmFile 发生错误",e);
}
return
fileName
;
}
...
...
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