fix: 导出自定义ID

This commit is contained in:
chenjianxing 2021-04-27 20:16:43 +08:00 committed by BugKing
parent 12f28344d0
commit 0e13fc3883
6 changed files with 20 additions and 1 deletions

View File

@ -11,6 +11,8 @@ public class TestCaseExcelData {
@ExcelIgnore
private Integer num;
@ExcelIgnore
private String customNum;
@ExcelIgnore
private String name;
@ExcelIgnore
private String nodePath;

View File

@ -17,6 +17,11 @@ public class TestCaseExcelDataCn extends TestCaseExcelData {
@NotRequired
private Integer num;
@ColumnWidth(50)
@ExcelProperty("自定义ID")
@NotRequired
private String customNum;
@NotBlank(message = "{cannot_be_null}")
@Length(max = 255)
@ExcelProperty("用例名称")

View File

@ -17,6 +17,11 @@ public class TestCaseExcelDataTw extends TestCaseExcelData {
@NotRequired
private Integer num;
@ColumnWidth(50)
@ExcelProperty("自定義ID")
@NotRequired
private String customNum;
@NotBlank(message = "{cannot_be_null}")
@Length(max = 255)
@ExcelProperty("用例名稱")

View File

@ -18,6 +18,11 @@ public class TestCaseExcelDataUs extends TestCaseExcelData {
@NotRequired
private Integer num;
@ColumnWidth(50)
@ExcelProperty("Custom ID")
@NotRequired
private String customNum;
@NotBlank(message = "{cannot_be_null}")
@Length(max = 255)
@ExcelProperty("Name")

View File

@ -184,6 +184,7 @@ public class TestCaseDataListener extends EasyExcelListener<TestCaseExcelData> {
testCase.setProjectId(this.projectId);
testCase.setCreateTime(System.currentTimeMillis());
testCase.setUpdateTime(System.currentTimeMillis());
testCase.setCustomNum(data.getCustomNum());
String nodePath = data.getNodePath();
if (!nodePath.startsWith("/")) {

View File

@ -483,7 +483,7 @@ public class TestCaseService {
testcase.setSort(sort.getAndIncrement());
int number = num.decrementAndGet();
testcase.setNum(number);
if (project.getCustomNum()) {
if (project.getCustomNum() && StringUtils.isBlank(testcase.getCustomNum())) {
testcase.setCustomNum(String.valueOf(number));
}
testcase.setReviewStatus(TestCaseReviewStatus.Prepare.name());
@ -667,6 +667,7 @@ public class TestCaseService {
data.setNodePath(t.getNodePath());
data.setPriority(t.getPriority());
data.setType(t.getType());
data.setCustomNum(t.getCustomNum());
if (StringUtils.isBlank(t.getStepModel())) {
data.setStepModel(TestCaseConstants.StepModel.STEP.name());
} else {