浏览代码

视频代码

18792927508 2 年前
父节点
当前提交
1467549b05
共有 1 个文件被更改,包括 13 次插入11 次删除
  1. 13
    11
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/VideoServiceImpl.java

+ 13
- 11
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/VideoServiceImpl.java 查看文件

@@ -222,17 +222,19 @@ public class VideoServiceImpl implements VideoService {
222 222
             fileName=fileId+fileName;
223 223
                 String absPath = getAbsoluteFile(RuoYiConfig.getVideoUploadPath(), fileName).getAbsolutePath();
224 224
                 staticAndMksDir = Paths.get(absPath).toFile().toString();
225
-                HttpUtil.downloadFile(fileUrl, staticAndMksDir );
226
-            Long caseId= caseApplicationMapper.selectCaseIdByRoomId(roomId);
227
-            String annexName = getPathFileName(RuoYiConfig.getVideoUploadPath(), fileName);
228
-            // 存入数据库
229
-            CaseAttach caseAttach = CaseAttach.builder().caseAppliId(caseId)
230
-                    .annexName(annexName)
231
-                    .annexPath(RuoYiConfig.getVideoUploadPath())
232
-                    .annexType(9)
233
-                    .build();
234
-             caseAttachMapper.save(caseAttach);
235
-            return annexName;
225
+            long downloadFile = HttpUtil.downloadFile(fileUrl, staticAndMksDir);
226
+            if(downloadFile>0) {
227
+                Long caseId = caseApplicationMapper.selectCaseIdByRoomId(roomId);
228
+                String annexName = getPathFileName(RuoYiConfig.getVideoUploadPath(), fileName);
229
+                // 存入数据库
230
+                CaseAttach caseAttach = CaseAttach.builder().caseAppliId(caseId)
231
+                        .annexName(annexName)
232
+                        .annexPath(RuoYiConfig.getVideoUploadPath())
233
+                        .annexType(9)
234
+                        .build();
235
+                caseAttachMapper.save(caseAttach);
236
+                return annexName;
237
+            }
236 238
         }
237 239
         return "";
238 240