diff --git a/src/main/java/com/sztzjy/financial_bigdata/controller/stu/JupyterhubController.java b/src/main/java/com/sztzjy/financial_bigdata/controller/stu/JupyterhubController.java index eae4e9e..b3daa19 100644 --- a/src/main/java/com/sztzjy/financial_bigdata/controller/stu/JupyterhubController.java +++ b/src/main/java/com/sztzjy/financial_bigdata/controller/stu/JupyterhubController.java @@ -82,12 +82,12 @@ public class JupyterhubController { String newCreatFile = path + caseName; - File dataFile = new File(newCreatFile); - - //判断文件夹是否存在 - if (!dataFile.exists()) { - //创建文件夹 - dataFile.mkdir(); +// File dataFile = new File(newCreatFile); +// +// //判断文件夹是否存在 +// +// //创建文件夹 +// dataFile.mkdir(); //判断有无ipynb文件,进行迁移 @@ -134,10 +134,20 @@ public class JupyterhubController { if (exitCode == 0) { // 执行成功,输出Python代码的结果 System.out.println("文件迁移成功!"); - return new ResultEntity<>(HttpStatus.OK, "数据不存在!", false); + //判断子目录是否有data文件 + String sonPath = newCreatFile + "/data"; + File sonFile = new File(sonPath); + if (sonFile.exists()) { + return new ResultEntity<>(HttpStatus.OK, "数据存在!", true); + } else { + return new ResultEntity<>(HttpStatus.OK, "数据不存在!", false); + } + } else { // 执行失败,输出错误信息 System.err.println("文件迁移失败了!\n" + errors.toString()); + + return new ResultEntity<>(HttpStatus.OK, "数据不存在!", false); } } catch (IOException | InterruptedException e) { @@ -149,19 +159,11 @@ public class JupyterhubController { } + return new ResultEntity<>(HttpStatus.OK, "数据不存在!", false); - } else { - //判断子目录是否有data文件 - String sonPath = newCreatFile + "/data"; - File sonFile = new File(sonPath); - if (sonFile.exists()) { - return new ResultEntity<>(HttpStatus.OK, "数据存在!", true); - } else { - return new ResultEntity<>(HttpStatus.OK, "数据不存在!", false); - } - } + }