@@ -62,8 +62,7 @@ public class UpdateFlightStatusService { | |||
} | |||
log.info("调用DSP开始录制, 返回:result={}", JacksonUtil.obj2StringPretty(result)); | |||
JSONObject jsonObject = (JSONObject) result.getData(); | |||
DspCallbackRecordVo vo = JSON.toJavaObject(jsonObject.getJSONObject("data"), DspCallbackRecordVo.class); | |||
DspCallbackRecordVo vo = (DspCallbackRecordVo) result.getData(); | |||
log.info("修改inspection status 开始"); | |||
inspectionUpdate.setStatus(InspectionStatusEnum.IN_FLIGHT.getCode()); |
@@ -43,7 +43,6 @@ public class QueryRecordIService { | |||
if (ObjectUtil.isEmpty(jsonResult) || (!ObjectUtil.isEmpty(Objects.requireNonNull(jsonResult).getData()) && jsonResult.getCode() != 0)) { | |||
throw new ServiceException("调用dsp平台,查询录屏信息接口失败"); | |||
} | |||
return jsonResult; | |||
} | |||
} |
@@ -1,11 +1,13 @@ | |||
package com.tuoheng.admin.service.third.dsp; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.alibaba.fastjson.JSON; | |||
import com.alibaba.fastjson.JSONArray; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.tuoheng.admin.constant.SystemConstant; | |||
import com.tuoheng.admin.entity.domain.Inspection; | |||
import com.tuoheng.admin.entity.request.inspection.MissionStatusRequest; | |||
import com.tuoheng.admin.entity.vo.DspCallbackRecordVo; | |||
import com.tuoheng.admin.enums.code.inspection.EditInspectionStatusCodeEnum; | |||
import com.tuoheng.common.core.exception.ServiceException; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
@@ -14,6 +16,7 @@ import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.beans.factory.annotation.Qualifier; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.core.ParameterizedTypeReference; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.web.client.RestTemplate; | |||
import org.springframework.web.util.UriComponentsBuilder; | |||
@@ -52,9 +55,12 @@ public class StartRecordIService { | |||
HttpHeaders headers = new HttpHeaders(); | |||
headers.setContentType(MediaType.APPLICATION_JSON); | |||
HttpEntity httpEntity = new HttpEntity(jsonObject, headers); | |||
ResponseEntity<JsonResult> response; | |||
ResponseEntity<JsonResult<DspCallbackRecordVo>> response; | |||
ParameterizedTypeReference<JsonResult<DspCallbackRecordVo>> parameterizedTypeReference = | |||
new ParameterizedTypeReference<JsonResult<DspCallbackRecordVo>>() { | |||
}; | |||
try { | |||
response = restTemplate.exchange(url, HttpMethod.POST, httpEntity, JsonResult.class); | |||
response = restTemplate.exchange(url, HttpMethod.POST, httpEntity, parameterizedTypeReference); | |||
} catch (Exception e) { | |||
log.info("调用dsp平台,开始录制接口异常,e:{}", e); | |||
throw new ServiceException("调用dsp平台,开始录制接口异常"); | |||
@@ -70,7 +76,6 @@ public class StartRecordIService { | |||
throw new ServiceException("调用dsp平台,开始录制接口,失败"); | |||
} | |||
return jsonResult; | |||
} | |||
} |
@@ -56,9 +56,7 @@ public class StopRecordIService { | |||
if (ObjectUtil.isEmpty(jsonResult) || (!ObjectUtil.isEmpty(Objects.requireNonNull(jsonResult).getData()) && jsonResult.getCode() != 0)) { | |||
return JsonResult.error("调用dsp平台,停止录制接失败,请重试!"); | |||
} | |||
return jsonResult; | |||
} | |||
} |
@@ -2,9 +2,11 @@ package com.tuoheng.admin.service; | |||
import com.alibaba.fastjson.JSONArray; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.tuoheng.admin.entity.request.inspection.MissionStatusRequest; | |||
import com.tuoheng.admin.entity.request.third.DspCallbackRequest; | |||
import com.tuoheng.admin.service.third.dsp.IDspCallbackService; | |||
import com.tuoheng.admin.service.third.dsp.SendPost; | |||
import com.tuoheng.admin.service.third.dsp.StartRecordIService; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.junit.Test; | |||
import org.junit.runner.RunWith; | |||
@@ -20,6 +22,9 @@ public class DspCallbackServiceTest { | |||
@Autowired | |||
private IDspCallbackService dspCallbackService; | |||
@Autowired | |||
private StartRecordIService startRecordIService; | |||
@Test | |||
public void testGetOneById() { | |||
String requestId = "dc96139337854ae78da7f20e144b3a9f"; | |||
@@ -59,4 +64,11 @@ public class DspCallbackServiceTest { | |||
System.out.println(stringStr); | |||
} | |||
@Test | |||
public void testStartRecord() { | |||
MissionStatusRequest request = new MissionStatusRequest(); | |||
request.setRequestId("2199124367dd36d6c1d99d7b15d38c3b"); | |||
request.setPullUrl("https://live.play.t-aaron.com/live/test21.flv"); | |||
startRecordIService.startRecord(request); | |||
} | |||
} |
@@ -67,12 +67,8 @@ public class InspectionServiceTest { | |||
request.setAirportId(1); | |||
request.setAirportName("禄口-2022112501"); | |||
request.setInspectionLine(1); | |||
request.setInspectionLineName("路线1"); | |||
JSONObject json = (JSONObject) JSONObject.toJSON(request); | |||
log.info("-----> 新增任务请求参数:json={}", json); | |||
JsonResult result = iInspectionService.insert(request); | |||
System.out.println(">>>>>>>>>>>>>" + result); | |||
} |