old mode 100644
new mode 100755
| | |
| | | package com.genersoft.iot.vmp.vmanager.gb28181.gbStream; |
| | | |
| | | import com.genersoft.iot.vmp.conf.exception.ControllerException; |
| | | import com.genersoft.iot.vmp.conf.security.JwtUtils; |
| | | import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| | | import com.genersoft.iot.vmp.vmanager.gb28181.gbStream.bean.GbStreamParam; |
| | | import com.genersoft.iot.vmp.service.IGbStreamService; |
| | | import com.genersoft.iot.vmp.service.IPlatformService; |
| | | import com.genersoft.iot.vmp.service.IStreamPushService; |
| | | import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; |
| | | import com.genersoft.iot.vmp.vmanager.gb28181.gbStream.bean.GbStreamParam; |
| | | import com.github.pagehelper.PageInfo; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.security.SecurityRequirement; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Tag(name = "视频流关联到级联平台") |
| | | @CrossOrigin |
| | | |
| | | @RestController |
| | | @RequestMapping("/api/gbStream") |
| | | public class GbStreamController { |
| | |
| | | private IGbStreamService gbStreamService; |
| | | |
| | | @Autowired |
| | | private IVideoManagerStorage storager; |
| | | private IStreamPushService service; |
| | | |
| | | @Autowired |
| | | private IPlatformService platformService; |
| | | |
| | | |
| | | /** |
| | |
| | | * @param platformId 平台ID |
| | | * @return |
| | | */ |
| | | @Operation(summary = "查询国标通道") |
| | | @Operation(summary = "查询国标通道", security = @SecurityRequirement(name = JwtUtils.HEADER)) |
| | | @Parameter(name = "page", description = "当前页", required = true) |
| | | @Parameter(name = "count", description = "每页条数", required = true) |
| | | @Parameter(name = "platformId", description = "平台ID", required = true) |
| | |
| | | @RequestParam(required = false)String catalogId, |
| | | @RequestParam(required = false)String query, |
| | | @RequestParam(required = false)String mediaServerId){ |
| | | if (StringUtils.isEmpty(catalogId)) { |
| | | if (ObjectUtils.isEmpty(catalogId)) { |
| | | catalogId = null; |
| | | } |
| | | if (StringUtils.isEmpty(query)) { |
| | | if (ObjectUtils.isEmpty(query)) { |
| | | query = null; |
| | | } |
| | | if (StringUtils.isEmpty(mediaServerId)) { |
| | | if (ObjectUtils.isEmpty(mediaServerId)) { |
| | | mediaServerId = null; |
| | | } |
| | | |
| | |
| | | * @param gbStreamParam |
| | | * @return |
| | | */ |
| | | @Operation(summary = "移除国标关联") |
| | | @Operation(summary = "移除国标关联", security = @SecurityRequirement(name = JwtUtils.HEADER)) |
| | | @DeleteMapping(value = "/del") |
| | | @ResponseBody |
| | | public Object del(@RequestBody GbStreamParam gbStreamParam){ |
| | | if (gbStreamService.delPlatformInfo(gbStreamParam.getPlatformId(), gbStreamParam.getGbStreams())) { |
| | | return "success"; |
| | | public void del(@RequestBody GbStreamParam gbStreamParam){ |
| | | |
| | | if (gbStreamParam.getGbStreams() == null || gbStreamParam.getGbStreams().isEmpty()) { |
| | | if (gbStreamParam.isAll()) { |
| | | gbStreamService.delAllPlatformInfo(gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId()); |
| | | } |
| | | }else { |
| | | return "fail"; |
| | | gbStreamService.delPlatformInfo(gbStreamParam.getPlatformId(), gbStreamParam.getGbStreams()); |
| | | } |
| | | |
| | | } |
| | |
| | | * @param gbStreamParam |
| | | * @return |
| | | */ |
| | | @Operation(summary = "保存国标关联") |
| | | @Operation(summary = "保存国标关联", security = @SecurityRequirement(name = JwtUtils.HEADER)) |
| | | @PostMapping(value = "/add") |
| | | @ResponseBody |
| | | public Object add(@RequestBody GbStreamParam gbStreamParam){ |
| | | if (gbStreamService.addPlatformInfo(gbStreamParam.getGbStreams(), gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId())) { |
| | | return "success"; |
| | | public void add(@RequestBody GbStreamParam gbStreamParam){ |
| | | if (gbStreamParam.getGbStreams() == null || gbStreamParam.getGbStreams().isEmpty()) { |
| | | if (gbStreamParam.isAll()) { |
| | | List<GbStream> allGBChannels = gbStreamService.getAllGBChannels(gbStreamParam.getPlatformId()); |
| | | gbStreamService.addPlatformInfo(allGBChannels, gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId()); |
| | | } |
| | | }else { |
| | | return "fail"; |
| | | gbStreamService.addPlatformInfo(gbStreamParam.getGbStreams(), gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 保存国标关联 |
| | | * @param gbId |
| | | * @return |
| | | */ |
| | | @Operation(summary = "保存国标关联", security = @SecurityRequirement(name = JwtUtils.HEADER)) |
| | | @GetMapping(value = "/addWithGbid") |
| | | @ResponseBody |
| | | public void add(String gbId, String platformGbId, @RequestParam(required = false) String catalogGbId){ |
| | | List<GbStream> gbStreams = gbStreamService.getGbChannelWithGbid(gbId); |
| | | if (gbStreams.isEmpty()) { |
| | | throw new ControllerException(ErrorCode.ERROR100.getCode(), "gbId的信息未找到"); |
| | | } |
| | | gbStreamService.addPlatformInfo(gbStreams, platformGbId, catalogGbId); |
| | | } |
| | | } |