Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
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
YZG
yzg-util
Commits
3b4a7b44
Commit
3b4a7b44
authored
Nov 16, 2020
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
参数处理
parent
cc4bbde3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
4 deletions
+48
-4
YzgFileUploadItemResVo.java
...com/yanzuoguang/cloud/file/vo/YzgFileUploadItemResVo.java
+14
-0
YzgFileUploadReqVo.java
...ava/com/yanzuoguang/cloud/file/vo/YzgFileUploadReqVo.java
+18
-3
YzgFileServiceImpl.java
...n/java/com/yanzuoguang/cloud/file/YzgFileServiceImpl.java
+16
-1
No files found.
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/file/vo/YzgFileUploadItemResVo.java
View file @
3b4a7b44
...
...
@@ -17,6 +17,12 @@ public class YzgFileUploadItemResVo extends YzgFileBaseVo {
@ApiModelProperty
(
notes
=
"上传的文件前台路径"
,
position
=
10
)
private
String
localFile
;
/**
* 视频时的第一帧相关信息
*/
@ApiModelProperty
(
notes
=
"上传的文件前台路径"
,
position
=
20
)
private
YzgFileBaseVo
first
;
public
String
getLocalFile
()
{
return
localFile
;
}
...
...
@@ -24,4 +30,12 @@ public class YzgFileUploadItemResVo extends YzgFileBaseVo {
public
void
setLocalFile
(
String
localFile
)
{
this
.
localFile
=
localFile
;
}
public
YzgFileBaseVo
getFirst
()
{
return
first
;
}
public
void
setFirst
(
YzgFileBaseVo
first
)
{
this
.
first
=
first
;
}
}
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/file/vo/YzgFileUploadReqVo.java
View file @
3b4a7b44
package
com
.
yanzuoguang
.
cloud
.
file
.
vo
;
import
com.yanzuoguang.util.vo.BaseVo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
org.springframework.web.multipart.MultipartFile
;
...
...
@@ -11,20 +12,26 @@ import org.springframework.web.multipart.MultipartFile;
* @author 颜佐光
*/
@ApiModel
(
description
=
"图片上传接口请求参数,调用本接口后需要后台服务调用路径转换接口"
)
public
class
YzgFileUploadReqVo
{
public
class
YzgFileUploadReqVo
extends
BaseVo
{
/**
* 文件数组
*/
@ApiModelProperty
(
notes
=
"文件数组"
,
value
=
"文件数组"
)
@ApiModelProperty
(
notes
=
"文件数组"
,
value
=
"文件数组"
,
position
=
10
)
private
MultipartFile
[]
file
;
/**
* 临时文件夹名称:默认temp
*/
@ApiModelProperty
(
notes
=
"临时文件夹名称:默认temp"
,
value
=
"临时文件夹名称:默认temp"
)
@ApiModelProperty
(
notes
=
"临时文件夹名称:默认temp"
,
value
=
"临时文件夹名称:默认temp"
,
position
=
20
)
private
String
folder
;
/**
* 视频时获取第一帧:默认false
*/
@ApiModelProperty
(
notes
=
"视频时获取第一帧:默认false"
,
value
=
"视频时获取第一帧:默认false"
,
position
=
30
)
private
boolean
first
;
public
MultipartFile
[]
getFile
()
{
return
file
;
}
...
...
@@ -40,4 +47,12 @@ public class YzgFileUploadReqVo {
public
void
setFolder
(
String
folder
)
{
this
.
folder
=
folder
;
}
public
boolean
isFirst
()
{
return
first
;
}
public
void
setFirst
(
boolean
first
)
{
this
.
first
=
first
;
}
}
yzg-util-file/src/main/java/com/yanzuoguang/cloud/file/YzgFileServiceImpl.java
View file @
3b4a7b44
...
...
@@ -8,7 +8,6 @@ import com.yanzuoguang.util.cache.MemoryCache;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.helper.DateHelper
;
import
com.yanzuoguang.util.helper.FileHelper
;
import
com.yanzuoguang.util.helper.HttpHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
...
...
@@ -79,10 +78,26 @@ public class YzgFileServiceImpl implements YzgFileService {
throw
new
CodeException
(
"文件保存失败"
,
ex
);
}
// 视频上传结果
YzgFileUploadItemResVo
item
=
new
YzgFileUploadItemResVo
();
item
.
setLocalFile
(
originalFilename
);
fileConfig
.
init
(
item
,
serverFile
);
res
.
getList
().
add
(
item
);
if
(
item
.
getType
()
==
FileHelper
.
FILE_TYPE_VIDEO
)
{
// 转换后的文件路径
String
zipTo
=
serverFile
+
".jpg"
;
// 生成转换参数
YzgFileConvertVideoFirstReqVo
firstReq
=
new
YzgFileConvertVideoFirstReqVo
();
firstReq
.
setFrom
(
serverFile
);
firstReq
.
setTo
(
zipTo
);
// 转换视频首帧
this
.
convertVideoFirst
(
firstReq
);
// 转换后的结果
YzgFileBaseVo
firstRes
=
fileConfig
.
init
(
zipTo
);
item
.
setFirst
(
firstRes
);
}
}
return
res
;
...
...
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