From a78af48e4eff8b00d624ef90e2d7d67a918866c1 Mon Sep 17 00:00:00 2001 From: wenyann Date: Fri, 25 Jun 2021 17:46:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96-=E5=BA=9F=E5=BC=83=E7=9A=84=E7=94=A8=E4=BE=8B?= =?UTF-8?q?=E5=9C=A8=E5=8E=9F=E6=9D=A5=E6=A8=A1=E5=9D=97=E4=B8=8B-?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=20=E5=9B=9E=E6=94=B6=E7=AB=99=20=E5=90=8E?= =?UTF-8?q?=E5=8F=88=E9=83=BD=E8=B7=91=E5=88=B0=E5=9B=9E=E6=94=B6=E7=AB=99?= =?UTF-8?q?=E9=87=8C=E9=9D=A2=E4=BA=86-=E5=88=B7=E6=96=B0=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=20=E5=8F=88=E6=81=A2=E5=A4=8D=E5=88=B0=20=E5=8E=9F?= =?UTF-8?q?=E6=9D=A5=E6=A8=A1=E5=9D=97=E4=B8=AD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ApiAutomationController.java | 5 +++ .../api/service/ApiAutomationService.java | 4 +++ .../base/mapper/ext/ExtApiScenarioMapper.java | 5 ++- .../base/mapper/ext/ExtApiScenarioMapper.xml | 6 ++++ .../metersphere/job/sechedule/IssuesJob.java | 31 ++++++++++--------- .../api/automation/ApiAutomation.vue | 14 ++++++++- .../automation/scenario/ApiScenarioList.vue | 1 + .../automation/scenario/ApiScenarioModule.vue | 7 +++-- .../components/module/ModuleTrashButton.vue | 8 +++-- 9 files changed, 59 insertions(+), 22 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java b/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java index 2b657bda0a..01e50ee439 100644 --- a/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java +++ b/backend/src/main/java/io/metersphere/api/controller/ApiAutomationController.java @@ -57,6 +57,11 @@ public class ApiAutomationController { return apiAutomationService.listAll(request); } + @PostMapping("/list/all/trash") + public int listAllTrash(@RequestBody ApiScenarioBatchRequest request) { + return apiAutomationService.listAllTrash(request); + } + @PostMapping("/listWithIds/all") @RequiresPermissions("PROJECT_API_SCENARIO:READ") public List listWithIds(@RequestBody ApiScenarioBatchRequest request) { diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index f761731c99..4db225e71c 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -153,6 +153,10 @@ public class ApiAutomationService { return list; } + public int listAllTrash(ApiScenarioBatchRequest request) { + return extApiScenarioMapper.selectTrash(request.getProjectId()); + } + public List idAll(ApiScenarioBatchRequest request) { ServiceUtils.getSelectAllIds(request, request.getCondition(), (query) -> extApiScenarioMapper.selectIdsByQuery((ApiScenarioRequest) query)); diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.java index cb4c8593b3..8cfe2c84e6 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.java @@ -17,11 +17,14 @@ public interface ExtApiScenarioMapper { int listModule(@Param("request") ApiScenarioRequest request); List listReview(@Param("request") ApiScenarioRequest request); + List selectByTagId(@Param("id") String id); List selectIds(@Param("ids") List ids); - List selectByIds(@Param("ids") String ids,@Param("oderId") String oderId); + int selectTrash(@Param("projectId") String projectId); + + List selectByIds(@Param("ids") String ids, @Param("oderId") String oderId); List selectReference(@Param("request") ApiScenarioRequest request); diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml index 596e1309c1..349e74fcfc 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml @@ -395,6 +395,12 @@ from api_scenario WHERE use_url IS NULL + diff --git a/backend/src/main/java/io/metersphere/job/sechedule/IssuesJob.java b/backend/src/main/java/io/metersphere/job/sechedule/IssuesJob.java index bf2c52cd67..0bbd12b5a3 100644 --- a/backend/src/main/java/io/metersphere/job/sechedule/IssuesJob.java +++ b/backend/src/main/java/io/metersphere/job/sechedule/IssuesJob.java @@ -8,6 +8,7 @@ import io.metersphere.base.domain.TestPlanTestCase; import io.metersphere.base.domain.TestPlanTestCaseWithBLOBs; import io.metersphere.track.service.IssuesService; import io.metersphere.track.service.TestPlanTestCaseService; +import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import javax.annotation.Resource; @@ -20,20 +21,20 @@ public class IssuesJob { @Resource private TestPlanTestCaseService testPlanTestCaseService; - @QuartzScheduled(fixedDelay = 3600 * 1000) - //@Scheduled(fixedDelay = 3600 * 1000) + //@QuartzScheduled(fixedDelay = 3600 * 1000) + @Scheduled(fixedDelay = 120 * 1000) public void IssuesCount() { - int pageSize = 20; - int pages = 1; - for (int i = 0; i < pages; i++) { - Page> page = PageHelper.startPage(i, pageSize, true); - pages = page.getPages(); - List list = testPlanTestCaseService.listAll(); - list.forEach(l -> { - List issues = issuesService.getIssues(l.getCaseId()); - int issuesCount = issues.size(); - testPlanTestCaseService.updateIssues(issuesCount, l.getPlanId(), l.getCaseId(), issues.toString()); - }); - } + /*int pageSize = 100; + int pages = 0; + Page> page = PageHelper.startPage(pages, pageSize, true); + pages = page.getPages(); + for (int i = 0; i < pages; i++) {*/ + List list = testPlanTestCaseService.listAll(); + list.forEach(l -> { + List issues = issuesService.getIssues(l.getCaseId()); + int issuesCount = issues.size(); + testPlanTestCaseService.updateIssues(issuesCount, l.getPlanId(), l.getCaseId(), issues.toString()); + }); } -} + } + diff --git a/frontend/src/business/components/api/automation/ApiAutomation.vue b/frontend/src/business/components/api/automation/ApiAutomation.vue index fec9f96609..7fe91c3a8e 100644 --- a/frontend/src/business/components/api/automation/ApiAutomation.vue +++ b/frontend/src/business/components/api/automation/ApiAutomation.vue @@ -14,6 +14,7 @@ @refreshAll="refreshAll" page-source="scenario" :type="'edit'" + :total='total' ref="nodeTree"/> @@ -21,6 +22,7 @@ { + this.total = response.data; + }); }, getProject() { this.$get("/project/get/" + this.projectId, result => { @@ -370,7 +382,7 @@ export default { } }); }, - updateInitApiTableOpretion(param){ + updateInitApiTableOpretion(param) { this.initApiTableOpretion = param; } } diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue index 84a893f9fc..9d33ae649d 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue @@ -509,6 +509,7 @@ export default { if (this.$refs.scenarioTable) { this.$refs.scenarioTable.clear(); } + this.$emit('getTrashCase'); }); } }, diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioModule.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioModule.vue index aa6518e48e..38e84489c3 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioModule.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioModule.vue @@ -25,7 +25,7 @@ :show-operator="showOperator" :condition="condition" :commands="operators"/> - + @@ -64,13 +64,14 @@ isReadOnly: { type: Boolean, default() { - return false + return false; } }, showOperator: Boolean, relevanceProjectId: String, planId: String, - pageSource:String, + pageSource: String, + total: Number, }, computed: { isPlanModel() { diff --git a/frontend/src/business/components/api/definition/components/module/ModuleTrashButton.vue b/frontend/src/business/components/api/definition/components/module/ModuleTrashButton.vue index 0ad9a069a3..dec0106723 100644 --- a/frontend/src/business/components/api/definition/components/module/ModuleTrashButton.vue +++ b/frontend/src/business/components/api/definition/components/module/ModuleTrashButton.vue @@ -1,6 +1,9 @@ @@ -11,12 +14,13 @@ condition: { type: Object, default() { - return {} + return {}; } }, exe: { type: Function }, + total: Number, }, methods: { // enableTrash() {