feat(一键成片):新增请求方法传递参数实现自动剪辑

This commit is contained in:
2025-03-14 11:42:05 +08:00
parent 66abda77d5
commit 77434fe5a0
6 changed files with 110 additions and 0 deletions
+4
View File
@@ -119,6 +119,10 @@
<version>4.0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webflux</artifactId>
</dependency>
</dependencies>
@@ -0,0 +1,57 @@
package com.central.order.controller;
import com.central.common.model.Result;
import com.central.order.model.RequestParamsEntity;
import com.central.order.model.SourceDTO;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import java.util.Arrays;
import java.util.List;
/**
* 一键成片
*
*/
@Slf4j
@RestController
@Tag(name = "剪辑管理")
@RequestMapping("/auto/cut")
public class AutoCutVideoController {
@Value("${videos.edit-config.url}")
private String url;
private final RestTemplate restTemplate = new RestTemplate();
@GetMapping()
public Result sendPostRequest() {
// 构造请求参数
List<String> textList = List.of("测试测试");
List<String> videoList = List.of("https://lsy010.oss-cn-beijing.aliyuncs.com/1.mp4");
List<String> audioList = Arrays.asList(
"https://lsy010.oss-cn-beijing.aliyuncs.com/%E5%B7%B1%E4%BA%A5%E6%9D%82%E8%AF%97.wav",
"https://lsy010.oss-cn-beijing.aliyuncs.com/%E6%B8%94%E6%AD%8C%E5%AD%90.wav",
"https://lsy010.oss-cn-beijing.aliyuncs.com/%E7%A4%BA%E5%84%BF.wav",
"https://lsy010.oss-cn-beijing.aliyuncs.com/%E7%A8%9A%E5%AD%90%E5%BC%84%E5%86%B0.wav"
);
List<String> imageList = Arrays.asList("https://lsy010.oss-cn-beijing.aliyuncs.com/63bedec88986d.png");
SourceDTO sourceDTO = new SourceDTO(textList, videoList, audioList, imageList);
RequestParamsEntity requestParams = new RequestParamsEntity(
"68c9ba9a92934623acdb6e84b4174f43",
"112233444",
"222222",
sourceDTO
);
// 发送POST请求
return Result.succeed(restTemplate.postForObject(url, requestParams, Object.class));
}
}
@@ -27,6 +27,7 @@ public class QrCode extends SuperEntity {
private String codeId;
private Long tourismId;
private String templateId;
private String filePath;
private transient String viewUrl;
@@ -0,0 +1,21 @@
package com.central.order.model;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
/**
* 一键成片请求参数实体类
* @author lsl
*
*/
@Setter
@Getter
@AllArgsConstructor
public class RequestParamsEntity {
private String templateId;
private String orderSn;
private String userId;
private SourceDTO sourceDTO;
}
@@ -0,0 +1,24 @@
package com.central.order.model;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
/**
* 定义请求参数中的sourceDTO类
* @author lsl
*
*/
@Setter
@Getter
@AllArgsConstructor
public class SourceDTO {
private List<String> textList;
private List<String> videoList;
private List<String> audioList;
private List<String> imageList;
}
@@ -57,3 +57,6 @@ file:
# jdbc-url: jdbc:mysql://${zlt.datasource.ip}:3306/logger-center?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai
# username: ${zlt.datasource.username}
# password: ${zlt.datasource.password}
videos:
edit-config:
url: https://www.lieflat.cn/api/editTask/editTaskSubmit