From 8eb34198a5868fbb78606e00986efdb946ab4689 Mon Sep 17 00:00:00 2001 From: HopeLi <1278288511@qq.com> Date: Mon, 30 Jun 2025 20:32:35 +0800 Subject: [PATCH] =?UTF-8?q?0630=20ljc=20=20=20=E4=BF=AE=E6=94=B9=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=94=A8=E4=BE=8B=E7=AE=A1=E7=90=86=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../report/impl/ReportServiceImpl.java | 51 ++++++++++--------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/modules/module-ci-process-biz/src/main/java/cd/casic/ci/process/process/service/report/impl/ReportServiceImpl.java b/modules/module-ci-process-biz/src/main/java/cd/casic/ci/process/process/service/report/impl/ReportServiceImpl.java index f3511a88..4713220c 100644 --- a/modules/module-ci-process-biz/src/main/java/cd/casic/ci/process/process/service/report/impl/ReportServiceImpl.java +++ b/modules/module-ci-process-biz/src/main/java/cd/casic/ci/process/process/service/report/impl/ReportServiceImpl.java @@ -247,7 +247,9 @@ public class ReportServiceImpl implements ReportService { //映射到报告信息表中去,做存储操作 List infoList = setReportInfoToCreate(data,req.getScaTaskId(),req.getTaskId()); - reportInfoDao.insertBatch(infoList); + if (!CollectionUtils.isEmpty(infoList)){ + reportInfoDao.insertBatch(infoList); + } } else { log.error("===============根据任务ID查询漏洞列表失败,新增报告信息失败================="); throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"新增报告信息失败"); @@ -546,30 +548,33 @@ public class ReportServiceImpl implements ReportService { creator = pipeline.getCreator(); } - for (int i = 0; i < records.size(); i++) { - JSONObject report = records.getJSONObject(i); - PipReportInfo pipReportInfo = new PipReportInfo(); - Long loginUserId = WebFrameworkUtils.getLoginUserId(); + if (!ObjectUtils.isEmpty(records)){ + for (int i = 0; i < records.size(); i++) { + JSONObject report = records.getJSONObject(i); + PipReportInfo pipReportInfo = new PipReportInfo(); - pipReportInfo.setTaskId(taskId); - pipReportInfo.setScaTaskId(scaTaskId); - pipReportInfo.setSecurityLevelId(report.getInteger("securityLevelId")); - pipReportInfo.setVulName(report.getString("vulName")); - pipReportInfo.setCveId(report.getString("cveId")); - pipReportInfo.setCweId(report.getString("cweId")); - pipReportInfo.setCnnvdId(report.getString("cnnvdId")); - pipReportInfo.setCnvdId(report.getString("cnvdId")); - pipReportInfo.setVulType(report.getString("vulType")); - pipReportInfo.setVulMarkStatus(report.getString("vulMarkStatus")); - pipReportInfo.setAttackType(report.getString("attackType")); - pipReportInfo.setCvssV2Score(report.getDouble("cvssV2Score")); - pipReportInfo.setCvssV3Score(report.getDouble("cvssV3Score")); - pipReportInfo.setExploitLevelIndex(report.getInteger("exploitLevelIndex")); - pipReportInfo.setReleaseDate(report.getString("releaseDate")); - pipReportInfo.setCreator(creator); - pipReportInfos.add(pipReportInfo); + pipReportInfo.setTaskId(taskId); + pipReportInfo.setScaTaskId(scaTaskId); + pipReportInfo.setSecurityLevelId(report.getInteger("securityLevelId")); + pipReportInfo.setVulName(report.getString("vulName")); + pipReportInfo.setCveId(report.getString("cveId")); + pipReportInfo.setCweId(report.getString("cweId")); + pipReportInfo.setCnnvdId(report.getString("cnnvdId")); + pipReportInfo.setCnvdId(report.getString("cnvdId")); + pipReportInfo.setVulType(report.getString("vulType")); + pipReportInfo.setVulMarkStatus(report.getString("vulMarkStatus")); + pipReportInfo.setAttackType(report.getString("attackType")); + pipReportInfo.setCvssV2Score(report.getDouble("cvssV2Score")); + pipReportInfo.setCvssV3Score(report.getDouble("cvssV3Score")); + pipReportInfo.setExploitLevelIndex(report.getInteger("exploitLevelIndex")); + pipReportInfo.setReleaseDate(report.getString("releaseDate")); + pipReportInfo.setCreator(creator); + pipReportInfos.add(pipReportInfo); + } + return pipReportInfos; + }else { + return new ArrayList<>(); } - return pipReportInfos; }