fix(测试跟踪): 测试计划长度设置为最长后点击执行报错

--bug=1012002 --user=李玉号 【测试跟踪】-测试计划长度 设置为128最长后,点击执行 会报错
https://www.tapd.cn/55049933/s/1176469
This commit is contained in:
shiziyuan9527 2022-06-08 16:25:52 +08:00 committed by shiziyuan9527
parent 2dde81bf50
commit d65ba6a9cd
2 changed files with 6 additions and 0 deletions

View File

@ -286,6 +286,9 @@ public class TestPlanReportService {
testPlanReport.setUpdateTime(System.currentTimeMillis());
try {
testPlanReport.setName(testPlan.getName() + "-" + DateUtils.getTimeString(new Date()));
if (testPlanReport.getName().length() > 128) {
testPlanReport.setName(testPlan.getName().substring(0, 106) + "-" + DateUtils.getTimeString(new Date()));
}
} catch (Exception ignored) {
}

View File

@ -1147,6 +1147,9 @@ public class TestPlanService {
// 覆盖原内容
targetPlan.setId(targetPlanId);
targetPlan.setName(testPlan.getName() + "_" + UUID.randomUUID().toString().substring(0, 5) + "_COPY");
if (targetPlan.getName().length() > 128) {
targetPlan.setName(testPlan.getName().substring(0, 116) + "_" + UUID.randomUUID().toString().substring(0, 5) + "_COPY");
}
targetPlan.setStatus(TestPlanStatus.Prepare.name());
targetPlan.setCreator(SessionUtils.getUserId());
targetPlan.setCreateTime(System.currentTimeMillis());