Przeglądaj źródła

Merge branch 'master' of http://117.50.213.128:10880/lihao16/smsb-plus

lihao16 2 miesięcy temu
rodzic
commit
33e49c3da5

+ 13 - 2
smsb-modules/smsb-source/src/main/java/com/inspur/source/service/impl/SmsbMinioDataServiceImpl.java

@@ -607,8 +607,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 +626,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 +850,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;