0630 ljc 修改测试用例管理接口

This commit is contained in:
HopeLi 2025-06-30 20:32:35 +08:00
parent f817f21c89
commit 8eb34198a5

View File

@ -247,7 +247,9 @@ public class ReportServiceImpl implements ReportService {
//映射到报告信息表中去做存储操作 //映射到报告信息表中去做存储操作
List<PipReportInfo> infoList = setReportInfoToCreate(data,req.getScaTaskId(),req.getTaskId()); List<PipReportInfo> infoList = setReportInfoToCreate(data,req.getScaTaskId(),req.getTaskId());
reportInfoDao.insertBatch(infoList); if (!CollectionUtils.isEmpty(infoList)){
reportInfoDao.insertBatch(infoList);
}
} else { } else {
log.error("===============根据任务ID查询漏洞列表失败新增报告信息失败================="); log.error("===============根据任务ID查询漏洞列表失败新增报告信息失败=================");
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"新增报告信息失败"); throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"新增报告信息失败");
@ -546,30 +548,33 @@ public class ReportServiceImpl implements ReportService {
creator = pipeline.getCreator(); creator = pipeline.getCreator();
} }
for (int i = 0; i < records.size(); i++) { if (!ObjectUtils.isEmpty(records)){
JSONObject report = records.getJSONObject(i); for (int i = 0; i < records.size(); i++) {
PipReportInfo pipReportInfo = new PipReportInfo(); JSONObject report = records.getJSONObject(i);
Long loginUserId = WebFrameworkUtils.getLoginUserId(); PipReportInfo pipReportInfo = new PipReportInfo();
pipReportInfo.setTaskId(taskId); pipReportInfo.setTaskId(taskId);
pipReportInfo.setScaTaskId(scaTaskId); pipReportInfo.setScaTaskId(scaTaskId);
pipReportInfo.setSecurityLevelId(report.getInteger("securityLevelId")); pipReportInfo.setSecurityLevelId(report.getInteger("securityLevelId"));
pipReportInfo.setVulName(report.getString("vulName")); pipReportInfo.setVulName(report.getString("vulName"));
pipReportInfo.setCveId(report.getString("cveId")); pipReportInfo.setCveId(report.getString("cveId"));
pipReportInfo.setCweId(report.getString("cweId")); pipReportInfo.setCweId(report.getString("cweId"));
pipReportInfo.setCnnvdId(report.getString("cnnvdId")); pipReportInfo.setCnnvdId(report.getString("cnnvdId"));
pipReportInfo.setCnvdId(report.getString("cnvdId")); pipReportInfo.setCnvdId(report.getString("cnvdId"));
pipReportInfo.setVulType(report.getString("vulType")); pipReportInfo.setVulType(report.getString("vulType"));
pipReportInfo.setVulMarkStatus(report.getString("vulMarkStatus")); pipReportInfo.setVulMarkStatus(report.getString("vulMarkStatus"));
pipReportInfo.setAttackType(report.getString("attackType")); pipReportInfo.setAttackType(report.getString("attackType"));
pipReportInfo.setCvssV2Score(report.getDouble("cvssV2Score")); pipReportInfo.setCvssV2Score(report.getDouble("cvssV2Score"));
pipReportInfo.setCvssV3Score(report.getDouble("cvssV3Score")); pipReportInfo.setCvssV3Score(report.getDouble("cvssV3Score"));
pipReportInfo.setExploitLevelIndex(report.getInteger("exploitLevelIndex")); pipReportInfo.setExploitLevelIndex(report.getInteger("exploitLevelIndex"));
pipReportInfo.setReleaseDate(report.getString("releaseDate")); pipReportInfo.setReleaseDate(report.getString("releaseDate"));
pipReportInfo.setCreator(creator); pipReportInfo.setCreator(creator);
pipReportInfos.add(pipReportInfo); pipReportInfos.add(pipReportInfo);
}
return pipReportInfos;
}else {
return new ArrayList<>();
} }
return pipReportInfos;
} }