|
@@ -140,6 +140,7 @@ public class SysFileMultipartServiceImpl implements SysFileMultipartService {
|
|
|
}
|
|
|
|
|
|
// 2.上传分块
|
|
|
+ // - 抖音云单个分块大小不能小于4MB
|
|
|
@Override
|
|
|
public Map<String, Object> multipartUpload(MultipartFile multipartFile, String upload_id, Integer upload_chunk_index) {
|
|
|
|
|
@@ -147,7 +148,6 @@ 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 不能为空");
|
|
|
|
|
|
-
|
|
|
// [Get] 获得初始化分块信息
|
|
|
SysFile sysFileEntity = sysFileDao.selectOne(new LambdaQueryWrapper<SysFile>().eq(SysFile::getUpload_id, upload_id));
|
|
|
if (sysFileEntity == null) throw new CustException("分块记录不存在");
|
|
@@ -155,6 +155,13 @@ public class SysFileMultipartServiceImpl implements SysFileMultipartService {
|
|
|
Integer upload_chunk_size = sysFileEntity.getUpload_chunk_count();
|
|
|
if (upload_chunk_index > upload_chunk_size) throw new CustException("分块索引(index)不能大于分块数量(count)");
|
|
|
|
|
|
+ if (upload_chunk_index < upload_chunk_size) {
|
|
|
+ // 分片编号从 1 开始,最大为 10000。除最后一个分片以外,其他分片大小最小为 4MiB
|
|
|
+ if (multipartFile.getSize() < 4 * 1024 * 1024) {
|
|
|
+ throw new CustException("分块文件大小不能小于 4MB");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 获得公共配置
|
|
|
List<SysCommon> sysCommonList = sysCommonService.getCommonByCategory("UPLOAD");
|
|
|
AtomicReference<Integer> UPLOAD_TARGET = new AtomicReference<>();
|