yumeng 1 year ago
parent
commit
aeb2b4bd31

+ 2 - 2
ruixuan-live/src/main/java/com/ruixuan/data/controller/VideoTextController.java

@@ -21,12 +21,12 @@ public class VideoTextController extends BaseController {
 
     @GetMapping(value = "getVideoText")
     @ApiOperation(value = "视频转文本")
-    public ResultResponse getVideoText(@ApiParam("视频URL") @RequestParam(value = "url", required = true) String url) {
+    public String getVideoText(@ApiParam("视频URL") @RequestParam(value = "url", required = true) String url) {
         try {
             return videoTextService.getVideoText(url);
         } catch (Exception e) {
             e.printStackTrace();
-            return ResultResponse.error("转文本异常");
+            return "异常";
         }
     }
 }

+ 1 - 1
ruixuan-live/src/main/java/com/ruixuan/data/service/VideoTextService.java

@@ -4,5 +4,5 @@ import com.ruixuan.common.core.domain.ResultResponse;
 
 public interface VideoTextService {
 
-    ResultResponse getVideoText(String url);
+    String getVideoText(String url);
 }

+ 4 - 4
ruixuan-live/src/main/java/com/ruixuan/data/service/impl/VideoTextServiceImpl.java

@@ -25,9 +25,9 @@ public class VideoTextServiceImpl implements VideoTextService {
     private String downloadPath;
 
     @Override
-    public ResultResponse getVideoText(String url) {
+    public String getVideoText(String url) {
         if (Check.isNull(url)) {
-            return ResultResponse.error("链接为空");
+            return null;
         }
         StringBuffer localPath = new StringBuffer();
         localPath.append(downloadPath).append("/").append("pcm").append("/").append(DateUtils.dateTime()).append("/");
@@ -67,8 +67,8 @@ public class VideoTextServiceImpl implements VideoTextService {
             }
         };
         thread.start();
-        log.info("转文字成功:{}", videoText);
-        return ResultResponse.success(videoText);
+
+        return videoText;
     }
 
 }

+ 11 - 15
ruixuan-live/src/main/java/com/ruixuan/jiaoyang/service/impl/JyMaterialListServiceImpl.java

@@ -161,7 +161,6 @@ public class JyMaterialListServiceImpl implements IJyMaterialListService {
     }
 
 
-
     @Override
     public void insertKeyWord(String type, String keyWord) {
         jyMaterialListMapper.insertKeyWord(type, keyWord);
@@ -175,28 +174,25 @@ public class JyMaterialListServiceImpl implements IJyMaterialListService {
                 JSONArray keyArray = new JSONArray();
                 Integer isKey = 2; // 2 未命中 3 命中
                 JyMaterialList updateMaterial = new JyMaterialList();
-                ResultResponse videoText = videoTextService.getVideoText(videoUrl);
+                String videoText = videoTextService.getVideoText(videoUrl);
                 if (!Check.isNull(videoText)) {
-                    String data = videoText.getData().toString();
-                    if (!Check.isNull(data)) {
-                        if (Check.isNull(keyList)) {
-                            getKeyList();
-                        }
-                        for (JSONObject keyJson : keyList) {
-                            String keyWord = keyJson.getString("keyWord");
-                            if (data.contains(keyWord)) {
-                                isKey = 3;
-                                keyArray.add(keyJson);
-                            }
+                    if (Check.isNull(keyList)) {
+                        getKeyList();
+                    }
+                    for (JSONObject keyJson : keyList) {
+                        String keyWord = keyJson.getString("keyWord");
+                        if (videoText.contains(keyWord)) {
+                            isKey = 3;
+                            keyArray.add(keyJson);
                         }
                     }
                     updateMaterial.setMaterialStatus(isKey);
-                    updateMaterial.setMaterialText(data);
+                    updateMaterial.setMaterialText(videoText);
                     updateMaterial.setViolatingText(keyArray.toJSONString());
                     updateMaterial.setSignature(signature);
                 } else {
                     updateMaterial.setMaterialStatus(isKey);
-                    updateMaterial.setMaterialText(null);
+                    updateMaterial.setMaterialText(videoText);
                     updateMaterial.setViolatingText(keyArray.toJSONString());
                     updateMaterial.setSignature(signature);
                 }