Commit b3d21c745214cef844b0def5d218410bc09b0c6b

Authored by 648540858
2 parents e8770eec a9264a8b

Merge branch '2.6.9' into wvp-28181-2.0

src/main/java/com/genersoft/iot/vmp/media/zlm/AssistRESTfulUtils.java
... ... @@ -78,11 +78,11 @@ public class AssistRESTfulUtils {
78 78 logger.warn("未启用Assist服务");
79 79 return null;
80 80 }
81   - StringBuffer stringBuffer = new StringBuffer();
82   - stringBuffer.append(String.format("http://%s:%s/%s", mediaServerItem.getIp(), mediaServerItem.getRecordAssistPort(), api));
  81 + StringBuilder stringBuffer = new StringBuilder();
  82 + stringBuffer.append(api);
83 83 JSONObject responseJSON = null;
84 84  
85   - if (param != null && param.keySet().size() > 0) {
  85 + if (param != null && !param.keySet().isEmpty()) {
86 86 stringBuffer.append("?");
87 87 int index = 1;
88 88 for (String key : param.keySet()){
... ... @@ -97,6 +97,7 @@ public class AssistRESTfulUtils {
97 97 }
98 98  
99 99 String url = stringBuffer.toString();
  100 + logger.info("[访问assist]: {}", url);
100 101 Request request = new Request.Builder()
101 102 .get()
102 103 .url(url)
... ... @@ -262,7 +263,8 @@ public class AssistRESTfulUtils {
262 263 return sendPost(mediaServerItem, urlStr, videoTaskInfoJSON, null, 30);
263 264 }
264 265  
265   - public JSONObject queryTaskList(MediaServerItem mediaServerItem, String app, String stream, String callId, String taskId, Boolean isEnd) {
  266 + public JSONObject queryTaskList(MediaServerItem mediaServerItem, String app, String stream, String callId,
  267 + String taskId, Boolean isEnd, String scheme) {
266 268 Map<String, Object> param = new HashMap<>();
267 269 if (!ObjectUtils.isEmpty(app)) {
268 270 param.put("app", app);
... ... @@ -279,7 +281,8 @@ public class AssistRESTfulUtils {
279 281 if (!ObjectUtils.isEmpty(isEnd)) {
280 282 param.put("isEnd", isEnd);
281 283 }
282   -
283   - return sendGet(mediaServerItem, "api/record/file/download/task/list", param, null);
  284 + String urlStr = String.format("%s://%s:%s/api/record/file/download/task/list",
  285 + scheme, mediaServerItem.getIp(), mediaServerItem.getRecordAssistPort());;
  286 + return sendGet(mediaServerItem, urlStr, param, null);
284 287 }
285 288 }
... ...
src/main/java/com/genersoft/iot/vmp/service/ICloudRecordService.java
... ... @@ -40,7 +40,7 @@ public interface ICloudRecordService {
40 40 /**
41 41 * 查询合并任务列表
42 42 */
43   - JSONArray queryTask(String app, String stream, String callId, String taskId, String mediaServerId, Boolean isEnd);
  43 + JSONArray queryTask(String app, String stream, String callId, String taskId, String mediaServerId, Boolean isEnd, String scheme);
44 44  
45 45 /**
46 46 * 收藏视频,收藏的视频过期不会删除
... ...
src/main/java/com/genersoft/iot/vmp/service/impl/CloudRecordServiceImpl.java
... ... @@ -144,7 +144,8 @@ public class CloudRecordServiceImpl implements ICloudRecordService {
144 144 }
145 145  
146 146 @Override
147   - public JSONArray queryTask(String app, String stream, String callId, String taskId, String mediaServerId, Boolean isEnd) {
  147 + public JSONArray queryTask(String app, String stream, String callId, String taskId, String mediaServerId,
  148 + Boolean isEnd, String scheme) {
148 149 MediaServerItem mediaServerItem = null;
149 150 if (mediaServerId == null) {
150 151 mediaServerItem = mediaServerService.getDefaultMediaServer();
... ... @@ -154,7 +155,8 @@ public class CloudRecordServiceImpl implements ICloudRecordService {
154 155 if (mediaServerItem == null) {
155 156 throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到可用的流媒体");
156 157 }
157   - JSONObject result = assistRESTfulUtils.queryTaskList(mediaServerItem, app, stream, callId, taskId, isEnd);
  158 +
  159 + JSONObject result = assistRESTfulUtils.queryTaskList(mediaServerItem, app, stream, callId, taskId, isEnd, scheme);
158 160 if (result == null || result.getInteger("code") != 0) {
159 161 throw new ControllerException(ErrorCode.ERROR100.getCode(), result == null ? "查询任务列表失败" : result.getString("msg"));
160 162 }
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/cloudRecord/CloudRecordController.java
... ... @@ -177,7 +177,7 @@ public class CloudRecordController {
177 177 throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到可用的流媒体");
178 178 }else {
179 179 if (remoteHost == null) {
180   - remoteHost = request.getScheme() + "://" + request.getLocalAddr() + ":" + mediaServerItem.getRecordAssistPort();
  180 + remoteHost = request.getScheme() + "://" + mediaServerItem.getIp() + ":" + mediaServerItem.getRecordAssistPort();
181 181 }
182 182 }
183 183 return cloudRecordService.addTask(app, stream, mediaServerItem, startTime, endTime, callId, remoteHost, mediaServerId != null);
... ... @@ -190,6 +190,7 @@ public class CloudRecordController {
190 190 @Parameter(name = "mediaServerId", description = "流媒体ID", required = false)
191 191 @Parameter(name = "isEnd", description = "是否结束", required = false)
192 192 public JSONArray queryTaskList(
  193 + HttpServletRequest request,
193 194 @RequestParam(required = false) String app,
194 195 @RequestParam(required = false) String stream,
195 196 @RequestParam(required = false) String callId,
... ... @@ -200,7 +201,8 @@ public class CloudRecordController {
200 201 if (ObjectUtils.isEmpty(mediaServerId)) {
201 202 mediaServerId = null;
202 203 }
203   - return cloudRecordService.queryTask(app, stream, callId, taskId, mediaServerId, isEnd);
  204 +
  205 + return cloudRecordService.queryTask(app, stream, callId, taskId, mediaServerId, isEnd, request.getScheme());
204 206 }
205 207  
206 208 @ResponseBody
... ...