|
@@ -17,6 +17,7 @@ import org.springframework.web.client.RestTemplate; |
|
|
|
|
|
|
|
|
import javax.annotation.PostConstruct; |
|
|
import javax.annotation.PostConstruct; |
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
@Slf4j |
|
|
@Slf4j |
|
|
@Component |
|
|
@Component |
|
@@ -36,10 +37,9 @@ public class SmSdkUtils { |
|
|
|
|
|
|
|
|
public static AiPreviewResult preview(SmPreviewVideoDTO dto) { |
|
|
public static AiPreviewResult preview(SmPreviewVideoDTO dto) { |
|
|
String url = smSdkUtils.smSdkProperties.getBaseUrl() + SmSdkConstant.PREVIEW_VIDEO; |
|
|
String url = smSdkUtils.smSdkProperties.getBaseUrl() + SmSdkConstant.PREVIEW_VIDEO; |
|
|
// HttpEntity<SmPreviewVideoDTO> httpEntity = new HttpEntity<>(dto); |
|
|
|
|
|
log.info("(遂芒api)【预览视频】接口的请求参数:{}", JSON.toJSONString(dto)); |
|
|
|
|
|
ResponseEntity<String> response = smSdkUtils.restTemplate.exchange(url, HttpMethod.POST, SmUtils.getHttpEntity(JSON.toJSONString(dto)), String.class); |
|
|
|
|
|
log.info("(遂芒api)【预览视频】接口的响应数据:{}", JSON.toJSONString(response.getBody())); |
|
|
|
|
|
|
|
|
log.info("(遂芒api)【预览视频】接口的请求参数:{}", JSON.toJSON(dto)); |
|
|
|
|
|
ResponseEntity<String> response = smSdkUtils.restTemplate.exchange(url, HttpMethod.POST, SmUtils.getHttpEntity(JSON.parseObject(JSON.toJSONString(dto), Map.class)), String.class); |
|
|
|
|
|
log.info("(遂芒api)【预览视频】接口的响应数据:{}", JSON.toJSON(response.getBody())); |
|
|
JSONObject resultObject = JSON.parseObject(response.getBody()); |
|
|
JSONObject resultObject = JSON.parseObject(response.getBody()); |
|
|
String data = resultObject.getString("data"); |
|
|
String data = resultObject.getString("data"); |
|
|
return StringUtils.isNotBlank(data) ? JSON.parseObject(data, AiPreviewResult.class) : new AiPreviewResult(); |
|
|
return StringUtils.isNotBlank(data) ? JSON.parseObject(data, AiPreviewResult.class) : new AiPreviewResult(); |
|
@@ -47,10 +47,10 @@ public class SmSdkUtils { |
|
|
|
|
|
|
|
|
public static AiVideoResult generateVideo(SmGenerateVideoDTO dto) { |
|
|
public static AiVideoResult generateVideo(SmGenerateVideoDTO dto) { |
|
|
String url = smSdkUtils.smSdkProperties.getBaseUrl() + SmSdkConstant.GENERATE_VIDEO; |
|
|
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, SmUtils.getHttpEntity(JSON.toJSONString(dto)), String.class); |
|
|
|
|
|
log.info("(遂芒api)【生成视频】接口的响应数据:{}", JSON.toJSONString(response.getBody())); |
|
|
|
|
|
|
|
|
// log.info("(遂芒api)【生成视频】接口的请求参数:{}", JSON.toJSONString(dto)); |
|
|
|
|
|
log.info("(遂芒api)【生成视频】接口的请求参数:{}", JSON.toJSON(dto.getId())); |
|
|
|
|
|
ResponseEntity<String> response = smSdkUtils.restTemplate.exchange(url, HttpMethod.POST, SmUtils.getHttpEntity(JSON.parseObject(JSON.toJSONString(dto), Map.class)), String.class); |
|
|
|
|
|
log.info("(遂芒api)【生成视频】接口的响应数据:{}", JSON.toJSON(response.getBody())); |
|
|
JSONObject resultObject = JSON.parseObject(response.getBody()); |
|
|
JSONObject resultObject = JSON.parseObject(response.getBody()); |
|
|
String data = resultObject.getString("data"); |
|
|
String data = resultObject.getString("data"); |
|
|
return StringUtils.isNotBlank(data) ? JSON.parseObject(data, AiVideoResult.class) : new AiVideoResult(); |
|
|
return StringUtils.isNotBlank(data) ? JSON.parseObject(data, AiVideoResult.class) : new AiVideoResult(); |
|
|