tsurumure 3 сар өмнө
parent
commit
b01e6801d8

+ 15 - 15
src/main/java/com/backendsys/modules/upload/service/impl/SysFileMultipartServiceImpl.java

@@ -156,9 +156,9 @@ public class SysFileMultipartServiceImpl implements SysFileMultipartService {
         String filename = multipartFile.getOriginalFilename();
         if (filename.length() > 50) throw new CustException("文件名长度不能超过 50 字符");
 
-        // 按用户加锁
-        RLock lock = redissonClient.getLock("lock::multipart-upload::user-id::" + SecurityUtil.getUserId());
-        try { lock.tryLock(3, TimeUnit.SECONDS);
+//        // 按用户加锁
+//        RLock lock = redissonClient.getLock("lock::multipart-upload::user-id::" + SecurityUtil.getUserId());
+//        try { lock.tryLock(3, TimeUnit.SECONDS);
 
             // 获得公共配置
             List<SysCommon> sysCommonList = sysCommonService.getCommonByCategory("UPLOAD");
@@ -235,8 +235,8 @@ public class SysFileMultipartServiceImpl implements SysFileMultipartService {
                 throw new RuntimeException(e);
             }
 
-        } catch (InterruptedException e) { throw new RuntimeException(e);
-        } finally { lock.unlock(); }
+//        } catch (InterruptedException e) { throw new RuntimeException(e);
+//        } finally { lock.unlock(); }
     }
 
     // 2.上传分块
@@ -249,9 +249,9 @@ public class SysFileMultipartServiceImpl implements SysFileMultipartService {
         if (StrUtil.isEmpty(upload_id)) throw new CustException("upload_id 不能为空");
         if (upload_chunk_index == null) throw new CustException("upload_chunk_index 不能为空");
 
-        // 按用户加锁
-        RLock lock = redissonClient.getLock("lock::multipart-upload::user-id::" + SecurityUtil.getUserId());
-        try { lock.tryLock(3, TimeUnit.SECONDS);
+//        // 按用户加锁
+//        RLock lock = redissonClient.getLock("lock::multipart-upload::user-id::" + SecurityUtil.getUserId());
+//        try { lock.tryLock(3, TimeUnit.SECONDS);
 
             // [Get] 获得初始化分块信息
             SysFile sysFileEntity = sysFileDao.selectOne(new LambdaQueryWrapper<SysFile>().eq(SysFile::getUpload_id, upload_id));
@@ -299,8 +299,8 @@ public class SysFileMultipartServiceImpl implements SysFileMultipartService {
             resp.put("part_etag", part_etag);
             return resp;
 
-        } catch (InterruptedException e) { throw new RuntimeException(e);
-        } finally { lock.unlock(); }
+//        } catch (InterruptedException e) { throw new RuntimeException(e);
+//        } finally { lock.unlock(); }
     }
 
     // 完成分块上传
@@ -309,9 +309,9 @@ public class SysFileMultipartServiceImpl implements SysFileMultipartService {
 
         if (StrUtil.isEmpty(upload_id)) throw new CustException("upload_id 不能为空");
 
-        // 按用户加锁
-        RLock lock = redissonClient.getLock("lock::multipart-upload::user-id::" + SecurityUtil.getUserId());
-        try { lock.tryLock(3, TimeUnit.SECONDS);
+//        // 按用户加锁
+//        RLock lock = redissonClient.getLock("lock::multipart-upload::user-id::" + SecurityUtil.getUserId());
+//        try { lock.tryLock(3, TimeUnit.SECONDS);
 
             // [Get] 查询文件分块记录
             SysFile sysFileEntity = sysFileDao.selectOne(new LambdaQueryWrapper<SysFile>().eq(SysFile::getUpload_id, upload_id));
@@ -395,8 +395,8 @@ public class SysFileMultipartServiceImpl implements SysFileMultipartService {
 
             return sysFileEntity;
 
-        } catch (InterruptedException e) { throw new RuntimeException(e);
-        } finally { lock.unlock(); }
+//        } catch (InterruptedException e) { throw new RuntimeException(e);
+//        } finally { lock.unlock(); }
     }
 
     // 查询分块上传情况