Commit 3b4a7b44 authored by yanzg's avatar yanzg

参数处理

parent cc4bbde3
......@@ -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;
}
}
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;
}
}
......@@ -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;
......
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