diff --git a/api-test/backend/src/main/java/io/metersphere/api/jmeter/utils/ReportStatusUtil.java b/api-test/backend/src/main/java/io/metersphere/api/jmeter/utils/ReportStatusUtil.java index 1069b02f35..e868dd883e 100644 --- a/api-test/backend/src/main/java/io/metersphere/api/jmeter/utils/ReportStatusUtil.java +++ b/api-test/backend/src/main/java/io/metersphere/api/jmeter/utils/ReportStatusUtil.java @@ -52,8 +52,7 @@ public class ReportStatusUtil { } if (MapUtils.isNotEmpty(dto.getArbitraryData()) && dto.getArbitraryData().containsKey(CommonConstants.REPORT_STATUS)) { // 资源池执行整体传输失败,单条传输内容,获取资源池执行统计的状态 - ResultVO o = (ResultVO) dto.getArbitraryData().get(CommonConstants.REPORT_STATUS); - resultVO.setStatus(o.getStatus()); + resultVO.setStatus(JSONUtil.convertValue(dto.getArbitraryData().get(CommonConstants.REPORT_STATUS), ResultVO.class).getStatus()); } // 过滤掉重试结果后进行统计 List requestResults = filterRetryResults(dto.getRequestResults()); @@ -65,7 +64,8 @@ public class ReportStatusUtil { // 默认状态 String status = dto.getRequestResults().isEmpty() && StringUtils.isEmpty(resultVO.getStatus()) ? ApiReportStatus.PENDING.name() - : StringUtils.defaultIfEmpty(resultVO.getStatus(), ApiReportStatus.SUCCESS.name()); + : ApiReportStatus.SUCCESS.name(); + if (errorSize > 0) { status = ApiReportStatus.ERROR.name(); } else if (errorReportResultSize > 0) { @@ -87,13 +87,15 @@ public class ReportStatusUtil { if (MapUtils.isNotEmpty(dto.getArbitraryData()) && dto.getArbitraryData().containsKey(CommonConstants.LOCAL_STATUS_KEY)) { // 本地执行状态 result = JSONUtil.convertValue(dto.getArbitraryData().get(CommonConstants.LOCAL_STATUS_KEY), ResultVO.class); - return result; } if (MapUtils.isNotEmpty(dto.getArbitraryData()) && dto.getArbitraryData().containsKey(CommonConstants.REPORT_STATUS)) { // 资源池执行整体传输失败,单条传输内容,获取资源池执行统计的状态 result = JSONUtil.convertValue(dto.getArbitraryData().get(CommonConstants.REPORT_STATUS), ResultVO.class); - return result; } - return getStatus(dto, result); + result = getStatus(dto, result); + if (result != null && result.getScenarioTotal() > 0 && result.getScenarioTotal() == result.getScenarioSuccess()) { + result.setStatus(ApiReportStatus.SUCCESS.name()); + } + return result; } }