feat(功能案例、接口场景): 功能案例汉化,修复场景删除报错的问题
--bug=1005213 --user=宋天阳 【回收站】-用例状态汉化 https://www.tapd.cn/55049933/s/1025953 --bug=1005253 --user=宋天阳 【回收站】批量删除场景回收站,报错 https://www.tapd.cn/55049933/s/1025949
This commit is contained in:
parent
b815b251f1
commit
aefab58482
|
@ -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<List<String>> getHead(boolean needNum, List<CustomFieldDao> customFields){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<TestCaseDTO> returnList = extTestCaseMapper.list(request);
|
||||
returnList = this.parseStatus(returnList);
|
||||
return returnList;
|
||||
}
|
||||
|
||||
private List<TestCaseDTO> parseStatus(List<TestCaseDTO> 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<arr.size();i++){
|
||||
JSONObject obj = arr.getJSONObject(i);
|
||||
if(obj.containsKey("name") && obj.containsKey("value")){
|
||||
String name = obj.getString("name");
|
||||
if(StringUtils.equalsAny(name,"用例状态","用例狀態","Case status")){
|
||||
obj.put("value",dataStatus);
|
||||
}
|
||||
}
|
||||
newArr.add(obj);
|
||||
}
|
||||
data.setCustomFields(newArr.toJSONString());
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
data.setStatus(dataStatus);
|
||||
}
|
||||
return returnList;
|
||||
}
|
||||
|
||||
|
|
|
@ -775,9 +775,12 @@ export default {
|
|||
//let ids = Array.from(this.selectRows).map(row => 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 {
|
||||
|
|
Loading…
Reference in New Issue