Browse Source

update:视频播放改成网格模式

release-sy-v1.0.0
“lyd” 3 weeks ago
parent
commit
57197faa59
  1. 8
      shuili-system/src/main/java/com/kms/yg/df/controller/BsSgcDfSpPlayController.java
  2. 37
      shuili-system/src/main/java/com/kms/yg/df/service/BsSgcDfSpPlayService.java
  3. 18
      shuili-system/src/main/java/com/kms/yxgh/df/dto/DfSpPlayGridDto.java
  4. 4
      shuili-system/src/main/java/com/kms/yxgh/df/dto/DfSpPlayQueDto.java

8
shuili-system/src/main/java/com/kms/yg/df/controller/BsSgcDfSpPlayController.java

@ -6,7 +6,7 @@ package com.kms.yg.df.controller;
import com.kms.yg.df.service.BsSgcDfSpPlayService; import com.kms.yg.df.service.BsSgcDfSpPlayService;
import com.kms.yxgh.base.Response; import com.kms.yxgh.base.Response;
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.DfSpPlayQueDto;
import com.kms.yxgh.df.dto.ReservoirListDto; import com.kms.yxgh.df.dto.ReservoirListDto;
import com.shuili.common.core.controller.BaseController; import com.shuili.common.core.controller.BaseController;
@ -37,9 +37,9 @@ public class BsSgcDfSpPlayController extends BaseController {
* @return * @return
*/ */
@PostMapping("/play") @PostMapping("/play")
@ApiOperation("视频播放") @ApiOperation("视频播放-九宫格")
public Response<DfSpPlayDto> Play(@RequestBody DfSpPlayQueDto dto) { public Response<DfSpPlayGridDto> Play(@RequestBody DfSpPlayQueDto dto) {
return Response.ok(bsSgcDfSpPlayService.play(dto)); return Response.ok(bsSgcDfSpPlayService.playGrid(dto));
} }
/** /**

37
shuili-system/src/main/java/com/kms/yg/df/service/BsSgcDfSpPlayService.java

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.kms.yxgh.df.dto.DfSpPlayDto; 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.DfSpPlayQueDto;
import com.kms.yxgh.df.dto.ReservoirListDto; import com.kms.yxgh.df.dto.ReservoirListDto;
import com.kms.yxgh.util.DataCenterRestTemplateUtils; import com.kms.yxgh.util.DataCenterRestTemplateUtils;
@ -12,14 +13,23 @@ import lombok.Data;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; 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.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.client.RestTemplate; 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; import java.util.stream.Collectors;
@ -85,6 +95,27 @@ public class BsSgcDfSpPlayService {
private String wmstCode; 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) { public DfSpPlayDto play(DfSpPlayQueDto dto) {
DfSpPlayDto rest = new DfSpPlayDto(); DfSpPlayDto rest = new DfSpPlayDto();
try { try {
@ -106,6 +137,7 @@ public class BsSgcDfSpPlayService {
String playOauthTokenUrlJson = getSpPlayUrls(dto); String playOauthTokenUrlJson = getSpPlayUrls(dto);
VideoInfo videoInfo = JSON.parseObject(playOauthTokenUrlJson, VideoInfo.class); VideoInfo videoInfo = JSON.parseObject(playOauthTokenUrlJson, VideoInfo.class);
if (videoInfo.isSuccess()) { if (videoInfo.isSuccess()) {
videoInfo.getData().getUrls().setCameraId(dto.getCameraId());
rest.setUrlsMap(videoInfo.getData().getUrls()); rest.setUrlsMap(videoInfo.getData().getUrls());
} }
return rest; return rest;
@ -132,6 +164,7 @@ public class BsSgcDfSpPlayService {
@Data @Data
public static class Url { public static class Url {
private String cameraId;
private String rtspPlayUrl; private String rtspPlayUrl;
private String flvPlayUrl; private String flvPlayUrl;
private String rtmpPlayUrl; private String rtmpPlayUrl;

18
shuili-system/src/main/java/com/kms/yxgh/df/dto/DfSpPlayGridDto.java

@ -0,0 +1,18 @@
package com.kms.yxgh.df.dto;
import com.kms.yg.df.service.BsSgcDfSpPlayService;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@ApiModel("视频播放")
@Data
public class DfSpPlayGridDto {
@ApiModelProperty(value = "播放地址")
private List<BsSgcDfSpPlayService.Url> urlsMapList = new ArrayList<>();
}

4
shuili-system/src/main/java/com/kms/yxgh/df/dto/DfSpPlayQueDto.java

@ -33,5 +33,9 @@ public class DfSpPlayQueDto {
@ApiModelProperty(value = "每页条数") @ApiModelProperty(value = "每页条数")
private Integer pageNum = 1; private Integer pageNum = 1;
@JSONField(name = "RES_CODE")
@ApiModelProperty(value = "水库编码")
private String resCode;
} }

Loading…
Cancel
Save