From bb50a243145dba2b3bf5f3bf225c63a092697a16 Mon Sep 17 00:00:00 2001
From: mrjackwang <30337754+mrjackwang@users.noreply.github.com>
Date: 星期五, 04 三月 2022 20:37:17 +0800
Subject: [PATCH] Merge branch '648540858:wvp-28181-2.0' into wvp-28181-2.0

---
 src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java |   36 ++++++++++++++++++++++++++++--------
 1 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java
index f099631..5f02b2a 100644
--- a/src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java
@@ -1,15 +1,15 @@
 package com.genersoft.iot.vmp.vmanager.streamProxy;
 
 import com.alibaba.fastjson.JSONObject;
-import com.genersoft.iot.vmp.media.zlm.dto.IMediaServerItem;
+import com.genersoft.iot.vmp.common.StreamInfo;
 import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
 import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
 import com.genersoft.iot.vmp.service.IMediaServerService;
+import com.genersoft.iot.vmp.service.IMediaService;
 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
 import com.genersoft.iot.vmp.service.IStreamProxyService;
 import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
 import com.github.pagehelper.PageInfo;
-import io.netty.util.internal.StringUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -70,13 +70,33 @@
     public WVPResult save(@RequestBody StreamProxyItem param){
         logger.info("娣诲姞浠g悊锛� " + JSONObject.toJSONString(param));
         if (StringUtils.isEmpty(param.getMediaServerId())) param.setMediaServerId("auto");
-        String msg = streamProxyService.save(param);
-        WVPResult<Object> result = new WVPResult<>();
-        result.setCode(0);
-        result.setMsg(msg);
+        if (StringUtils.isEmpty(param.getType())) param.setType("default");
+        if (StringUtils.isEmpty(param.getGbId())) param.setGbId(null);
+        WVPResult<StreamInfo> result = streamProxyService.save(param);
         return result;
     }
-
+    @ApiOperation("淇敼浠g悊")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "param", value = "浠g悊鍙傛暟", dataTypeClass = StreamProxyItem.class),
+    })
+    @PostMapping(value = "/update")
+    @ResponseBody
+    public WVPResult update(@RequestBody StreamProxyItem param){
+        logger.info("淇敼浠g悊锛� " + JSONObject.toJSONString(param));
+        WVPResult<StreamInfo> result = new WVPResult<>();
+        if(StringUtils.isEmpty(param.getApp())||StringUtils.isEmpty(param.getStream())){
+            result.setCode(400);
+            result.setMsg("app涓嶈兘涓簄ull涓攕tream涓嶈兘涓簄ull锛岃妫�鏌ュ叿浣撳弬鏁帮紒");
+            return result;
+        }
+        streamProxyService.del(param.getApp(), param.getStream());
+        if (StringUtils.isEmpty(param.getMediaServerId())) param.setMediaServerId("auto");
+        if (StringUtils.isEmpty(param.getType())) param.setType("default");
+        if (StringUtils.isEmpty(param.getGbId())) param.setGbId(null);
+        param.setEnable(false);
+        result = streamProxyService.save(param);
+        return result;
+    }
     @ApiOperation("鑾峰彇ffmpeg.cmd妯℃澘")
     @GetMapping(value = "/ffmpeg_cmd/list")
     @ApiImplicitParams({
@@ -86,7 +106,7 @@
     public WVPResult getFFmpegCMDs(@RequestParam String mediaServerId){
         logger.debug("鑾峰彇鑺傜偣[ {} ]ffmpeg.cmd妯℃澘", mediaServerId );
 
-        IMediaServerItem mediaServerItem = mediaServerService.getOne(mediaServerId);
+        MediaServerItem mediaServerItem = mediaServerService.getOne(mediaServerId);
         JSONObject data = streamProxyService.getFFmpegCMDs(mediaServerItem);
         WVPResult<JSONObject> result = new WVPResult<>();
         result.setCode(0);

--
Gitblit v1.8.0