浏览代码

不能删除

zhujinghui 4 年之前
父节点
当前提交
6d1ef90dc4

+ 4 - 3
4dkankan-scene/src/main/java/com/fdkankan/scene/service/impl/SceneProServiceImpl.java

@@ -40,7 +40,6 @@ import com.github.pagehelper.Page;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.util.StringUtil;
-import com.google.gson.JsonObject;
 import lombok.extern.slf4j.Slf4j;
 import net.coobird.thumbnailator.Thumbnails;
 import org.apache.commons.lang3.StringUtils;
@@ -3901,7 +3900,8 @@ public class SceneProServiceImpl extends BaseServiceImpl<SceneProEntity, String>
         if (videos == null) {
             throw new BaseRuntimeException("json数据异常");
         }
-        data = ((JsonObject)videos).get("data");
+        JSONObject vo = (JSONObject) videos;
+        data = vo.get("data");
         if (data == null || data instanceof JSONArray == false) {
             throw new BaseRuntimeException("json-data数据异常");
         }
@@ -3919,7 +3919,8 @@ public class SceneProServiceImpl extends BaseServiceImpl<SceneProEntity, String>
         if (videos == null) {
             throw new BaseRuntimeException("json数据异常");
         }
-        data = ((JsonObject)videos).get("data");
+        JSONObject vo = (JSONObject) videos;
+        data = vo.get("data");
         if (data == null || data instanceof JSONArray == false) {
             throw new BaseRuntimeException("json-data数据异常");
         }

+ 2 - 3
4dkankan-scene/src/main/java/com/fdkankan/scene/util/CreateObjUtil.java

@@ -47,12 +47,11 @@ public class CreateObjUtil{
 	public static void generateShareVideo(String videoPath, String ffmpegEnv) throws Exception{
 		log.info("生成水印视频开始");
 		String fileName = videoPath.substring(videoPath.lastIndexOf("/") + 1, videoPath.lastIndexOf("."));
-		String suffix = videoPath.substring(videoPath.lastIndexOf("."));
 		String fileFolderPath = videoPath.substring(0, videoPath.lastIndexOf("/") + 1);
 		String command = "ssh root@" + ffmpegEnv +  " '4dage-ffmpeg-rotVwatermark -s " + videoPath
 				+ " -w " + Constant.WATER_MARK_PATH
-				+ " -n " + fileName + Constant.SCENE_VIDEO_SHARE_SUFFIX + suffix
-				+ " -o " + fileFolderPath + "'";
+				+ " -n " + fileName + Constant.SCENE_VIDEO_SHARE_SUFFIX
+				+ " -o " + fileFolderPath.substring(0, fileFolderPath.length() - 1) + "'";
 		log.info("调用脚本命令-{}", command);
 		callshell(command);
 		log.info("生成水印视频结束");

+ 0 - 21
4dkankan-web/src/main/java/com/fdkankan/web/controller/SceneEditController.java

@@ -1164,25 +1164,4 @@ public class SceneEditController extends BaseController {
         return ViewResult.success(new DownlVideoVO(url));
     }
 
-
-    @ApiOperation(value = "", hidden = true)
-    @GetMapping("/test")
-    public ViewResult test() throws Exception{
-        String json = "{\"data\":[{\"blend_fov\":\"7\",\"id\":\"2\",\"value\":\"1.31156\"},{\"blend_fov\":\"7\",\"id\":\"4\",\"value\":\"0.890266\"}],\"upPath\":\"https://4dkk.4dage.com/data/datat-kryAqiX/Up.xml\",\"version\":3}";
-        JSONObject scenejson = JSONObject.parseObject(json);
-        System.out.println(scenejson);
-        Object data =  scenejson.get("data");
-        JSONArray jsonArray = (JSONArray) data;
-        Object jsonObj = jsonArray.stream().filter(j -> "2".equals(((JSONObject)j).get("id")))
-                .findAny().orElseThrow(() -> new BaseRuntimeException("json数据data里找不到对应记录"));
-
-        ((JSONObject)jsonObj).put("show", true);
-
-        System.out.println(scenejson);
-        return null;
-    }
-
-
-
-
 }

+ 50 - 0
4dkankan-web/src/main/java/com/fdkankan/web/controller/TestController.java

@@ -0,0 +1,50 @@
+package com.fdkankan.web.controller;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.common.api.BaseController;
+import com.fdkankan.common.exception.BaseRuntimeException;
+import com.fdkankan.common.model.ViewResult;
+import com.fdkankan.scene.util.CreateObjUtil;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.log4j.Log4j2;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Log4j2
+@Api(tags = "test")
+@RestController
+@RequestMapping("/api/test")
+public class TestController extends BaseController {
+
+    @ApiOperation(value = "", hidden = true)
+    @GetMapping("/test1")
+    public ViewResult test1() throws Exception{
+        String json = "{\"data\":[{\"blend_fov\":\"7\",\"id\":\"2\",\"value\":\"1.31156\"},{\"blend_fov\":\"7\",\"id\":\"4\",\"value\":\"0.890266\"}],\"upPath\":\"https://4dkk.4dage.com/data/datat-kryAqiX/Up.xml\",\"version\":3}";
+        JSONObject scenejson = JSONObject.parseObject(json);
+        System.out.println(scenejson);
+        Object data =  scenejson.get("data");
+        JSONArray jsonArray = (JSONArray) data;
+        Object jsonObj = jsonArray.stream().filter(j -> "2".equals(((JSONObject)j).get("id")))
+                .findAny().orElseThrow(() -> new BaseRuntimeException("json数据data里找不到对应记录"));
+
+        ((JSONObject)jsonObj).put("show", true);
+
+        System.out.println(scenejson);
+        return null;
+    }
+
+    @ApiOperation("获取")
+    @GetMapping("/test2")
+    public void test2() throws Exception {
+        String url = "/mnt/4Dkankan/scene/video/videoHDdAupM0Px/0.mp4";
+        String ip = "127.0.0.1";
+        CreateObjUtil.generateShareVideo(url, ip);
+    }
+
+
+
+
+}

+ 2 - 7
4dkankan-web/src/main/java/com/fdkankan/web/controller/VrController.java

@@ -3,6 +3,7 @@ package com.fdkankan.web.controller;
 import com.fdkankan.common.api.BaseController;
 import com.fdkankan.common.model.ViewResult;
 import com.fdkankan.common.util.RandomUtil;
+import com.fdkankan.scene.util.CreateObjUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.log4j.Log4j2;
@@ -27,13 +28,7 @@ public class VrController extends BaseController {
         return ViewResult.success(RandomUtil.generateOnlyStringLongUuid());
     }
 
-    @ApiOperation("获取")
-    @GetMapping("/test")
-    public void test() {
-        String d = "op/dddd/aa.mp4";
-        System.out.println(d.substring(d.lastIndexOf("/") + 1, d.lastIndexOf(".")));
-        System.out.println(d.substring(d.lastIndexOf(".")));
-    }
+
 
 
 }