You've already forked FrameTour-BE
fix(task): 修复 vlog视频文件名生成逻辑
All checks were successful
ZhenTu-BE/pipeline/head This commit looks good
All checks were successful
ZhenTu-BE/pipeline/head This commit looks good
- 使用 MD5 哈希算法生成唯一的文件名前缀,以避免文件名冲突 - 将任务创建时间加入哈希计算,确保即使任务 ID 相同也能生成不同的文件名 - 修改涉及两个代码块,分别处理视频上传和获取视频 URL 的场景
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.ycwl.basic.service.task.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.crypto.digest.MD5;
|
||||
import com.ycwl.basic.utils.JacksonUtil;
|
||||
import com.ycwl.basic.biz.OrderBiz;
|
||||
import com.ycwl.basic.biz.TaskStatusBiz;
|
||||
@@ -479,7 +480,8 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
}
|
||||
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(task.getScenicId());
|
||||
IStorageAdapter adapter = scenicService.getScenicTmpStorageAdapter(task.getScenicId());
|
||||
String filename = StorageUtil.joinPath(StorageConstant.VLOG_PATH, task.getId() + "_" + task.getScenicId() + ".mp4");
|
||||
String hash = MD5.create().digestHex(task.getId() + "_" + task.getCreateTime().getTime());
|
||||
String filename = StorageUtil.joinPath(StorageConstant.VLOG_PATH, hash + "_" + task.getScenicId() + ".mp4");
|
||||
adapter.setAcl(StorageAcl.PUBLIC_READ, filename);
|
||||
videoReUploader.addVideoTask(video.getId());
|
||||
int isBuy = 0;
|
||||
@@ -547,7 +549,8 @@ public class TaskTaskServiceImpl implements TaskService {
|
||||
} catch (Exception e) {
|
||||
adapter = scenicService.getScenicStorageAdapter(task.getScenicId());
|
||||
}
|
||||
String filename = StorageUtil.joinPath(StorageConstant.VLOG_PATH, task.getId() + "_" + task.getScenicId() + ".mp4");
|
||||
String hash = MD5.create().digestHex(task.getId() + "_" + task.getCreateTime().getTime());
|
||||
String filename = StorageUtil.joinPath(StorageConstant.VLOG_PATH, hash + "_" + task.getScenicId() + ".mp4");
|
||||
// 生成
|
||||
String url = adapter.getUrl(filename);
|
||||
TaskEntity updateTask = new TaskEntity();
|
||||
|
Reference in New Issue
Block a user