refactor(接口测试): 优化接口调试模块提示

This commit is contained in:
wxg0103 2023-10-31 18:50:27 +08:00 committed by Craftsman
parent eadb7768e9
commit 03e8006e1c
5 changed files with 15 additions and 6 deletions

View File

@ -274,3 +274,8 @@ api_debug_module.project_id.length_range=项目ID长度必须在1-50之间
api_debug_module.pos.not_blank=模块位置不能为空 api_debug_module.pos.not_blank=模块位置不能为空
api_debug_module.name.not_contain_slash=模块名称不能包含斜杠 api_debug_module.name.not_contain_slash=模块名称不能包含斜杠
#module: ApiEnvironmentConfig
api_environment_config.id.not_blank=ID不能为空
api_environment_config.environment_id.length_range=环境ID长度必须在1-50之间
api_environment_config.environment_id.not_blank=环境ID不能为空
api_module.not.exist=模块不存在

View File

@ -280,3 +280,4 @@ api_debug_module.unplanned_request=Unplanned request
api_environment_config.id.not_blank=ID不能为空 api_environment_config.id.not_blank=ID不能为空
api_environment_config.environment_id.length_range=环境ID长度必须在1-50之间 api_environment_config.environment_id.length_range=环境ID长度必须在1-50之间
api_environment_config.environment_id.not_blank=环境ID不能为空 api_environment_config.environment_id.not_blank=环境ID不能为空
api_module.not.exist=模块不存在

View File

@ -280,3 +280,4 @@ api_debug_module.unplanned_request=未规划请求
api_environment_config.id.not_blank=ID不能为空 api_environment_config.id.not_blank=ID不能为空
api_environment_config.environment_id.length_range=环境ID长度必须在1-50之间 api_environment_config.environment_id.length_range=环境ID长度必须在1-50之间
api_environment_config.environment_id.not_blank=环境ID不能为空 api_environment_config.environment_id.not_blank=环境ID不能为空
api_module.not.exist=模块不存在

View File

@ -280,3 +280,4 @@ api_debug_module.unplanned_request=未規劃請求
api_environment_config.id.not_blank=ID不能為空 api_environment_config.id.not_blank=ID不能為空
api_environment_config.environment_id.length_range=環境ID長度必須在1-50之間 api_environment_config.environment_id.length_range=環境ID長度必須在1-50之間
api_environment_config.environment_id.not_blank=環境ID不能為空 api_environment_config.environment_id.not_blank=環境ID不能為空
api_module.not.exist=模塊不存在

View File

@ -36,6 +36,7 @@ import java.util.stream.Collectors;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public class ApiDebugModuleService extends ModuleTreeService { public class ApiDebugModuleService extends ModuleTreeService {
private static final String UNPLANNED = "api_debug_module.unplanned_request"; private static final String UNPLANNED = "api_debug_module.unplanned_request";
private static final String MODULE_NO_EXIST = "api_module.not.exist";
private static final String METHOD = "method"; private static final String METHOD = "method";
private static final String DEBUG_MODULE_COUNT_ALL = "all"; private static final String DEBUG_MODULE_COUNT_ALL = "all";
@Resource @Resource
@ -151,7 +152,7 @@ public class ApiDebugModuleService extends ModuleTreeService {
public void update(DebugModuleUpdateRequest request, String userId, String projectId) { public void update(DebugModuleUpdateRequest request, String userId, String projectId) {
ApiDebugModule module = apiDebugModuleMapper.selectByPrimaryKey(request.getId()); ApiDebugModule module = apiDebugModuleMapper.selectByPrimaryKey(request.getId());
if (module == null) { if (module == null) {
throw new MSException("file_module.not.exist"); throw new MSException(Translator.get(MODULE_NO_EXIST));
} }
ApiDebugModule updateModule = new ApiDebugModule(); ApiDebugModule updateModule = new ApiDebugModule();
updateModule.setId(request.getId()); updateModule.setId(request.getId());
@ -209,7 +210,7 @@ public class ApiDebugModuleService extends ModuleTreeService {
ApiDebugModule dragNode = apiDebugModuleMapper.selectByPrimaryKey(request.getDragNodeId()); ApiDebugModule dragNode = apiDebugModuleMapper.selectByPrimaryKey(request.getDragNodeId());
if (dragNode == null) { if (dragNode == null) {
throw new MSException("file_module.not.exist:" + request.getDragNodeId()); throw new MSException(Translator.get(MODULE_NO_EXIST) + ": " + request.getDragNodeId());
} else { } else {
module = new BaseModule(dragNode.getId(), dragNode.getName(), dragNode.getPos(), dragNode.getProjectId(), dragNode.getParentId()); module = new BaseModule(dragNode.getId(), dragNode.getName(), dragNode.getPos(), dragNode.getProjectId(), dragNode.getParentId());
} }
@ -221,7 +222,7 @@ public class ApiDebugModuleService extends ModuleTreeService {
ApiDebugModule dropNode = apiDebugModuleMapper.selectByPrimaryKey(request.getDropNodeId()); ApiDebugModule dropNode = apiDebugModuleMapper.selectByPrimaryKey(request.getDropNodeId());
if (dropNode == null) { if (dropNode == null) {
throw new MSException("file_module.not.exist:" + request.getDropNodeId()); throw new MSException(Translator.get(MODULE_NO_EXIST) + ": " + request.getDropNodeId());
} }
if (request.getDropPosition() == 0) { if (request.getDropPosition() == 0) {