Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
shop-Mall
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
shop-Mall
Commits
b0a4039e
Commit
b0a4039e
authored
Mar 09, 2021
by
liqin
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fixed
parent
c88ee674
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
9 deletions
+9
-9
Dockerfile
Dockerfile
+1
-1
UploadServiceImpl.java
...java/cn/wisenergy/service/app/impl/UploadServiceImpl.java
+7
-7
application-test.yml
wisenergy-web-admin/src/main/resources/application-test.yml
+1
-1
No files found.
Dockerfile
View file @
b0a4039e
#FROM
openjdk:8-jdk-alpine
#FROM
halcom/oracle-jdk8:151
FROM
liumiaocn/jdk:ora8u201-alpine3.9-glibc2.29
FROM
liumiaocn/jdk:ora8u201-alpine3.9-glibc2.29
USER
root
USER
root
MAINTAINER
Danny Lee
MAINTAINER
Danny Lee
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/UploadServiceImpl.java
View file @
b0a4039e
...
@@ -42,6 +42,8 @@ public class UploadServiceImpl implements UploadService {
...
@@ -42,6 +42,8 @@ public class UploadServiceImpl implements UploadService {
@Autowired
@Autowired
private
ShopZxMapper
shopZxMapper
;
private
ShopZxMapper
shopZxMapper
;
@Value
(
"${file.upload.path:#{null}}"
)
private
String
path
;
/**
/**
* 视频文件上传
* 视频文件上传
...
@@ -194,12 +196,12 @@ public class UploadServiceImpl implements UploadService {
...
@@ -194,12 +196,12 @@ public class UploadServiceImpl implements UploadService {
//创建集合
//创建集合
List
<
Map
<
String
,
Object
>>
root
=
new
ArrayList
<
Map
<
String
,
Object
>>();
List
<
Map
<
String
,
Object
>>
root
=
new
ArrayList
<
Map
<
String
,
Object
>>();
String
imgUrl
=
null
;
String
imgUrl
=
""
;
String
zxName
=
null
;
String
zxName
=
null
;
String
fileName
=
null
;
String
fileName
=
null
;
String
zxUrl
=
null
;
String
zxUrl
=
null
;
// 要上传的目标文件存放的绝对路径
// 要上传的目标文件存放的绝对路径
final
String
localPath
=
"d:\\IDEAProject\\imageupload\\target\\classes\\static\\img"
;
final
String
localPath
=
path
;
Map
<
String
,
Object
>
result
=
new
HashMap
<
String
,
Object
>();
//一个文件上传的结果
Map
<
String
,
Object
>
result
=
new
HashMap
<
String
,
Object
>();
//一个文件上传的结果
String
result_msg
=
""
;
//上传结果信息
String
result_msg
=
""
;
//上传结果信息
//遍历图片数据
//遍历图片数据
...
@@ -211,7 +213,7 @@ public class UploadServiceImpl implements UploadService {
...
@@ -211,7 +213,7 @@ public class UploadServiceImpl implements UploadService {
}
}
//判断上传文件格式
//判断上传文件格式
String
fileType
=
file
.
getContentType
();
String
fileType
=
file
.
getContentType
();
if
(
fileType
.
equals
(
"image/jpeg"
)
||
fileType
.
equals
(
"image/png"
)
||
fileType
.
equals
(
"image/jpeg"
)
)
{
if
(
fileType
.
equals
(
"image/jpeg"
)
||
fileType
.
equals
(
"image/png"
))
{
// 要上传的目标文件存放的绝对路径
// 要上传的目标文件存放的绝对路径
//上传后保存的文件名(需要防止图片重名导致的文件覆盖)
//上传后保存的文件名(需要防止图片重名导致的文件覆盖)
...
@@ -223,7 +225,7 @@ public class UploadServiceImpl implements UploadService {
...
@@ -223,7 +225,7 @@ public class UploadServiceImpl implements UploadService {
fileName
=
UUID
.
randomUUID
()
+
suffixName
;
fileName
=
UUID
.
randomUUID
()
+
suffixName
;
zxUrl
=
""
;
zxUrl
=
""
;
zxName
+=
fileName
+
","
;
zxName
+=
fileName
+
","
;
imgUrl
+=
localPath
+
fileName
+
","
;
imgUrl
+=
localPath
+
fileName
+
","
;
// shopZxMapper.zxadd(zxUrl,userId,zxName,zxField,imgUrl,zxAddress);
// shopZxMapper.zxadd(zxUrl,userId,zxName,zxField,imgUrl,zxAddress);
if
(
FileUtils
.
upload
(
file
,
localPath
,
fileName
))
{
if
(
FileUtils
.
upload
(
file
,
localPath
,
fileName
))
{
...
@@ -250,8 +252,6 @@ public class UploadServiceImpl implements UploadService {
...
@@ -250,8 +252,6 @@ public class UploadServiceImpl implements UploadService {
System
.
out
.
println
(
imgUrl
);
System
.
out
.
println
(
imgUrl
);
shopZxMapper
.
zxadd
(
zxUrl
,
userId
,
zxName
,
zxField
,
imgUrl
,
zxAddress
);
shopZxMapper
.
zxadd
(
zxUrl
,
userId
,
zxName
,
zxField
,
imgUrl
,
zxAddress
);
return
root
;
return
root
;
}
}
/**
/**
...
@@ -259,7 +259,7 @@ public class UploadServiceImpl implements UploadService {
...
@@ -259,7 +259,7 @@ public class UploadServiceImpl implements UploadService {
*/
*/
private
Path
fileStorageLocation
;
// 文件在本地存储的地址
private
Path
fileStorageLocation
;
// 文件在本地存储的地址
public
UploadServiceImpl
(
@Value
(
"${file.upload.path:#{null}}"
)
String
path
)
{
public
UploadServiceImpl
()
{
if
(!
StringUtil
.
isBlank
(
path
))
{
if
(!
StringUtil
.
isBlank
(
path
))
{
this
.
fileStorageLocation
=
Paths
.
get
(
path
).
toAbsolutePath
().
normalize
();
this
.
fileStorageLocation
=
Paths
.
get
(
path
).
toAbsolutePath
().
normalize
();
try
{
try
{
...
...
wisenergy-web-admin/src/main/resources/application-test.yml
View file @
b0a4039e
...
@@ -52,7 +52,7 @@ uploadFile:
...
@@ -52,7 +52,7 @@ uploadFile:
location
:
/opt/images/upload_flowChart/
#自定义上传文件服务器硬盘保存路径 ,linux服务器保存路径 /home/changfa/app/wxbjgkpt/upload_flowChart/
location
:
/opt/images/upload_flowChart/
#自定义上传文件服务器硬盘保存路径 ,linux服务器保存路径 /home/changfa/app/wxbjgkpt/upload_flowChart/
file
:
file
:
upload
:
upload
:
path
:
C:/aplus
path
:
/opt/images/
jwt
:
jwt
:
# 加密秘钥
# 加密秘钥
secret
:
f4e2e52034348f86b67cde581c0f9eb5
secret
:
f4e2e52034348f86b67cde581c0f9eb5
...
...
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