修改文件上传逻辑,新增配置时样例文件生成成功后立刻将源文件和样例文件上传至中间服务。

Signed-off-by: zhangwei <zhangwei@intranet.com>
This commit is contained in:
zhangwei
2018-08-27 16:39:23 +08:00
parent 5f93a39d3f
commit a231611c39
2 changed files with 66 additions and 16 deletions

View File

@@ -131,9 +131,11 @@ public class AvController extends BaseController {
entity.setResultPath(resultFileAllPath);
File uploadSrcFile = new File(srcFileAllPath);
File uploadSampleFile = new File(sampleFileAllPath);
// File uploadSampleFile = new File(sampleFileAllPath);
FileCopyUtils.copy(srcFile.getBytes(), uploadSrcFile);//保存源文件
String host = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath();
entity.setSrcUrl("");
entity.setSampleUrl("");
/*String host = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath();
String srcUrl = host+srcFilePath.substring(srcFilePath.indexOf(Constants.AV_FILE_PATH)+Constants.AV_FILE_PATH.length()-1)+sep+uploadSrcFile.getName();
String sampleUrl = host+sampleFilePath.substring(sampleFilePath.indexOf(Constants.AV_FILE_PATH)+Constants.AV_FILE_PATH.length()-1)+sep+uploadSampleFile.getName();
srcUrl = srcUrl.replace("\\", "/");
@@ -141,7 +143,7 @@ public class AvController extends BaseController {
logger.info("srcUrl:"+srcUrl);
logger.info("sampleUrl:"+sampleUrl);
entity.setSrcUrl(srcUrl);
entity.setSampleUrl(sampleUrl);
entity.setSampleUrl(sampleUrl);*/
// File uploadSrcFile = new File(srcFilePath);
// FileCopyUtils.copy(srcFile.getBytes(), uploadSrcFile);
@@ -209,10 +211,10 @@ public class AvController extends BaseController {
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
String oldSrcUrl = entity.getSrcPath();
String oldSampleUrl = entity.getSamplePath();
// String oldSrcUrl = entity.getSrcPath();
// String oldSampleUrl = entity.getSamplePath();
try {
if(isAudit==1){
/*if(isAudit==1){
Date creatTime = entity.getCreateTime();
//音视频文件上传接口调用
File srcFile = new File(oldSrcUrl);
@@ -254,15 +256,15 @@ public class AvController extends BaseController {
// entity.setSamplePath("");
}
}
}*/
avCfgService.auditAvFileSample(entity,isAudit);
//删除本地源文件和样例文件
if(!oldSrcUrl.equals(entity.getSrcUrl())){
/*if(!oldSrcUrl.equals(entity.getSrcUrl())){
FileUtils.deleteFile(oldSrcUrl);
}
if(!oldSampleUrl.equals(entity.getSampleUrl())){
FileUtils.deleteFile(oldSampleUrl);
}
}*/
}catch(Exception e){
e.printStackTrace();
if(e instanceof MaatConvertException) {