Commit 9f467414 authored by yanzg's avatar yanzg

文件处理

parent 95262b2f
package com.yanzuoguang.cloud.file; package com.yanzuoguang.cloud.file;
import com.yanzuoguang.cloud.file.vo.YzgFileMoveReqVo; import com.yanzuoguang.cloud.file.vo.YzgFileMoveReqVo;
import com.yanzuoguang.cloud.file.vo.YzgFileVideoImageReqVo;
import com.yanzuoguang.mq.service.MqService; import com.yanzuoguang.mq.service.MqService;
import com.yanzuoguang.mq.vo.MessageVo; import com.yanzuoguang.mq.vo.MessageVo;
import com.yanzuoguang.mq.vo.QueueVo; import com.yanzuoguang.mq.vo.QueueVo;
...@@ -23,8 +24,9 @@ import java.util.Date; ...@@ -23,8 +24,9 @@ import java.util.Date;
public class YzgFileProcedure implements InitializingBean { public class YzgFileProcedure implements InitializingBean {
public static final String YZG_REMOVE_TEMP_FOLDER = "YZG_REMOVE_TEMP_FOLDER"; 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_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 @Autowired
private MqService mqService; private MqService mqService;
...@@ -48,6 +50,8 @@ public class YzgFileProcedure implements InitializingBean { ...@@ -48,6 +50,8 @@ public class YzgFileProcedure implements InitializingBean {
public void afterPropertiesSet() throws Exception { public void afterPropertiesSet() throws Exception {
mqService.createQueue(new QueueVo(YZG_REMOVE_TEMP_FOLDER)); mqService.createQueue(new QueueVo(YZG_REMOVE_TEMP_FOLDER));
mqService.createQueue(new QueueVo(YZG_MOVE_FILE)); 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 { ...@@ -90,4 +94,44 @@ public class YzgFileProcedure implements InitializingBean {
public void moveFile(String json, int dedTime) { public void moveFile(String json, int dedTime) {
mqService.message(new MessageVo(YZG_MOVE_FILE, json, 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));
}
} }
package com.yanzuoguang.cloud.file; package com.yanzuoguang.cloud.file;
import com.yanzuoguang.cloud.file.vo.YzgFileMoveReqVo; import com.yanzuoguang.cloud.file.vo.*;
import com.yanzuoguang.cloud.file.vo.YzgFileUploadReqVo;
import com.yanzuoguang.cloud.file.vo.YzgFileUploadResVo;
/** /**
* 文件上传路径 * 文件上传路径
...@@ -32,4 +30,33 @@ public interface YzgFileService { ...@@ -32,4 +30,33 @@ public interface YzgFileService {
* @param req * @param req
*/ */
void moveFile(YzgFileMoveReqVo 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);
} }
...@@ -43,6 +43,17 @@ public class YzgFileBaseVo extends BaseVo { ...@@ -43,6 +43,17 @@ public class YzgFileBaseVo extends BaseVo {
@ApiModelProperty(notes = "文件类型归档:0-其他文件,1-图片,2-视频,3-音频", position = 1040) @ApiModelProperty(notes = "文件类型归档:0-其他文件,1-图片,2-视频,3-音频", position = 1040)
private int type = FileHelper.FILE_TYPE_NONE; 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() { public String getServer() {
return server; return server;
} }
......
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;
}
}
...@@ -172,6 +172,47 @@ public class YzgFileServiceImpl implements YzgFileService { ...@@ -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) {
}
/** /**
* 获取行记的显示的图片 * 获取行记的显示的图片
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment