From 44a51a66a45a13006b65fc605f628ad7e2684d07 Mon Sep 17 00:00:00 2001 From: linbangquan <1437892690@qq.com> Date: Mon, 20 Nov 2023 17:39:10 +0800 Subject: [PATCH 1/4] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E8=A7=86=E5=9B=BE?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE-=E5=A2=9E=E5=8A=A0=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E8=A7=86=E5=9B=BE=E6=95=B0=E6=8D=AE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1023682900623360]视图设置-增加显示视图数据功能 http://192.168.0.96:8090/demo/rdm.html#/story-detail/939050947543040/939050947543042/1023682900623360 --- ...am2CombopPhaseOperationArgumentParamDependencyHandler.java | 3 +++ ...Param2CombopPhaseOperationInputParamDependencyHandler.java | 3 +++ ...AutoexecProfile2CombopPhaseOperationDependencyHandler.java | 3 +++ .../dependency/AutoexecScenarioCombopDependencyHandler.java | 4 +++- .../AutoexecScript2CombopPhaseOperationDependencyHandler.java | 3 +++ .../AutoexecTool2CombopPhaseOperationDependencyHandler.java | 3 +++ .../Matrix2AutoexecCombopVersionParamDependencyHandler.java | 3 +++ 7 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/main/java/neatlogic/module/autoexec/dependency/AutoexecGlobalParam2CombopPhaseOperationArgumentParamDependencyHandler.java b/src/main/java/neatlogic/module/autoexec/dependency/AutoexecGlobalParam2CombopPhaseOperationArgumentParamDependencyHandler.java index b4b3adf9..3368c0e1 100644 --- a/src/main/java/neatlogic/module/autoexec/dependency/AutoexecGlobalParam2CombopPhaseOperationArgumentParamDependencyHandler.java +++ b/src/main/java/neatlogic/module/autoexec/dependency/AutoexecGlobalParam2CombopPhaseOperationArgumentParamDependencyHandler.java @@ -107,6 +107,9 @@ public class AutoexecGlobalParam2CombopPhaseOperationArgumentParamDependencyHand } if (Objects.equals(paramMappingVo.getValue(), dependencyVo.getFrom())) { AutoexecCombopVo autoexecCombopVo = autoexecCombopMapper.getAutoexecCombopById(autoexecCombopVersionVo.getCombopId()); + if (autoexecCombopVo == null) { + return null; + } String operationName = phaseOperationVo.getOperationName(); String phaseName = combopPhaseVo.getName(); String combopName = autoexecCombopVo.getName(); diff --git a/src/main/java/neatlogic/module/autoexec/dependency/AutoexecGlobalParam2CombopPhaseOperationInputParamDependencyHandler.java b/src/main/java/neatlogic/module/autoexec/dependency/AutoexecGlobalParam2CombopPhaseOperationInputParamDependencyHandler.java index 89158371..269ee83d 100644 --- a/src/main/java/neatlogic/module/autoexec/dependency/AutoexecGlobalParam2CombopPhaseOperationInputParamDependencyHandler.java +++ b/src/main/java/neatlogic/module/autoexec/dependency/AutoexecGlobalParam2CombopPhaseOperationInputParamDependencyHandler.java @@ -107,6 +107,9 @@ public class AutoexecGlobalParam2CombopPhaseOperationInputParamDependencyHandler } if (Objects.equals(paramMappingVo.getValue(), dependencyVo.getFrom())) { AutoexecCombopVo autoexecCombopVo = autoexecCombopMapper.getAutoexecCombopById(autoexecCombopVersionVo.getCombopId()); + if (autoexecCombopVo == null) { + return null; + } String operationName = phaseOperationVo.getOperationName(); String phaseName = combopPhaseVo.getName(); String combopName = autoexecCombopVo.getName(); diff --git a/src/main/java/neatlogic/module/autoexec/dependency/AutoexecProfile2CombopPhaseOperationDependencyHandler.java b/src/main/java/neatlogic/module/autoexec/dependency/AutoexecProfile2CombopPhaseOperationDependencyHandler.java index c99127c7..f91d1d4c 100644 --- a/src/main/java/neatlogic/module/autoexec/dependency/AutoexecProfile2CombopPhaseOperationDependencyHandler.java +++ b/src/main/java/neatlogic/module/autoexec/dependency/AutoexecProfile2CombopPhaseOperationDependencyHandler.java @@ -97,6 +97,9 @@ public class AutoexecProfile2CombopPhaseOperationDependencyHandler extends Fixed return null; } AutoexecCombopVo autoexecCombopVo = autoexecCombopMapper.getAutoexecCombopById(autoexecCombopVersionVo.getCombopId()); + if (autoexecCombopVo == null) { + return null; + } String operationName = phaseOperationVo.getOperationName(); String phaseName = combopPhaseVo.getName(); String combopName = autoexecCombopVo.getName(); diff --git a/src/main/java/neatlogic/module/autoexec/dependency/AutoexecScenarioCombopDependencyHandler.java b/src/main/java/neatlogic/module/autoexec/dependency/AutoexecScenarioCombopDependencyHandler.java index a4ad79b7..086afcff 100644 --- a/src/main/java/neatlogic/module/autoexec/dependency/AutoexecScenarioCombopDependencyHandler.java +++ b/src/main/java/neatlogic/module/autoexec/dependency/AutoexecScenarioCombopDependencyHandler.java @@ -60,7 +60,9 @@ public class AutoexecScenarioCombopDependencyHandler extends FixedTableDependenc } Long combopId = autoexecCombopVersionVo.getCombopId(); AutoexecCombopVo autoexecCombopVo = autoexecCombopMapper.getAutoexecCombopById(combopId); - + if (autoexecCombopVo == null) { + return null; + } JSONObject dependencyInfoConfig = new JSONObject(); dependencyInfoConfig.put("combopId", combopId); dependencyInfoConfig.put("versionId", versionId); diff --git a/src/main/java/neatlogic/module/autoexec/dependency/AutoexecScript2CombopPhaseOperationDependencyHandler.java b/src/main/java/neatlogic/module/autoexec/dependency/AutoexecScript2CombopPhaseOperationDependencyHandler.java index 148a3e85..56fbcc38 100644 --- a/src/main/java/neatlogic/module/autoexec/dependency/AutoexecScript2CombopPhaseOperationDependencyHandler.java +++ b/src/main/java/neatlogic/module/autoexec/dependency/AutoexecScript2CombopPhaseOperationDependencyHandler.java @@ -95,6 +95,9 @@ public class AutoexecScript2CombopPhaseOperationDependencyHandler extends FixedT return null; } AutoexecCombopVo autoexecCombopVo = autoexecCombopMapper.getAutoexecCombopById(autoexecCombopVersionVo.getCombopId()); + if (autoexecCombopVo == null) { + return null; + } String operationName = phaseOperationVo.getOperationName(); String phaseName = combopPhaseVo.getName(); String combopName = autoexecCombopVo.getName(); diff --git a/src/main/java/neatlogic/module/autoexec/dependency/AutoexecTool2CombopPhaseOperationDependencyHandler.java b/src/main/java/neatlogic/module/autoexec/dependency/AutoexecTool2CombopPhaseOperationDependencyHandler.java index 968b6f05..d85f75fd 100644 --- a/src/main/java/neatlogic/module/autoexec/dependency/AutoexecTool2CombopPhaseOperationDependencyHandler.java +++ b/src/main/java/neatlogic/module/autoexec/dependency/AutoexecTool2CombopPhaseOperationDependencyHandler.java @@ -95,6 +95,9 @@ public class AutoexecTool2CombopPhaseOperationDependencyHandler extends FixedTab return null; } AutoexecCombopVo autoexecCombopVo = autoexecCombopMapper.getAutoexecCombopById(autoexecCombopVersionVo.getCombopId()); + if (autoexecCombopVo == null) { + return null; + } String operationName = phaseOperationVo.getOperationName(); String phaseName = combopPhaseVo.getName(); String combopName = autoexecCombopVo.getName(); diff --git a/src/main/java/neatlogic/module/autoexec/dependency/Matrix2AutoexecCombopVersionParamDependencyHandler.java b/src/main/java/neatlogic/module/autoexec/dependency/Matrix2AutoexecCombopVersionParamDependencyHandler.java index 98e210e2..f36683c8 100644 --- a/src/main/java/neatlogic/module/autoexec/dependency/Matrix2AutoexecCombopVersionParamDependencyHandler.java +++ b/src/main/java/neatlogic/module/autoexec/dependency/Matrix2AutoexecCombopVersionParamDependencyHandler.java @@ -71,6 +71,9 @@ public class Matrix2AutoexecCombopVersionParamDependencyHandler extends FixedTab for (AutoexecParamVo autoexecParamVo : runtimeParamList) { if (Objects.equals(dependencyVo.getTo(), autoexecParamVo.getId().toString())) { AutoexecCombopVo autoexecCombopVo = autoexecCombopMapper.getAutoexecCombopById(autoexecCombopVersionVo.getCombopId()); + if (autoexecCombopVo == null) { + return null; + } JSONObject dependencyInfoConfig = new JSONObject(); dependencyInfoConfig.put("combopId", autoexecCombopVo.getId()); dependencyInfoConfig.put("versionId", autoexecCombopVersionVo.getId()); -- Gitee From b40ee75a2b9aa87874f301623707e6f6805e9b99 Mon Sep 17 00:00:00 2001 From: linbangquan <1437892690@qq.com> Date: Mon, 20 Nov 2023 17:45:10 +0800 Subject: [PATCH 2/4] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E8=A7=86=E5=9B=BE?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE-=E5=A2=9E=E5=8A=A0=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E8=A7=86=E5=9B=BE=E6=95=B0=E6=8D=AE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1023682900623360]视图设置-增加显示视图数据功能 http://192.168.0.96:8090/demo/rdm.html#/story-detail/939050947543040/939050947543042/1023682900623360 --- .../paramtype/ScriptParamTypeAccount.java | 2 +- .../paramtype/ScriptParamTypeCheckbox.java | 33 +++++++++---------- .../script/paramtype/ScriptParamTypeFile.java | 2 +- .../paramtype/ScriptParamTypeMultiSelect.java | 33 +++++++++---------- .../script/paramtype/ScriptParamTypeNode.java | 7 +--- .../paramtype/ScriptParamTypePassword.java | 4 +-- .../paramtype/ScriptParamTypePhase.java | 10 ------ .../paramtype/ScriptParamTypeRadio.java | 25 +++++++------- .../paramtype/ScriptParamTypeSelect.java | 27 +++++++-------- .../paramtype/ScriptParamTypeSwitch.java | 10 ------ .../paramtype/ScriptParamTypeUserSelect.java | 2 +- 11 files changed, 63 insertions(+), 92 deletions(-) diff --git a/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeAccount.java b/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeAccount.java index 8b7989f0..b800c3a1 100644 --- a/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeAccount.java +++ b/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeAccount.java @@ -122,7 +122,7 @@ public class ScriptParamTypeAccount extends ScriptParamTypeBase { } @Override - protected Object getMyTextByValue(Object value) { + protected Object getMyTextByValue(Object value, JSONObject config) { String valueStr = value.toString(); if (StringUtils.isNotBlank(valueStr)) { IResourceAccountCrossoverMapper resourceAccountCrossoverMapper = CrossoverServiceFactory.getApi(IResourceAccountCrossoverMapper.class); diff --git a/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeCheckbox.java b/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeCheckbox.java index 4465983c..4ecf8bd8 100644 --- a/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeCheckbox.java +++ b/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeCheckbox.java @@ -16,10 +16,14 @@ limitations under the License. package neatlogic.module.autoexec.script.paramtype; -import neatlogic.framework.autoexec.constvalue.ParamType; -import neatlogic.framework.autoexec.script.paramtype.ScriptParamTypeBase; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import neatlogic.framework.autoexec.constvalue.ParamType; +import neatlogic.framework.autoexec.script.paramtype.ScriptParamTypeBase; +import neatlogic.framework.crossover.CrossoverServiceFactory; +import neatlogic.framework.form.dto.AttributeDataVo; +import neatlogic.framework.form.service.IFormCrossoverService; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Service; /** @@ -79,8 +83,6 @@ public class ScriptParamTypeCheckbox extends ScriptParamTypeBase { { this.put("type", "checkbox"); this.put("placeholder", "请选择"); - this.put("url", "/api/rest/matrix/column/data/search/forselect/new"); - this.put("rootName", "tbodyList"); } }; } @@ -91,20 +93,15 @@ public class ScriptParamTypeCheckbox extends ScriptParamTypeBase { } @Override - public Object getMyTextByValue(Object value) { - JSONArray values = JSONArray.parseArray(value.toString()); - for (int i = 0; i < values.size(); i++) { - String valueStr = values.getString(i); - int tmpIndex = valueStr.indexOf("&=&"); - if (tmpIndex > -1) { - values.set(i,valueStr.substring(tmpIndex + 3)); - } + public Object getMyTextByValue(Object value, JSONObject config) { + IFormCrossoverService formCrossoverService = CrossoverServiceFactory.getApi(IFormCrossoverService.class); + AttributeDataVo attributeDataVo = new AttributeDataVo(); + attributeDataVo.setDataObj(value); + JSONObject resultObj = formCrossoverService.getMyDetailedDataForSelectHandler(attributeDataVo, config); + JSONArray textList = resultObj.getJSONArray("textList"); + if (CollectionUtils.isNotEmpty(textList)) { + return textList; } - return values; - } - - @Override - public Object getMyAutoexecParamByValue(Object value){ - return getMyTextByValue(value); + return value; } } diff --git a/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeFile.java b/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeFile.java index 902c6095..9b19c795 100644 --- a/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeFile.java +++ b/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeFile.java @@ -87,7 +87,7 @@ public class ScriptParamTypeFile extends ScriptParamTypeBase { } @Override - protected Object getMyTextByValue(Object value) { + protected Object getMyTextByValue(Object value, JSONObject config) { return JSONObject.parseObject(value.toString()); } diff --git a/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeMultiSelect.java b/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeMultiSelect.java index 86ca0865..440d09c9 100644 --- a/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeMultiSelect.java +++ b/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeMultiSelect.java @@ -16,10 +16,14 @@ limitations under the License. package neatlogic.module.autoexec.script.paramtype; -import neatlogic.framework.autoexec.constvalue.ParamType; -import neatlogic.framework.autoexec.script.paramtype.ScriptParamTypeBase; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import neatlogic.framework.autoexec.constvalue.ParamType; +import neatlogic.framework.autoexec.script.paramtype.ScriptParamTypeBase; +import neatlogic.framework.crossover.CrossoverServiceFactory; +import neatlogic.framework.form.dto.AttributeDataVo; +import neatlogic.framework.form.service.IFormCrossoverService; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Service; /** @@ -79,8 +83,6 @@ public class ScriptParamTypeMultiSelect extends ScriptParamTypeBase { { this.put("type", "select"); this.put("placeholder", "请选择"); - this.put("dynamicUrl", "/api/rest/matrix/column/data/search/forselect/new"); - this.put("rootName", "tbodyList"); this.put("multiple", true); } }; @@ -92,20 +94,15 @@ public class ScriptParamTypeMultiSelect extends ScriptParamTypeBase { } @Override - public Object getMyTextByValue(Object value) { - JSONArray values = JSONArray.parseArray(value.toString()); - for (int i = 0; i < values.size(); i++) { - String valueStr = values.getString(i); - int tmpIndex = valueStr.indexOf("&=&"); - if (tmpIndex > -1) { - values.set(i,valueStr.substring(tmpIndex + 3)); - } + public Object getMyTextByValue(Object value, JSONObject config) { + IFormCrossoverService formCrossoverService = CrossoverServiceFactory.getApi(IFormCrossoverService.class); + AttributeDataVo attributeDataVo = new AttributeDataVo(); + attributeDataVo.setDataObj(value); + JSONObject resultObj = formCrossoverService.getMyDetailedDataForSelectHandler(attributeDataVo, config); + JSONArray textList = resultObj.getJSONArray("textList"); + if (CollectionUtils.isNotEmpty(textList)) { + return textList; } - return values; - } - - @Override - public Object getMyAutoexecParamByValue(Object value){ - return getMyTextByValue(value); + return value; } } diff --git a/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeNode.java b/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeNode.java index 90ef6368..36c509c1 100644 --- a/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeNode.java +++ b/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeNode.java @@ -84,7 +84,7 @@ public class ScriptParamTypeNode extends ScriptParamTypeBase { } @Override - protected Object getMyTextByValue(Object value) { + protected Object getMyTextByValue(Object value, JSONObject config) { JSONArray nodeJsonArray = JSONObject.parseArray(value.toString()); for (Object node : nodeJsonArray) { JSONObject nodeJson = (JSONObject) node; @@ -92,9 +92,4 @@ public class ScriptParamTypeNode extends ScriptParamTypeBase { } return nodeJsonArray; } - - @Override - public Object getMyAutoexecParamByValue(Object value){ - return value; - } } diff --git a/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypePassword.java b/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypePassword.java index fdb87bc6..79a3caef 100644 --- a/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypePassword.java +++ b/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypePassword.java @@ -86,13 +86,13 @@ public class ScriptParamTypePassword extends ScriptParamTypeBase { } @Override - protected Object getMyTextByValue(Object value) { + protected Object getMyTextByValue(Object value, JSONObject config) { String valueStr = value.toString(); return RC4Util.encrypt(valueStr); } @Override public Object getMyAutoexecParamByValue(Object value){ - return getMyTextByValue(value); + return getMyTextByValue(value, null); } } diff --git a/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypePhase.java b/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypePhase.java index 7a3c5dc7..5d63c722 100644 --- a/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypePhase.java +++ b/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypePhase.java @@ -87,14 +87,4 @@ public class ScriptParamTypePhase extends ScriptParamTypeBase { public Boolean myNeedDataSource() { return false; } - - @Override - public Object getMyTextByValue(Object value) { - return value; - } - - @Override - public Object getMyAutoexecParamByValue(Object value){ - return getMyTextByValue(value); - } } diff --git a/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeRadio.java b/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeRadio.java index a00c8add..79c31294 100644 --- a/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeRadio.java +++ b/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeRadio.java @@ -16,9 +16,14 @@ limitations under the License. package neatlogic.module.autoexec.script.paramtype; +import com.alibaba.fastjson.JSONArray; import neatlogic.framework.autoexec.constvalue.ParamType; import neatlogic.framework.autoexec.script.paramtype.ScriptParamTypeBase; import com.alibaba.fastjson.JSONObject; +import neatlogic.framework.crossover.CrossoverServiceFactory; +import neatlogic.framework.form.dto.AttributeDataVo; +import neatlogic.framework.form.service.IFormCrossoverService; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Service; /** @@ -78,8 +83,6 @@ public class ScriptParamTypeRadio extends ScriptParamTypeBase { { this.put("type", "radio"); this.put("placeholder", "请选择"); - this.put("url", "/api/rest/matrix/column/data/search/forselect/new"); - this.put("rootName", "tbodyList"); } }; } @@ -90,17 +93,15 @@ public class ScriptParamTypeRadio extends ScriptParamTypeBase { } @Override - public Object getMyTextByValue(Object value) { - String valueStr = value.toString(); - int tmpIndex = valueStr.indexOf("&=&"); - if (tmpIndex > -1) { - return valueStr.substring(tmpIndex + 3); + public Object getMyTextByValue(Object value, JSONObject config) { + IFormCrossoverService formCrossoverService = CrossoverServiceFactory.getApi(IFormCrossoverService.class); + AttributeDataVo attributeDataVo = new AttributeDataVo(); + attributeDataVo.setDataObj(value); + JSONObject resultObj = formCrossoverService.getMyDetailedDataForSelectHandler(attributeDataVo, config); + JSONArray textList = resultObj.getJSONArray("textList"); + if (CollectionUtils.isNotEmpty(textList)) { + return textList.get(0); } return value; } - - @Override - public Object getMyAutoexecParamByValue(Object value){ - return getMyTextByValue(value); - } } diff --git a/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeSelect.java b/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeSelect.java index 048e1fda..9fa015fb 100644 --- a/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeSelect.java +++ b/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeSelect.java @@ -16,9 +16,14 @@ limitations under the License. package neatlogic.module.autoexec.script.paramtype; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import neatlogic.framework.autoexec.constvalue.ParamType; import neatlogic.framework.autoexec.script.paramtype.ScriptParamTypeBase; -import com.alibaba.fastjson.JSONObject; +import neatlogic.framework.crossover.CrossoverServiceFactory; +import neatlogic.framework.form.dto.AttributeDataVo; +import neatlogic.framework.form.service.IFormCrossoverService; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Service; /** @@ -78,8 +83,6 @@ public class ScriptParamTypeSelect extends ScriptParamTypeBase { { this.put("type", "select"); this.put("placeholder", "请选择"); - this.put("dynamicUrl", "/api/rest/matrix/column/data/search/forselect/new"); - this.put("rootName", "tbodyList"); this.put("multiple", false); } }; @@ -91,17 +94,15 @@ public class ScriptParamTypeSelect extends ScriptParamTypeBase { } @Override - public Object getMyTextByValue(Object value) { - String valueStr = value.toString(); - int tmpIndex = valueStr.indexOf("&=&"); - if (tmpIndex > -1) { - return valueStr.substring(tmpIndex + 3); + public Object getMyTextByValue(Object value, JSONObject config) { + IFormCrossoverService formCrossoverService = CrossoverServiceFactory.getApi(IFormCrossoverService.class); + AttributeDataVo attributeDataVo = new AttributeDataVo(); + attributeDataVo.setDataObj(value); + JSONObject resultObj = formCrossoverService.getMyDetailedDataForSelectHandler(attributeDataVo, config); + JSONArray textList = resultObj.getJSONArray("textList"); + if (CollectionUtils.isNotEmpty(textList)) { + return textList.get(0); } return value; } - - @Override - public Object getMyAutoexecParamByValue(Object value){ - return getMyTextByValue(value); - } } diff --git a/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeSwitch.java b/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeSwitch.java index 07f0e337..ee1636a0 100644 --- a/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeSwitch.java +++ b/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeSwitch.java @@ -85,14 +85,4 @@ public class ScriptParamTypeSwitch extends ScriptParamTypeBase { public Boolean myNeedDataSource() { return false; } - - @Override - public Object getMyTextByValue(Object value) { - return value; - } - - @Override - public Object getMyAutoexecParamByValue(Object value) { - return getMyTextByValue(value); - } } diff --git a/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeUserSelect.java b/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeUserSelect.java index 1b5696f4..472b5778 100644 --- a/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeUserSelect.java +++ b/src/main/java/neatlogic/module/autoexec/script/paramtype/ScriptParamTypeUserSelect.java @@ -100,7 +100,7 @@ public class ScriptParamTypeUserSelect extends ScriptParamTypeBase { } @Override - public Object getMyTextByValue(Object value) { + public Object getMyTextByValue(Object value, JSONObject config) { String valueString = value.toString(); if (valueString.startsWith("[") && valueString.endsWith("]")) { return JSONObject.parseArray(valueString); -- Gitee From ff9078f24d7ba8c51852bf038fd626d281331330 Mon Sep 17 00:00:00 2001 From: linbangquan <1437892690@qq.com> Date: Mon, 20 Nov 2023 17:46:13 +0800 Subject: [PATCH 3/4] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E8=A7=86=E5=9B=BE?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE-=E5=A2=9E=E5=8A=A0=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E8=A7=86=E5=9B=BE=E6=95=B0=E6=8D=AE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1023682900623360]视图设置-增加显示视图数据功能 http://192.168.0.96:8090/demo/rdm.html#/story-detail/939050947543040/939050947543042/1023682900623360 --- .../job/AutoexecJobRunTimeParamGetApi.java | 13 +-- .../api/tool/ExportAutoexecToolParamApi.java | 95 ++++--------------- 2 files changed, 27 insertions(+), 81 deletions(-) diff --git a/src/main/java/neatlogic/module/autoexec/api/job/AutoexecJobRunTimeParamGetApi.java b/src/main/java/neatlogic/module/autoexec/api/job/AutoexecJobRunTimeParamGetApi.java index 55d0f249..0afe82a6 100644 --- a/src/main/java/neatlogic/module/autoexec/api/job/AutoexecJobRunTimeParamGetApi.java +++ b/src/main/java/neatlogic/module/autoexec/api/job/AutoexecJobRunTimeParamGetApi.java @@ -78,15 +78,16 @@ public class AutoexecJobRunTimeParamGetApi extends PrivateApiComponentBase { JSONArray runTimeParam = JSONObject.parseArray(paramContentVo.getContent()); //集成数据特殊处理,截取text for (int i = 0; i < runTimeParam.size(); i++) { - String value = runTimeParam.getJSONObject(i).getString("value"); - String defaultValue = runTimeParam.getJSONObject(i).getString("defaultValue"); + Object value = runTimeParam.getJSONObject(i).get("value"); + Object defaultValue = runTimeParam.getJSONObject(i).get("defaultValue"); String type = runTimeParam.getJSONObject(i).getString("type"); - if (StringUtils.isNotBlank(type) && StringUtils.isNotBlank(value)) { + if (StringUtils.isNotBlank(type) && value != null) { IScriptParamType paramType = ScriptParamTypeFactory.getHandler(type); if (paramType != null) { - runTimeParam.getJSONObject(i).put("value", paramType.getTextByValue(value)); - if (StringUtils.isNotBlank(defaultValue)) { - runTimeParam.getJSONObject(i).put("defaultValue", paramType.getTextByValue(defaultValue)); + JSONObject config = runTimeParam.getJSONObject(i).getJSONObject("config"); + runTimeParam.getJSONObject(i).put("value", paramType.getTextByValue(value, config)); + if (defaultValue != null) { + runTimeParam.getJSONObject(i).put("defaultValue", paramType.getTextByValue(defaultValue, config)); } } } diff --git a/src/main/java/neatlogic/module/autoexec/api/tool/ExportAutoexecToolParamApi.java b/src/main/java/neatlogic/module/autoexec/api/tool/ExportAutoexecToolParamApi.java index a2af45a6..6fb90a3c 100644 --- a/src/main/java/neatlogic/module/autoexec/api/tool/ExportAutoexecToolParamApi.java +++ b/src/main/java/neatlogic/module/autoexec/api/tool/ExportAutoexecToolParamApi.java @@ -15,9 +15,10 @@ */ package neatlogic.module.autoexec.api.tool; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import neatlogic.framework.auth.core.AuthAction; import neatlogic.framework.autoexec.auth.AUTOEXEC_BASE; -import neatlogic.framework.autoexec.constvalue.ParamDataSource; import neatlogic.framework.autoexec.constvalue.ParamType; import neatlogic.framework.autoexec.dao.mapper.AutoexecToolMapper; import neatlogic.framework.autoexec.dto.AutoexecParamConfigVo; @@ -27,17 +28,15 @@ import neatlogic.framework.autoexec.dto.profile.AutoexecProfileParamVo; import neatlogic.framework.autoexec.dto.profile.AutoexecProfileVo; import neatlogic.framework.autoexec.exception.AutoexecToolExportNotFoundToolException; import neatlogic.framework.autoexec.exception.AutoexecToolNotFoundException; +import neatlogic.framework.autoexec.script.paramtype.IScriptParamType; +import neatlogic.framework.autoexec.script.paramtype.ScriptParamTypeFactory; import neatlogic.framework.cmdb.crossover.IResourceAccountCrossoverMapper; import neatlogic.framework.cmdb.dto.resourcecenter.AccountVo; import neatlogic.framework.cmdb.dto.resourcecenter.ResourceVo; import neatlogic.framework.common.constvalue.ApiParamType; -import neatlogic.framework.common.dto.ValueTextVo; import neatlogic.framework.crossover.CrossoverServiceFactory; import neatlogic.framework.exception.type.ParamNotExistsException; import neatlogic.framework.file.dto.FileVo; -import neatlogic.framework.matrix.core.MatrixPrivateDataSourceHandlerFactory; -import neatlogic.framework.matrix.dao.mapper.MatrixMapper; -import neatlogic.framework.matrix.dto.MatrixVo; import neatlogic.framework.restful.annotation.Description; import neatlogic.framework.restful.annotation.Input; import neatlogic.framework.restful.annotation.OperationType; @@ -50,8 +49,6 @@ import neatlogic.framework.util.word.enums.FontFamily; import neatlogic.framework.util.word.enums.TableColor; import neatlogic.framework.util.word.enums.TitleType; import neatlogic.module.autoexec.dao.mapper.AutoexecProfileMapper; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; @@ -83,9 +80,6 @@ public class ExportAutoexecToolParamApi extends PrivateBinaryStreamApiComponentB @Resource private AutoexecProfileMapper autoexecProfileMapper; - @Resource - private MatrixMapper matrixMapper; - @Override public String getName() { return "导出工具库工具参数"; @@ -234,85 +228,36 @@ public class ExportAutoexecToolParamApi extends PrivateBinaryStreamApiComponentB if (config == null) { return returnDefaultValue; } - String dataSource = config.getDataSource(); - //静态数据源 - if (StringUtils.equals(ParamDataSource.STATIC.getValue(), dataSource)) { - if (paramDefaultValue != null && !Objects.equals(paramDefaultValue.toString(), "")) { - JSONArray dataArray = config.getDataList(); - if (CollectionUtils.isNotEmpty(dataArray)) { - List valueTextVoList = dataArray.toJavaList(ValueTextVo.class); - Map valueTextMap = valueTextVoList.stream().collect(Collectors.toMap(ValueTextVo::getValue, ValueTextVo::getText)); - returnDefaultValue.append(" ").append(valueTextMap.get(paramDefaultValue)); - } - } - //矩阵数据源 - } else if (StringUtils.equals(ParamDataSource.MATRIX.getValue(), dataSource)) { - String matrixUuid = config.getMatrixUuid(); - if (StringUtils.isNotBlank(matrixUuid)) { - MatrixVo matrixVo = matrixMapper.getMatrixByUuid(matrixUuid); - if (matrixVo == null) { - matrixVo = MatrixPrivateDataSourceHandlerFactory.getMatrixVo(matrixUuid); - } - if (matrixVo != null) { - returnDefaultValue = new StringBuilder(matrixVo.getName()); - if (paramDefaultValue != null) { - String valueString = String.valueOf(paramDefaultValue); - returnDefaultValue.append(" ").append(valueString.substring(valueString.substring(0, valueString.indexOf("&=&")).length() + 3)); - } - } + IScriptParamType paramType = ScriptParamTypeFactory.getHandler(paramVo.getType()); + if (paramType != null) { + Object text = paramType.getTextByValue(paramDefaultValue, JSONObject.parseObject(JSONObject.toJSONString(config))).toString(); + if (text != null) { + returnDefaultValue.append(" ").append(text); } } - //复选、多选下拉 } else if (StringUtils.equals(ParamType.CHECKBOX.getValue(), paramVo.getType()) || StringUtils.equals(ParamType.MULTISELECT.getValue(), paramVo.getType())) { AutoexecParamConfigVo config = paramVo.getConfig(); if (config == null) { return returnDefaultValue; } - String dataSource = config.getDataSource(); - //静态数据源 - if (StringUtils.equals(ParamDataSource.STATIC.getValue(), dataSource)) { - if (paramDefaultValue != null) { - List valueList = (List) paramDefaultValue; - JSONArray dataArray = config.getDataList(); - if (CollectionUtils.isNotEmpty(dataArray)) { - List valueTextVoList = dataArray.toJavaList(ValueTextVo.class); - Map valueTextMap = valueTextVoList.stream().collect(Collectors.toMap(ValueTextVo::getValue, ValueTextVo::getText)); - for (int i = 0; i < valueList.size(); i++) { - Object object = valueList.get(i); - returnDefaultValue.append(" ").append(valueTextMap.get(object)); - if (i < valueList.size() - 1) { + IScriptParamType paramType = ScriptParamTypeFactory.getHandler(paramVo.getType()); + if (paramType != null) { + Object text = paramType.getTextByValue(paramDefaultValue, JSONObject.parseObject(JSONObject.toJSONString(config))).toString(); + if (text != null) { + if (text instanceof List) { + List textList = (List) text; + returnDefaultValue.append(" "); + for (int i = 0; i < textList.size(); i++) { + Object textStr = textList.get(i); + returnDefaultValue.append(textStr); + if (i < textList.size() - 1) { returnDefaultValue.append("|"); } } } } - - //矩阵数据源 - } else if (StringUtils.equals(ParamDataSource.MATRIX.getValue(), dataSource)) { - String matrixUuid = config.getMatrixUuid(); - if (StringUtils.isNotBlank(matrixUuid)) { - MatrixVo matrixVo = matrixMapper.getMatrixByUuid(matrixUuid); - if (matrixVo == null) { - matrixVo = MatrixPrivateDataSourceHandlerFactory.getMatrixVo(matrixUuid); - } - if (matrixVo != null) { - returnDefaultValue = new StringBuilder(matrixVo.getName()); - if (paramDefaultValue != null) { - List valueList = (List) paramDefaultValue; - returnDefaultValue.append(" "); - for (int i = 0; i < valueList.size(); i++) { - String valueString = (String) valueList.get(i); - returnDefaultValue.append(valueString.substring(valueString.substring(0, valueString.indexOf("&=&")).length() + 3)); - if (i < valueList.size() - 1) { - returnDefaultValue.append("|"); - } - } - } - } - } } - //文件 } else if (StringUtils.equals(ParamType.FILE.getValue(), paramVo.getType())) { if (paramDefaultValue != null) { -- Gitee From ab049d1705b257d68d389db7cab2a7488aa2c1ce Mon Sep 17 00:00:00 2001 From: linbangquan <1437892690@qq.com> Date: Tue, 21 Nov 2023 11:40:27 +0800 Subject: [PATCH 4/4] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E8=A7=86=E5=9B=BE?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE-=E5=A2=9E=E5=8A=A0=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E8=A7=86=E5=9B=BE=E6=95=B0=E6=8D=AE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1023682900623360]视图设置-增加显示视图数据功能 http://192.168.0.96:8090/demo/rdm.html#/story-detail/939050947543040/939050947543042/1023682900623360 --- .../service/CreateAutoexecServiceJobApi.java | 17 +++++++++++- .../component/AutoexecProcessComponent.java | 26 +++++++++++++++---- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/src/main/java/neatlogic/module/autoexec/api/service/CreateAutoexecServiceJobApi.java b/src/main/java/neatlogic/module/autoexec/api/service/CreateAutoexecServiceJobApi.java index 8df21953..23489676 100644 --- a/src/main/java/neatlogic/module/autoexec/api/service/CreateAutoexecServiceJobApi.java +++ b/src/main/java/neatlogic/module/autoexec/api/service/CreateAutoexecServiceJobApi.java @@ -36,13 +36,16 @@ import neatlogic.framework.autoexec.exception.AutoexecJobParamNotExistException; import neatlogic.framework.autoexec.exception.AutoexecServiceConfigExpiredException; import neatlogic.framework.autoexec.exception.AutoexecServiceNotFoundException; import neatlogic.framework.common.constvalue.ApiParamType; +import neatlogic.framework.crossover.CrossoverServiceFactory; import neatlogic.framework.dto.AuthenticationInfoVo; import neatlogic.framework.exception.type.ParamNotExistsException; import neatlogic.framework.exception.type.PermissionDeniedException; +import neatlogic.framework.form.constvalue.FormHandler; import neatlogic.framework.form.dao.mapper.FormMapper; import neatlogic.framework.form.dto.FormAttributeVo; import neatlogic.framework.form.dto.FormVersionVo; import neatlogic.framework.form.exception.FormAttributeRequiredException; +import neatlogic.framework.form.service.IFormCrossoverService; import neatlogic.framework.restful.annotation.*; import neatlogic.framework.restful.constvalue.OperationTypeEnum; import neatlogic.framework.restful.core.privateapi.PrivateApiComponentBase; @@ -190,10 +193,12 @@ public class CreateAutoexecServiceJobApi extends PrivateApiComponentBase { } formAttributeDataMap.put(attributeUuid, dataList); } + Map attributeUuid2HandlerMap = new HashMap<>(); FormVersionVo formVersionVo = formMapper.getActionFormVersionByFormUuid(formUuid); List formAttributeVoList = formVersionVo.getFormAttributeList(); for (FormAttributeVo formAttributeVo : formAttributeVoList) { String uuid = formAttributeVo.getUuid(); + attributeUuid2HandlerMap.put(uuid, formAttributeVo.getHandler()); if (formAttributeVo.isRequired()) { if (hidecomponentList.contains(uuid)) { continue; @@ -204,6 +209,10 @@ public class CreateAutoexecServiceJobApi extends PrivateApiComponentBase { throw new FormAttributeRequiredException(formAttributeVo.getLabel()); } } + List formSelectAttributeList = new ArrayList<>(); + formSelectAttributeList.add(FormHandler.FORMSELECT.getHandler()); + formSelectAttributeList.add(FormHandler.FORMCHECKBOX.getHandler()); + formSelectAttributeList.add(FormHandler.FORMRADIO.getHandler()); if (config != null) { ParamMappingVo roundCountParamMappingVo = config.getRoundCount(); if (needRoundCount && roundCountParamMappingVo != null) { @@ -277,7 +286,13 @@ public class CreateAutoexecServiceJobApi extends PrivateApiComponentBase { } else if (Objects.equals(paramMappingVo.getMappingMode(), ServiceParamMappingMode.FORMATTR.getValue())) { Object formAttrValue = formAttributeDataMap.get(value); if (formAttrValue != null) { - param.put(key, formAttrValue); + if (formSelectAttributeList.contains(attributeUuid2HandlerMap.get(value))) { + IFormCrossoverService formCrossoverService = CrossoverServiceFactory.getApi(IFormCrossoverService.class); + Object valueObject = formCrossoverService.getFormSelectAttributeValueByOriginalValue(formAttrValue); + param.put(key, valueObject); + } else { + param.put(key, formAttrValue); + } } } } diff --git a/src/main/java/neatlogic/module/autoexec/stephandler/component/AutoexecProcessComponent.java b/src/main/java/neatlogic/module/autoexec/stephandler/component/AutoexecProcessComponent.java index 591be70a..4ba08856 100644 --- a/src/main/java/neatlogic/module/autoexec/stephandler/component/AutoexecProcessComponent.java +++ b/src/main/java/neatlogic/module/autoexec/stephandler/component/AutoexecProcessComponent.java @@ -16,7 +16,10 @@ limitations under the License. package neatlogic.module.autoexec.stephandler.component; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONException; +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.JSONPath; import neatlogic.framework.asynchronization.threadlocal.UserContext; import neatlogic.framework.autoexec.constvalue.CombopOperationType; import neatlogic.framework.autoexec.constvalue.JobStatus; @@ -34,6 +37,7 @@ import neatlogic.framework.common.constvalue.SystemUser; import neatlogic.framework.crossover.CrossoverServiceFactory; import neatlogic.framework.form.dto.FormAttributeVo; import neatlogic.framework.form.dto.FormVersionVo; +import neatlogic.framework.form.service.IFormCrossoverService; import neatlogic.framework.process.constvalue.*; import neatlogic.framework.process.crossover.IProcessTaskCrossoverService; import neatlogic.framework.process.dao.mapper.ProcessTaskStepDataMapper; @@ -46,9 +50,6 @@ import neatlogic.framework.process.stephandler.core.ProcessStepHandlerFactory; import neatlogic.framework.process.stephandler.core.ProcessStepThread; import neatlogic.module.autoexec.constvalue.FailPolicy; import neatlogic.module.autoexec.service.AutoexecJobActionService; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.alibaba.fastjson.JSONPath; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; @@ -576,6 +577,14 @@ public class AutoexecProcessComponent extends ProcessStepHandlerBase { JSONObject tbodyObj, Map formAttributeMap, Map processTaskFormAttributeDataMap) { + List formSelectAttributeList = new ArrayList<>(); + formSelectAttributeList.add(neatlogic.framework.form.constvalue.FormHandler.FORMSELECT.getHandler()); + formSelectAttributeList.add(neatlogic.framework.form.constvalue.FormHandler.FORMCHECKBOX.getHandler()); + formSelectAttributeList.add(neatlogic.framework.form.constvalue.FormHandler.FORMRADIO.getHandler()); + List formTextAttributeList = new ArrayList<>(); + formTextAttributeList.add(neatlogic.framework.form.constvalue.FormHandler.FORMTEXT.getHandler()); + formTextAttributeList.add(neatlogic.framework.form.constvalue.FormHandler.FORMTEXTAREA.getHandler()); + JSONObject param = new JSONObject(); for (int i = 0; i < runtimeParamList.size(); i++) { JSONObject runtimeParamObj = runtimeParamList.getJSONObject(i); @@ -608,9 +617,13 @@ public class AutoexecProcessComponent extends ProcessStepHandlerBase { } else if (Objects.equals(mappingMode, "formCommonComponent")) { ProcessTaskFormAttributeDataVo attributeDataVo = processTaskFormAttributeDataMap.get(value); if (attributeDataVo != null) { - if (Objects.equals(attributeDataVo.getType(), "formtext") || Objects.equals(attributeDataVo.getType(), "formtextarea")) { + if (formTextAttributeList.contains(attributeDataVo.getType())) { String type = runtimeParamObj.getString("type"); param.put(key, convertDateType(type, (String) attributeDataVo.getDataObj())); + } else if (formSelectAttributeList.contains(attributeDataVo.getType())) { + IFormCrossoverService formCrossoverService = CrossoverServiceFactory.getApi(IFormCrossoverService.class); + Object valueObject = formCrossoverService.getFormSelectAttributeValueByOriginalValue(attributeDataVo.getDataObj()); + param.put(key, valueObject); } else { param.put(key, attributeDataVo.getDataObj()); } @@ -634,6 +647,9 @@ public class AutoexecProcessComponent extends ProcessStepHandlerBase { JSONObject tbodyObj, Map formAttributeMap, Map processTaskFormAttributeDataMap) { + List formTextAttributeList = new ArrayList<>(); + formTextAttributeList.add(neatlogic.framework.form.constvalue.FormHandler.FORMTEXT.getHandler()); + formTextAttributeList.add(neatlogic.framework.form.constvalue.FormHandler.FORMTEXTAREA.getHandler()); JSONObject executeConfig = new JSONObject(); for (int i = 0; i < executeParamList.size(); i++) { JSONObject executeParamObj = executeParamList.getJSONObject(i); @@ -695,7 +711,7 @@ public class AutoexecProcessComponent extends ProcessStepHandlerBase { if (Objects.equals(attributeDataVo.getType(), FormHandler.FORMRESOURECES.getHandler())) { // 映射的表单组件是执行目标 executeNodeConfigVo = ((JSONObject) dataObj).toJavaObject(AutoexecCombopExecuteNodeConfigVo.class); - } else if (Objects.equals(attributeDataVo.getType(), "formtext") || Objects.equals(attributeDataVo.getType(), "formtextarea")) { + } else if (formTextAttributeList.contains(attributeDataVo.getType())) { // 映射的表单组件是文本框 String dataStr = dataObj.toString(); try { -- Gitee