diff --git a/backend/src/main/java/io/metersphere/api/jmeter/KafkaListenerTask.java b/backend/src/main/java/io/metersphere/api/jmeter/KafkaListenerTask.java index 42cdba7ab7..f232b475e3 100644 --- a/backend/src/main/java/io/metersphere/api/jmeter/KafkaListenerTask.java +++ b/backend/src/main/java/io/metersphere/api/jmeter/KafkaListenerTask.java @@ -56,7 +56,9 @@ public class KafkaListenerTask implements Runnable { if (testResult != null) { if (testResult.getArbitraryData() != null && testResult.getArbitraryData().containsKey("TEST_END") && (Boolean) testResult.getArbitraryData().get("TEST_END")) { resultDTOS.add(testResult); - } else { + } + // 携带结果 + if (CollectionUtils.isNotEmpty(testResult.getRequestResults())) { String key = RUN_MODE_MAP.get(testResult.getRunMode()); if (assortMap.containsKey(key)) { assortMap.get(key).add(testResult); @@ -68,6 +70,7 @@ public class KafkaListenerTask implements Runnable { } } }); + if (MapUtils.isNotEmpty(assortMap)) { LoggerUtil.info("KAFKA消费执行内容存储开始"); testResultService.batchSaveResults(assortMap); diff --git a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java index d43f460938..dc7250732e 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java @@ -96,14 +96,6 @@ public class ApiScenarioReportService { example.createCriteria().andReportIdEqualTo(dto.getReportId()); List requestResults = apiScenarioReportResultMapper.selectByExample(example); - if (StringUtils.isNotEmpty(dto.getTestPlanReportId())) { - String status = getStatus(requestResults, dto); - Map reportMap = new HashMap() {{ - this.put(dto.getReportId(), status); - }}; - testPlanLog.info("TestPlanReportId" + JSONArray.toJSONString(dto.getReportId()) + " EXECUTE OVER. SCENARIO STATUS : " + JSONObject.toJSONString(reportMap)); - } - ApiScenarioReport scenarioReport; if (StringUtils.equals(dto.getRunMode(), ApiRunMode.SCENARIO_PLAN.name())) { scenarioReport = updatePlanCase(requestResults, dto); @@ -287,6 +279,11 @@ public class ApiScenarioReportService { long errorSize = requestResults.stream().filter(requestResult -> StringUtils.equalsIgnoreCase(requestResult.getStatus(), ScenarioStatus.Error.name())).count(); String status = getStatus(requestResults, dto); + List requestResultIdList = new ArrayList<>(); + for (ApiScenarioReportResult result : requestResults) { + requestResultIdList.add(result.getId()); + } + testPlanLog.info("TestPlanReportId" + JSONArray.toJSONString(dto.getReportId()) + " EXECUTE OVER. STATUS : " + status + ", ResultIds:" + JSONObject.toJSONString(requestResultIdList)); ApiScenarioReport report = editReport(dto.getReportType(), dto.getReportId(), status, dto.getRunMode()); if (report != null) { if (StringUtils.isNotEmpty(dto.getTestPlanReportId()) && !testPlanReportIdList.contains(dto.getTestPlanReportId())) {