From 1467549b055d6ffd2858dcfecc3d56865b301479 Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Tue, 31 Oct 2023 09:10:55 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=86=E9=A2=91=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/VideoServiceImpl.java | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/VideoServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/VideoServiceImpl.java index 77c4979..bb62362 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/VideoServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/VideoServiceImpl.java @@ -222,17 +222,19 @@ public class VideoServiceImpl implements VideoService { fileName=fileId+fileName; String absPath = getAbsoluteFile(RuoYiConfig.getVideoUploadPath(), fileName).getAbsolutePath(); staticAndMksDir = Paths.get(absPath).toFile().toString(); - HttpUtil.downloadFile(fileUrl, staticAndMksDir ); - Long caseId= caseApplicationMapper.selectCaseIdByRoomId(roomId); - String annexName = getPathFileName(RuoYiConfig.getVideoUploadPath(), fileName); - // 存入数据库 - CaseAttach caseAttach = CaseAttach.builder().caseAppliId(caseId) - .annexName(annexName) - .annexPath(RuoYiConfig.getVideoUploadPath()) - .annexType(9) - .build(); - caseAttachMapper.save(caseAttach); - return annexName; + long downloadFile = HttpUtil.downloadFile(fileUrl, staticAndMksDir); + if(downloadFile>0) { + Long caseId = caseApplicationMapper.selectCaseIdByRoomId(roomId); + String annexName = getPathFileName(RuoYiConfig.getVideoUploadPath(), fileName); + // 存入数据库 + CaseAttach caseAttach = CaseAttach.builder().caseAppliId(caseId) + .annexName(annexName) + .annexPath(RuoYiConfig.getVideoUploadPath()) + .annexType(9) + .build(); + caseAttachMapper.save(caseAttach); + return annexName; + } } return "";