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());
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;
}