| | |
| | | package com.genersoft.iot.vmp.media.zlm; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| | | import okhttp3.*; |
| | | import okhttp3.logging.HttpLoggingInterceptor; |
| | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.net.ConnectException; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | @Component |
| | | public class AssistRESTfulUtils { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(AssistRESTfulUtils.class); |
| | | |
| | | |
| | | public interface RequestCallback{ |
| | | void run(JSONObject response); |
| | |
| | | return sendGet(mediaServerItem, "api/record/file/duration",param, callback); |
| | | } |
| | | |
| | | public JSONObject getInfo(MediaServerItem mediaServerItem, RequestCallback callback){ |
| | | Map<String, Object> param = new HashMap<>(); |
| | | return sendGet(mediaServerItem, "api/record/info",param, callback); |
| | | } |
| | | |
| | | public JSONObject addStreamCallInfo(MediaServerItem mediaServerItem, String app, String stream, String callId, RequestCallback callback){ |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("app",app); |
| | |
| | | return sendGet(mediaServerItem, "api/record/addStreamCallInfo",param, callback); |
| | | } |
| | | |
| | | public JSONObject getDateList(MediaServerItem mediaServerItem, String app, String stream, int year, int month) { |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("app", app); |
| | | param.put("stream", stream); |
| | | param.put("year", year); |
| | | param.put("month", month); |
| | | return sendGet(mediaServerItem, "api/record/date/list", param, null); |
| | | } |
| | | |
| | | public JSONObject getFileList(MediaServerItem mediaServerItem, int page, int count, String app, String stream, |
| | | String startTime, String endTime) { |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("app", app); |
| | | param.put("stream", stream); |
| | | param.put("page", page); |
| | | param.put("count", count); |
| | | param.put("startTime", startTime); |
| | | param.put("endTime", endTime); |
| | | return sendGet(mediaServerItem, "api/record/file/listWithDate", param, null); |
| | | } |
| | | |
| | | } |