Преглед на файлове

2022-9-28 14:38:00 分析系统提交代码

沈永艺 преди 3 години
родител
ревизия
87f64b0d0b
променени са 1 файла, в които са добавени 8 реда и са изтрити 2 реда
  1. 8 2
      PAS/src/main/java/cn/cslg/pas/service/ProjectService.java

+ 8 - 2
PAS/src/main/java/cn/cslg/pas/service/ProjectService.java

@@ -547,7 +547,10 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
             String savePath = fileUtils.getSystemPath(url);
             File directory = new File(tempPath);
             if (!directory.exists()) {
-                directory.mkdir();
+                boolean success = directory.mkdir();
+                if (!success) {
+                    throw new Exception("数据导出时创建文件夹失败");
+                }
             }
             WebSocketServer.sendInfo(Response.websocket(true, ResponseEnum.PROJECT_EXPORT_TASK_SUCCESS), String.valueOf(userId));
             if (params.getProjectInfo()) {
@@ -672,7 +675,10 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
             String tempSavePath = fileUtils.getSystemPath(url);
             File tempDirectory = new File(tempPath);
             if (!tempDirectory.exists()) {
-                tempDirectory.mkdir();
+                boolean success = tempDirectory.mkdir();
+                if (!success) {
+                    throw new Exception("数据导入时创建文件夹失败");
+                }
             }
             projectImportStatusService.add(importId, userId, 2);
             ZipUtil.unzip(tempSavePath, tempPath);