|
|
@@ -14,7 +14,6 @@ import com.inspur.source.mapper.*;
|
|
|
import com.inspur.source.service.ISmsbMinioDataService;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.dromara.common.core.constant.Constants;
|
|
|
import org.dromara.common.core.exception.ServiceException;
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
@@ -607,8 +606,7 @@ public class SmsbMinioDataServiceImpl implements ISmsbMinioDataService {
|
|
|
}
|
|
|
|
|
|
private SysOssVo mergeChunks(String uploadId, String tempDir, String uploadDir, String fileExtension,
|
|
|
- String originalFileName) throws
|
|
|
- IOException {
|
|
|
+ String originalFileName) throws IOException {
|
|
|
Path chunkDir = Paths.get(tempDir, uploadId);
|
|
|
|
|
|
try (Stream<Path> files = Files.list(chunkDir)) {
|
|
|
@@ -627,6 +625,12 @@ public class SmsbMinioDataServiceImpl implements ISmsbMinioDataService {
|
|
|
|
|
|
// Append the file extension to the final filename
|
|
|
Path finalPath = Paths.get(uploadDir, uploadId + fileExtension);
|
|
|
+ // 确保上传目录存在
|
|
|
+ Path uploadPath = Paths.get(uploadDir);
|
|
|
+ if (!Files.exists(uploadPath)) {
|
|
|
+ Files.createDirectories(uploadPath);
|
|
|
+ }
|
|
|
+
|
|
|
try (OutputStream finalFile = new FileOutputStream(finalPath.toFile())) {
|
|
|
for (Path chunk : chunks) {
|
|
|
try (InputStream chunkFile = new FileInputStream(chunk.toFile())) {
|
|
|
@@ -845,6 +849,12 @@ public class SmsbMinioDataServiceImpl implements ISmsbMinioDataService {
|
|
|
public DiskUseVo diskUse() {
|
|
|
Long total = 5 * 1024 * 1024L;
|
|
|
DiskUseVo result = baseMapper.diskUse();
|
|
|
+ if (result == null) {
|
|
|
+ result = new DiskUseVo();
|
|
|
+ result.setUsed(0L);
|
|
|
+ result.setImageUse(0L);
|
|
|
+ result.setVideoUse(0L);
|
|
|
+ }
|
|
|
result.setTotal(total);
|
|
|
result.setFree(total - result.getUsed());
|
|
|
return result;
|