Преглед изворни кода

店铺管理列表查询框
改为:店铺分类。

lyhzzz пре 3 година
родитељ
комит
cb24ed6673

+ 11 - 4
src/main/java/com/cdf/service/impl/FdkkSceneEditService.java

@@ -178,10 +178,17 @@ public class FdkkSceneEditService {
             if(file !=null && file.getSize() >0){
                 String fileName = file.getOriginalFilename();
                 assert fileName != null;
-                String newFilePath = String.format(hotLocalPath,fdkkUploadRequest.getNum()) + "/"+fileName ;
-                File newFile = new File(newFilePath);
-                file.transferTo(newFile);
-                String path = newFile.getPath();
+                String newFilePath = String.format(hotLocalPath,fdkkUploadRequest.getNum()) + "/"+fileName;
+                File newFiles = new File(newFilePath  );
+
+                if (!newFiles.getParentFile().exists()) {
+                    newFiles.getParentFile().mkdirs();
+                }
+                if (!newFiles.exists()) {
+                    newFiles.createNewFile();
+                }
+                file.transferTo(newFiles);
+                String path = newFiles.getPath();
                 paths.add(path);
             }
         }

+ 0 - 1
src/main/java/com/cdf/util/FileUtils.java

@@ -8,7 +8,6 @@ public class FileUtils {
         if (!fout.getParentFile().exists()) {
             fout.getParentFile().mkdirs();
         }
-
         if (!fout.exists()) {
             fout.createNewFile();
         }