| @@ -76,12 +76,6 @@ public class PersonPhotoController extends BaseController { | |||||
| if(StringUtils.isBlank(record.getMaterial())){ | if(StringUtils.isBlank(record.getMaterial())){ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"素材为空"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"素材为空"); | ||||
| } | } | ||||
| //todo 掉第三方接口判断图片是否符合规范 | |||||
| ResultData data = personPhotoService.checkPhoto(record.getMaterial()); | |||||
| if (data.code != 2000){ | |||||
| return new ResultData(data.code,data.message); | |||||
| } | |||||
| if(record.getTitle() == null){ | if(record.getTitle() == null){ | ||||
| record.setTitle("用户自建"); | record.setTitle("用户自建"); | ||||
| } | } | ||||
| @@ -91,6 +85,22 @@ public class PersonPhotoController extends BaseController { | |||||
| return personPhotoService.saveOrUpdate(record); | return personPhotoService.saveOrUpdate(record); | ||||
| } | } | ||||
| @ApiOperation("图片质量审核接口") | |||||
| @PostMapping("checkPhoto") | |||||
| @ApiImplicitParam(name = "material", value = "material", dataType = "String", paramType = "query", required = true) | |||||
| public ResultData checkPhoto(String material) { | |||||
| logger.debug("[" + getIpAddr() + "] PersonPhotoController::checkPhoto"); | |||||
| if (StringUtils.isBlank(material)) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "素材为空"); | |||||
| } | |||||
| ResultData data = personPhotoService.checkPhoto(material); | |||||
| if (data.code == 2000) { | |||||
| return new ResultData(); | |||||
| } | |||||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(), data.message); | |||||
| } | |||||
| @ApiOperation("根据id查询接口") | @ApiOperation("根据id查询接口") | ||||
| @GetMapping("/findById") | @GetMapping("/findById") | ||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | ||||
| @@ -53,7 +53,7 @@ public class VoiceInfoServiceImpl implements VoiceInfoService { | |||||
| @Override | @Override | ||||
| public ResultData voicePreview(AiPreviewParam aiPreviewParam) { | public ResultData voicePreview(AiPreviewParam aiPreviewParam) { | ||||
| if (aiPreviewParam.getVoice_id() == null || StringUtils.isBlank(aiPreviewParam.getGen_txt())) { | if (aiPreviewParam.getVoice_id() == null || StringUtils.isBlank(aiPreviewParam.getGen_txt())) { | ||||
| return new ResultData(); | |||||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(), "参数不能为空"); | |||||
| } | } | ||||
| VoiceInfo voiceInfo = voiceMapper.selectOne(new LambdaQueryWrapper<VoiceInfo>().eq(VoiceInfo::getIsDel, 0).eq(VoiceInfo::getId, aiPreviewParam.getVoice_id())); | VoiceInfo voiceInfo = voiceMapper.selectOne(new LambdaQueryWrapper<VoiceInfo>().eq(VoiceInfo::getIsDel, 0).eq(VoiceInfo::getId, aiPreviewParam.getVoice_id())); | ||||
| @@ -219,14 +219,14 @@ public class AiVideoHelper { | |||||
| // AiVideoResult video = AiVideoHelper.createVideo(videoParam); | // AiVideoResult video = AiVideoHelper.createVideo(videoParam); | ||||
| // | // | ||||
| AiPhotoSpeakParam param = new AiPhotoSpeakParam(); | |||||
| param.setGen_txt("人多泰达股份冲冠怒发代发"); | |||||
| param.setImg(Base64Util.imageUrlToBase64("https://suimang.oss-accelerate.aliyuncs.com/builtin/digitalperson/16760216806604820_cSHoijDX_matting.png")); | |||||
| param.setGender("male"); | |||||
| param.setVoice_id("zh-CN-YunxiNeural"); | |||||
| param.setVoice_style("sad"); | |||||
| param.setUrl("None"); | |||||
| AiPhotoSpeakResult video = AiVideoHelper.createPhotoSpeakVideo(param); | |||||
| // AiPhotoSpeakParam param = new AiPhotoSpeakParam(); | |||||
| // param.setGen_txt("人多泰达股份冲冠怒发代发"); | |||||
| // param.setImg(Base64Util.imageUrlToBase64("https://suimang.oss-accelerate.aliyuncs.com/builtin/digitalperson/16760216806604820_cSHoijDX_matting.png")); | |||||
| // param.setGender("male"); | |||||
| // param.setVoice_id("zh-CN-YunxiNeural"); | |||||
| // param.setVoice_style("sad"); | |||||
| // param.setUrl("None"); | |||||
| // AiPhotoSpeakResult video = AiVideoHelper.createPhotoSpeakVideo(param); | |||||
| // AiCheckPhotoParam param = new AiCheckPhotoParam(); | // AiCheckPhotoParam param = new AiCheckPhotoParam(); | ||||
| // String img = Base64Util.imageUrlToBase64("https://suimang.oss-accelerate.aliyuncs.com/builtin/personmould/16760216806604820_cSHoijDX_grace_1080.jpg"); | // String img = Base64Util.imageUrlToBase64("https://suimang.oss-accelerate.aliyuncs.com/builtin/personmould/16760216806604820_cSHoijDX_grace_1080.jpg"); | ||||
| @@ -234,12 +234,12 @@ public class AiVideoHelper { | |||||
| // AiCheckPhotoResult result = AiVideoHelper.checkPhoto(param); | // AiCheckPhotoResult result = AiVideoHelper.checkPhoto(param); | ||||
| // System.out.println(result); | // System.out.println(result); | ||||
| // | // | ||||
| // AiPreviewParam param = new AiPreviewParam(); | |||||
| // param.setGen_txt("今天是个好日子"); | |||||
| // param.setVoice_id("zh-CN-YunyangNeural"); | |||||
| // param.setVoice_style("default"); | |||||
| // param.setGender("male"); | |||||
| // AiPreviewResult result = AiVideoHelper.voicePreview(param); | |||||
| AiPreviewParam param = new AiPreviewParam(); | |||||
| param.setGen_txt("今天是个好日子"); | |||||
| param.setVoice_id("zh-CN-YunyangNeural"); | |||||
| param.setVoice_style("default"); | |||||
| param.setGender("male"); | |||||
| AiPreviewResult result = AiVideoHelper.voicePreview(param); | |||||
| } | } | ||||