From 3c6a5734dd89f41e56123a29c439d6903d3d32d8 Mon Sep 17 00:00:00 2001 From: youys <1272586223@qq.com> Date: Wed, 27 Nov 2024 14:23:41 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E8=B4=A8=E9=87=8F=E5=88=86=E6=9E=90):=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9F=A5=E8=AF=A2=E4=BB=A3=E7=A0=81=E5=AD=97?= =?UTF-8?q?=E6=AE=B5shixunCodeIds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ecsonar/task/QualityInspectRunnable.java | 16 +++++++++------- src/main/resources/application.properties | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/educoder/ecsonar/task/QualityInspectRunnable.java b/src/main/java/net/educoder/ecsonar/task/QualityInspectRunnable.java index eb6fa2a..93d30a7 100644 --- a/src/main/java/net/educoder/ecsonar/task/QualityInspectRunnable.java +++ b/src/main/java/net/educoder/ecsonar/task/QualityInspectRunnable.java @@ -8,6 +8,7 @@ import net.educoder.ecsonar.model.TaskInfoDetail; import net.educoder.ecsonar.model.vo.QualityInspectUserDataVO; import net.educoder.ecsonar.services.DbOperateService; import net.educoder.ecsonar.services.SonarService; +import org.apache.commons.collections4.CollectionUtils; import org.apache.tomcat.util.http.fileupload.FileUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -64,15 +65,16 @@ public class QualityInspectRunnable implements Runnable { List codeIds = userData.getCodeIds(); List shiXunCodeIds = userData.getStudentWorkShixunCodeIds(); - for (Long codeId : codeIds) { - processCodeId(codeId, path, projectName, dbOperateService::queryGameCodesById); - } - - for (Long codeId : shiXunCodeIds) { - processCodeId(codeId, path, projectName, dbOperateService::queryShiXunCodesById); + if(CollectionUtils.isNotEmpty(shiXunCodeIds)){ + for (Long codeId : shiXunCodeIds) { + processCodeId(codeId, path, projectName, dbOperateService::queryShiXunCodesById); + } + }else{ + for (Long codeId : codeIds) { + processCodeId(codeId, path, projectName, dbOperateService::queryGameCodesById); + } } - // 写完所有文件开始用sonar进行质量分析 SonarScannerParam param = new SonarScannerParam(projectName, path); if (Constant.C.equalsIgnoreCase(language) || Constant.CXX.equalsIgnoreCase(language)) { diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 5be8e96..52f91f4 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -14,7 +14,7 @@ spring.datasource.master.driverClassName=org.postgresql.Driver #### test ###### spring.datasource.readonly.driverClassName=com.mysql.jdbc.Driver -spring.datasource.readonly.url=jdbc:mysql://testeducoder-public.mysql.polardb.rds.aliyuncs.com:3306/newtesteducoderweb?userSSL=false&useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false +spring.datasource.readonly.url=jdbc:mysql://testeducoder-public.mysql.polardb.rds.aliyuncs.com:3306/newtesteducoderweb?useSSL=false&useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false spring.datasource.readonly.username=testeducoder spring.datasource.readonly.password=TEST@123