| @@ -5,6 +5,7 @@ import com.iformall.controller.BaseController; | |||||
| import com.iformall.dto.GenerateVideoDTO; | import com.iformall.dto.GenerateVideoDTO; | ||||
| import com.iformall.dto.PreviewVideoDTO; | import com.iformall.dto.PreviewVideoDTO; | ||||
| import com.iformall.service.AiVideoService; | import com.iformall.service.AiVideoService; | ||||
| import com.iformall.sm.AiVideoParam; | |||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -29,7 +30,7 @@ public class AiVideoController extends BaseController { | |||||
| @ApiOperation("生成视频") | @ApiOperation("生成视频") | ||||
| @PostMapping("generateVideo") | @PostMapping("generateVideo") | ||||
| public ResultData generateVideo(@RequestBody GenerateVideoDTO dto) { | |||||
| return new ResultData(aiVideoService.generateVideo(dto.getAiVideoParam(), dto.getId(), getServiceId())); | |||||
| public ResultData generateVideo(@RequestBody AiVideoParam aiVideoParam) { | |||||
| return new ResultData(aiVideoService.generateVideo(aiVideoParam, getServiceId())); | |||||
| } | } | ||||
| } | } | ||||
| @@ -23,5 +23,5 @@ public interface AiVideoService { | |||||
| * @param aiVideoParam | * @param aiVideoParam | ||||
| * @return {@link AiVideoResult} | * @return {@link AiVideoResult} | ||||
| */ | */ | ||||
| AiVideoResult generateVideo(AiVideoParam aiVideoParam, Long taskId, Long serviceId); | |||||
| AiVideoResult generateVideo(AiVideoParam aiVideoParam, Long serviceId); | |||||
| } | } | ||||
| @@ -25,8 +25,8 @@ public class AiVideoServiceImpl implements AiVideoService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public AiVideoResult generateVideo(AiVideoParam aiVideoParam, Long taskId, Long serviceId) { | |||||
| AiVideoResult video = AiVideoHelper.createVideo(aiVideoParam, taskId); | |||||
| public AiVideoResult generateVideo(AiVideoParam aiVideoParam, Long serviceId) { | |||||
| AiVideoResult video = AiVideoHelper.createVideo(aiVideoParam); | |||||
| if (video.isSuccess()) { | if (video.isSuccess()) { | ||||
| // 记录时长 | // 记录时长 | ||||
| SaveServiceVideoRecordDTO dto = SaveServiceVideoRecordDTO.builder() | SaveServiceVideoRecordDTO dto = SaveServiceVideoRecordDTO.builder() | ||||
| @@ -349,6 +349,7 @@ public class UserMouldVideoServiceImpl implements UserMouldVideoService { | |||||
| try{ | try{ | ||||
| AiVideoParam videoParam = new AiVideoParam(); | AiVideoParam videoParam = new AiVideoParam(); | ||||
| videoParam.setTask_id(mouldVideo.getId()); | |||||
| videoParam.setGen_txt(paperwork.replaceAll(Constant.text_pause, "[*]")); | videoParam.setGen_txt(paperwork.replaceAll(Constant.text_pause, "[*]")); | ||||
| videoParam.setVideo_template_id(personMouldSmId); | videoParam.setVideo_template_id(personMouldSmId); | ||||
| videoParam.setSubtitle(subtitleMap); | videoParam.setSubtitle(subtitleMap); | ||||
| @@ -391,7 +392,7 @@ public class UserMouldVideoServiceImpl implements UserMouldVideoService { | |||||
| } | } | ||||
| videoParam.setVideo_files(videoFiles); | videoParam.setVideo_files(videoFiles); | ||||
| AiVideoResult video = AiVideoHelper.createVideo(videoParam,mouldVideo.getId()); | |||||
| AiVideoResult video = AiVideoHelper.createVideo(videoParam); | |||||
| if(video.isSuccess()){ | if(video.isSuccess()){ | ||||
| videoUpd.setVideoPath(video.getUrl()); | videoUpd.setVideoPath(video.getUrl()); | ||||
| // videoUpd.setVideoTime(video.getDuration()+""); | // videoUpd.setVideoTime(video.getDuration()+""); | ||||
| @@ -61,10 +61,14 @@ public class AiVideoHelper { | |||||
| } | } | ||||
| public static AiVideoResult createVideo(AiVideoParam videoParam,Long taskId) { | |||||
| public static AiVideoResult createVideo(AiVideoParam videoParam) { | |||||
| videoParam.setTask_id(taskId); | |||||
| videoParam.setCallback_url(callbackUrl + "/callback/oral/broadcasting"); | |||||
| // videoParam.setTask_id(taskId); | |||||
| if (StringUtils.isNotBlank(videoParam.getCallback_url())) { | |||||
| videoParam.setCallback_url(videoParam.getCallback_url()); | |||||
| } else { | |||||
| videoParam.setCallback_url(callbackUrl + "/callback/oral/broadcasting"); | |||||
| } | |||||
| log.info("生成视频start request:" + videoParam.neglectImgString()); | log.info("生成视频start request:" + videoParam.neglectImgString()); | ||||
| log.info("完整参数:{}", JSONObject.toJSONString(videoParam)); | log.info("完整参数:{}", JSONObject.toJSONString(videoParam)); | ||||