From aefab58482d96c1a073e13b872b26ba86825e304 Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Tue, 20 Jul 2021 00:08:50 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=8A=9F=E8=83=BD=E6=A1=88=E4=BE=8B?= =?UTF-8?q?=E3=80=81=E6=8E=A5=E5=8F=A3=E5=9C=BA=E6=99=AF):=20=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E6=A1=88=E4=BE=8B=E6=B1=89=E5=8C=96=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=9C=BA=E6=99=AF=E5=88=A0=E9=99=A4=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1005213 --user=宋天阳 【回收站】-用例状态汉化 https://www.tapd.cn/55049933/s/1025953 --bug=1005253 --user=宋天阳 【回收站】批量删除场景回收站,报错 https://www.tapd.cn/55049933/s/1025949 --- .../excel/domain/TestCaseExcelData.java | 15 ++++++++ .../excel/domain/TestCaseExcelDataCn.java | 15 ++++++++ .../excel/domain/TestCaseExcelDataTw.java | 15 ++++++++ .../excel/domain/TestCaseExcelDataUs.java | 15 ++++++++ .../track/service/TestCaseService.java | 36 ++++++++++++++++--- .../automation/scenario/ApiScenarioList.vue | 3 ++ 6 files changed, 95 insertions(+), 4 deletions(-) diff --git a/backend/src/main/java/io/metersphere/excel/domain/TestCaseExcelData.java b/backend/src/main/java/io/metersphere/excel/domain/TestCaseExcelData.java index 6cd734c8c9..2e7e8dfd88 100644 --- a/backend/src/main/java/io/metersphere/excel/domain/TestCaseExcelData.java +++ b/backend/src/main/java/io/metersphere/excel/domain/TestCaseExcelData.java @@ -4,6 +4,7 @@ import com.alibaba.excel.annotation.ExcelIgnore; import io.metersphere.dto.CustomFieldDao; import lombok.Getter; import lombok.Setter; +import org.apache.commons.lang3.StringUtils; import java.util.*; @@ -57,6 +58,20 @@ public class TestCaseExcelData { return excludeColumnFiledNames; } + public String parseStatus(String parseStatus){ + String caseStatusValue = ""; + if(StringUtils.equalsAnyIgnoreCase(parseStatus,"Underway","进行中","進行中")){ + caseStatusValue = "Underway"; + }else if(StringUtils.equalsAnyIgnoreCase(parseStatus,"Prepare","未开始","未開始")){ + caseStatusValue = "Prepare"; + }else if(StringUtils.equalsAnyIgnoreCase(parseStatus,"Completed","已完成","已完成")){ + caseStatusValue = "Completed"; + }else if(StringUtils.equalsAnyIgnoreCase(parseStatus,"Trash")){ + caseStatusValue = "Trash"; + } + return caseStatusValue; + } + public List> getHead(boolean needNum, List customFields){ return new ArrayList<>(); } diff --git a/backend/src/main/java/io/metersphere/excel/domain/TestCaseExcelDataCn.java b/backend/src/main/java/io/metersphere/excel/domain/TestCaseExcelDataCn.java index 74f3f3f745..5dad665fb8 100644 --- a/backend/src/main/java/io/metersphere/excel/domain/TestCaseExcelDataCn.java +++ b/backend/src/main/java/io/metersphere/excel/domain/TestCaseExcelDataCn.java @@ -141,4 +141,19 @@ public class TestCaseExcelDataCn extends TestCaseExcelData { } return returnList; } + + @Override + public String parseStatus(String parseStatus){ + String caseStatusValue = ""; + if(StringUtils.equalsAnyIgnoreCase(parseStatus,"Underway","进行中","進行中")){ + caseStatusValue = "进行中"; + }else if(StringUtils.equalsAnyIgnoreCase(parseStatus,"Prepare","未开始","未開始")){ + caseStatusValue = "未开始"; + }else if(StringUtils.equalsAnyIgnoreCase(parseStatus,"Completed","已完成","已完成")){ + caseStatusValue = "已完成"; + }else if(StringUtils.equalsAnyIgnoreCase(parseStatus,"Trash","废弃","廢棄")){ + caseStatusValue = "废弃"; + } + return caseStatusValue; + } } diff --git a/backend/src/main/java/io/metersphere/excel/domain/TestCaseExcelDataTw.java b/backend/src/main/java/io/metersphere/excel/domain/TestCaseExcelDataTw.java index 8db2563df3..96f37c1115 100644 --- a/backend/src/main/java/io/metersphere/excel/domain/TestCaseExcelDataTw.java +++ b/backend/src/main/java/io/metersphere/excel/domain/TestCaseExcelDataTw.java @@ -141,4 +141,19 @@ public class TestCaseExcelDataTw extends TestCaseExcelData { } return returnList; } + + @Override + public String parseStatus(String parseStatus){ + String caseStatusValue = ""; + if(StringUtils.equalsAnyIgnoreCase(parseStatus,"Underway","进行中","進行中")){ + caseStatusValue = "進行中"; + }else if(StringUtils.equalsAnyIgnoreCase(parseStatus,"Prepare","未开始","未開始")){ + caseStatusValue = "未開始"; + }else if(StringUtils.equalsAnyIgnoreCase(parseStatus,"Completed","已完成","已完成")){ + caseStatusValue = "已完成"; + }else if(StringUtils.equalsAnyIgnoreCase(parseStatus,"Trash","废弃","廢棄")){ + caseStatusValue = "廢棄"; + } + return caseStatusValue; + } } diff --git a/backend/src/main/java/io/metersphere/excel/domain/TestCaseExcelDataUs.java b/backend/src/main/java/io/metersphere/excel/domain/TestCaseExcelDataUs.java index 1faafe5997..3fe9160100 100644 --- a/backend/src/main/java/io/metersphere/excel/domain/TestCaseExcelDataUs.java +++ b/backend/src/main/java/io/metersphere/excel/domain/TestCaseExcelDataUs.java @@ -141,4 +141,19 @@ public class TestCaseExcelDataUs extends TestCaseExcelData { } return returnList; } + + @Override + public String parseStatus(String parseStatus){ + String caseStatusValue = ""; + if(StringUtils.equalsAnyIgnoreCase(parseStatus,"Underway","进行中","進行中")){ + caseStatusValue = "Underway"; + }else if(StringUtils.equalsAnyIgnoreCase(parseStatus,"Prepare","未开始","未開始")){ + caseStatusValue = "Prepare"; + }else if(StringUtils.equalsAnyIgnoreCase(parseStatus,"Completed","已完成","已完成")){ + caseStatusValue = "Completed"; + }else if(StringUtils.equalsAnyIgnoreCase(parseStatus,"Trash")){ + caseStatusValue = "Trash"; + } + return caseStatusValue; + } } diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java index d5cab09e55..46e906872d 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -19,10 +19,7 @@ import io.metersphere.controller.request.OrderRequest; import io.metersphere.controller.request.member.QueryMemberRequest; import io.metersphere.dto.CustomFieldDao; import io.metersphere.dto.TestCaseTemplateDao; -import io.metersphere.excel.domain.ExcelErrData; -import io.metersphere.excel.domain.ExcelResponse; -import io.metersphere.excel.domain.TestCaseExcelData; -import io.metersphere.excel.domain.TestCaseExcelDataFactory; +import io.metersphere.excel.domain.*; import io.metersphere.excel.handler.FunctionCaseTemplateWriteHandler; import io.metersphere.excel.listener.TestCaseNoModelDataListener; import io.metersphere.excel.utils.EasyExcelExporter; @@ -330,6 +327,37 @@ public class TestCaseService { request.getFilters().put("status",new ArrayList<>(0)); } List returnList = extTestCaseMapper.list(request); + returnList = this.parseStatus(returnList); + return returnList; + } + + private List parseStatus(List returnList) { + TestCaseExcelData excelData = new TestCaseExcelDataFactory().getTestCaseExcelDataLocal(); + for (TestCaseDTO data :returnList) { + String dataStatus = excelData.parseStatus(data.getStatus()); + + if(StringUtils.equalsAnyIgnoreCase(data.getStatus(),"Trash")){ + try { + JSONArray arr = JSONArray.parseArray(data.getCustomFields()); + JSONArray newArr = new JSONArray(); + for(int i = 0;i row.id); let param = {}; this.buildBatchParam(param); + this.result.loading = true; this.$post('/api/automation/deleteBatchByCondition/', param, () => { this.$success(this.$t('commons.delete_success')); this.search(); + }, (error) => { + this.search(); }); return; }else {