| @@ -77,9 +77,9 @@ public class UploadController extends BaseController { | |||||
| TenantEntity tenantEntity = getTenantInfo(); | TenantEntity tenantEntity = getTenantInfo(); | ||||
| long size = multiReq.getSize(); | long size = multiReq.getSize(); | ||||
| final long length = 2097152 * 2; | |||||
| final long length = 2097152; | |||||
| if (size > length) { | if (size > length) { | ||||
| return new ResultData(ErrorCode.PICTURE_FOUR_SIZE_EXCEED); | |||||
| return new ResultData(ErrorCode.PICTURE_SIZE_EXCEED); | |||||
| } | } | ||||
| String fileFormat = ""; | String fileFormat = ""; | ||||
| @@ -472,8 +472,8 @@ public class PhotoSpeakVideoController extends BaseController { | |||||
| @ApiOperation("获取视频是否生成成功") | @ApiOperation("获取视频是否生成成功") | ||||
| @GetMapping("/checkVideoStatus") | @GetMapping("/checkVideoStatus") | ||||
| public ResultData checkVideoStatus() { | |||||
| photoSpeakVideoService.checkVideoStatus(getMemberId()); | |||||
| return new ResultData(); | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| public ResultData checkVideoStatus(String time) { | |||||
| return photoSpeakVideoService.checkVideoStatus(getMemberId(),time); | |||||
| } | } | ||||
| } | } | ||||
| @@ -75,9 +75,9 @@ public class UploadController extends BaseController { | |||||
| TenantEntity tenantEntity = getTenantInfo(); | TenantEntity tenantEntity = getTenantInfo(); | ||||
| long size = multiReq.getSize(); | long size = multiReq.getSize(); | ||||
| final long length = 2097152; | |||||
| final long length = 2097152 * 2; | |||||
| if (size > length) { | if (size > length) { | ||||
| return new ResultData(ErrorCode.PICTURE_SIZE_EXCEED); | |||||
| return new ResultData(ErrorCode.PICTURE_FOUR_SIZE_EXCEED); | |||||
| } | } | ||||
| String fileFormat = ""; | String fileFormat = ""; | ||||
| @@ -56,18 +56,23 @@ public class VideoCallbackController extends BaseController { | |||||
| @AuthIgnore | @AuthIgnore | ||||
| @ApiOperation("新增接口") | @ApiOperation("新增接口") | ||||
| @PostMapping("/photo/speak") | |||||
| @PostMapping(value = "/photo/speak") | |||||
| public ResultData photoSpeak(@RequestBody Map<String, Object> paranMap) { | public ResultData photoSpeak(@RequestBody Map<String, Object> paranMap) { | ||||
| logger.debug("[" + getIpAddr() + "] VideoCallbackController::photoSpeak"); | logger.debug("[" + getIpAddr() + "] VideoCallbackController::photoSpeak"); | ||||
| logger.info("照片生成视频结果通知{}"+JSONObject.toJSONString(paranMap)); | logger.info("照片生成视频结果通知{}"+JSONObject.toJSONString(paranMap)); | ||||
| String task_id = (String) paranMap.get("task_id");//任务ID | |||||
| Long task_id = (Long) paranMap.get("task_id");//任务ID | |||||
| Integer code = (Integer) paranMap.get("code");//code | Integer code = (Integer) paranMap.get("code");//code | ||||
| String msg = (String) paranMap.get("msg"); | String msg = (String) paranMap.get("msg"); | ||||
| String data = (String)paranMap.get("data"); | |||||
| Map<String, Object> data = (HashMap) paranMap.get("data"); | |||||
| String url = (String) data.get("url"); | |||||
| String save_dir = (String) data.get("save_dir"); | |||||
| Boolean sr = (Boolean) data.get("sr");//判断 sr=True 就是超分的, False 是没超分的 | |||||
| Map dataMap = JSONObject.parseObject(data,Map.class); | |||||
| String url = (String) dataMap.get("url"); | |||||
| String save_dir = (String) dataMap.get("save_dir"); | |||||
| Boolean sr = (Boolean) dataMap.get("sr");//判断 sr=True 就是超分的, False 是没超分的 | |||||
| if (task_id == null){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"任务ID不能为空"); | |||||
| } | |||||
| PhotoSpeakVideo photoSpeakVideo = photoSpeakVideoService.getById(Long.valueOf(task_id)); | PhotoSpeakVideo photoSpeakVideo = photoSpeakVideoService.getById(Long.valueOf(task_id)); | ||||
| if (photoSpeakVideo == null){ | if (photoSpeakVideo == null){ | ||||
| @@ -89,10 +94,6 @@ public class VideoCallbackController extends BaseController { | |||||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),returnMsg); | return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),returnMsg); | ||||
| } | } | ||||
| if (StringUtils.isEmpty(task_id)){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"任务ID不能为空"); | |||||
| } | |||||
| if (StringUtils.isEmpty(url)){ | if (StringUtils.isEmpty(url)){ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"视频URL不能为空"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"视频URL不能为空"); | ||||
| } | } | ||||
| @@ -23,5 +23,5 @@ public interface PhotoSpeakVideoMapper extends CommonMapper<PhotoSpeakVideo, Lon | |||||
| List<PhotoSpeakVideo> getSortList(PhotoSpeakVideo record); | List<PhotoSpeakVideo> getSortList(PhotoSpeakVideo record); | ||||
| Integer checkVideoStatus(@Param("userId") Long userId); | |||||
| Integer checkVideoStatus(@Param("userId") Long userId,@Param("time") String time); | |||||
| } | } | ||||
| @@ -3,10 +3,8 @@ package com.iformall.service.sm; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.sm.PhotoSpeakVideo; | import com.iformall.domain.po.sm.PhotoSpeakVideo; | ||||
| import com.iformall.domain.po.sm.UserMouldVideo; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.concurrent.Future; | |||||
| public interface PhotoSpeakVideoService { | public interface PhotoSpeakVideoService { | ||||
| @@ -67,5 +65,5 @@ public interface PhotoSpeakVideoService { | |||||
| List<PhotoSpeakVideo> getNotHyUploadList(); | List<PhotoSpeakVideo> getNotHyUploadList(); | ||||
| ResultData checkVideoStatus(Long userId); | |||||
| ResultData checkVideoStatus(Long userId, String time); | |||||
| } | } | ||||
| @@ -188,16 +188,18 @@ public class PhotoSpeakVideoServiceImpl implements PhotoSpeakVideoService { | |||||
| param.setTask_id(photoSpeakVideo.getId()); | param.setTask_id(photoSpeakVideo.getId()); | ||||
| param.setCallback_url(callbackUrl + "/callback/photo/speak"); | param.setCallback_url(callbackUrl + "/callback/photo/speak"); | ||||
| param.setImg(Base64Util.imageUrlToBase64(photoSpeakVideo.getPersonPhotoUrl())); | param.setImg(Base64Util.imageUrlToBase64(photoSpeakVideo.getPersonPhotoUrl())); | ||||
| param.setVoice_id(photoSpeakVideo.getVoiceMouldSm() == null ? "default" : photoSpeakVideo.getVoiceMouldSm()); | |||||
| String voiceMouldSm = photoSpeakVideo.getVoiceMouldSm(); | String voiceMouldSm = photoSpeakVideo.getVoiceMouldSm(); | ||||
| Integer sex = 1; | Integer sex = 1; | ||||
| String speakType = null; | |||||
| Integer speakType = 0; | |||||
| String mouldSmId = null; | |||||
| if (!StringUtils.isBlank(voiceMouldSm)) { | if (!StringUtils.isBlank(voiceMouldSm)) { | ||||
| JSONObject jsonObject = JSON.parseObject(voiceMouldSm); | JSONObject jsonObject = JSON.parseObject(voiceMouldSm); | ||||
| speakType = jsonObject.getString("speakType"); | |||||
| speakType = jsonObject.getInteger("speakType"); | |||||
| sex = jsonObject.getInteger("sex"); | sex = jsonObject.getInteger("sex"); | ||||
| mouldSmId = jsonObject.getString("mouldSmId"); | |||||
| } | } | ||||
| param.setVoice_style(speakType == null ? "default" : EnumSpeakType.getEnum(speakType).getType()); | param.setVoice_style(speakType == null ? "default" : EnumSpeakType.getEnum(speakType).getType()); | ||||
| param.setVoice_id(mouldSmId == null ? "default" : mouldSmId); | |||||
| Integer voiceFrom = photoSpeakVideo.getVoiceFrom(); | Integer voiceFrom = photoSpeakVideo.getVoiceFrom(); | ||||
| String voiceMaterialUrl = photoSpeakVideo.getVoiceMaterialUrl(); | String voiceMaterialUrl = photoSpeakVideo.getVoiceMaterialUrl(); | ||||
| @@ -228,16 +230,16 @@ public class PhotoSpeakVideoServiceImpl implements PhotoSpeakVideoService { | |||||
| this.updateById(photoSpeakVideo); | this.updateById(photoSpeakVideo); | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| photoSpeakVideo.setVideoStatus(EnumVideoStatus.draft.getCode()); | |||||
| photoSpeakVideo.setVideoStatus(EnumVideoStatus.fail.getCode()); | |||||
| photoSpeakVideo.setVideoMsg(video.getMsg()); | photoSpeakVideo.setVideoMsg(video.getMsg()); | ||||
| this.updateById(photoSpeakVideo); | this.updateById(photoSpeakVideo); | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"接口请求异常"); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"生成视频失败"); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| e.printStackTrace(); | e.printStackTrace(); | ||||
| photoSpeakVideo.setVideoStatus(EnumVideoStatus.draft.getCode()); | |||||
| photoSpeakVideo.setVideoStatus(EnumVideoStatus.fail.getCode()); | |||||
| photoSpeakVideo.setVideoMsg("接口请求异常"); | photoSpeakVideo.setVideoMsg("接口请求异常"); | ||||
| this.updateById(photoSpeakVideo); | this.updateById(photoSpeakVideo); | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"接口请求异常"); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"生成视频失败"); | |||||
| } | } | ||||
| } | } | ||||
| @@ -381,8 +383,8 @@ public class PhotoSpeakVideoServiceImpl implements PhotoSpeakVideoService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public ResultData checkVideoStatus(Long userId) { | |||||
| Integer integer = photoSpeakVideoMapper.checkVideoStatus(userId); | |||||
| public ResultData checkVideoStatus(Long userId, String time) { | |||||
| Integer integer = photoSpeakVideoMapper.checkVideoStatus(userId,time); | |||||
| if (integer > 0){ | if (integer > 0){ | ||||
| return new ResultData("生成视频成功"); | return new ResultData("生成视频成功"); | ||||
| } | } | ||||
| @@ -11,7 +11,7 @@ public class AiPhotoSpeakResult { | |||||
| private String saveDir; | private String saveDir; | ||||
| public String getMsgInfo(Integer code, String msg) { | public String getMsgInfo(Integer code, String msg) { | ||||
| if (code == 4000 && msg.equals("success")) { | |||||
| if (code == 4000 && msg.equals("img_talk success")) { | |||||
| return "成功"; | return "成功"; | ||||
| } else if (code == 3006 && msg.equals("miss parameter")) { | } else if (code == 3006 && msg.equals("miss parameter")) { | ||||
| return "却少参数"; | return "却少参数"; | ||||
| @@ -159,7 +159,7 @@ | |||||
| <select id="checkVideoStatus" resultType="java.lang.Integer"> | <select id="checkVideoStatus" resultType="java.lang.Integer"> | ||||
| select count(1) | select count(1) | ||||
| from photo_speak_video | from photo_speak_video | ||||
| where video_status = 5 and create_video_date >= now() and user_id = #{userId} | |||||
| where video_status = 5 and create_video_date >= #{time} and user_id = #{userId} | |||||
| </select> | </select> | ||||