diff --git a/suimangCApi/src/main/java/com/iformall/controller/PhotoSpeakVideoController.java b/suimangCApi/src/main/java/com/iformall/controller/PhotoSpeakVideoController.java index d88a4cc..944befd 100644 --- a/suimangCApi/src/main/java/com/iformall/controller/PhotoSpeakVideoController.java +++ b/suimangCApi/src/main/java/com/iformall/controller/PhotoSpeakVideoController.java @@ -178,8 +178,8 @@ public class PhotoSpeakVideoController extends BaseController { return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"视频已生成完成"); } - PhotoSpeakVideo videoUpd = new PhotoSpeakVideo(); - videoUpd.setId(record.getId()); +// PhotoSpeakVideo videoUpd = new PhotoSpeakVideo(); +// videoUpd.setId(record.getId()); if (mouldVideo.getPersonPhotoId() == null) { return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未查询到人物照片"); @@ -187,19 +187,13 @@ public class PhotoSpeakVideoController extends BaseController { if(StringUtils.isBlank(mouldVideo.getPersonPhotoUrl())){ return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未查询到人物照片地址"); } - videoUpd.setPersonPhotoId(mouldVideo.getPersonPhotoId()); - videoUpd.setPersonPhotoUrl(mouldVideo.getPersonPhotoUrl()); Integer voiceFrom = mouldVideo.getVoiceFrom(); - videoUpd.setVoiceFrom(voiceFrom); if(EnumVoiceFrom.FROM_MOULD.getCode().equals(voiceFrom)){ String voiceMouldSmId = null; try{ JSONObject personMouldObject = JSONObject.parseObject(mouldVideo.getVoiceMouldSm()); voiceMouldSmId = personMouldObject.getString("mouldSmId"); - videoUpd.setVoiceMouldSm(voiceMouldSmId); - videoUpd.setPaperwork(mouldVideo.getPaperwork()); - videoUpd.setVoiceMouldSm(mouldVideo.getVoiceMouldSm()); }catch(Exception e){ logger.info(e.getMessage()); } @@ -221,7 +215,7 @@ public class PhotoSpeakVideoController extends BaseController { if(StringUtils.isBlank(voiceMaterialUrl)){ return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未找到上传声音文件"); } - videoUpd.setVoiceMaterialUrl(voiceMaterialUrl); + mouldVideo.setVoiceMaterialUrl(voiceMaterialUrl); // videoUpd.setVideoTime(String.valueOf(voiceMaterial.getTime())); } else if (EnumVoiceFrom.MUSIC.getCode().equals(voiceFrom)) { Long musicId = mouldVideo.getMusicId(); @@ -235,7 +229,7 @@ public class PhotoSpeakVideoController extends BaseController { if(musicInfo.getTime() == null){ return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"音乐时长为空"); } - videoUpd.setVoiceMaterialUrl(musicInfo.getUrl()); + mouldVideo.setVoiceMaterialUrl(musicInfo.getUrl()); // videoUpd.setVideoTime(String.valueOf(musicInfo.getTime())); } else { return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"声音数据异常"); @@ -247,7 +241,8 @@ public class PhotoSpeakVideoController extends BaseController { mouldVideoUpd.setCreateVideoDate(new Date()); photoSpeakVideoService.saveOrUpdate(mouldVideoUpd); - photoSpeakVideoService.createVideo(videoUpd); + + photoSpeakVideoService.createVideo(mouldVideo); return new ResultData(); } diff --git a/suimangCApi/src/main/resources/application-dev.yml b/suimangCApi/src/main/resources/application-dev.yml index 8ea2189..9a8269a 100644 --- a/suimangCApi/src/main/resources/application-dev.yml +++ b/suimangCApi/src/main/resources/application-dev.yml @@ -189,7 +189,7 @@ logging: path: ./logs/c photo: - url: http://111.198.0.15:22299 + url: http://nas.pucao.cn:2002 hy_url: http://111.198.0.15:22288 talk: http://111.198.0.15:22266 callbackUrl: https://phototest.metavatar.cc/C diff --git a/suimangSchedule/src/main/resources/application-dev.yml b/suimangSchedule/src/main/resources/application-dev.yml index 4f6d56f..f6541b0 100644 --- a/suimangSchedule/src/main/resources/application-dev.yml +++ b/suimangSchedule/src/main/resources/application-dev.yml @@ -192,7 +192,7 @@ logging: path: ./logs/s photo: - url: http://111.198.0.15:22299 + url: http://nas.pucao.cn:2002 hy_url: http://111.198.0.15:22288 talk: http://111.198.0.15:22266 callbackUrl: https://phototest.metavatar.cc/C \ No newline at end of file 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 1c9cc4f..d5ef578 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 @@ -205,6 +205,17 @@ public class PhotoSpeakVideoServiceImpl implements PhotoSpeakVideoService { param.setTask_id(photoSpeakVideo.getId()); param.setCallback_url(callbackUrl + "/callback/photo/speak"); param.setImg(Base64Util.imageUrlToBase64(photoSpeakVideo.getPersonPhotoUrl())); + Map subtitleMap = new HashMap<>(); + subtitleMap.put("enabled",photoSpeakVideo.getSubtitleEnabled()); + if(EnumYesOrNo.YES.getCode().equals(photoSpeakVideo.getSubtitleEnabled())){ + Map titleParams = JSON.parseObject(photoSpeakVideo.getSubtitleParams(),Map.class); + if(titleParams == null || titleParams.isEmpty()){ + subtitleMap.put("enabled",EnumYesOrNo.NO.getCode()); + }else{ + subtitleMap.put("params",titleParams); + } + } + String voiceMouldSm = photoSpeakVideo.getVoiceMouldSm(); Integer sex = 1; Integer speakType = 0; @@ -220,78 +231,38 @@ public class PhotoSpeakVideoServiceImpl implements PhotoSpeakVideoService { Integer voiceFrom = photoSpeakVideo.getVoiceFrom(); String voiceMaterialUrl = photoSpeakVideo.getVoiceMaterialUrl(); - if (photoSpeakVideo.getSubtitleEnabled()==1){ -// //开启字幕 查询字幕列表 - Map reSubtitle = new HashMap(); - Map params = new HashMap(); - JSONObject subtitle = JSON.parseObject(photoSpeakVideo.getSubtitleParams()); - params.put("Fontname",(subtitle.get("Fontname")==null?"宋体":subtitle.get("Fontname"))); - params.put("Fontsize",(subtitle.get("Fontsize")==null? 25:subtitle.get("Fontsize"))); - params.put("PrimaryColour",(subtitle.get("PrimaryColour")==null?"&Hffffff":subtitle.get("PrimaryColour"))); - params.put("SecondaryColour",(subtitle.get("SecondaryColour")==null?"BBGGRR":subtitle.get("SecondaryColour"))); - params.put("OutlineColour",(subtitle.get("OutlineColour")==null?"BBGGRR":subtitle.get("OutlineColour"))); - params.put("BackColour",(subtitle.get("BackColour")==null?"&H0000ff":subtitle.get("BackColour"))); - params.put("Bold",(subtitle.get("Bold")==null? -1:subtitle.get("Bold"))); - params.put("Italic",(subtitle.get("Italic")==null? 0:subtitle.get("Italic"))); - params.put("Underline",(subtitle.get("Underline")==null? 0:subtitle.get("Underline"))); - params.put("Strikeout",(subtitle.get("Strikeout")==null? 0:subtitle.get("Strikeout"))); - params.put("ScaleX",(subtitle.get("ScaleX")==null? 100:subtitle.get("ScaleX"))); - params.put("ScaleY",(subtitle.get("ScaleY")==null? 100:subtitle.get("ScaleY"))); - params.put("Spacing",(subtitle.get("Spacing")==null? 0:subtitle.get("Spacing"))); - params.put("Angle",(subtitle.get("Angle")==null? 15:subtitle.get("Angle"))); - params.put("BorderStyle",(subtitle.get("BorderStyle")==null?"1":subtitle.get("BorderStyle"))); - params.put("Outline",(subtitle.get("Outline")==null? 20:subtitle.get("Outline"))); - params.put("Shadow",(subtitle.get("Shadow")==null? 12:subtitle.get("Shadow"))); - params.put("Alignment",(subtitle.get("Alignment")==null? 1:subtitle.get("Alignment"))); - params.put("MarginL",(subtitle.get("MarginL")==null? 100:subtitle.get("MarginL"))); - params.put("MarginR",(subtitle.get("MarginR")==null? 100:subtitle.get("MarginR"))); - params.put("MarginV",(subtitle.get("MarginV")==null? 100:subtitle.get("MarginV"))); - subtitle.put("enabled",1); - subtitle.put("text",photoSpeakVideo.getPaperwork()); - subtitle.put("params",params); - param.setSubtitle_params(subtitle); - - } -// List videoMapperList = photoSpeakVideoMapper.findList(speakVideoUpd); -// for (PhotoSpeakVideo speakVideo : videoMapperList) { -// if (speakVideo.getSubtitleEnabled()==1){ -//// 开启字幕 查询字幕列表 -// String[] getparams = speakVideo.getSubtitleParams().split(","); -// Map subtitle = new HashMap(); -// Map params = new HashMap(); -// Map map = new HashMap(); -// for (String s : getparams) { -// String[] kv = s.split(":"); -// map.put(kv[0],kv[1]); -// } -// -// params.put("Fontname",(map.get("Fontname")==null?"宋体":map.get("Fontname"))); -// params.put("Fontsize",(map.get("Fontsize")==null? 25:map.get("Fontsize"))); -// params.put("PrimaryColour",(map.get("PrimaryColour")==null?"&Hffffff":map.get("PrimaryColour"))); -// params.put("SecondaryColour",(map.get("SecondaryColour")==null?"BBGGRR":map.get("SecondaryColour"))); -// params.put("OutlineColour",(map.get("OutlineColour")==null?"BBGGRR":map.get("OutlineColour"))); -// params.put("BackColour",(map.get("BackColour")==null?"&H0000ff":map.get("BackColour"))); -// params.put("Bold",(map.get("Bold")==null? -1:map.get("Bold"))); -// params.put("Italic",(map.get("Italic")==null? 0:map.get("Italic"))); -// params.put("Underline",(map.get("Underline")==null? 0:map.get("Underline"))); -// params.put("Strikeout",(map.get("Strikeout")==null? 0:map.get("Strikeout"))); -// params.put("ScaleX",(map.get("ScaleX")==null? 100:map.get("ScaleX"))); -// params.put("ScaleY",(map.get("ScaleY")==null? 100:map.get("ScaleY"))); -// params.put("Spacing",(map.get("Spacing")==null? 0:map.get("Spacing"))); -// params.put("Angle",(map.get("Angle")==null? 15:map.get("Angle"))); -// params.put("BorderStyle",(map.get("BorderStyle")==null?"1":map.get("BorderStyle"))); -// params.put("Outline",(map.get("Outline")==null? 20:map.get("Outline"))); -// params.put("Shadow",(map.get("Shadow")==null? 12:map.get("Shadow"))); -// params.put("Alignment",(map.get("Alignment")==null? 1:map.get("Alignment"))); -// params.put("MarginL",(map.get("MarginL")==null? 100:map.get("MarginL"))); -// params.put("MarginR",(map.get("MarginR")==null? 100:map.get("MarginR"))); -// params.put("MarginV",(map.get("MarginV")==null? 100:map.get("MarginV"))); +// if (photoSpeakVideo.getSubtitleEnabled()==1){ +//// //开启字幕 查询字幕列表 +// Map reSubtitle = new HashMap(); +// Map params = new HashMap(); +// JSONObject subtitle = JSON.parseObject(photoSpeakVideo.getSubtitleParams()); +// params.put("Fontname",(subtitle.get("Fontname")==null?"宋体":subtitle.get("Fontname"))); +// params.put("Fontsize",(subtitle.get("Fontsize")==null? 25:subtitle.get("Fontsize"))); +// params.put("PrimaryColour",(subtitle.get("PrimaryColour")==null?"&Hffffff":subtitle.get("PrimaryColour"))); +// params.put("SecondaryColour",(subtitle.get("SecondaryColour")==null?"BBGGRR":subtitle.get("SecondaryColour"))); +// params.put("OutlineColour",(subtitle.get("OutlineColour")==null?"BBGGRR":subtitle.get("OutlineColour"))); +// params.put("BackColour",(subtitle.get("BackColour")==null?"&H0000ff":subtitle.get("BackColour"))); +// params.put("Bold",(subtitle.get("Bold")==null? -1:subtitle.get("Bold"))); +// params.put("Italic",(subtitle.get("Italic")==null? 0:subtitle.get("Italic"))); +// params.put("Underline",(subtitle.get("Underline")==null? 0:subtitle.get("Underline"))); +// params.put("Strikeout",(subtitle.get("Strikeout")==null? 0:subtitle.get("Strikeout"))); +// params.put("ScaleX",(subtitle.get("ScaleX")==null? 100:subtitle.get("ScaleX"))); +// params.put("ScaleY",(subtitle.get("ScaleY")==null? 100:subtitle.get("ScaleY"))); +// params.put("Spacing",(subtitle.get("Spacing")==null? 0:subtitle.get("Spacing"))); +// params.put("Angle",(subtitle.get("Angle")==null? 15:subtitle.get("Angle"))); +// params.put("BorderStyle",(subtitle.get("BorderStyle")==null?"1":subtitle.get("BorderStyle"))); +// params.put("Outline",(subtitle.get("Outline")==null? 20:subtitle.get("Outline"))); +// params.put("Shadow",(subtitle.get("Shadow")==null? 12:subtitle.get("Shadow"))); +// params.put("Alignment",(subtitle.get("Alignment")==null? 1:subtitle.get("Alignment"))); +// params.put("MarginL",(subtitle.get("MarginL")==null? 100:subtitle.get("MarginL"))); +// params.put("MarginR",(subtitle.get("MarginR")==null? 100:subtitle.get("MarginR"))); +// params.put("MarginV",(subtitle.get("MarginV")==null? 100:subtitle.get("MarginV"))); // subtitle.put("enabled",1); -// subtitle.put("text",speakVideo.getPaperwork()); +// subtitle.put("text",photoSpeakVideo.getPaperwork()); // subtitle.put("params",params); // param.setSubtitle_params(subtitle); -// } -// } +// +// } if (EnumVoiceFrom.FROM_MOULD.getCode().equals(voiceFrom)) {