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
633533ef
Commit
633533ef
authored
Jan 09, 2021
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
c6ba23e7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
8 deletions
+3
-8
CostFileUtil.java
...in/java/com/blt/other/module/cost/utils/CostFileUtil.java
+3
-8
No files found.
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/utils/CostFileUtil.java
View file @
633533ef
...
...
@@ -21,8 +21,6 @@ import java.io.FileOutputStream;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.util.UUID
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
/**
* 费用模块文件上传、下载工具类
...
...
@@ -35,14 +33,11 @@ public class CostFileUtil {
public
static
String
upload
(
MultipartFile
file
,
String
filePath
)
{
// 获取文件名
String
fileName
=
file
.
getOriginalFilename
();
// 去除中文
Pattern
pat
=
Pattern
.
compile
(
REGEX_CHINESE
);
Matcher
mat
=
pat
.
matcher
(
fileName
);
fileName
=
mat
.
replaceAll
(
""
);
String
[]
fileNames
=
file
.
getOriginalFilename
().
split
(
"."
);
String
suffix
=
fileNames
[
fileNames
.
length
-
1
];
// fileName处理
fileName
=
filePath
+
UUID
.
randomUUID
()
+
"&"
+
fileName
;
String
fileName
=
filePath
+
IdWorker
.
getIdStr
()
+
"&"
+
IdWorker
.
getIdStr
()
+
"."
+
suffix
;
// 文件对象
File
dest
=
new
File
(
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