From 192dac6f793056438d7b857ee317925d487b3dab Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Tue, 7 Jul 2020 18:12:02 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=80=A7=E8=83=BD?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=8A=A5=E5=91=8A=E6=97=B6=E5=90=8C=E6=97=B6?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=9B=B8=E5=85=B3=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/PerformanceTestService.java | 10 +--------- .../performance/service/ReportService.java | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java b/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java index 8d199b0808..5332c337b7 100644 --- a/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java +++ b/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java @@ -102,16 +102,8 @@ public class PerformanceTestService { if (!loadTestReports.isEmpty()) { List reportIdList = loadTestReports.stream().map(LoadTestReport::getId).collect(Collectors.toList()); - // delete load_test_report_result - LoadTestReportResultExample loadTestReportResultExample = new LoadTestReportResultExample(); - loadTestReportResultExample.createCriteria().andReportIdIn(reportIdList); - loadTestReportResultMapper.deleteByExample(loadTestReportResultExample); - - // delete load_test_report, delete load_test_report_detail + // delete load_test_report reportIdList.forEach(reportId -> { - LoadTestReportDetailExample example = new LoadTestReportDetailExample(); - example.createCriteria().andReportIdEqualTo(reportId); - loadTestReportDetailMapper.deleteByExample(example); reportService.deleteReport(reportId); }); } diff --git a/backend/src/main/java/io/metersphere/performance/service/ReportService.java b/backend/src/main/java/io/metersphere/performance/service/ReportService.java index 5f3e3a66ad..50bcc908fc 100644 --- a/backend/src/main/java/io/metersphere/performance/service/ReportService.java +++ b/backend/src/main/java/io/metersphere/performance/service/ReportService.java @@ -3,10 +3,7 @@ package io.metersphere.performance.service; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import io.metersphere.base.domain.*; -import io.metersphere.base.mapper.LoadTestMapper; -import io.metersphere.base.mapper.LoadTestReportLogMapper; -import io.metersphere.base.mapper.LoadTestReportMapper; -import io.metersphere.base.mapper.LoadTestReportResultMapper; +import io.metersphere.base.mapper.*; import io.metersphere.base.mapper.ext.ExtLoadTestReportMapper; import io.metersphere.commons.constants.PerformanceTestStatus; import io.metersphere.commons.constants.ReportKeys; @@ -45,6 +42,8 @@ public class ReportService { private LoadTestReportLogMapper loadTestReportLogMapper; @Resource private TestResourceService testResourceService; + @Resource + private LoadTestReportDetailMapper loadTestReportDetailMapper; public List getRecentReportList(ReportRequest request) { List orders = new ArrayList<>(); @@ -85,6 +84,16 @@ public class ReportService { stopEngine(loadTest, engine); } + // delete load_test_report_result + LoadTestReportResultExample loadTestReportResultExample = new LoadTestReportResultExample(); + loadTestReportResultExample.createCriteria().andReportIdEqualTo(reportId); + loadTestReportResultMapper.deleteByExample(loadTestReportResultExample); + + // delete load_test_report_detail + LoadTestReportDetailExample example = new LoadTestReportDetailExample(); + example.createCriteria().andReportIdEqualTo(reportId); + loadTestReportDetailMapper.deleteByExample(example); + loadTestReportMapper.deleteByPrimaryKey(reportId); } From 712154dd8a50af448539ac4cb5d1f049cddc33cf Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Tue, 7 Jul 2020 18:23:37 +0800 Subject: [PATCH 2/2] ws or wss --- .../components/performance/report/PerformanceReportView.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/business/components/performance/report/PerformanceReportView.vue b/frontend/src/business/components/performance/report/PerformanceReportView.vue index d30b2dc501..9f046180bd 100644 --- a/frontend/src/business/components/performance/report/PerformanceReportView.vue +++ b/frontend/src/business/components/performance/report/PerformanceReportView.vue @@ -139,7 +139,11 @@ } }, initWebSocket() { - const uri = "ws://" + window.location.host + "/performance/report/" + this.reportId; + let protocol = "ws://"; + if (window.location.protocol === 'https:') { + protocol = "wss://"; + } + const uri = protocol + window.location.host + "/performance/report/" + this.reportId; this.websocket = new WebSocket(uri); this.websocket.onmessage = this.onMessage; this.websocket.onopen = this.onOpen;