|
|
@@ -2,14 +2,12 @@ package com.iformall.service.sm.impl; |
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.google.common.collect.Lists; |
|
|
|
import com.iformall.common.ErrorCode; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.domain.vo.sm.PreviewVoiceVO; |
|
|
|
import com.iformall.domain.po.sm.VoiceInfo; |
|
|
|
import com.iformall.domain.vo.VoiceInfoVo; |
|
|
|
import com.iformall.enums.EnumSex; |
|
|
|
import com.iformall.enums.EnumSpeakType; |
|
|
|
import com.iformall.exception.BizException; |
|
|
|
import com.iformall.file.aliyun.bean.AliyunOSSConfig; |
|
|
@@ -20,7 +18,6 @@ import com.iformall.utils.Constant; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.util.ObjectUtils; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
@@ -79,7 +76,7 @@ public class VoiceInfoServiceImpl implements VoiceInfoService { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Double previewVoice(AiPreviewParam aiPreviewParam) { |
|
|
|
public PreviewVoiceVO previewVoice(AiPreviewParam aiPreviewParam) { |
|
|
|
VoiceInfo voiceInfo = voiceMapper.selectOne(new LambdaQueryWrapper<VoiceInfo>() |
|
|
|
.eq(VoiceInfo::getIsDel, 0) |
|
|
|
.eq(VoiceInfo::getId, aiPreviewParam.getVoice_id())); |
|
|
@@ -92,7 +89,10 @@ public class VoiceInfoServiceImpl implements VoiceInfoService { |
|
|
|
param.setGender(voiceInfo.getSex() == 1 ? "male" : "female"); |
|
|
|
AiPreviewResult result = AiVideoHelper.voicePreview(param); |
|
|
|
if (result.isSuccess()){ |
|
|
|
return result.getTime(); |
|
|
|
PreviewVoiceVO vo = new PreviewVoiceVO(); |
|
|
|
vo.setTime(result.getTime()); |
|
|
|
vo.setUrl(result.getUrl()); |
|
|
|
return vo; |
|
|
|
} |
|
|
|
throw new BizException(result.getCode(), result.getMsgInfo(result.getCode(),result.getMsg())); |
|
|
|
} |
|
|
|