Commit 8d8bb653 authored by tangwei's avatar tangwei

语音融合获取录音文件接口更换

parent b9b4fbca
...@@ -11,8 +11,10 @@ import org.springframework.util.MultiValueMap; ...@@ -11,8 +11,10 @@ import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestClientException; import org.springframework.web.client.RestClientException;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import com.alibaba.fastjson.JSON;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -80,22 +82,60 @@ public class FusionServiceImpl implements IFusionService { ...@@ -80,22 +82,60 @@ public class FusionServiceImpl implements IFusionService {
return getResult(jsonObject); return getResult(jsonObject);
} }
// @Override
// public Map<String, String> getCallRecordByCID(String cid) {
// MultiValueMap<String, String> requestEntity = new LinkedMultiValueMap<String, String>();
// requestEntity.add("CID", cid);
// JSONObject jsonObject = null;
// try {
// jsonObject = RestTemplateUtil.getRestInstance().postForObject(String.format("%s/GetCallRecordByCID", voiceURL), requestEntity, JSONObject.class);
// } catch (RestClientException e) {
// e.printStackTrace();
// throw new BadRequest("访问融合终端失败");
// }
// return getResult(jsonObject);
// }
@Override @Override
public Map<String, String> getCallRecordByCID(String cid) { public Map<String, String> getCallRecordByCID(String cid) {
MultiValueMap<String, String> requestEntity = new LinkedMultiValueMap<String, String>(); MultiValueMap<String, String> requestEntity = new LinkedMultiValueMap<String, String>();
requestEntity.add("CID", cid); requestEntity.add("cid", cid);
requestEntity.add("sliceIndex", "0");
requestEntity.add("sliceCount", "1");
JSONObject jsonObject = null; JSONObject jsonObject = null;
try { try {
jsonObject = RestTemplateUtil.getRestInstance().postForObject(String.format("%s/GetCallRecordByCID", voiceURL), requestEntity, JSONObject.class); jsonObject = RestTemplateUtil.getRestInstance().postForObject(String.format("%s/getRecordFilesByCID", voiceURL), requestEntity, JSONObject.class);
} catch (RestClientException e) { } catch (RestClientException e) {
e.printStackTrace(); e.printStackTrace();
throw new BadRequest("访问融合终端失败"); throw new BadRequest("访问融合终端失败");
} }
return getResult(jsonObject); return getResultnew(jsonObject);
} }
public Map<String, String> getResultnew(JSONObject jsonObject) {
Map<String, String> map = new HashMap<>();
Map<String, String> mapDA = new HashMap<>();
if (ValidationUtil.isEmpty(jsonObject)) {
throw new BadRequest("访问融合终端失败");
}
JSONArray data = jsonObject.getJSONArray("data");
if (!ValidationUtil.isEmpty(data)) {
map = (Map) data.get(0);
if(map.get("sliceData")!=null){
List<Map> list= JSON.parseArray(JSON.toJSONString(map.get("sliceData")),Map.class);
mapDA= list.get(0);
}
}
return mapDA;
}
@Override @Override
public JSONObject selectAudioVideoRecords( public JSONObject selectAudioVideoRecords(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment