Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
D
data-server
Project
Project
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
licc
data-server
Commits
44413526
Commit
44413526
authored
Mar 11, 2021
by
liqin
💬
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://111.203.232.171:8888/licc/shop-mall
into master
parents
590b1a41
fd02f155
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
UploadServiceImpl.java
...java/cn/wisenergy/service/app/impl/UploadServiceImpl.java
+4
-2
No files found.
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/UploadServiceImpl.java
View file @
44413526
...
@@ -42,7 +42,7 @@ public class UploadServiceImpl implements UploadService {
...
@@ -42,7 +42,7 @@ public class UploadServiceImpl implements UploadService {
@Autowired
@Autowired
private
UsersMapper
usersMapper
;
private
UsersMapper
usersMapper
;
@Value
(
"${file.upload.path:#{null}}"
)
//
@Value("${file.upload.path:#{null}}")
private
String
path
;
private
String
path
;
/**
/**
...
@@ -152,10 +152,10 @@ public class UploadServiceImpl implements UploadService {
...
@@ -152,10 +152,10 @@ public class UploadServiceImpl implements UploadService {
public
List
imageUpload
(
MultipartFile
[]
files
,
String
zxField
,
String
zxAddress
,
String
inviteCode
)
{
public
List
imageUpload
(
MultipartFile
[]
files
,
String
zxField
,
String
zxAddress
,
String
inviteCode
)
{
//获取上传图片数量,打印在控制台
//获取上传图片数量,打印在控制台
System
.
out
.
println
(
"上传图片数量"
+
files
.
length
);
System
.
out
.
println
(
"上传图片数量"
+
files
.
length
);
String
zxUrl
=
new
String
();
//创建集合
//创建集合
List
<
Map
<
String
,
Object
>>
root
=
new
ArrayList
<
Map
<
String
,
Object
>>();
List
<
Map
<
String
,
Object
>>
root
=
new
ArrayList
<
Map
<
String
,
Object
>>();
String
fileName1
=
null
;
String
fileName1
=
null
;
String
zxUrl
=
null
;
// 要上传的目标文件存放的绝对路径
// 要上传的目标文件存放的绝对路径
// final String localPath = path;
// final String localPath = path;
Long
time
=
new
Date
().
getTime
();
Long
time
=
new
Date
().
getTime
();
...
@@ -167,6 +167,7 @@ public class UploadServiceImpl implements UploadService {
...
@@ -167,6 +167,7 @@ public class UploadServiceImpl implements UploadService {
if
(
file
.
isEmpty
())
{
if
(
file
.
isEmpty
())
{
System
.
out
.
println
(
"上传图片为空,请重新上传"
);
System
.
out
.
println
(
"上传图片为空,请重新上传"
);
}
}
//判断上传文件格式
//判断上传文件格式
String
fileType
=
file
.
getContentType
();
String
fileType
=
file
.
getContentType
();
if
(
fileType
.
equals
(
"image/jpeg"
)
||
fileType
.
equals
(
"image/png"
))
{
if
(
fileType
.
equals
(
"image/jpeg"
)
||
fileType
.
equals
(
"image/png"
))
{
...
@@ -181,6 +182,7 @@ public class UploadServiceImpl implements UploadService {
...
@@ -181,6 +182,7 @@ public class UploadServiceImpl implements UploadService {
//设置文件存储路径,可以存放在你想要指定的路径里面
//设置文件存储路径,可以存放在你想要指定的路径里面
String
Path
=
"/opt/upload/video/"
;
//上传图片存放位置
String
Path
=
"/opt/upload/video/"
;
//上传图片存放位置
zxUrl
+=
localPath
+
fileName
+
","
;
zxUrl
+=
localPath
+
fileName
+
","
;
if
(
FileUtils
.
upload
(
file
,
Path
,
fileName
))
{
if
(
FileUtils
.
upload
(
file
,
Path
,
fileName
))
{
//文件存放的相对路径(一般存放在数据库用于img标签的src)
//文件存放的相对路径(一般存放在数据库用于img标签的src)
String
relativePath
=
"用于判断是否图片上传成功,返回值有:"
+
fileName
;
String
relativePath
=
"用于判断是否图片上传成功,返回值有:"
+
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