|
@ -1,7 +1,6 @@ |
|
|
package com.kms.yg.df.service; |
|
|
package com.kms.yg.df.service; |
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.alibaba.fastjson.annotation.JSONField; |
|
|
import com.alibaba.fastjson.annotation.JSONField; |
|
|
import com.kms.yxgh.df.dto.DfSpPlayDto; |
|
|
import com.kms.yxgh.df.dto.DfSpPlayDto; |
|
@ -94,11 +93,12 @@ public class BsSgcDfSpPlayService { |
|
|
String spOauthTokenUrlJson = getToken(dto); |
|
|
String spOauthTokenUrlJson = getToken(dto); |
|
|
JSONObject tokenJson = parseJson(spOauthTokenUrlJson); |
|
|
JSONObject tokenJson = parseJson(spOauthTokenUrlJson); |
|
|
if (!isSuccess(tokenJson)) { |
|
|
if (!isSuccess(tokenJson)) { |
|
|
|
|
|
log.error("获取令牌失败,{}", tokenJson); |
|
|
return rest; |
|
|
return rest; |
|
|
} |
|
|
} |
|
|
JSONObject tokenData = tokenJson.getJSONObject("data"); |
|
|
JSONObject tokenData = tokenJson.getJSONObject("data"); |
|
|
if (tokenData == null) { |
|
|
if (tokenData == null) { |
|
|
log.warn("令牌数据为空"); |
|
|
log.error("令牌数据为空"); |
|
|
return rest; |
|
|
return rest; |
|
|
} |
|
|
} |
|
|
String token = String.valueOf(tokenData.get("token")); |
|
|
String token = String.valueOf(tokenData.get("token")); |
|
@ -179,11 +179,9 @@ public class BsSgcDfSpPlayService { |
|
|
HttpHeaders headers = new HttpHeaders(); |
|
|
HttpHeaders headers = new HttpHeaders(); |
|
|
headers.setContentType(MediaType.APPLICATION_JSON); |
|
|
headers.setContentType(MediaType.APPLICATION_JSON); |
|
|
HttpEntity<String> httpEntity = new HttpEntity<>(requestStr, headers); |
|
|
HttpEntity<String> httpEntity = new HttpEntity<>(requestStr, headers); |
|
|
String seqResult; |
|
|
|
|
|
try { |
|
|
try { |
|
|
ResponseEntity<String> responseEntity = restTemplate.exchange(videoUrl + OAUTH_TOKEN, HttpMethod.POST, httpEntity, String.class); |
|
|
ResponseEntity<String> responseEntity = restTemplate.exchange(videoUrl + OAUTH_TOKEN, HttpMethod.POST, httpEntity, String.class); |
|
|
seqResult = responseEntity.getBody(); |
|
|
return responseEntity.getBody(); |
|
|
log.info("获取播放地址响应SP_PLAY_URL: {}", seqResult); |
|
|
|
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
log.warn("请求接口OAUTH_TOKEN返回异常: {}", e.getMessage()); |
|
|
log.warn("请求接口OAUTH_TOKEN返回异常: {}", e.getMessage()); |
|
|
} |
|
|
} |
|
|