|
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.annotation.JSONField; |
|
|
|
import com.kms.yxgh.df.dto.DfSpPlayDto; |
|
|
|
import com.kms.yxgh.df.dto.DfSpPlayGridDto; |
|
|
|
import com.kms.yxgh.df.dto.DfSpPlayQueDto; |
|
|
|
import com.kms.yxgh.df.dto.ReservoirListDto; |
|
|
|
import com.kms.yxgh.util.DataCenterRestTemplateUtils; |
|
|
@ -12,14 +13,23 @@ import lombok.Data; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.http.*; |
|
|
|
import org.springframework.http.HttpEntity; |
|
|
|
import org.springframework.http.HttpHeaders; |
|
|
|
import org.springframework.http.HttpMethod; |
|
|
|
import org.springframework.http.MediaType; |
|
|
|
import org.springframework.http.ResponseEntity; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.util.LinkedMultiValueMap; |
|
|
|
import org.springframework.util.MultiValueMap; |
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
import org.springframework.web.client.RestTemplate; |
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Objects; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
@ -85,6 +95,27 @@ public class BsSgcDfSpPlayService { |
|
|
|
private String wmstCode; |
|
|
|
} |
|
|
|
|
|
|
|
public DfSpPlayGridDto playGrid(DfSpPlayQueDto dto) { |
|
|
|
ReservoirListDto reservoirListDto = new ReservoirListDto(); |
|
|
|
reservoirListDto.setResCode(dto.getResCode()); |
|
|
|
ReservoirListDto cameraIdsList = reservoirList(reservoirListDto); |
|
|
|
DfSpPlayGridDto dfSpPlayGridDto = new DfSpPlayGridDto(); |
|
|
|
cameraIdsList |
|
|
|
.getCameraIds() |
|
|
|
.stream() |
|
|
|
.parallel(). |
|
|
|
forEach(e -> { |
|
|
|
DfSpPlayQueDto dfSpPlayQueDto = new DfSpPlayQueDto(); |
|
|
|
dfSpPlayQueDto.setCameraId(e); |
|
|
|
dfSpPlayQueDto.setMobile(dto.getMobile()); |
|
|
|
DfSpPlayDto play = play(dfSpPlayQueDto); |
|
|
|
if (!Objects.isNull(play)) { |
|
|
|
dfSpPlayGridDto.getUrlsMapList().add(play.getUrlsMap()); |
|
|
|
} |
|
|
|
}); |
|
|
|
return dfSpPlayGridDto; |
|
|
|
} |
|
|
|
|
|
|
|
public DfSpPlayDto play(DfSpPlayQueDto dto) { |
|
|
|
DfSpPlayDto rest = new DfSpPlayDto(); |
|
|
|
try { |
|
|
@ -106,6 +137,7 @@ public class BsSgcDfSpPlayService { |
|
|
|
String playOauthTokenUrlJson = getSpPlayUrls(dto); |
|
|
|
VideoInfo videoInfo = JSON.parseObject(playOauthTokenUrlJson, VideoInfo.class); |
|
|
|
if (videoInfo.isSuccess()) { |
|
|
|
videoInfo.getData().getUrls().setCameraId(dto.getCameraId()); |
|
|
|
rest.setUrlsMap(videoInfo.getData().getUrls()); |
|
|
|
} |
|
|
|
return rest; |
|
|
@ -132,6 +164,7 @@ public class BsSgcDfSpPlayService { |
|
|
|
|
|
|
|
@Data |
|
|
|
public static class Url { |
|
|
|
private String cameraId; |
|
|
|
private String rtspPlayUrl; |
|
|
|
private String flvPlayUrl; |
|
|
|
private String rtmpPlayUrl; |
|
|
|