| @@ -46,6 +46,12 @@ public class PersonMouldController extends BaseController { | |||||
| public ResultData list(@ModelAttribute PersonMould record, Integer pageNum, Integer pageSize) { | public ResultData list(@ModelAttribute PersonMould record, Integer pageNum, Integer pageSize) { | ||||
| logger.debug("[" + getIpAddr() + "] MouldPatchController::list"); | logger.debug("[" + getIpAddr() + "] MouldPatchController::list"); | ||||
| if (record == null) record = new PersonMould(); | if (record == null) record = new PersonMould(); | ||||
| if(record.getVideoType() != null && record.getVideoType().intValue() == -1){ | |||||
| record.setVideoType(null); | |||||
| } | |||||
| if(record.getSex() != null && record.getSex().intValue() == -1){ | |||||
| record.setSex(null); | |||||
| } | |||||
| // record.setSendType(EnumMouldSendType.auto.getCode()); | // record.setSendType(EnumMouldSendType.auto.getCode()); | ||||
| record.setStatus(EnumaMouldPatchStatus.put_on.getCode()); | record.setStatus(EnumaMouldPatchStatus.put_on.getCode()); | ||||
| record.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); | record.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); | ||||
| @@ -56,6 +56,9 @@ public class UserMouldVideoController extends BaseController { | |||||
| public ResultData list(@ModelAttribute UserMouldVideo record, Integer pageNum, Integer pageSize) { | public ResultData list(@ModelAttribute UserMouldVideo record, Integer pageNum, Integer pageSize) { | ||||
| logger.debug("[" + getIpAddr() + "] UserMouldVideoController::list"); | logger.debug("[" + getIpAddr() + "] UserMouldVideoController::list"); | ||||
| if (record == null) record = new UserMouldVideo(); | if (record == null) record = new UserMouldVideo(); | ||||
| if(record.getVideoType() != null && record.getVideoType().intValue() == -1){ | |||||
| record.setVideoType(null); | |||||
| } | |||||
| record.setUserId(getMemberId()); | record.setUserId(getMemberId()); | ||||
| record.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); | record.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); | ||||
| final PageInfo<UserMouldVideo> page = userMouldVideoService.cListAsPage(record, pageNum, pageSize); | final PageInfo<UserMouldVideo> page = userMouldVideoService.cListAsPage(record, pageNum, pageSize); | ||||
| @@ -118,8 +121,13 @@ public class UserMouldVideoController extends BaseController { | |||||
| if(StringUtils.isEmpty(mouldVideo.getPaperwork())){ | if(StringUtils.isEmpty(mouldVideo.getPaperwork())){ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未填写视频文案"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未填写视频文案"); | ||||
| } | } | ||||
| if(EnumVideoStatus.ing.getCode().equals(mouldVideo.getVideoStatus())){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"生成视频中"); | |||||
| if(!EnumVideoStatus.draft.getCode().equals(mouldVideo.getVideoStatus()) | |||||
| && !EnumVideoStatus.fail.getCode().equals(mouldVideo.getVideoStatus())){ | |||||
| if(EnumVideoStatus.ing.getCode().equals(mouldVideo.getVideoStatus())){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"视频生成中"); | |||||
| }else{ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"视频已生成完成"); | |||||
| } | |||||
| } | } | ||||
| UserMouldVideo mouldVideoUpd = new UserMouldVideo(); | UserMouldVideo mouldVideoUpd = new UserMouldVideo(); | ||||
| @@ -139,6 +147,12 @@ public class UserMouldVideoController extends BaseController { | |||||
| public ResultData findVideo(Long id) { | public ResultData findVideo(Long id) { | ||||
| logger.debug("[" + getIpAddr() + "] MouldPatchController::findVideo"); | logger.debug("[" + getIpAddr() + "] MouldPatchController::findVideo"); | ||||
| UserMouldVideo userMouldVideo = userMouldVideoService.findVideo(id); | UserMouldVideo userMouldVideo = userMouldVideoService.findVideo(id); | ||||
| if(EnumVideoStatus.upload_ing.getCode().equals(userMouldVideo.getVideoStatus()) | |||||
| || EnumVideoStatus.upload_success.getCode().equals(userMouldVideo.getVideoStatus()) | |||||
| || EnumVideoStatus.upload_fail.getCode().equals(userMouldVideo.getVideoStatus())){ | |||||
| //上传阿里云状态 都是生成成功 | |||||
| userMouldVideo.setVideoStatus(EnumVideoStatus.success.getCode()); | |||||
| } | |||||
| return new ResultData(userMouldVideo); | return new ResultData(userMouldVideo); | ||||
| } | } | ||||
| @@ -36,7 +36,7 @@ public class AiVideoHelper { | |||||
| public static AiVideoResult createVideo(AiVideoParam videoParam) { | public static AiVideoResult createVideo(AiVideoParam videoParam) { | ||||
| log.info("生成视频start request:" + JSONObject.toJSONString(videoParam)); | |||||
| log.info("生成视频start request:" + videoParam.neglectImgString()); | |||||
| String response = doPost(uri+"/gen_dh_video", JSONObject.toJSONString(videoParam)); | String response = doPost(uri+"/gen_dh_video", JSONObject.toJSONString(videoParam)); | ||||
| log.info("生成视频end response:"+response); | log.info("生成视频end response:"+response); | ||||
| @@ -35,6 +35,51 @@ public class AiVideoParam { | |||||
| private String voice_style; | private String voice_style; | ||||
| private VideoFiles video_files; | private VideoFiles video_files; | ||||
| public String neglectImgString(){ | |||||
| StringBuffer str = new StringBuffer(); | |||||
| str.append("{"); | |||||
| str.append("\"gen_txt\":").append("\"").append(gen_txt).append("\","); | |||||
| str.append("\"video_template_id\":").append("\"").append(video_template_id).append("\","); | |||||
| str.append("\"voice_id\":").append("\"").append(voice_id).append("\","); | |||||
| str.append("\"voice_style\":").append("\"").append(voice_style).append("\","); | |||||
| if(video_files != null){ | |||||
| str.append("\"video_files\":").append("{"); | |||||
| if(video_files.getBack_ground() != null){ | |||||
| str.append("\"back_ground\":").append("{") | |||||
| .append("\"image\":").append("\"").append("\",") | |||||
| .append("\"type\":").append("\"").append(video_files.getBack_ground().getType()).append("\"") | |||||
| .append("},"); | |||||
| } | |||||
| if(video_files.getDigital_human() != null){ | |||||
| str.append("\"digital_human\":").append("{") | |||||
| .append("\"coord\":").append(video_files.getDigital_human().getCoord().toString()).append(",") | |||||
| .append("\"level\":").append(video_files.getDigital_human().getLevel()).append(",") | |||||
| .append("\"ratio\":").append(video_files.getDigital_human().getRatio()) | |||||
| .append("},"); | |||||
| } | |||||
| if(video_files.getMaterial() != null && video_files.getMaterial().size() > 0){ | |||||
| str.append("\"material\":").append("["); | |||||
| for (Material material:video_files.getMaterial()) { | |||||
| if(material != null){ | |||||
| str.append("{"); | |||||
| str.append("\"coord\":").append(material.getCoord().toString()).append(",") | |||||
| .append("\"image\":").append("\"").append("\",") | |||||
| .append("\"level\":").append(material.getLevel()).append(",") | |||||
| .append("\"ratio\":").append(material.getRatio()); | |||||
| str.append("},"); | |||||
| } | |||||
| } | |||||
| str.deleteCharAt(str.length()-1); | |||||
| str.append("]"); | |||||
| } | |||||
| str.append("},"); | |||||
| } | |||||
| str.deleteCharAt(str.length()-1); | |||||
| str.append("}"); | |||||
| return str.toString(); | |||||
| } | |||||
| @Data | @Data | ||||
| public static class VideoFiles { | public static class VideoFiles { | ||||
| private BackGround back_ground; | private BackGround back_ground; | ||||