Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-webapp-plug
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
base_platform_enterprise
gic-webapp-plug
Commits
93d641d5
Commit
93d641d5
authored
May 29, 2020
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
上传文件
parent
67bed719
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
UploadImgController.java
...java/com/gic/plug/web/controller/UploadImgController.java
+9
-5
No files found.
src/main/java/com/gic/plug/web/controller/UploadImgController.java
View file @
93d641d5
...
...
@@ -7,6 +7,7 @@ import com.gic.thirdparty.BucketNameEnum;
import
com.gic.thirdparty.FileOperateUtils
;
import
com.gic.thirdparty.pic.QQCloudPicUtils
;
import
com.gic.thirdparty.pic.UploadResult
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -84,8 +85,11 @@ public class UploadImgController {
bucketName
=
BucketNameEnum
.
VIDEO_40000
.
getName
();
}
String
url
=
FileOperateUtils
.
simpleUploadFileFromLocal
(
targetFile
,
fieldCode
,
bucketName
);
if
(
StringUtils
.
isNotBlank
(
url
))
{
url
=
"https://"
+
url
;
}
Map
<
String
,
Object
>
pic
=
new
HashMap
<>();
Map
<
String
,
Object
>
pic
=
new
HashMap
<>(
8
);
pic
.
put
(
"fileId"
,
fieldCode
);
pic
.
put
(
"url"
,
url
);
pic
.
put
(
"fileName"
,
fileRealName
);
...
...
@@ -154,24 +158,24 @@ public class UploadImgController {
public
static
boolean
isPicture
(
String
fileSuffix
)
throws
Exception
{
String
[]
imageArray
=
{
"bmp"
,
"dib"
,
"gif"
,
"jfif"
,
"jpe"
,
"jpeg"
,
"jpg"
,
"png"
,
"tif"
,
"tiff"
,
"ico"
,
"10"
};
return
Arrays
.
stream
(
imageArray
).
anyMatch
(
e
->
e
.
equals
(
fileSuffix
));
return
Arrays
.
stream
(
imageArray
).
anyMatch
(
e
->
e
.
equals
(
fileSuffix
.
replace
(
"."
,
""
)
));
}
public
static
boolean
isOffice
(
String
fileSuffix
)
throws
Exception
{
String
[]
arr
=
{
"doc"
,
"docx"
,
"xls"
,
"xlsx"
,
"pptx"
,
"ppt"
};
return
Arrays
.
stream
(
arr
).
anyMatch
(
e
->
e
.
equals
(
fileSuffix
));
return
Arrays
.
stream
(
arr
).
anyMatch
(
e
->
e
.
equals
(
fileSuffix
.
replace
(
"."
,
""
)
));
}
public
static
boolean
isMusic
(
String
fileSuffix
)
throws
Exception
{
String
[]
arr
=
{
"wma"
,
"mpc"
,
"ogg"
,
"wav"
,
"mpeg"
,
"mp3"
};
return
Arrays
.
stream
(
arr
).
anyMatch
(
e
->
e
.
equals
(
fileSuffix
));
return
Arrays
.
stream
(
arr
).
anyMatch
(
e
->
e
.
equals
(
fileSuffix
.
replace
(
"."
,
""
)
));
}
public
static
boolean
isVedio
(
String
fileSuffix
)
throws
Exception
{
String
[]
arr
=
{
"rm"
,
"rmvb"
,
"mp4"
,
"wmv"
,
"asf"
,
"asx"
,
"3gp"
,
"mov"
,
"m4v"
,
"avi"
,
"dat"
,
"mkv"
,
"flv"
,
"vob"
};
return
Arrays
.
stream
(
arr
).
anyMatch
(
e
->
e
.
equals
(
fileSuffix
));
return
Arrays
.
stream
(
arr
).
anyMatch
(
e
->
e
.
equals
(
fileSuffix
.
replace
(
"."
,
""
)
));
}
}
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