fix(测试跟踪): 功能用例导入状态字段有误

Co-authored-by: song-cc-rock <changchang.song@fit2cloud.com>
This commit is contained in:
MeterSphere Bot 2022-08-31 14:57:47 +08:00 committed by GitHub
parent 61c91f7db0
commit 4e5c1d1ce3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 2 deletions

View File

@ -0,0 +1,14 @@
package io.metersphere.commons.constants;
public class TestCaseStatusConstants {
public static final String UNDERWAY_US = "Underway";
public static final String UNDERWAY_CN = "进行中";
public static final String UNDERWAY_TW = "進行中";
public static final String PREPARE_US = "Prepare";
public static final String PREPARE_CN = "未开始";
public static final String PREPARE_TW = "未開始";
public static final String COMPLETED_US = "Completed";
public static final String COMPLETED_CN = "已完成";
public static final String COMPLETED_TW = "已完成";
}

View File

@ -7,7 +7,9 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import io.metersphere.base.domain.TestCase;
import io.metersphere.base.domain.TestCaseWithBLOBs;
import io.metersphere.commons.constants.CommonConstants;
import io.metersphere.commons.constants.TestCaseConstants;
import io.metersphere.commons.constants.TestCaseStatusConstants;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.*;
import io.metersphere.dto.CustomFieldDao;
@ -642,7 +644,7 @@ public class TestCaseNoModelDataListener extends AnalysisEventListener<Map<Integ
} else if (StringUtils.equals(field, "stepModel")) {
data.setStepModel(value);
} else if (StringUtils.equals(field, "status")) {
data.setStatus(value);
data.setStatus(parseStatus(value));
} else if (StringUtils.equals(field, "maintainer")) {
data.setMaintainer(value);
} else if (StringUtils.equals(field, "priority")) {
@ -771,4 +773,21 @@ public class TestCaseNoModelDataListener extends AnalysisEventListener<Map<Integ
}
return true;
}
public String parseStatus(String parseStatus){
String caseStatusValue = "";
if(StringUtils.equalsAnyIgnoreCase(parseStatus,
TestCaseStatusConstants.UNDERWAY_US, TestCaseStatusConstants.UNDERWAY_CN, TestCaseStatusConstants.UNDERWAY_TW)){
caseStatusValue = TestCaseStatusConstants.UNDERWAY_US;
}else if(StringUtils.equalsAnyIgnoreCase(parseStatus,
TestCaseStatusConstants.PREPARE_US, TestCaseStatusConstants.PREPARE_CN, TestCaseStatusConstants.PREPARE_TW)){
caseStatusValue = TestCaseStatusConstants.PREPARE_US;
}else if(StringUtils.equalsAnyIgnoreCase(parseStatus,
TestCaseStatusConstants.COMPLETED_US, TestCaseStatusConstants.COMPLETED_CN, TestCaseStatusConstants.COMPLETED_TW)){
caseStatusValue = TestCaseStatusConstants.COMPLETED_US;
}else if(StringUtils.equalsAnyIgnoreCase(parseStatus, CommonConstants.TrashStatus)){
caseStatusValue = CommonConstants.TrashStatus;
}
return caseStatusValue;
}
}

View File

@ -1084,7 +1084,9 @@ public class TestCaseService {
}
num++;
testCase.setReviewStatus(TestCaseReviewStatus.Prepare.name());
testCase.setStatus(TestCaseReviewStatus.Prepare.name());
if (StringUtils.isEmpty(testCase.getStatus())) {
testCase.setStatus(TestCaseReviewStatus.Prepare.name());
}
testCase.setOrder(Long.valueOf(testCases.size() - (num - beforeInsertId)) * ServiceUtils.ORDER_STEP);
testCase.setRefId(testCase.getId());
testCase.setVersionId(request.getVersionId());