Commit 5ac7c3bd5d42b5409953137657276618f2d634b1

Authored by YunaiV
1 parent d9afb0e6

code review ProjectReactor 的代码实现

yudao-server/src/test/java/cn/iocoder/yudao/ProjectReactor.java
@@ -31,7 +31,7 @@ public class ProjectReactor { @@ -31,7 +31,7 @@ public class ProjectReactor {
31 String projectBaseDir = getProjectBaseDir(); 31 String projectBaseDir = getProjectBaseDir();
32 32
33 // ========== 配置,需要你手动修改 ========== 33 // ========== 配置,需要你手动修改 ==========
34 - String groupIdNew = "cn.huwing.boot"; 34 + String groupIdNew = "cn.huwing.boot"; // TODO @seeker:这几个参数改回去原来的哈。
35 String artifactIdNew = "zdm"; 35 String artifactIdNew = "zdm";
36 String packageNameNew = "cn.huwing.zdm"; 36 String packageNameNew = "cn.huwing.zdm";
37 String titleNew = "测试名管理系统"; 37 String titleNew = "测试名管理系统";
@@ -47,8 +47,8 @@ public class ProjectReactor { @@ -47,8 +47,8 @@ public class ProjectReactor {
47 String content = replaceFileContent(file, groupIdNew, artifactIdNew, packageNameNew, titleNew); 47 String content = replaceFileContent(file, groupIdNew, artifactIdNew, packageNameNew, titleNew);
48 writeFile(file, content, projectBaseDir, projectBaseDirNew, packageNameNew, artifactIdNew); 48 writeFile(file, content, projectBaseDir, projectBaseDirNew, packageNameNew, artifactIdNew);
49 }); 49 });
50 - long end = System.currentTimeMillis();  
51 - log.info("[main][重写完成]共耗时:" + (end - start) / 1000 + "秒"); 50 + long end = System.currentTimeMillis(); // TODO @seeker:直接减,不用增加变量
  51 + log.info("[main][重写完成]共耗时:" + (end - start) / 1000 + "秒"); // TODO @seeker:logger 不要拼接字符串,用占位符
52 } 52 }
53 53
54 private static String getProjectBaseDir() { 54 private static String getProjectBaseDir() {
@@ -59,7 +59,7 @@ public class ProjectReactor { @@ -59,7 +59,7 @@ public class ProjectReactor {
59 Collection<File> files = FileUtils.listFiles(new File(projectBaseDir), null, true); 59 Collection<File> files = FileUtils.listFiles(new File(projectBaseDir), null, true);
60 // 移除 IDEA Git GitHub 自身的文件; Node 编译出来的文件 60 // 移除 IDEA Git GitHub 自身的文件; Node 编译出来的文件
61 files = files.stream() 61 files = files.stream()
62 - .filter(file -> !file.getPath().contains("\\target\\") 62 + .filter(file -> !file.getPath().contains("\\target\\") // TODO @seeker:使用 File.separator,也要考虑 mac
63 && !file.getPath().contains("\\node_modules\\") 63 && !file.getPath().contains("\\node_modules\\")
64 && !file.getPath().contains("\\.idea\\") 64 && !file.getPath().contains("\\.idea\\")
65 && !file.getPath().contains("\\.git\\") 65 && !file.getPath().contains("\\.git\\")
@@ -91,4 +91,4 @@ public class ProjectReactor { @@ -91,4 +91,4 @@ public class ProjectReactor {
91 .replaceAll(StrUtil.upperFirst(ARTIFACT_ID), StrUtil.upperFirst(artifactIdNew)); 91 .replaceAll(StrUtil.upperFirst(ARTIFACT_ID), StrUtil.upperFirst(artifactIdNew));
92 FileUtil.writeUtf8String(fileContent, newPath); 92 FileUtil.writeUtf8String(fileContent, newPath);
93 } 93 }
94 -}  
95 \ No newline at end of file 94 \ No newline at end of file
  95 +}