From 523d0a5dfb54fd95722b12a3cb32273228dfd149 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Thu, 10 Jun 2021 15:42:18 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E4=BB=BB=E5=8A=A1=E4=B8=AD=E5=BF=83):=20?= =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=82=B9=E5=87=BB=E4=BB=BB=E5=8A=A1=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E8=87=B3=E5=AF=B9=E5=BA=94=E6=8A=A5=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ApiDefinitionController.java | 5 ++ .../api/service/ApiDefinitionService.java | 6 ++ .../base/mapper/ext/ExtTaskMapper.xml | 2 +- .../business/components/task/TaskCenter.vue | 61 ++++++++++++++++++- 4 files changed, 70 insertions(+), 4 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/controller/ApiDefinitionController.java b/backend/src/main/java/io/metersphere/api/controller/ApiDefinitionController.java index 4faa3d53dd..e32cd6387c 100644 --- a/backend/src/main/java/io/metersphere/api/controller/ApiDefinitionController.java +++ b/backend/src/main/java/io/metersphere/api/controller/ApiDefinitionController.java @@ -187,6 +187,11 @@ public class ApiDefinitionController { return apiDefinitionService.getDbResult(testId); } + @GetMapping("/report/get/{testId}") + public APIReportResult getReportById(@PathVariable String testId) { + return apiDefinitionService.getReportById(testId); + } + @GetMapping("/report/getReport/{testId}/{type}") public APIReportResult getReport(@PathVariable String testId, @PathVariable String type) { return apiDefinitionService.getDbResult(testId, type); diff --git a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java index 3b876f599b..75a0327ea7 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java @@ -77,6 +77,8 @@ public class ApiDefinitionService { @Resource private ExtApiDefinitionExecResultMapper extApiDefinitionExecResultMapper; @Resource + private ApiDefinitionExecResultMapper apiDefinitionExecResultMapper; + @Resource private JMeterService jMeterService; @Resource private SqlSessionFactory sqlSessionFactory; @@ -635,6 +637,10 @@ public class ApiDefinitionService { ApiDefinitionExecResult result = extApiDefinitionExecResultMapper.selectMaxResultByResourceId(testId); return buildAPIReportResult(result); } + public APIReportResult getReportById(String testId) { + ApiDefinitionExecResult result = apiDefinitionExecResultMapper.selectByPrimaryKey(testId); + return buildAPIReportResult(result); + } private APIReportResult buildAPIReportResult(ApiDefinitionExecResult result) { if (result == null) { diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTaskMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTaskMapper.xml index c393345fc4..fc6a6046b4 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTaskMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTaskMapper.xml @@ -17,7 +17,7 @@ UNION ALL (select t.id,t.name,'API' as executionModule, ifnull(t.actuator,'LOCAL') as actuator, t1.`name` as executor,t.create_time as executionTime, ifnull(t.trigger_mode,'MANUAL') as triggerMode ,ifnull(t.status,'Saved') as executionStatus from api_definition_exec_result t left join `user` t1 ON t.user_id = t1.id left join api_definition t3 on t.resource_id = t3.id left join api_test_case t4 on t4.id = t.resource_id - where to_days(FROM_UNIXTIME(t.create_time/1000))= to_days(now()) and t3.project_id =#{request.projectId} and t4.project_id =#{request.projectId} + where to_days(FROM_UNIXTIME(t.create_time/1000))= to_days(now()) and (t3.project_id =#{request.projectId} OR t4.project_id =#{request.projectId}) and t.trigger_mode = #{request.triggerMode} diff --git a/frontend/src/business/components/task/TaskCenter.vue b/frontend/src/business/components/task/TaskCenter.vue index 7fbaba691e..2f9e165a15 100644 --- a/frontend/src/business/components/task/TaskCenter.vue +++ b/frontend/src/business/components/task/TaskCenter.vue @@ -36,7 +36,7 @@
- + {{ item.name }}
执行器:{{ item.actuator }} 由 {{ item.executor }} {{ item.executionTime | timestampFormatDate }} {{ getMode(item.triggerMode) }}
@@ -44,17 +44,25 @@
+ + + + +