|
|
@@ -2,7 +2,11 @@ package com.iformall.smsdk; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.iformall.sm.AiVideoParam; |
|
|
|
import com.iformall.sm.AiVideoResult; |
|
|
|
import com.iformall.utils.JsonUtil; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.http.HttpEntity; |
|
|
|
import org.springframework.http.HttpMethod; |
|
|
@@ -29,12 +33,15 @@ public class SmSdkUtils { |
|
|
|
smSdkUtils = this; |
|
|
|
} |
|
|
|
|
|
|
|
public static void generateVideo(SmGenerateVideoDTO dto) { |
|
|
|
public static AiVideoResult generateVideo(SmGenerateVideoDTO dto) { |
|
|
|
String url = smSdkUtils.smSdkProperties.getBaseUrl() + SmSdkConstant.GENERATE_VIDEO; |
|
|
|
HttpEntity<SmGenerateVideoDTO> httpEntity = new HttpEntity<>(dto); |
|
|
|
log.info("(遂芒api)【生成视频】接口的请求参数:{}", JSON.toJSONString(dto)); |
|
|
|
ResponseEntity<String> response = smSdkUtils.restTemplate.exchange(url, HttpMethod.POST, httpEntity, String.class); |
|
|
|
log.info("(遂芒api)【生成视频】接口的响应数据:{}", JSON.toJSONString(response.getBody())); |
|
|
|
JSONObject resultObject = JSON.parseObject(response.getBody()); |
|
|
|
String data = resultObject.getString("data"); |
|
|
|
return StringUtils.isNotBlank(data) ? JSON.parseObject(data, AiVideoResult.class) : new AiVideoResult(); |
|
|
|
} |
|
|
|
|
|
|
|
public static Double preview(SmPreviewVideoDTO dto) { |
|
|
|