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
9f467414
Commit
9f467414
authored
Nov 12, 2020
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文件处理
parent
95262b2f
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
190 additions
and
4 deletions
+190
-4
YzgFileProcedure.java
...ain/java/com/yanzuoguang/cloud/file/YzgFileProcedure.java
+45
-1
YzgFileService.java
.../main/java/com/yanzuoguang/cloud/file/YzgFileService.java
+30
-3
YzgFileBaseVo.java
...ain/java/com/yanzuoguang/cloud/file/vo/YzgFileBaseVo.java
+11
-0
YzgFileVideoImageInfoVo.java
...om/yanzuoguang/cloud/file/vo/YzgFileVideoImageInfoVo.java
+63
-0
YzgFileServiceImpl.java
...n/java/com/yanzuoguang/cloud/file/YzgFileServiceImpl.java
+41
-0
No files found.
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/file/YzgFileProcedure.java
View file @
9f467414
package
com
.
yanzuoguang
.
cloud
.
file
;
import
com.yanzuoguang.cloud.file.vo.YzgFileMoveReqVo
;
import
com.yanzuoguang.cloud.file.vo.YzgFileVideoImageReqVo
;
import
com.yanzuoguang.mq.service.MqService
;
import
com.yanzuoguang.mq.vo.MessageVo
;
import
com.yanzuoguang.mq.vo.QueueVo
;
...
...
@@ -23,8 +24,9 @@ import java.util.Date;
public
class
YzgFileProcedure
implements
InitializingBean
{
public
static
final
String
YZG_REMOVE_TEMP_FOLDER
=
"YZG_REMOVE_TEMP_FOLDER"
;
public
static
final
String
YZG_MOVE_FILE
=
"YZG_MOVE_FILE"
;
public
static
final
String
YZG_CONVERT_IMAGE
=
"YZG_CONVERT_IMAGE"
;
public
static
final
String
YZG_CONVERT_VIDEO
=
"YZG_CONVERT_VIDEO"
;
@Autowired
private
MqService
mqService
;
...
...
@@ -48,6 +50,8 @@ public class YzgFileProcedure implements InitializingBean {
public
void
afterPropertiesSet
()
throws
Exception
{
mqService
.
createQueue
(
new
QueueVo
(
YZG_REMOVE_TEMP_FOLDER
));
mqService
.
createQueue
(
new
QueueVo
(
YZG_MOVE_FILE
));
mqService
.
createQueue
(
new
QueueVo
(
YZG_CONVERT_IMAGE
));
mqService
.
createQueue
(
new
QueueVo
(
YZG_CONVERT_VIDEO
));
}
/**
...
...
@@ -90,4 +94,44 @@ public class YzgFileProcedure implements InitializingBean {
public
void
moveFile
(
String
json
,
int
dedTime
)
{
mqService
.
message
(
new
MessageVo
(
YZG_MOVE_FILE
,
json
,
dedTime
));
}
/**
* 转换图片
*
* @param req
*/
public
void
convertImage
(
YzgFileVideoImageReqVo
req
)
{
convertImage
(
JsonHelper
.
serialize
(
req
),
0
);
}
/**
* 转换图片
*
* @param json
* @param dedTime
*/
public
void
convertImage
(
String
json
,
int
dedTime
)
{
mqService
.
message
(
new
MessageVo
(
YZG_CONVERT_IMAGE
,
json
,
dedTime
));
}
/**
* 转换视频
*
* @param req
*/
public
void
convertVideo
(
YzgFileVideoImageReqVo
req
)
{
convertVideo
(
JsonHelper
.
serialize
(
req
),
0
);
}
/**
* 转换视频
*
* @param json
* @param dedTime
*/
public
void
convertVideo
(
String
json
,
int
dedTime
)
{
mqService
.
message
(
new
MessageVo
(
YZG_CONVERT_VIDEO
,
json
,
dedTime
));
}
}
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/file/YzgFileService.java
View file @
9f467414
package
com
.
yanzuoguang
.
cloud
.
file
;
import
com.yanzuoguang.cloud.file.vo.YzgFileMoveReqVo
;
import
com.yanzuoguang.cloud.file.vo.YzgFileUploadReqVo
;
import
com.yanzuoguang.cloud.file.vo.YzgFileUploadResVo
;
import
com.yanzuoguang.cloud.file.vo.*
;
/**
* 文件上传路径
...
...
@@ -32,4 +30,33 @@ public interface YzgFileService {
* @param req
*/
void
moveFile
(
YzgFileMoveReqVo
req
);
/**
* 获取文件信息
*
* @param fromUrl
* @return
*/
YzgFileVideoImageInfoVo
getInfo
(
String
fromUrl
);
/**
* 转换图片
*
* @param req
*/
void
convertImage
(
YzgFileVideoImageReqVo
req
);
/**
* 转换视频第一帧
*
* @param req
*/
void
convertVideoFirst
(
YzgFileMoveItemReqVo
req
);
/**
* 转换视频质量
*
* @param req
*/
void
convertVideo
(
YzgFileVideoImageReqVo
req
);
}
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/file/vo/YzgFileBaseVo.java
View file @
9f467414
...
...
@@ -43,6 +43,17 @@ public class YzgFileBaseVo extends BaseVo {
@ApiModelProperty
(
notes
=
"文件类型归档:0-其他文件,1-图片,2-视频,3-音频"
,
position
=
1040
)
private
int
type
=
FileHelper
.
FILE_TYPE_NONE
;
public
YzgFileBaseVo
()
{
}
public
YzgFileBaseVo
(
String
server
,
String
display
,
long
size
,
String
mime
,
int
type
)
{
this
.
server
=
server
;
this
.
display
=
display
;
this
.
size
=
size
;
this
.
mime
=
mime
;
this
.
type
=
type
;
}
public
String
getServer
()
{
return
server
;
}
...
...
yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/file/vo/YzgFileVideoImageInfoVo.java
0 → 100644
View file @
9f467414
package
com
.
yanzuoguang
.
cloud
.
file
.
vo
;
import
io.swagger.annotations.ApiModelProperty
;
/**
* 获取图片信息
*
* @author 颜佐光
*/
public
class
YzgFileVideoImageInfoVo
extends
YzgFileBaseVo
{
/**
* 分辨率x,如: 1920*1080中的1920.
*/
@ApiModelProperty
(
notes
=
"分辨率x,如: 1920*1080中的1920."
)
private
Double
x
;
/**
* 分辨率y,如: 1920*1080中的1080.
*/
@ApiModelProperty
(
notes
=
"分辨率y,如: 1920*1080中的1080."
)
private
Double
y
;
/**
* 质量
*/
@ApiModelProperty
(
notes
=
"质量"
,
position
=
1040
)
private
Double
bitrate
;
public
YzgFileVideoImageInfoVo
()
{
}
public
YzgFileVideoImageInfoVo
(
String
server
,
String
display
,
long
size
,
String
mime
,
int
type
,
double
x
,
double
y
,
double
bitrate
)
{
super
(
server
,
display
,
size
,
mime
,
type
);
this
.
x
=
x
;
this
.
y
=
y
;
this
.
bitrate
=
bitrate
;
}
public
Double
getX
()
{
return
x
;
}
public
void
setX
(
Double
x
)
{
this
.
x
=
x
;
}
public
Double
getY
()
{
return
y
;
}
public
void
setY
(
Double
y
)
{
this
.
y
=
y
;
}
public
Double
getBitrate
()
{
return
bitrate
;
}
public
void
setBitrate
(
Double
bitrate
)
{
this
.
bitrate
=
bitrate
;
}
}
yzg-util-file/src/main/java/com/yanzuoguang/cloud/file/YzgFileServiceImpl.java
View file @
9f467414
...
...
@@ -172,6 +172,47 @@ public class YzgFileServiceImpl implements YzgFileService {
}
/**
* 获取文件信息
*
* @param fromUrl
* @return
*/
@Override
public
YzgFileVideoImageInfoVo
getInfo
(
String
fromUrl
)
{
return
null
;
}
/**
* 移动文件或文件夹
*
* @param req
*/
@Override
public
void
convertImage
(
YzgFileVideoImageReqVo
req
)
{
}
/**
* 转换视频第一帧
*
* @param req
*/
@Override
public
void
convertVideoFirst
(
YzgFileMoveItemReqVo
req
)
{
}
/**
* 移动文件或文件夹
*
* @param req
*/
@Override
public
void
convertVideo
(
YzgFileVideoImageReqVo
req
)
{
}
/**
* 获取行记的显示的图片
*
...
...
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