@@ -42,7 +42,7 @@ public class HttpUtils { | |||
while ((line = in.readLine()) != null) { | |||
result.append(line); | |||
} | |||
log.info("recv - {}", result); | |||
// log.info("recv - {}", result); | |||
} catch (ConnectException e) { | |||
log.error("调用HttpUtils.sendGet ConnectException, url=" + url + ",param=" + param, e); | |||
} catch (SocketTimeoutException e) { |
@@ -17,6 +17,7 @@ import java.util.Objects; | |||
@Slf4j | |||
@Service | |||
public class QueryRecordIService { | |||
@Autowired | |||
@Qualifier("restTemplate") | |||
private RestTemplate restTemplate; | |||
@@ -31,16 +32,16 @@ public class QueryRecordIService { | |||
String url = UriComponentsBuilder.fromHttpUrl(dspDomainUrl+SystemConstant.DSP_QUERY_RECORD) | |||
.queryParam("requestId", msgId) | |||
.toUriString(); | |||
log.info("调用dsp平台,查询录屏信息接口,url:{}", url); | |||
JsonResult jsonResult; | |||
try { | |||
jsonResult = restTemplate.getForObject(url, JsonResult.class); | |||
} catch (Exception e) { | |||
log.info("调用查询录屏信息接口异常, url:{}", url); | |||
throw new ServiceException("调用查询录屏信息接口异常"); | |||
log.info("调用dsp平台,查询录屏信息接口异常"); | |||
throw new ServiceException("调用dsp平台,查询录屏信息接口异常"); | |||
} | |||
if (ObjectUtil.isEmpty(jsonResult) || (!ObjectUtil.isEmpty(Objects.requireNonNull(jsonResult).getData()) && jsonResult.getCode() != 0)) { | |||
return JsonResult.error("调用查询录屏信息接口失败,请重试!"); | |||
throw new ServiceException("调用dsp平台,查询录屏信息接口失败"); | |||
} | |||
return jsonResult; |
@@ -46,6 +46,9 @@ public class StartRecordIService { | |||
jsonObject.put("requestId", request.getRequestId()); | |||
jsonObject.put("pullUrl", request.getPullUrl()); | |||
log.info("调用dsp平台,开始录制接口,url:{}", url); | |||
log.info("调用dsp平台,开始录制接口,jsonObject:{}", jsonObject); | |||
HttpHeaders headers = new HttpHeaders(); | |||
headers.setContentType(MediaType.APPLICATION_JSON); | |||
HttpEntity httpEntity = new HttpEntity(jsonObject, headers); | |||
@@ -53,21 +56,18 @@ public class StartRecordIService { | |||
try { | |||
response = restTemplate.exchange(url, HttpMethod.POST, httpEntity, JsonResult.class); | |||
} catch (Exception e) { | |||
log.info("调用dsp平台,调用开始录制接口异常,url:{}", url); | |||
log.info("调用dsp平台,调用开始录制接口异常,jsonObject:{}", jsonObject); | |||
return null; | |||
log.info("调用dsp平台,开始录制接口异常,e:{}", e); | |||
throw new ServiceException("调用dsp平台,开始录制接口异常"); | |||
} | |||
if (ObjectUtil.isEmpty(response)) { | |||
log.info("调用dsp平台,调用开始录制接口返回为空,url:{}", url); | |||
log.info("调用dsp平台,调用开始录制接口返回为空,jsonObject:{}", jsonObject); | |||
return null; | |||
log.info("调用dsp平台,开始录制接口返回为空"); | |||
throw new ServiceException("调用dsp平台,开始录制接口返回为空"); | |||
} | |||
JsonResult jsonResult = response.getBody(); | |||
if (0 != jsonResult.getCode()) { | |||
log.info("调用dsp平台,调用开始录制接口,失败,url:{}", url); | |||
log.info("调用dsp平台,调用开始录制接口,失败,jsonObject:{}", jsonObject); | |||
log.info("调用dsp平台,调用开始录制接口,失败", jsonResult.getMsg()); | |||
return null; | |||
log.info("调用dsp平台,开始录制接口,失败,jsonResult:{}", jsonResult); | |||
log.info("调用dsp平台,开始录制接口,失败", jsonResult.getMsg()); | |||
throw new ServiceException("调用dsp平台,开始录制接口,失败"); | |||
} | |||
return jsonResult; | |||
@@ -45,16 +45,16 @@ public class StopRecordIService { | |||
String url = UriComponentsBuilder.fromHttpUrl(dspDomainUrl+SystemConstant.DSP_STOP_RECORD) | |||
.queryParam("requestId", msgId) | |||
.toUriString(); | |||
log.info("调用dsp平台,停止录制接口,url:{}", url); | |||
JsonResult jsonResult; | |||
try { | |||
jsonResult = restTemplate.getForObject(url, JsonResult.class); | |||
} catch (Exception e) { | |||
log.info("调用停止录制接口异常, url:{}", url); | |||
log.info("调用dsp平台,停止录制接异常, e:{}", e); | |||
throw new ServiceException("调用停止录制接口异常"); | |||
} | |||
if (ObjectUtil.isEmpty(jsonResult) || (!ObjectUtil.isEmpty(Objects.requireNonNull(jsonResult).getData()) && jsonResult.getCode() != 0)) { | |||
return JsonResult.error("调用停止录制接口失败,请重试!"); | |||
return JsonResult.error("调用dsp平台,停止录制接失败,请重试!"); | |||
} | |||
return jsonResult; |