feat(app): 添加防重复提交注解
- 在视频上传接口添加 @RepeatSubmit 注解 - 在音频上传接口添加 @RepeatSubmit 注解 - 在文字转音频接口添加 @RepeatSubmit 注解 - 设置重复提交间隔为2 秒- 添加重复提交提示信息"请勿重复提交!"
This commit is contained in:
@ -3,6 +3,7 @@ package com.fuyuanshen.app.controller;
|
|||||||
import com.fuyuanshen.app.service.AudioProcessService;
|
import com.fuyuanshen.app.service.AudioProcessService;
|
||||||
import com.fuyuanshen.app.service.VideoProcessService;
|
import com.fuyuanshen.app.service.VideoProcessService;
|
||||||
import com.fuyuanshen.common.core.domain.R;
|
import com.fuyuanshen.common.core.domain.R;
|
||||||
|
import com.fuyuanshen.common.idempotent.annotation.RepeatSubmit;
|
||||||
import com.fuyuanshen.common.web.core.BaseController;
|
import com.fuyuanshen.common.web.core.BaseController;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
@ -13,6 +14,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APP 视频处理控制器
|
* APP 视频处理控制器
|
||||||
@ -27,6 +29,7 @@ public class AppVideoController extends BaseController {
|
|||||||
private final AudioProcessService audioProcessService;
|
private final AudioProcessService audioProcessService;
|
||||||
|
|
||||||
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||||
|
@RepeatSubmit(interval = 2, timeUnit = TimeUnit.SECONDS,message = "请勿重复提交!")
|
||||||
public R<List<String>> uploadVideo(@RequestParam("file") MultipartFile file) {
|
public R<List<String>> uploadVideo(@RequestParam("file") MultipartFile file) {
|
||||||
return R.ok(videoProcessService.processVideo(file));
|
return R.ok(videoProcessService.processVideo(file));
|
||||||
}
|
}
|
||||||
@ -35,6 +38,7 @@ public class AppVideoController extends BaseController {
|
|||||||
* 上传音频文件并转码
|
* 上传音频文件并转码
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = "/audio", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
@PostMapping(value = "/audio", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||||
|
@RepeatSubmit(interval = 2, timeUnit = TimeUnit.SECONDS,message = "请勿重复提交!")
|
||||||
public R<List<String>> uploadAudio(@RequestParam("file") MultipartFile file) {
|
public R<List<String>> uploadAudio(@RequestParam("file") MultipartFile file) {
|
||||||
return R.ok(audioProcessService.processAudio(file));
|
return R.ok(audioProcessService.processAudio(file));
|
||||||
}
|
}
|
||||||
@ -43,6 +47,7 @@ public class AppVideoController extends BaseController {
|
|||||||
* 文字转音频TTS服务
|
* 文字转音频TTS服务
|
||||||
*/
|
*/
|
||||||
@GetMapping("/audioTTS")
|
@GetMapping("/audioTTS")
|
||||||
|
@RepeatSubmit(interval = 2, timeUnit = TimeUnit.SECONDS,message = "请勿重复提交!")
|
||||||
public R<List<String>> uploadAudioTTS(@RequestParam String text) throws IOException {
|
public R<List<String>> uploadAudioTTS(@RequestParam String text) throws IOException {
|
||||||
return R.ok(audioProcessService.generateStandardPcmData(text));
|
return R.ok(audioProcessService.generateStandardPcmData(text));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user