|
|
@@ -19,6 +19,7 @@ import com.iformall.vo.PagePersonMouldVO; |
|
|
|
import com.iformall.vo.PageServiceVedioRecordVO; |
|
|
|
import com.iformall.vo.PageVO; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.List; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
@@ -50,13 +51,29 @@ public class AiVideoServiceImpl implements AiVideoService { |
|
|
|
ServiceInfo serviceInfo = serviceInfoService.getServiceInfo(serviceId); |
|
|
|
// 如果是api接入,则将图片地址转为base64 |
|
|
|
if (EnumThirdPartyType.API_JOIN.getCode().equals(serviceInfo.getType())) { |
|
|
|
//判断时长是否还有 |
|
|
|
if (serviceInfo.getRemainingTimes() <= 0 ) { |
|
|
|
AiVideoResult result = new AiVideoResult(); |
|
|
|
result.setSuccess(false); |
|
|
|
result.setMsg("接入方无有效时长,请联系销售充时长。"); |
|
|
|
return result; |
|
|
|
} |
|
|
|
AiVideoParam.VideoFiles videoFiles = aiVideoParam.getVideo_files(); |
|
|
|
videoFiles.getBack_ground().setImage(Base64Util.imageUrlToBase64(videoFiles.getBack_ground().getImage())); |
|
|
|
for (AiVideoParam.Material material : videoFiles.getMaterial()) { |
|
|
|
material.setImage(Base64Util.imageUrlToBase64(material.getImage())); |
|
|
|
} |
|
|
|
}else if(EnumThirdPartyType.PRIVATE_JOIN.getCode().equals(serviceInfo.getType())) { |
|
|
|
//私有化部署校验时长 |
|
|
|
if (serviceInfo.getRemainingTimes() <= 0 ) { |
|
|
|
AiVideoResult result = new AiVideoResult(); |
|
|
|
result.setSuccess(false); |
|
|
|
result.setMsg("接入方无有效时长,请联系销售充时长。"); |
|
|
|
return result; |
|
|
|
} |
|
|
|
//TODO 本地部署的视频文件怎么处理 |
|
|
|
} |
|
|
|
//TODO 本地部署的视频文件怎么处理 |
|
|
|
|
|
|
|
AiVideoResult video = AiVideoHelper.createVideo(aiVideoParam); |
|
|
|
if (video.isSuccess()) { |
|
|
|
// 记录时长 |
|
|
@@ -66,6 +83,8 @@ public class AiVideoServiceImpl implements AiVideoService { |
|
|
|
.videoUrl(video.getUrl()) |
|
|
|
.build(); |
|
|
|
serviceVideoRecordService.saveServiceVideoRecord(saveServiceVideoRecordDTO); |
|
|
|
//扣掉总时长 |
|
|
|
serviceInfoService.reduceTimes(serviceId, new BigDecimal(video.getDuration()).multiply(new BigDecimal(60)).longValue()); |
|
|
|
} |
|
|
|
return video; |
|
|
|
} |
|
|
|