diff --git a/backend/src/main/java/io/metersphere/excel/listener/TestCaseDataListener.java b/backend/src/main/java/io/metersphere/excel/listener/TestCaseDataListener.java index 4ea8b6b606..9d9a9b3a6f 100644 --- a/backend/src/main/java/io/metersphere/excel/listener/TestCaseDataListener.java +++ b/backend/src/main/java/io/metersphere/excel/listener/TestCaseDataListener.java @@ -133,7 +133,16 @@ public class TestCaseDataListener extends EasyExcelListener { if(isUseCustomId){ checkResult = testCaseService.checkCustomIdExist(data.getCustomNum().toString(), projectId); }else { - checkResult = testCaseService.checkIdExist(Integer.parseInt(data.getCustomNum()), projectId); + int customNumId = -1; + try{ + customNumId = Integer.parseInt(data.getCustomNum()); + }catch (Exception e){ + } + if(customNumId < 0){ + stringBuilder.append(Translator.get("id_not_rightful") + "["+data.getCustomNum()+"]; "); + }else { + checkResult = testCaseService.checkIdExist(customNumId, projectId); + } } if (null != checkResult) { //该ID在当前项目中存在 //如果前面所经过的校验都没报错 diff --git a/backend/src/main/resources/i18n/messages.properties b/backend/src/main/resources/i18n/messages.properties index 01f29ad987..0f0dec8c9b 100644 --- a/backend/src/main/resources/i18n/messages.properties +++ b/backend/src/main/resources/i18n/messages.properties @@ -68,3 +68,4 @@ id_required= id_repeat_in_table= template_already= expect_name_exists= +id_not_rightful= diff --git a/backend/src/main/resources/i18n/messages_en_US.properties b/backend/src/main/resources/i18n/messages_en_US.properties index 376817a300..a490c3c24f 100644 --- a/backend/src/main/resources/i18n/messages_en_US.properties +++ b/backend/src/main/resources/i18n/messages_en_US.properties @@ -262,4 +262,6 @@ auth_title=Auth # track home api_case=API performance_case=PERFORMANCE -scenario_case=SCENARIO \ No newline at end of file +scenario_case=SCENARIO + +id_not_rightful=ID is not rightful \ No newline at end of file diff --git a/backend/src/main/resources/i18n/messages_zh_CN.properties b/backend/src/main/resources/i18n/messages_zh_CN.properties index b1edcca754..18413810f6 100644 --- a/backend/src/main/resources/i18n/messages_zh_CN.properties +++ b/backend/src/main/resources/i18n/messages_zh_CN.properties @@ -261,4 +261,6 @@ auth_title=系统认证 # track home api_case=接口用例 performance_case=性能用例 -scenario_case=场景用例 \ No newline at end of file +scenario_case=场景用例 + +id_not_rightful=ID 不合法 \ No newline at end of file diff --git a/backend/src/main/resources/i18n/messages_zh_TW.properties b/backend/src/main/resources/i18n/messages_zh_TW.properties index 9dee0e7114..64fe5e7758 100644 --- a/backend/src/main/resources/i18n/messages_zh_TW.properties +++ b/backend/src/main/resources/i18n/messages_zh_TW.properties @@ -261,4 +261,6 @@ auth_title=系统认证 # track home api_case=接口用例 performance_case=性能用例 -scenario_case=場景用例 \ No newline at end of file +scenario_case=場景用例 + +id_not_rightful=ID 不合法 \ No newline at end of file