ソースを参照

实验室配置详情接口异常bug处理

linfutong 3 年 前
コミット
76fca8f076
共有1 個のファイルを変更した21 個の追加15 個の削除を含む
  1. 21 15
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/iot/vmp/vmanager/gb28181/play/PlayController.java

+ 21 - 15
zd-modules/zd-algorithm/src/main/java/com/zd/alg/iot/vmp/vmanager/gb28181/play/PlayController.java

@@ -107,21 +107,27 @@ public class PlayController {
         String deviceStr[] = deviceIds.split(",");
         List<String> deviceList = Arrays.asList(deviceStr);
         List<DeviceChannel> deviceChannelList = playService.queryChannelByDeviceId(deviceList, page, count);
-        for (DeviceChannel deviceChannel : deviceChannelList) {
-            // 获取可用的zlm
-            Device device = storager.queryVideoDevice(deviceChannel.getDeviceId());
-            MediaServerItem newMediaServerItem = playService.getNewMediaServerItem(device);
-            PlayResult playResult = playService.play(newMediaServerItem, deviceChannel.getDeviceId(), deviceChannel.getChannelId(), null, null);
-            DeferredResult<ResponseEntity<String>> result=playResult.getResult();
-            ResponseEntity responseEntity =  (ResponseEntity)result.getResult();
-            if(responseEntity != null && responseEntity.getStatusCode()==HttpStatus.OK){
-                WVPResult wvpResult = (WVPResult)responseEntity.getBody();
-                if (wvpResult.getCode() == 0) {
-                    StreamInfo streamInfo = (StreamInfo)wvpResult.getData();
-                    list.add(streamInfo);
-                }
-            }
-        }
+        if (deviceChannelList != null && deviceChannelList.size() > 0) {
+			for (DeviceChannel deviceChannel : deviceChannelList) {
+				// 获取可用的zlm
+				Device device = storager.queryVideoDevice(deviceChannel.getDeviceId());
+				MediaServerItem newMediaServerItem = playService.getNewMediaServerItem(device);
+				PlayResult playResult = playService.play(newMediaServerItem, deviceChannel.getDeviceId(), deviceChannel.getChannelId(), null, null);
+				if (playResult != null && playResult.getResult() != null) {
+					DeferredResult<ResponseEntity<String>> result = playResult.getResult();
+					if (result != null && result.getResult() != null) {
+						ResponseEntity responseEntity = (ResponseEntity) result.getResult();
+						if (responseEntity != null && responseEntity.getStatusCode() == HttpStatus.OK) {
+							WVPResult wvpResult = (WVPResult) responseEntity.getBody();
+							if (wvpResult.getCode() == 0) {
+								StreamInfo streamInfo = (StreamInfo) wvpResult.getData();
+								list.add(streamInfo);
+							}
+						}
+					}
+				}
+			}
+		}
         Map<String, Object> map = new HashMap<>();
         map.put("code", "200");
         map.put("msg", "成功!");