渲染机支持配置存储地址

This commit is contained in:
2025-04-20 15:06:02 +08:00
parent b36da6ff35
commit 3863c0d963
9 changed files with 45 additions and 23 deletions

View File

@@ -1,5 +1,6 @@
package com.ycwl.basic.service.task;
import com.ycwl.basic.model.pc.task.resp.TaskRespVO;
import com.ycwl.basic.model.pc.template.resp.TemplateRespVO;
import com.ycwl.basic.model.task.req.TaskReqVo;
import com.ycwl.basic.model.task.req.TaskSuccessReqVo;
@@ -32,4 +33,6 @@ public interface TaskService {
Date getTaskShotDate(Long taskId);
void sendVideoGeneratedServiceNotification(Long taskId, Long memberId);
TaskRespVO taskInfo(Long taskId);
}

View File

@@ -650,18 +650,23 @@ public class TaskTaskServiceImpl implements TaskService {
if (task == null) {
return null;
}
IStorageAdapter adapter = scenicService.getScenicTmpStorageAdapter(task.getScenicId());
String filename = StorageUtil.joinPath(StorageConstant.VLOG_PATH, task.getId() + "_" + task.getScenicId() + ".mp4");
if (StringUtils.isBlank(task.getVideoUrl())) {
// 生成
String url = adapter.getUrl(filename);
TaskEntity updateTask = new TaskEntity();
updateTask.setId(taskId);
updateTask.setVideoUrl(url);
taskMapper.update(updateTask);
videoTaskRepository.clearTaskCache(updateTask.getId());
RenderWorkerEntity worker = getWorker(req);
IStorageAdapter adapter;
try {
adapter = StorageFactory.get(worker.getStoreType());
adapter.loadConfig(JSONObject.parseObject(worker.getStoreConfigJson(), Map.class));
} catch (Exception e) {
adapter = scenicService.getScenicStorageAdapter(task.getScenicId());
}
return adapter.getUrlForUpload(new Date(System.currentTimeMillis() + 1000 * 60 * 60), "video/mp4", filename);
String filename = StorageUtil.joinPath(StorageConstant.VLOG_PATH, task.getId() + "_" + task.getScenicId() + ".mp4");
// 生成
String url = adapter.getUrl(filename);
TaskEntity updateTask = new TaskEntity();
updateTask.setId(taskId);
updateTask.setVideoUrl(url);
taskMapper.update(updateTask);
videoTaskRepository.clearTaskCache(updateTask.getId());
return adapter.getUrlForUpload(new Date(System.currentTimeMillis() + 1000 * 3600), "video/mp4", filename);
}
public void sendVideoGeneratedServiceNotification(Long taskId) {
@@ -733,4 +738,9 @@ public class TaskTaskServiceImpl implements TaskService {
adapter.sendTo(new NotifyContent(title, page, params), openId);
}
}
@Override
public TaskRespVO taskInfo(Long taskId) {
return taskMapper.getById(taskId);
}
}