Compare commits

..

No commits in common. "f297ff342e3249705cd409df4e17ffcabf9d8ed9" and "ed48073df93651575938c68fc75ad2c63c88f51f" have entirely different histories.

7 changed files with 23 additions and 41 deletions

View File

@ -82,6 +82,4 @@ public class ReportResp {
private Integer fail; private Integer fail;
private Integer success; private Integer success;
private String message;
} }

View File

@ -140,12 +140,8 @@ public class ApplicationWorker extends HttpWorker {
req.setScaTaskId(scaTaskId); req.setScaTaskId(scaTaskId);
ReportResp reportResp = reportService.assetReportTask(req); ReportResp reportResp = reportService.assetReportTask(req);
if (!ObjectUtils.isEmpty(reportResp)){ if (!ObjectUtils.isEmpty(reportResp)){
if (reportResp.getMessage().equals("success")){ applicationConfigInfo.put("reportId",reportResp.getId());
append(context,"回调报告生成接口成功"); applicationConfigInfo.put("reportName",reportResp.getName());
applicationConfigInfo.put("reportId",reportResp.getId());
}else {
append(context,"回调报告生成接口失败,scaTaskId = " + scaTaskId + "=====错误原因=====" + reportResp.getMessage());
}
} }
//更新scaTaskId数据到task表 //更新scaTaskId数据到task表
@ -169,6 +165,8 @@ public class ApplicationWorker extends HttpWorker {
append(context,message); append(context,message);
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"SCA-应用包审查分析节点执行失败"); throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"SCA-应用包审查分析节点执行失败");
} }
// Thread.currentThread().interrupt();
toBadEnding();
} }
private MultiValueMap<String, Object> buildRequestBody(Map<String, Object> applicationConfigInfo, File file) { private MultiValueMap<String, Object> buildRequestBody(Map<String, Object> applicationConfigInfo, File file) {

View File

@ -116,12 +116,8 @@ public class CodingWorker extends HttpWorker {
req.setScaTaskId(scaTaskId); req.setScaTaskId(scaTaskId);
ReportResp reportResp = reportService.assetReportTask(req); ReportResp reportResp = reportService.assetReportTask(req);
if (!ObjectUtils.isEmpty(reportResp)){ if (!ObjectUtils.isEmpty(reportResp)){
if (reportResp.getMessage().equals("success")){ codingConfigInfo.put("reportId",reportResp.getId());
append(context,"回调报告生成接口成功"); codingConfigInfo.put("reportName",reportResp.getName());
codingConfigInfo.put("reportId",reportResp.getId());
}else {
append(context,"回调报告生成接口失败,scaTaskId = " + scaTaskId + "=====错误原因=====" + reportResp.getMessage());
}
} }
//更新scaTaskId数据到task表 //更新scaTaskId数据到task表

View File

@ -148,12 +148,8 @@ public class ScaBinaryWorker extends HttpWorker {
req.setScaTaskId(scaTaskId); req.setScaTaskId(scaTaskId);
ReportResp reportResp = reportService.assetReportTask(req); ReportResp reportResp = reportService.assetReportTask(req);
if (!ObjectUtils.isEmpty(reportResp)){ if (!ObjectUtils.isEmpty(reportResp)){
if (reportResp.getMessage().equals("success")){ scaBinaryConfigInfo.put("reportId",reportResp.getId());
append(context,"回调报告生成接口成功"); scaBinaryConfigInfo.put("reportName",reportResp.getName());
scaBinaryConfigInfo.put("reportId",reportResp.getId());
}else {
append(context,"回调报告生成接口失败,scaTaskId = " + scaTaskId + "=====错误原因=====" + reportResp.getMessage());
}
} }
//更新scaTaskId数据到task表 //更新scaTaskId数据到task表
@ -178,6 +174,8 @@ public class ScaBinaryWorker extends HttpWorker {
append(context,message); append(context,message);
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"SCA-SBOM节点执行失败"); throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"SCA-SBOM节点执行失败");
} }
// Thread.currentThread().interrupt();
toBadEnding();
} }
private MultiValueMap<String, Object> buildRequestBody(Map<String, Object> scaBinaryConfigInfo, File file) { private MultiValueMap<String, Object> buildRequestBody(Map<String, Object> scaBinaryConfigInfo, File file) {

View File

@ -145,12 +145,8 @@ public class ScaMirrorWorker extends HttpWorker {
req.setScaTaskId(scaTaskId); req.setScaTaskId(scaTaskId);
ReportResp reportResp = reportService.assetReportTask(req); ReportResp reportResp = reportService.assetReportTask(req);
if (!ObjectUtils.isEmpty(reportResp)){ if (!ObjectUtils.isEmpty(reportResp)){
if (reportResp.getMessage().equals("success")){ scaMirrorConfigInfo.put("reportId",reportResp.getId());
append(context,"回调报告生成接口成功"); scaMirrorConfigInfo.put("reportName",reportResp.getName());
scaMirrorConfigInfo.put("reportId",reportResp.getId());
}else {
append(context,"回调报告生成接口失败,scaTaskId = " + scaTaskId + "=====错误原因=====" + reportResp.getMessage());
}
} }
//更新scaTaskId数据到task表 //更新scaTaskId数据到task表
@ -175,6 +171,8 @@ public class ScaMirrorWorker extends HttpWorker {
append(context,message); append(context,message);
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"SCA-SBOM节点执行失败"); throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"SCA-SBOM节点执行失败");
} }
// Thread.currentThread().interrupt();
toBadEnding();
} }
private MultiValueMap<String, Object> buildRequestBody(Map<String, Object> scaMirrorConfigInfo, File file) { private MultiValueMap<String, Object> buildRequestBody(Map<String, Object> scaMirrorConfigInfo, File file) {

View File

@ -142,12 +142,8 @@ public class ScaSbomWorker extends HttpWorker {
req.setScaTaskId(scaTaskId); req.setScaTaskId(scaTaskId);
ReportResp reportResp = reportService.assetReportTask(req); ReportResp reportResp = reportService.assetReportTask(req);
if (!ObjectUtils.isEmpty(reportResp)){ if (!ObjectUtils.isEmpty(reportResp)){
if (reportResp.getMessage().equals("success")){ scaSbomConfigInfo.put("reportId",reportResp.getId());
append(context,"回调报告生成接口成功"); scaSbomConfigInfo.put("reportName",reportResp.getName());
scaSbomConfigInfo.put("reportId",reportResp.getId());
}else {
append(context,"回调报告生成接口失败,scaTaskId = " + scaTaskId + "=====错误原因=====" + reportResp.getMessage());
}
} }
//更新scaTaskId数据到task表 //更新scaTaskId数据到task表
@ -161,7 +157,7 @@ public class ScaSbomWorker extends HttpWorker {
Integer oldScaTaskId = (Integer) scaSbomConfigInfo.get("scaTaskId"); Integer oldScaTaskId = (Integer) scaSbomConfigInfo.get("scaTaskId");
Integer oldApplicationId = (Integer) scaSbomConfigInfo.get("applicationId"); Integer oldApplicationId = (Integer) scaSbomConfigInfo.get("applicationId");
append(context,"跳过上传步骤获取scaTaskId:"+oldScaTaskId); append(context,"跳过上传步骤获取scaTaskId:"+oldScaTaskId);
append(context,"重新运行上一次的,applicationId:"+oldApplicationId); append(context,"重新运行上一次的,scaTaskId:"+oldScaTaskId);
int restartResult = reStartTask(restTemplate, oldApplicationId,context); int restartResult = reStartTask(restTemplate, oldApplicationId,context);
if (restartResult != 0) { if (restartResult != 0) {
return; return;
@ -172,7 +168,8 @@ public class ScaSbomWorker extends HttpWorker {
append(context,message); append(context,message);
throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"SCA-SBOM节点执行失败"); throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"SCA-SBOM节点执行失败");
} }
// Thread.currentThread().interrupt();
toBadEnding();
} }
private MultiValueMap<String, Object> buildRequestBody(Map<String, Object> scaSbomConfigInfo, File file) { private MultiValueMap<String, Object> buildRequestBody(Map<String, Object> scaSbomConfigInfo, File file) {

View File

@ -151,17 +151,16 @@ public class ReportServiceImpl implements ReportService {
log.info("根据任务ID列表生成检测报告:" + reportDeleteUrl); log.info("根据任务ID列表生成检测报告:" + reportDeleteUrl);
JSONObject response = restTemplate.postForObject(reportDeleteUrl, requestEntity, JSONObject.class); JSONObject response = restTemplate.postForObject(reportDeleteUrl, requestEntity, JSONObject.class);
String message = response.getString("message"); String message = response.getString("message");
ReportResp reportResp = new ReportResp();
if (message.equals("success")) { if (message.equals("success")) {
ReportResp reportResp = new ReportResp();
log.info("===============根据任务ID列表生成检测报告成功================="); log.info("===============根据任务ID列表生成检测报告成功=================");
setReportAssetResp(response.getString("xmTraceId"),response.getInteger("data"),reportResp); setReportAssetResp(response.getString("xmTraceId"),reportResp);
return reportResp; return reportResp;
} else { } else {
reportResp.setMessage(message);
log.error("===============根据任务ID列表生成检测报告失败================="); log.error("===============根据任务ID列表生成检测报告失败=================");
return reportResp; throw new ServiceException(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR.getCode(),"根据任务ID列表生成检测报告失败");
} }
} }
@ -295,10 +294,8 @@ public class ReportServiceImpl implements ReportService {
reportResp.setXmTraceId(xmTraceId); reportResp.setXmTraceId(xmTraceId);
} }
private void setReportAssetResp(String xmTraceId, Integer data, ReportResp reportResp) { private void setReportAssetResp(String xmTraceId, ReportResp reportResp) {
reportResp.setXmTraceId(xmTraceId); reportResp.setXmTraceId(xmTraceId);
reportResp.setMessage("success");
reportResp.setId(data);
} }