From 872d336dedb501f83e403dfb43f590ce3bc5e4cb Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期一, 11 一月 2021 11:24:56 +0800 Subject: [PATCH] Merge pull request #29 from lawrencehj/wvp-28181-2.0 --- src/main/java/com/genersoft/iot/vmp/vmanager/platform/PlatformController.java | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 47 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/platform/PlatformController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/platform/PlatformController.java index 152fa5d..0823c49 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/platform/PlatformController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/platform/PlatformController.java @@ -1,10 +1,13 @@ package com.genersoft.iot.vmp.vmanager.platform; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; import com.genersoft.iot.vmp.storager.IVideoManagerStorager; +import com.genersoft.iot.vmp.vmanager.platform.bean.ChannelReduce; +import com.genersoft.iot.vmp.vmanager.platform.bean.UpdateChannelParam; import com.github.pagehelper.PageInfo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -14,6 +17,9 @@ import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; import com.genersoft.iot.vmp.conf.SipConfig; + +import java.util.List; +import java.util.Map; @CrossOrigin @@ -25,6 +31,7 @@ @Autowired private IVideoManagerStorager storager; + @Autowired private IRedisCatchStorage redisCatchStorage; @@ -75,10 +82,19 @@ } // TODO 妫�鏌ユ槸鍚﹀凡缁忓瓨鍦�,涓旀敞鍐屾垚鍔�, 濡傛灉娉ㄥ唽鎴愬姛,闇�瑕佸厛娉ㄩ攢涔嬪墠鍐�,淇敼骞舵敞鍐� + ParentPlatform parentPlatformOld = storager.queryParentPlatById(parentPlatform.getDeviceGBId()); + boolean updateResult = storager.updateParentPlatform(parentPlatform); if (updateResult) { - commanderForPlatform.register(parentPlatform); + // 淇濆瓨鏃跺惎鐢ㄥ氨鍙戦�佹敞鍐� + if (parentPlatform.isEnable()) { + // 鍙淇濆瓨灏卞彂閫佹敞鍐� + commanderForPlatform.register(parentPlatform); + }else if (parentPlatformOld != null && parentPlatformOld.isEnable() && !parentPlatform.isEnable()){ // 鍏抽棴鍚敤鏃舵敞閿� + commanderForPlatform.unregister(parentPlatform, null, null); + } + return new ResponseEntity<>("success", HttpStatus.OK); }else { @@ -98,7 +114,7 @@ return new ResponseEntity<>("missing parameters", HttpStatus.BAD_REQUEST); } - // 鍙戦�佺绾挎秷鎭�, + // 鍙戦�佺绾挎秷鎭�,鏃犺鏄惁鎴愬姛閮藉垹闄ょ紦瀛� commanderForPlatform.unregister(parentPlatform, (event -> { // 娓呯┖redis缂撳瓨 redisCatchStorage.delPlatformCatchInfo(parentPlatform.getDeviceGBId()); @@ -132,5 +148,34 @@ return new ResponseEntity<>(String.valueOf(parentPlatform != null), HttpStatus.OK); } + @RequestMapping("/platforms/channelList") + @ResponseBody + public PageInfo<ChannelReduce> channelList(int page, int count, + @RequestParam(required = false) String query, + @RequestParam(required = false) Boolean online, + @RequestParam(required = false) Boolean channelType){ + + if (logger.isDebugEnabled()) { + logger.debug("鏌ヨ鎵�鏈夋墍鏈夐�氶亾API璋冪敤"); + } + + PageInfo<ChannelReduce> channelReduces = storager.queryChannelListInAll(page, count, query, online, channelType, null); + + return channelReduces; + } + + + @RequestMapping("/platforms/updateChannelForGB") + @ResponseBody + public ResponseEntity<String> updateChannelForGB(@RequestBody UpdateChannelParam param){ + + if (logger.isDebugEnabled()) { + logger.debug("缁欎笂绾у钩鍙版坊鍔犲浗鏍囬�氶亾API璋冪敤"); + } + int result = storager.updateChannelForGB(param.getPlatformId(), param.getChannelReduces()); + + return new ResponseEntity<>(String.valueOf(result > 0), HttpStatus.OK); + } + } -- Gitblit v1.8.0