| 
				
				
					
				
				
				 | 
			
			 | 
			@@ -9,6 +9,9 @@ import com.iformall.exception.BizException; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import com.iformall.service.AiVideoService; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import com.iformall.service.sm.UserMouldVideoService; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import com.iformall.service.sm.VoiceInfoService; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import com.iformall.sm.AiVideoHelper; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import com.iformall.sm.AiVideoParam; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import com.iformall.sm.AiVideoResult; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import org.apache.commons.lang3.StringUtils; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import org.springframework.beans.factory.annotation.Autowired; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			import org.springframework.stereotype.Service; | 
		
		
	
	
		
			
				| 
				
					
				
				
					
				
				
				 | 
			
			 | 
			@@ -36,25 +39,31 @@ public class AiVideoServiceImpl implements AiVideoService { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    } | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    @Override | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    public void generateVideo(GenerateVideoDTO dto) { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        // 参数校验 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        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(), "视频已生成完成"); | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        } | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    public AiVideoResult generateVideo(AiVideoParam aiVideoParam, Long taskId) { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			//        // 参数校验 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			//        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); | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        // 更新视频信息 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        updateUserMouldVideo(userMouldVideo); | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        userMouldVideoService.createVideo(userMouldVideo); | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        AiVideoResult video = AiVideoHelper.createVideo(aiVideoParam, taskId); | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        if (video.isSuccess()) { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			            // 记录时长 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        } | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        return video; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    } | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    private void updateUserMouldVideo(UserMouldVideo userMouldVideo) { | 
		
		
	
	
		
			
				| 
				
					
				
				
				
				 | 
			
			 | 
			
  |