|
|
@@ -1,24 +1,12 @@ |
|
|
|
package com.iformall.service.impl; |
|
|
|
|
|
|
|
import com.iformall.common.ErrorCode; |
|
|
|
import com.iformall.domain.dto.neuver.SaveServiceVideoRecordDTO; |
|
|
|
import com.iformall.domain.po.sm.UserMouldVideo; |
|
|
|
import com.iformall.dto.GenerateVideoDTO; |
|
|
|
import com.iformall.dto.PreviewVideoDTO; |
|
|
|
import com.iformall.enums.EnumVideoStatus; |
|
|
|
import com.iformall.exception.BizException; |
|
|
|
import com.iformall.service.AiVideoService; |
|
|
|
import com.iformall.service.sm.ServiceVideoRecordService; |
|
|
|
import com.iformall.service.sm.UserMouldVideoService; |
|
|
|
import com.iformall.service.sm.VoiceInfoService; |
|
|
|
import com.iformall.sm.*; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
import java.util.Optional; |
|
|
|
|
|
|
|
/** |
|
|
|
* ai视频服务 |
|
|
|
* |
|
|
@@ -28,8 +16,6 @@ import java.util.Optional; |
|
|
|
@Service |
|
|
|
public class AiVideoServiceImpl implements AiVideoService { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private UserMouldVideoService userMouldVideoService; |
|
|
|
@Autowired |
|
|
|
private ServiceVideoRecordService serviceVideoRecordService; |
|
|
|
|
|
|
@@ -40,25 +26,6 @@ public class AiVideoServiceImpl implements AiVideoService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public AiVideoResult generateVideo(AiVideoParam aiVideoParam, Long taskId, Long serviceId) { |
|
|
|
// // 参数校验 |
|
|
|
// UserMouldVideo userMouldVideo = Optional.ofNullable(userMouldVideoService.getById(dto.getId())).orElseThrow(() -> new BizException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "未找到用户数据")); |
|
|
|
// if (StringUtils.isBlank(userMouldVideo.getPaperwork())) { |
|
|
|
// throw new BizException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "未填写视频文案"); |
|
|
|
// } |
|
|
|
// if (EnumVideoStatus.ing.getCode().equals(userMouldVideo.getVideoStatus()) |
|
|
|
// || EnumVideoStatus.success.getCode().equals(userMouldVideo.getVideoStatus()) |
|
|
|
// || EnumVideoStatus.upload_ing.getCode().equals(userMouldVideo.getVideoStatus()) |
|
|
|
// || EnumVideoStatus.upload_fail.getCode().equals(userMouldVideo.getVideoStatus())) { |
|
|
|
// throw new BizException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "视频生成中"); |
|
|
|
// } |
|
|
|
// if (EnumVideoStatus.upload_success.getCode().equals(userMouldVideo.getVideoStatus())) { |
|
|
|
// throw new BizException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "视频已生成完成"); |
|
|
|
// } |
|
|
|
// |
|
|
|
// // 更新视频信息 |
|
|
|
// updateUserMouldVideo(userMouldVideo); |
|
|
|
// userMouldVideoService.createVideo(userMouldVideo); |
|
|
|
|
|
|
|
AiVideoResult video = AiVideoHelper.createVideo(aiVideoParam, taskId); |
|
|
|
if (video.isSuccess()) { |
|
|
|
// 记录时长 |
|
|
@@ -70,13 +37,4 @@ public class AiVideoServiceImpl implements AiVideoService { |
|
|
|
} |
|
|
|
return video; |
|
|
|
} |
|
|
|
|
|
|
|
private void updateUserMouldVideo(UserMouldVideo userMouldVideo) { |
|
|
|
UserMouldVideo video = new UserMouldVideo(); |
|
|
|
video.setId(userMouldVideo.getId()); |
|
|
|
video.setVideoStatus(EnumVideoStatus.ing.getCode()); |
|
|
|
video.setVideoMsg(""); |
|
|
|
video.setCreateVideoDate(new Date()); |
|
|
|
userMouldVideoService.updateById(video); |
|
|
|
} |
|
|
|
} |