diff --git a/suimangCApi/src/main/java/com/iformall/controller/PersonMouldController.java b/suimangCApi/src/main/java/com/iformall/controller/PersonMouldController.java index e2ea0d1..87a74f9 100644 --- a/suimangCApi/src/main/java/com/iformall/controller/PersonMouldController.java +++ b/suimangCApi/src/main/java/com/iformall/controller/PersonMouldController.java @@ -46,6 +46,12 @@ public class PersonMouldController extends BaseController { public ResultData list(@ModelAttribute PersonMould record, Integer pageNum, Integer pageSize) { logger.debug("[" + getIpAddr() + "] MouldPatchController::list"); 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.setStatus(EnumaMouldPatchStatus.put_on.getCode()); record.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); diff --git a/suimangCApi/src/main/java/com/iformall/controller/UserMouldVideoController.java b/suimangCApi/src/main/java/com/iformall/controller/UserMouldVideoController.java index fa4b8d0..03cc6ea 100644 --- a/suimangCApi/src/main/java/com/iformall/controller/UserMouldVideoController.java +++ b/suimangCApi/src/main/java/com/iformall/controller/UserMouldVideoController.java @@ -56,6 +56,9 @@ public class UserMouldVideoController extends BaseController { public ResultData list(@ModelAttribute UserMouldVideo record, Integer pageNum, Integer pageSize) { logger.debug("[" + getIpAddr() + "] UserMouldVideoController::list"); if (record == null) record = new UserMouldVideo(); + if(record.getVideoType() != null && record.getVideoType().intValue() == -1){ + record.setVideoType(null); + } record.setUserId(getMemberId()); record.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); final PageInfo page = userMouldVideoService.cListAsPage(record, pageNum, pageSize); @@ -118,8 +121,13 @@ public class UserMouldVideoController extends BaseController { if(StringUtils.isEmpty(mouldVideo.getPaperwork())){ 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(); @@ -139,6 +147,12 @@ public class UserMouldVideoController extends BaseController { public ResultData findVideo(Long id) { logger.debug("[" + getIpAddr() + "] MouldPatchController::findVideo"); 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); } diff --git a/suimangService/src/main/java/com/iformall/sm/AiVideoHelper.java b/suimangService/src/main/java/com/iformall/sm/AiVideoHelper.java index a3850fa..73122ff 100644 --- a/suimangService/src/main/java/com/iformall/sm/AiVideoHelper.java +++ b/suimangService/src/main/java/com/iformall/sm/AiVideoHelper.java @@ -36,7 +36,7 @@ public class AiVideoHelper { 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)); log.info("生成视频end response:"+response); diff --git a/suimangService/src/main/java/com/iformall/sm/AiVideoParam.java b/suimangService/src/main/java/com/iformall/sm/AiVideoParam.java index 226b546..f700b49 100644 --- a/suimangService/src/main/java/com/iformall/sm/AiVideoParam.java +++ b/suimangService/src/main/java/com/iformall/sm/AiVideoParam.java @@ -35,6 +35,51 @@ public class AiVideoParam { private String voice_style; 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 public static class VideoFiles { private BackGround back_ground;