diff --git a/suimangCApi/src/main/java/com/iformall/controller/VideoCallbackController.java b/suimangCApi/src/main/java/com/iformall/controller/VideoCallbackController.java index 002473a..8c60ee7 100644 --- a/suimangCApi/src/main/java/com/iformall/controller/VideoCallbackController.java +++ b/suimangCApi/src/main/java/com/iformall/controller/VideoCallbackController.java @@ -62,16 +62,6 @@ public class VideoCallbackController extends BaseController { Long task_id = (Long) paranMap.get("task_id");//任务ID String code = (String) paranMap.get("code");//code String msg = (String) paranMap.get("msg"); - Object data = paranMap.get("data"); - - String jsonString = JSONObject.toJSONString(data); - Map dataMap = JSONObject.parseObject(jsonString,Map.class); - Boolean sr = (Boolean) dataMap.get("sr");//判断 sr=True 就是超分的, False 是没超分的 - String url = (String) dataMap.get("url"); - String save_dir = null; - if (!sr){ - save_dir = (String) dataMap.get("save_dir"); - } if (task_id == null){ return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"任务ID不能为空"); @@ -82,44 +72,57 @@ public class VideoCallbackController extends BaseController { return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到任务数据"); } - if (Integer.parseInt(code) != 4000){ - String returnMsg; - if (sr){ - photoSpeakVideo.setVideoStatus(EnumVideoStatus.hy_fail.getCode()); - returnMsg = "超分视频生成失败"; - }else { - photoSpeakVideo.setVideoStatus(EnumVideoStatus.fail.getCode()); - returnMsg = "视频生成失败"; + Object data = paranMap.get("data"); + String jsonString = JSONObject.toJSONString(data); + Map dataMap = JSONObject.parseObject(jsonString,Map.class); + Boolean sr = (Boolean) dataMap.get("sr");//判断 sr=True 就是超分的, False 是没超分的 + String url = (String) dataMap.get("url"); + String save_dir = null; + String audio_path = null; + if(sr){ + if(!EnumVideoStatus.hy_ing.getCode().equals(photoSpeakVideo.getVideoStatus())){ + return new ResultData(); } - photoSpeakVideo.setVideoMsg("(MetaService)"+msg); - photoSpeakVideo.setUpdateDate(new Date()); - photoSpeakVideoService.updateById(photoSpeakVideo); - return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),returnMsg); + }else{ + if(!EnumVideoStatus.ing.getCode().equals(photoSpeakVideo.getVideoStatus())){ + return new ResultData(); + } + save_dir = (String) dataMap.get("save_dir"); + audio_path = (String) dataMap.get("audio_path"); } - if (StringUtils.isEmpty(url)){ return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"视频URL不能为空"); } - if (save_dir != null && !save_dir.equals(photoSpeakVideo.getSaveDir())){ - return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"save_dir参数不一致"); - } + PhotoSpeakVideo speakVideoUpd = new PhotoSpeakVideo(); + speakVideoUpd.setId(photoSpeakVideo.getId()); - if (sr){ - photoSpeakVideo.setVideoStatus(EnumVideoStatus.hy_success.getCode()); - photoSpeakVideo.setVideoPath(url); - }else { - photoSpeakVideo.setVideoStatus(EnumVideoStatus.success.getCode()); - photoSpeakVideo.setVideoPath(url); + if("4000".equals(code)){ + if (sr){ + speakVideoUpd.setVideoStatus(EnumVideoStatus.hy_success.getCode()); + }else { + speakVideoUpd.setVideoStatus(EnumVideoStatus.success.getCode()); + speakVideoUpd.setSaveDir(save_dir); + speakVideoUpd.setAudioPath(audio_path); + } + speakVideoUpd.setVideoPath(url); + speakVideoUpd.setVideoMsg("视频生成成功"); + }else{ + if (sr){ + speakVideoUpd.setVideoStatus(EnumVideoStatus.hy_fail.getCode()); + }else { + speakVideoUpd.setVideoStatus(EnumVideoStatus.fail.getCode()); + } + speakVideoUpd.setVideoMsg("(MetaService)"+msg); } - photoSpeakVideo.setVideoMsg("success"); - photoSpeakVideo.setUpdateDate(new Date()); - photoSpeakVideoService.updateById(photoSpeakVideo); + speakVideoUpd.setUpdateDate(new Date()); + photoSpeakVideoService.updateById(speakVideoUpd); + //TODO 用户相关操作 if (sr){ - photoSpeakVideoService.uploadHyVideo(photoSpeakVideo); + photoSpeakVideoService.uploadHyVideo(speakVideoUpd); }else { - photoSpeakVideoService.uploadVideo(photoSpeakVideo); + photoSpeakVideoService.uploadVideo(speakVideoUpd); } return new ResultData(); diff --git a/suimangCApi/src/main/resources/application-dev.yml b/suimangCApi/src/main/resources/application-dev.yml index a619b33..8ea2189 100644 --- a/suimangCApi/src/main/resources/application-dev.yml +++ b/suimangCApi/src/main/resources/application-dev.yml @@ -191,5 +191,5 @@ logging: photo: url: http://111.198.0.15:22299 hy_url: http://111.198.0.15:22288 - talk: + talk: http://111.198.0.15:22266 callbackUrl: https://phototest.metavatar.cc/C diff --git a/suimangCApi/src/main/resources/application-prod.yml b/suimangCApi/src/main/resources/application-prod.yml index a0a368b..0e295f7 100644 --- a/suimangCApi/src/main/resources/application-prod.yml +++ b/suimangCApi/src/main/resources/application-prod.yml @@ -146,5 +146,5 @@ logging: photo: url: http://111.198.0.15:22299 hy_url: http://111.198.0.15:22288 - talk: + talk: http://111.198.0.15:22266 callbackUrl: https://photo.metavatar.cc/C diff --git a/suimangSchedule/src/main/resources/application-dev.yml b/suimangSchedule/src/main/resources/application-dev.yml index 5d429fe..4f6d56f 100644 --- a/suimangSchedule/src/main/resources/application-dev.yml +++ b/suimangSchedule/src/main/resources/application-dev.yml @@ -194,5 +194,5 @@ logging: photo: url: http://111.198.0.15:22299 hy_url: http://111.198.0.15:22288 - talk: + talk: http://111.198.0.15:22266 callbackUrl: https://phototest.metavatar.cc/C \ No newline at end of file diff --git a/suimangSchedule/src/main/resources/application-prod.yml b/suimangSchedule/src/main/resources/application-prod.yml index efcdab7..160c318 100644 --- a/suimangSchedule/src/main/resources/application-prod.yml +++ b/suimangSchedule/src/main/resources/application-prod.yml @@ -150,5 +150,5 @@ logging: photo: url: http://111.198.0.15:22299 hy_url: http://111.198.0.15:22288 - talk: + talk: http://111.198.0.15:22266 callbackUrl: https://photo.metavatar.cc/C \ No newline at end of file diff --git a/suimangService/src/main/java/com/iformall/domain/po/sm/PhotoSpeakVideo.java b/suimangService/src/main/java/com/iformall/domain/po/sm/PhotoSpeakVideo.java index cd09480..ebb494b 100644 --- a/suimangService/src/main/java/com/iformall/domain/po/sm/PhotoSpeakVideo.java +++ b/suimangService/src/main/java/com/iformall/domain/po/sm/PhotoSpeakVideo.java @@ -114,20 +114,7 @@ public class PhotoSpeakVideo extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value="视频文件",name="videoId") private String videoId; - @TableField(exist = false) - private String videoPathUri; - public String getVideoPathUri(){ - if(StringUtils.isNotBlank(this.videoPath)){ - videoPathUri = AiVideoHelper.uri; - } - return videoPathUri; - } -// public String getPhotoSpeakPathUri(){ -// if(StringUtils.isNotBlank(this.videoPath)){ -// videoPathUri = AiVideoHelper.url; -// } -// return videoPathUri; -// } + @io.swagger.annotations.ApiModelProperty(value="",name="videoPath") private String videoPath; @io.swagger.annotations.ApiModelProperty(value="播放地址",name="videoPlayUrl") diff --git a/suimangService/src/main/java/com/iformall/domain/po/sm/UserMouldVideo.java b/suimangService/src/main/java/com/iformall/domain/po/sm/UserMouldVideo.java index 4077e60..c6fded9 100644 --- a/suimangService/src/main/java/com/iformall/domain/po/sm/UserMouldVideo.java +++ b/suimangService/src/main/java/com/iformall/domain/po/sm/UserMouldVideo.java @@ -152,14 +152,7 @@ public class UserMouldVideo extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value="视频文件",name="videoId") private String videoId; - @TableField(exist = false) - private String videoPathUri; - public String getVideoPathUri(){ - if(StringUtils.isNotBlank(this.videoPath)){ - videoPathUri = AiVideoHelper.uri; - } - return videoPathUri; - } + @io.swagger.annotations.ApiModelProperty(value="",name="videoPath") private String videoPath; @io.swagger.annotations.ApiModelProperty(value="播放地址",name="videoPlayUrl") diff --git a/suimangService/src/main/java/com/iformall/service/sm/impl/PhotoSpeakVideoServiceImpl.java b/suimangService/src/main/java/com/iformall/service/sm/impl/PhotoSpeakVideoServiceImpl.java index 5c779ee..2e6f1fb 100644 --- a/suimangService/src/main/java/com/iformall/service/sm/impl/PhotoSpeakVideoServiceImpl.java +++ b/suimangService/src/main/java/com/iformall/service/sm/impl/PhotoSpeakVideoServiceImpl.java @@ -199,6 +199,8 @@ public class PhotoSpeakVideoServiceImpl implements PhotoSpeakVideoService { @Async @Override public ResultData createVideo(PhotoSpeakVideo photoSpeakVideo) { + PhotoSpeakVideo speakVideoUpd = new PhotoSpeakVideo(); + speakVideoUpd.setId(photoSpeakVideo.getId()); try { AiPhotoSpeakParam param = new AiPhotoSpeakParam(); param.setTask_id(photoSpeakVideo.getId()); @@ -242,27 +244,27 @@ public class PhotoSpeakVideoServiceImpl implements PhotoSpeakVideoService { try { AiPhotoSpeakResult video = AiVideoHelper.createPhotoSpeakVideo(param); if (video.isSuccess()) { - photoSpeakVideo.setSaveDir(video.getSaveDir()); - photoSpeakVideo.setAudioPath(video.getAudioPath()); - photoSpeakVideo.setVideoPath(video.getUrl()); - this.updateById(photoSpeakVideo); +// speakVideoUpd.setSaveDir(video.getSaveDir()); +// speakVideoUpd.setAudioPath(video.getAudioPath()); +// speakVideoUpd.setVideoPath(video.getUrl()); +// this.updateById(speakVideoUpd); return new ResultData(); } - photoSpeakVideo.setVideoStatus(EnumVideoStatus.fail.getCode()); - photoSpeakVideo.setVideoMsg(video.getMsg()); - this.updateById(photoSpeakVideo); + speakVideoUpd.setVideoStatus(EnumVideoStatus.fail.getCode()); + speakVideoUpd.setVideoMsg(video.getMsg()); + this.updateById(speakVideoUpd); return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), video.getMsg()); }catch (Exception e){ - photoSpeakVideo.setVideoStatus(EnumVideoStatus.fail.getCode()); - photoSpeakVideo.setVideoMsg("Meta接口请求异常"); - this.updateById(photoSpeakVideo); + speakVideoUpd.setVideoStatus(EnumVideoStatus.fail.getCode()); + speakVideoUpd.setVideoMsg("Meta接口请求异常"); + this.updateById(speakVideoUpd); return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"Meta接口请求异常"); } } catch (Exception e) { e.printStackTrace(); - photoSpeakVideo.setVideoStatus(EnumVideoStatus.fail.getCode()); - photoSpeakVideo.setVideoMsg("接口请求异常"); - this.updateById(photoSpeakVideo); + speakVideoUpd.setVideoStatus(EnumVideoStatus.fail.getCode()); + speakVideoUpd.setVideoMsg("接口请求异常"); + this.updateById(speakVideoUpd); return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"生成视频失败"); } } @@ -271,8 +273,7 @@ public class PhotoSpeakVideoServiceImpl implements PhotoSpeakVideoService { @Async @Override public void uploadVideo(PhotoSpeakVideo mouldVideo){ - if(EnumVideoStatus.success.getCode().equals(mouldVideo.getVideoStatus()) - || EnumVideoStatus.upload_fail.getCode().equals(mouldVideo.getVideoStatus())){ + if(EnumVideoStatus.success.getCode().equals(mouldVideo.getVideoStatus())){ String url1 = url + mouldVideo.getVideoPath(); VideUploadResult result = videoFactory.getExcutor(videoType).uploadVideoPath(mouldVideo.getTitle(), url1); if(result.isSuccess()){ @@ -280,40 +281,38 @@ public class PhotoSpeakVideoServiceImpl implements PhotoSpeakVideoService { videoUpd.setId(mouldVideo.getId()); videoUpd.setVideoId(result.getVideoId()); videoUpd.setVideoStatus(EnumVideoStatus.upload_ing.getCode()); + videoUpd.setUpdateDate(new Date()); this.saveOrUpdate(videoUpd); - AtomicInteger integer = new AtomicInteger(30); - while (true){ + PhotoSpeakVideo videoUrlUpd = new PhotoSpeakVideo(); + videoUrlUpd.setId(mouldVideo.getId()); + for (int i = 0;i <= 30; i++){ try { - String progress = videoFactory.getExcutor(videoType).getVedioUploadProgress(result.getVideoId()); - Thread.sleep(1000); - if (StringUtils.isNotEmpty(progress) && progress.equals("complete")) { - VideUploadResult videoDetail = videoFactory.getExcutor(videoType).getVideoDetailWithCache(result.getVideoId(),true); - if (videoDetail.isSuccess() - && StringUtils.isNotBlank(videoDetail.getDuration()) - && !"0.0".equals(videoDetail.getDuration())) { - mouldVideo.setCoverImg(videoDetail.getCoverURL()); - mouldVideo.setVideoPlayUrl(videoDetail.getVideoUrl()); - mouldVideo.setVideoTime(videoDetail.getDuration()); - mouldVideo.setVideoSize(videoDetail.getSize()); - mouldVideo.setVideoStatus(EnumVideoStatus.upload_success.getCode()); - this.updateById(mouldVideo); - break; - } - } - - if (integer.getAndDecrement() <= 0){ - mouldVideo.setVideoStatus(EnumVideoStatus.fail.getCode()); - mouldVideo.setVideoMsg("视频上传失败,点击“编辑”重试"); - this.updateById(mouldVideo); - break; - } + Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); - mouldVideo.setVideoStatus(EnumVideoStatus.fail.getCode()); - mouldVideo.setVideoMsg("视频上传失败,点击“编辑”重试"); - this.updateById(mouldVideo); } + String progress = videoFactory.getExcutor(videoType).getVedioUploadProgress(result.getVideoId()); + if (progress.equals("complete")) { + VideUploadResult videoDetail = videoFactory.getExcutor(videoType).getVideoDetailWithCache(result.getVideoId(),true); + if (videoDetail.isSuccess()){ + videoUrlUpd.setCoverImg(videoDetail.getCoverURL()); + videoUrlUpd.setVideoPlayUrl(videoDetail.getVideoUrl()); + videoUrlUpd.setVideoTime(videoDetail.getDuration()); + videoUrlUpd.setVideoSize(videoDetail.getSize()); + videoUrlUpd.setVideoStatus(EnumVideoStatus.upload_success.getCode()); + videoUrlUpd.setVideoMsg("视频上传成功"); + videoUrlUpd.setUpdateDate(new Date()); + this.updateById(videoUrlUpd); + break; + } + } + } + if(videoUrlUpd.getVideoStatus() == null){ + videoUrlUpd.setVideoStatus(EnumVideoStatus.upload_fail.getCode()); + videoUrlUpd.setVideoMsg("视频上传超时"); + videoUrlUpd.setUpdateDate(new Date()); + this.updateById(videoUrlUpd); } } } @@ -358,6 +357,8 @@ public class PhotoSpeakVideoServiceImpl implements PhotoSpeakVideoService { @Override @Async public ResultData videoHy(PhotoSpeakVideo speakVideo) { + PhotoSpeakVideo speakVideoUpd = new PhotoSpeakVideo(); + speakVideoUpd.setId(speakVideo.getId()); try { AiVideoHqParam param = new AiVideoHqParam(); param.setSave_dir(speakVideo.getSaveDir()); @@ -367,31 +368,31 @@ public class PhotoSpeakVideoServiceImpl implements PhotoSpeakVideoService { try { AiVideoHqResult result = AiVideoHelper.videoHq(param); if (result.isSuccess()) { - speakVideo.setVideoStatus(EnumVideoStatus.hy_success.getCode()); - speakVideo.setVideoMsg("超分视频生成成功"); - speakVideo.setVideoPath(result.getUrl()); - this.updateById(speakVideo); +// speakVideoUpd.setVideoStatus(EnumVideoStatus.hy_success.getCode()); +// speakVideoUpd.setVideoMsg("超分视频生成成功"); +// speakVideoUpd.setVideoPath(result.getUrl()); +// this.updateById(speakVideoUpd); return new ResultData(); } - speakVideo.setVideoStatus(EnumVideoStatus.hy_fail.getCode()); - speakVideo.setVideoMsg("Mata视频超分失败"); - speakVideo.setIsHy(EnumYesOrNo.NO.getCode()); - this.updateById(speakVideo); + speakVideoUpd.setVideoStatus(EnumVideoStatus.hy_fail.getCode()); + speakVideoUpd.setVideoMsg("Mata视频超分失败"); + speakVideoUpd.setIsHy(EnumYesOrNo.NO.getCode()); + this.updateById(speakVideoUpd); return new ResultData(result.getCode(), result.getMsgInfo(result.getCode(),result.getMsg())); }catch (Exception e){ e.printStackTrace(); - speakVideo.setVideoStatus(EnumVideoStatus.hy_fail.getCode()); - speakVideo.setVideoMsg("Mata视频超分失败"); - speakVideo.setIsHy(EnumYesOrNo.NO.getCode()); - this.updateById(speakVideo); + speakVideoUpd.setVideoStatus(EnumVideoStatus.hy_fail.getCode()); + speakVideoUpd.setVideoMsg("Mata视频超分失败"); + speakVideoUpd.setIsHy(EnumYesOrNo.NO.getCode()); + this.updateById(speakVideoUpd); return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"Meta接口请求异常"); } } catch (Exception e) { e.printStackTrace(); - speakVideo.setVideoStatus(EnumVideoStatus.hy_fail.getCode()); - speakVideo.setVideoMsg("超分视频接口请求异常"); - speakVideo.setIsHy(EnumYesOrNo.NO.getCode()); - this.updateById(speakVideo); + speakVideoUpd.setVideoStatus(EnumVideoStatus.hy_fail.getCode()); + speakVideoUpd.setVideoMsg("超分视频接口请求异常"); + speakVideoUpd.setIsHy(EnumYesOrNo.NO.getCode()); + this.updateById(speakVideoUpd); return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "超分视频接口请求异常"); } } @@ -399,8 +400,7 @@ public class PhotoSpeakVideoServiceImpl implements PhotoSpeakVideoService { @Async @Override public void uploadHyVideo(PhotoSpeakVideo mouldVideo){ - if(EnumVideoStatus.hy_success.getCode().equals(mouldVideo.getVideoStatus()) - || EnumVideoStatus.hy_upload_fail.getCode().equals(mouldVideo.getVideoStatus())){ + if(EnumVideoStatus.hy_success.getCode().equals(mouldVideo.getVideoStatus())){ String url = hy_url + mouldVideo.getVideoPath(); VideUploadResult result = videoFactory.getExcutor(videoType).uploadVideoPath(mouldVideo.getTitle(), url); if(result.isSuccess()){ @@ -408,42 +408,38 @@ public class PhotoSpeakVideoServiceImpl implements PhotoSpeakVideoService { videoUpd.setId(mouldVideo.getId()); videoUpd.setVideoId(result.getVideoId()); videoUpd.setVideoStatus(EnumVideoStatus.hy_upload_ing.getCode()); + videoUpd.setUpdateDate(new Date()); this.saveOrUpdate(videoUpd); - AtomicInteger integer = new AtomicInteger(30); - while (true){ + PhotoSpeakVideo videoUrlUpd = new PhotoSpeakVideo(); + videoUrlUpd.setId(mouldVideo.getId()); + for (int i = 0;i <= 30; i++){ try { - String progress = videoFactory.getExcutor(videoType).getVedioUploadProgress(result.getVideoId()); - Thread.sleep(1000); - if (progress.equals("complete")) { - VideUploadResult videoDetail = videoFactory.getExcutor(videoType).getVideoDetailWithCache(result.getVideoId(),true); - if (videoDetail.isSuccess() - && StringUtils.isNotBlank(videoDetail.getDuration()) - && !"0.0".equals(videoDetail.getDuration())) { - mouldVideo.setCoverImg(videoDetail.getCoverURL()); - mouldVideo.setVideoPlayUrl(videoDetail.getVideoUrl()); - mouldVideo.setVideoTime(videoDetail.getDuration()); - mouldVideo.setVideoSize(videoDetail.getSize()); - mouldVideo.setVideoStatus(EnumVideoStatus.hy_upload_success.getCode()); - this.updateById(mouldVideo); - break; - } - } - - if (integer.getAndDecrement() <= 0){ - mouldVideo.setVideoStatus(EnumVideoStatus.hy_fail.getCode()); - mouldVideo.setIsHy(EnumYesOrNo.NO.getCode()); - mouldVideo.setVideoMsg("视频上传失败,点击“编辑”重试"); - this.updateById(mouldVideo); - break; - } + Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); - mouldVideo.setVideoStatus(EnumVideoStatus.hy_fail.getCode()); - mouldVideo.setIsHy(EnumYesOrNo.NO.getCode()); - mouldVideo.setVideoMsg("视频上传失败,点击“编辑”重试"); - this.updateById(mouldVideo); } + String progress = videoFactory.getExcutor(videoType).getVedioUploadProgress(result.getVideoId()); + if (progress.equals("complete")) { + VideUploadResult videoDetail = videoFactory.getExcutor(videoType).getVideoDetailWithCache(result.getVideoId(),true); + if (videoDetail.isSuccess()){ + videoUrlUpd.setCoverImg(videoDetail.getCoverURL()); + videoUrlUpd.setVideoPlayUrl(videoDetail.getVideoUrl()); + videoUrlUpd.setVideoTime(videoDetail.getDuration()); + videoUrlUpd.setVideoSize(videoDetail.getSize()); + videoUrlUpd.setVideoStatus(EnumVideoStatus.hy_upload_success.getCode()); + videoUrlUpd.setVideoMsg("视频上传成功"); + videoUrlUpd.setUpdateDate(new Date()); + this.updateById(videoUrlUpd); + break; + } + } + } + if(videoUrlUpd.getVideoStatus() == null){ + videoUrlUpd.setVideoStatus(EnumVideoStatus.hy_upload_fail.getCode()); + videoUrlUpd.setVideoMsg("视频上传超时"); + videoUrlUpd.setUpdateDate(new Date()); + this.updateById(videoUrlUpd); } } } diff --git a/suimangService/src/main/java/com/iformall/service/sm/impl/UserMouldVideoServiceImpl.java b/suimangService/src/main/java/com/iformall/service/sm/impl/UserMouldVideoServiceImpl.java index 3a217fe..f5deca5 100644 --- a/suimangService/src/main/java/com/iformall/service/sm/impl/UserMouldVideoServiceImpl.java +++ b/suimangService/src/main/java/com/iformall/service/sm/impl/UserMouldVideoServiceImpl.java @@ -27,6 +27,7 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.AsyncResult; import org.springframework.stereotype.Service; @@ -60,6 +61,13 @@ public class UserMouldVideoServiceImpl implements UserMouldVideoService { @Autowired String videoType; + @Value("${photo.url}") + private String url; + @Value("${photo.hy_url}") + private String hy_url; + @Value("${photo.talk}") + private String talk_url; + @Override public PageInfo listAsPage(UserMouldVideo record, Integer pageIndex, Integer pageSize) { @@ -378,7 +386,7 @@ public class UserMouldVideoServiceImpl implements UserMouldVideoService { public void uploadVideo(UserMouldVideo mouldVideo){ if(EnumVideoStatus.success.getCode().equals(mouldVideo.getVideoStatus()) || EnumVideoStatus.upload_fail.getCode().equals(mouldVideo.getVideoStatus())){ - String url = mouldVideo.getVideoPathUri() + mouldVideo.getVideoPath(); + String url = talk_url + mouldVideo.getVideoPath(); VideUploadResult result = videoFactory.getExcutor(videoType).uploadVideoPath(mouldVideo.getTitle(), url); if(result.isSuccess()){ UserMouldVideo videoUpd = new UserMouldVideo(); diff --git a/suimangService/src/main/java/com/iformall/sm/AiVideoHelper.java b/suimangService/src/main/java/com/iformall/sm/AiVideoHelper.java index 3e2ba6f..97f5ca2 100644 --- a/suimangService/src/main/java/com/iformall/sm/AiVideoHelper.java +++ b/suimangService/src/main/java/com/iformall/sm/AiVideoHelper.java @@ -31,18 +31,6 @@ import java.util.*; @Component public class AiVideoHelper { -// public static String uri = "http://222.128.9.132:22266"; -// http://nas.pucao.cn:2001/gen_dh_video -// public static String uri = "http://nas.pucao.cn:2001"; - public static String uri = "http://111.198.0.15:22266"; - -// public static String url = "http://nas.pucao.cn:2002"; -// public static String hy_url = "http://nas.pucao.cn:2002"; -// -// public static String url = "http://111.198.0.15:22299"; -// public static String hy_url = "http://111.198.0.15:22288"; - - private static String url; @Value("${photo.url}") public void setUrl(String url){ @@ -71,7 +59,7 @@ public class AiVideoHelper { public static AiVideoResult createVideo(AiVideoParam videoParam) { log.info("生成视频start request:" + videoParam.neglectImgString()); - String response = doPost(uri+"/gen_dh_video", JSONObject.toJSONString(videoParam)); + String response = doPost(talk_url+"/gen_dh_video", JSONObject.toJSONString(videoParam)); log.info("生成视频end response:"+response); AiVideoResult result = new AiVideoResult(); @@ -128,9 +116,9 @@ public class AiVideoHelper { // } } public static AiPhotoSpeakResult createPhotoSpeakVideo(AiPhotoSpeakParam videoParam) { - String response = doPost("http://111.198.0.15:22299" + photo_speak_suffix, JSONObject.toJSONString(videoParam)); + String response = doPost(url + photo_speak_suffix, JSONObject.toJSONString(videoParam)); log.info("生成视频end response:" + response); - log.info("生成视频的 IP:" + "http://111.198.0.15:22299" + photo_speak_suffix); + log.info("生成视频的 IP:" + url + photo_speak_suffix); AiPhotoSpeakResult result = new AiPhotoSpeakResult(); if (StringUtils.isBlank(response)) { result.setSuccess(false);