diff --git a/src/main/java/net/educoder/ecsonar/services/SonarService.java b/src/main/java/net/educoder/ecsonar/services/SonarService.java index c71db27..f56c5f2 100644 --- a/src/main/java/net/educoder/ecsonar/services/SonarService.java +++ b/src/main/java/net/educoder/ecsonar/services/SonarService.java @@ -258,7 +258,7 @@ public class SonarService { */ public void scanExcel(String excelPath) { - int homeworkId = 20230302; + int homeworkId = 20230402; try { List personList = ExcelUtil.readExcel(excelPath); diff --git a/src/main/java/net/educoder/ecsonar/task/ReadExcelRunnable.java b/src/main/java/net/educoder/ecsonar/task/ReadExcelRunnable.java index f0a62d9..68d75ac 100644 --- a/src/main/java/net/educoder/ecsonar/task/ReadExcelRunnable.java +++ b/src/main/java/net/educoder/ecsonar/task/ReadExcelRunnable.java @@ -57,10 +57,10 @@ public class ReadExcelRunnable implements Runnable{ // } // } String key = String.format("%d-%s", homeworkId, uid); - if(new File(path + "/.scannerwork/").exists()){ - System.out.println(path+ "----exist"); - return; - } +// if(new File(path + "/.scannerwork/").exists()){ +// System.out.println(path+ "----exist"); +// return; +// } log.info("开始调用sonar:{}",key); sonarService.sonar(path,key); } diff --git a/src/main/java/net/educoder/ecsonar/utils/ExcelUtil.java b/src/main/java/net/educoder/ecsonar/utils/ExcelUtil.java index e49edee..b44cf4d 100644 --- a/src/main/java/net/educoder/ecsonar/utils/ExcelUtil.java +++ b/src/main/java/net/educoder/ecsonar/utils/ExcelUtil.java @@ -406,7 +406,7 @@ public class ExcelUtil { String uid = row.getCell(1).getStringCellValue(); - String downloadUrl = row.getCell(2).getStringCellValue() + "?secret_key=806ac9e5a8b40233c99bb513a315ed66"; + String downloadUrl = row.getCell(2).getStringCellValue(); Person person = new Person(); person.setName(name); diff --git a/src/main/java/net/educoder/ecsonar/utils/RarUtil.java b/src/main/java/net/educoder/ecsonar/utils/RarUtil.java index 848c8d8..f957bed 100644 --- a/src/main/java/net/educoder/ecsonar/utils/RarUtil.java +++ b/src/main/java/net/educoder/ecsonar/utils/RarUtil.java @@ -29,17 +29,17 @@ public class RarUtil { public static void main(String[] args) { // unrar("/tmp/20230301/201905962222/20230519153409_wuiol3vn.rar", "/Users/youyongsheng/Desktop/aa"); - un7Z("/tmp/20230301/201905962241/20230519153506_i39sv5p2.7z", "/Users/youyongsheng/Desktop/aa"); +// un7Z("/tmp/20230301/201905962241/20230519153506_i39sv5p2.7z", "/Users/youyongsheng/Desktop/aa"); // unzip(); -// valid("/tmp/20230201"); - removeFullCode("/tmp/20230302"); + valid("/tmp/20230402"); +// removeFullCode("/tmp/20230302"); } public static void unzip(){ - String sourceDir = "/tmp/20230301"; - String targetDir = "/tmp/20230302"; + String sourceDir = "/tmp/20230401"; + String targetDir = "/tmp/20230402"; File directory = new File(sourceDir); File[] studentDirs = directory.listFiles(); @@ -71,12 +71,10 @@ public class RarUtil { for (File zipFile : zipFiles) { try { if(zipFile.getName().endsWith(".zip")){ -// unzip(zipFile.getAbsolutePath(), studentTargetDir); + unzip(zipFile.getAbsolutePath(), studentTargetDir); }else if(zipFile.getName().endsWith(".rar")){ - System.out.println(zipFile.getAbsolutePath() + " to " + targetDir); unRar(zipFile.getAbsolutePath(), studentTargetDir); }else{ - System.out.println(zipFile.getAbsolutePath() + " to " + targetDir); RarUtil.un7Z(zipFile.getAbsolutePath(), studentTargetDir); } } catch (Exception e) { @@ -110,7 +108,11 @@ public class RarUtil { for (File studentDir : studentDirs) { if (studentDir.isDirectory()) { - for (File file : studentDir.listFiles()) { + File[] files = studentDir.listFiles(); + if(files == null || files.length == 0){ + System.out.println(studentDir.getName()+" -> null"); + } + for (File file : files) { System.out.println(studentDir.getName()+" ->" + file.getName()); } System.out.println("--------------------------------"); diff --git a/src/test/java/net/educoder/ecsonar/EcsonarApplicationTests.java b/src/test/java/net/educoder/ecsonar/EcsonarApplicationTests.java index 8976fed..d1c9f09 100644 --- a/src/test/java/net/educoder/ecsonar/EcsonarApplicationTests.java +++ b/src/test/java/net/educoder/ecsonar/EcsonarApplicationTests.java @@ -68,7 +68,7 @@ public class EcsonarApplicationTests { CountDownLatch countDownLatch = new CountDownLatch(1); // String excelPath = "/Users/youyongsheng/Desktop/ZQ/质量分析/2023-05-16/data.xlsx"; - String excelPath = "/Users/youyongsheng/Desktop/ZQ/质量分析/2023-05-16/111111.xlsx"; + String excelPath = "/Users/youyongsheng/Desktop/ZQ/质量分析/2023-05-24/湖南工业大学-2023届软件工程-原始数据.xlsx"; sonarService.scanExcel(excelPath); try { @@ -81,13 +81,13 @@ public class EcsonarApplicationTests { @Test public void writeExcel() throws Exception { - int homeworkId = 20230202; - String directory = "/tmp/20230202/"; + int homeworkId = 20230402; + String directory = "/tmp/20230402/"; File file = new File(directory); File[] files = file.listFiles(); System.out.println("学生数:" + files.length); - List personList = ExcelUtil.readExcel("/Users/youyongsheng/Desktop/ZQ/质量分析/2023-05-16/湘潭大学网络工程专业2023届-原始数据.xlsx"); + List personList = ExcelUtil.readExcel("/Users/youyongsheng/Desktop/ZQ/质量分析/2023-05-24/湖南工业大学-2023届软件工程-原始数据.xlsx"); Map> collect = personList.stream().collect(Collectors.groupingBy(Person::getUid)); @@ -100,7 +100,7 @@ public class EcsonarApplicationTests { Metrics metrics = reportService.getMetrics(projectName); String templatePath = this.getClass().getClassLoader().getResource("template1.xlsx").getPath(); - String outPath = "/Users/youyongsheng/Desktop/bbbbb.xlsx"; + String outPath = "/Users/youyongsheng/Desktop/ddddd.xlsx"; System.out.println("第"+(i++)+"个学生," + uid); if (CollectionUtils.isEmpty(collect.get(uid))) {