Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gogirl-miniapp-backend
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
huluobin
gogirl-miniapp-backend
Commits
87597fa9
Commit
87597fa9
authored
May 25, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文件上传
parent
0ab93c37
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
QiniuFileServiceImpl.java
...nfrastructure/service/file/impl/QiniuFileServiceImpl.java
+7
-1
No files found.
src/main/java/com/gogirl/infrastructure/service/file/impl/QiniuFileServiceImpl.java
View file @
87597fa9
package
com
.
gogirl
.
infrastructure
.
service
.
file
.
impl
;
package
com
.
gogirl
.
infrastructure
.
service
.
file
.
impl
;
import
com.baomidou.mybatisplus.core.toolkit.IdWorker
;
import
com.gogirl.infrastructure.common.exception.RRException
;
import
com.gogirl.infrastructure.common.util.StringUtils
;
import
com.gogirl.infrastructure.config.property.GogirlProperties
;
import
com.gogirl.infrastructure.config.property.GogirlProperties
;
import
com.gogirl.infrastructure.service.file.FileService
;
import
com.gogirl.infrastructure.service.file.FileService
;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
...
@@ -32,8 +35,11 @@ public class QiniuFileServiceImpl implements FileService {
...
@@ -32,8 +35,11 @@ public class QiniuFileServiceImpl implements FileService {
String
picturePath
=
gogirlProperties
.
getPicturePath
();
String
picturePath
=
gogirlProperties
.
getPicturePath
();
//文件名
//文件名
String
fileName
=
multipartFile
.
getOriginalFilename
();
String
fileName
=
multipartFile
.
getOriginalFilename
();
if
(
StringUtils
.
isEmpty
(
fileName
))
{
throw
new
RRException
(
"上传文件为空,请重新上传"
);
}
String
fileSuffix
=
fileName
.
substring
(
fileName
.
lastIndexOf
(
"."
));
String
fileSuffix
=
fileName
.
substring
(
fileName
.
lastIndexOf
(
"."
));
String
localFileName
=
System
.
currentTimeMillis
()
+
fileSuffix
;
String
localFileName
=
IdWorker
.
getId
()
+
fileSuffix
;
String
filePath
=
picturePath
+
File
.
separator
+
localFileName
;
String
filePath
=
picturePath
+
File
.
separator
+
localFileName
;
File
localFile
=
new
File
(
filePath
);
File
localFile
=
new
File
(
filePath
);
File
imagePath
=
new
File
(
picturePath
);
File
imagePath
=
new
File
(
picturePath
);
...
...
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