From 1a3230cd17da3f6e2828fce8904bb8f9363154a7 Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Tue, 13 May 2025 18:51:55 +0800 Subject: [PATCH 1/3] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E5=90=8E=E7=AB=AF-?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=8C=96-=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E5=8F=AF=E4=BB=A5=E5=83=8F=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E5=BA=93=E4=B8=80=E6=A0=B7=EF=BC=8C=E7=9B=B4=E6=8E=A5=E5=9F=BA?= =?UTF-8?q?=E4=BA=8E=E6=9C=80=E6=96=B0=E7=89=88=E7=82=B9=E5=87=BB=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E5=92=8C=E5=88=9B=E5=BB=BA=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1420165709791232]后端-自动化-自定义工具可以像工具库一样,直接基于最新版点击测试和创建作业 http://192.168.0.96:8090/demo/rdm.html#/task-detail/939050947543040/939050947543050/1420165709791232 --- .../AutoexecScriptOrToolInputParamGetApi.java | 41 +++++++++++++++---- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/src/main/java/neatlogic/module/autoexec/api/script/AutoexecScriptOrToolInputParamGetApi.java b/src/main/java/neatlogic/module/autoexec/api/script/AutoexecScriptOrToolInputParamGetApi.java index e4c1314a..54e55a23 100644 --- a/src/main/java/neatlogic/module/autoexec/api/script/AutoexecScriptOrToolInputParamGetApi.java +++ b/src/main/java/neatlogic/module/autoexec/api/script/AutoexecScriptOrToolInputParamGetApi.java @@ -27,10 +27,12 @@ import neatlogic.framework.autoexec.dto.AutoexecToolVo; import neatlogic.framework.autoexec.dto.script.AutoexecScriptVersionParamVo; import neatlogic.framework.autoexec.dto.script.AutoexecScriptVersionVo; import neatlogic.framework.autoexec.dto.script.AutoexecScriptVo; +import neatlogic.framework.autoexec.exception.AutoexecScriptHasNoActiveVersionException; import neatlogic.framework.autoexec.exception.AutoexecScriptNotFoundException; import neatlogic.framework.autoexec.exception.AutoexecScriptVersionNotFoundException; import neatlogic.framework.autoexec.exception.AutoexecToolNotFoundException; import neatlogic.framework.common.constvalue.ApiParamType; +import neatlogic.framework.exception.type.ParamNotExistsException; import neatlogic.framework.restful.annotation.*; import neatlogic.framework.restful.constvalue.OperationTypeEnum; import neatlogic.framework.restful.core.privateapi.PrivateApiComponentBase; @@ -74,7 +76,8 @@ public class AutoexecScriptOrToolInputParamGetApi extends PrivateApiComponentBas } @Input({ - @Param(name = "id", type = ApiParamType.LONG, isRequired = true, desc = "工具ID或自定义工具版本ID"), + @Param(name = "id", type = ApiParamType.LONG, desc = "工具ID或自定义工具版本ID"), + @Param(name = "scriptId", type = ApiParamType.LONG, desc = "自定义工具ID"), @Param(name = "type", type = ApiParamType.ENUM, rule = "script,tool", isRequired = true, desc = "工具或自定义工具"), }) @Output({ @@ -90,15 +93,31 @@ public class AutoexecScriptOrToolInputParamGetApi extends PrivateApiComponentBas String name; List inputParamList = null; if (ToolType.SCRIPT.getValue().equals(type)) { - AutoexecScriptVersionVo version = autoexecScriptMapper.getVersionByVersionId(id); - if (version == null) { - throw new AutoexecScriptVersionNotFoundException(id); + Long scriptId = jsonObj.getLong("scriptId"); + if (id != null) { + AutoexecScriptVersionVo version = autoexecScriptMapper.getVersionByVersionId(id); + if (version == null) { + throw new AutoexecScriptVersionNotFoundException(id); + } + AutoexecScriptVo script = autoexecScriptMapper.getScriptBaseInfoById(version.getScriptId()); + if (script == null) { + throw new AutoexecScriptNotFoundException(version.getScriptId()); + } + name = script.getName(); + } else if (scriptId != null) { + AutoexecScriptVo script = autoexecScriptMapper.getScriptBaseInfoById(scriptId); + if (script == null) { + throw new AutoexecScriptNotFoundException(scriptId); + } + name = script.getName(); + AutoexecScriptVersionVo version = autoexecScriptMapper.getActiveVersionByScriptId(scriptId); + if (version == null) { + throw new AutoexecScriptHasNoActiveVersionException(name); + } + id = version.getId(); + } else { + throw new ParamNotExistsException("id", "scriptId"); } - AutoexecScriptVo script = autoexecScriptMapper.getScriptBaseInfoById(version.getScriptId()); - if (script == null) { - throw new AutoexecScriptNotFoundException(version.getScriptId()); - } - name = script.getName(); List paramList = autoexecScriptMapper.getParamListByVersionId(id); if (CollectionUtils.isNotEmpty(paramList)) { inputParamList = paramList.stream() @@ -107,6 +126,9 @@ public class AutoexecScriptOrToolInputParamGetApi extends PrivateApiComponentBas .collect(Collectors.toList()); } } else { + if (id == null) { + throw new ParamNotExistsException("id"); + } AutoexecToolVo tool = autoexecToolMapper.getToolById(id); if (tool == null) { throw new AutoexecToolNotFoundException(id); @@ -119,6 +141,7 @@ public class AutoexecScriptOrToolInputParamGetApi extends PrivateApiComponentBas autoexecService.mergeConfig(autoexecParamVo); } } + result.put("id", id); result.put("name", name); result.put("inputParamList", inputParamList); return result; -- Gitee From 52cdfd1338ee47803146ca4d12b30c1b8af90ad1 Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Wed, 14 May 2025 08:35:15 +0800 Subject: [PATCH 2/3] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E5=90=8E=E7=AB=AF-?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=8C=96-=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E5=8F=AF=E4=BB=A5=E5=83=8F=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E5=BA=93=E4=B8=80=E6=A0=B7=EF=BC=8C=E7=9B=B4=E6=8E=A5=E5=9F=BA?= =?UTF-8?q?=E4=BA=8E=E6=9C=80=E6=96=B0=E7=89=88=E7=82=B9=E5=87=BB=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E5=92=8C=E5=88=9B=E5=BB=BA=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1420165709791232]后端-自动化-自定义工具可以像工具库一样,直接基于最新版点击测试和创建作业 http://192.168.0.96:8090/demo/rdm.html#/task-detail/939050947543040/939050947543050/1420165709791232 --- .../neatlogic/module/autoexec/operate/ScriptOperateManager.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/neatlogic/module/autoexec/operate/ScriptOperateManager.java b/src/main/java/neatlogic/module/autoexec/operate/ScriptOperateManager.java index b4ccf117..89b1c9a0 100644 --- a/src/main/java/neatlogic/module/autoexec/operate/ScriptOperateManager.java +++ b/src/main/java/neatlogic/module/autoexec/operate/ScriptOperateManager.java @@ -296,6 +296,8 @@ public class ScriptOperateManager { generateToCombop.setDisabled(1); generateToCombop.setDisabledReason("当前自定义工具未有激活版本,无法发布为组合工具"); } else if (isLibScriptIdList.contains(id)) { + test.setDisabled(1); + test.setDisabledReason("当前自定义工具是库文件,不能测试"); generateToCombop.setDisabled(1); generateToCombop.setDisabledReason("当前自定义工具是库文件,无法发布为组合工具"); } -- Gitee From 214ba64bc894eafb60855754965f70885641092b Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Wed, 14 May 2025 10:12:35 +0800 Subject: [PATCH 3/3] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E5=90=8E=E7=AB=AF-?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=8C=96-=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E5=8F=AF=E4=BB=A5=E5=83=8F=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E5=BA=93=E4=B8=80=E6=A0=B7=EF=BC=8C=E7=9B=B4=E6=8E=A5=E5=9F=BA?= =?UTF-8?q?=E4=BA=8E=E6=9C=80=E6=96=B0=E7=89=88=E7=82=B9=E5=87=BB=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E5=92=8C=E5=88=9B=E5=BB=BA=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1420165709791232]后端-自动化-自定义工具可以像工具库一样,直接基于最新版点击测试和创建作业 http://192.168.0.96:8090/demo/rdm.html#/task-detail/939050947543040/939050947543050/1420165709791232 --- .../GetAutoexecScriptOrToolArgumentApi.java | 33 ++++++++++++++++--- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/src/main/java/neatlogic/module/autoexec/api/script/GetAutoexecScriptOrToolArgumentApi.java b/src/main/java/neatlogic/module/autoexec/api/script/GetAutoexecScriptOrToolArgumentApi.java index 2798b306..fe8f427c 100644 --- a/src/main/java/neatlogic/module/autoexec/api/script/GetAutoexecScriptOrToolArgumentApi.java +++ b/src/main/java/neatlogic/module/autoexec/api/script/GetAutoexecScriptOrToolArgumentApi.java @@ -24,9 +24,13 @@ import neatlogic.framework.autoexec.dao.mapper.AutoexecToolMapper; import neatlogic.framework.autoexec.dto.AutoexecToolVo; import neatlogic.framework.autoexec.dto.script.AutoexecScriptArgumentVo; import neatlogic.framework.autoexec.dto.script.AutoexecScriptVersionVo; +import neatlogic.framework.autoexec.dto.script.AutoexecScriptVo; +import neatlogic.framework.autoexec.exception.AutoexecScriptHasNoActiveVersionException; +import neatlogic.framework.autoexec.exception.AutoexecScriptNotFoundException; import neatlogic.framework.autoexec.exception.AutoexecScriptVersionNotFoundException; import neatlogic.framework.autoexec.exception.AutoexecToolNotFoundException; import neatlogic.framework.common.constvalue.ApiParamType; +import neatlogic.framework.exception.type.ParamNotExistsException; import neatlogic.framework.restful.annotation.*; import neatlogic.framework.restful.constvalue.OperationTypeEnum; import neatlogic.framework.restful.core.privateapi.PrivateApiComponentBase; @@ -61,7 +65,8 @@ public class GetAutoexecScriptOrToolArgumentApi extends PrivateApiComponentBase } @Input({ - @Param(name = "id", type = ApiParamType.LONG, isRequired = true, desc = "工具ID或自定义工具版本ID"), + @Param(name = "id", type = ApiParamType.LONG, desc = "工具ID或自定义工具版本ID"), + @Param(name = "scriptId", type = ApiParamType.LONG, desc = "自定义工具ID"), @Param(name = "type", type = ApiParamType.ENUM, rule = "script,tool", isRequired = true, desc = "工具或自定义工具"), }) @Output({ @@ -72,12 +77,30 @@ public class GetAutoexecScriptOrToolArgumentApi extends PrivateApiComponentBase public Object myDoService(JSONObject jsonObj) throws Exception { Long id =jsonObj.getLong("id"); if (ToolType.SCRIPT.getValue().equals(jsonObj.getString("type"))) { - AutoexecScriptVersionVo version = autoexecScriptMapper.getVersionByVersionId(id); - if (version == null) { - throw new AutoexecScriptVersionNotFoundException(id); + Long scriptId = jsonObj.getLong("scriptId"); + if (id != null) { + AutoexecScriptVersionVo version = autoexecScriptMapper.getVersionByVersionId(id); + if (version == null) { + throw new AutoexecScriptVersionNotFoundException(id); + } + return autoexecScriptMapper.getArgumentByVersionId(id); + } else if (scriptId != null) { + AutoexecScriptVo script = autoexecScriptMapper.getScriptBaseInfoById(scriptId); + if (script == null) { + throw new AutoexecScriptNotFoundException(scriptId); + } + AutoexecScriptVersionVo version = autoexecScriptMapper.getActiveVersionByScriptId(scriptId); + if (version == null) { + throw new AutoexecScriptHasNoActiveVersionException(script.getName()); + } + return autoexecScriptMapper.getArgumentByVersionId(version.getId()); + } else { + throw new ParamNotExistsException("id", "scriptId"); } - return autoexecScriptMapper.getArgumentByVersionId(id); }else{ + if (id == null) { + throw new ParamNotExistsException("id"); + } AutoexecToolVo tool = autoexecToolMapper.getToolById(id); if (tool == null) { throw new AutoexecToolNotFoundException(id); -- Gitee