From 26439659fdcff4738ca8a029c2d1766997f96b5b Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Thu, 8 May 2025 18:59:37 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E5=90=8E=E7=AB=AF-itsm?= =?UTF-8?q?=E6=B5=81=E7=A8=8B-=E8=87=AA=E5=8A=A8=E5=8C=96=E8=8A=82?= =?UTF-8?q?=E7=82=B9&=E5=A4=96=E9=83=A8=E8=B0=83=E7=94=A8=E8=8A=82?= =?UTF-8?q?=E7=82=B9=20=E5=8F=82=E6=95=B0=E6=98=A0=E5=B0=84=E4=B8=8D?= =?UTF-8?q?=E5=81=9A=E8=A1=A8=E5=8D=95=E7=B1=BB=E5=9E=8B=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1416779639783424]后端-itsm流程-自动化节点&外部调用节点 参数映射不做表单类型限制 http://192.168.0.96:8090/demo/rdm.html#/task-detail/939050947543040/939050947543050/1416779639783424 --- .../ProcessTaskFormAttributeCondition.java | 101 ++++++++++-------- 1 file changed, 54 insertions(+), 47 deletions(-) diff --git a/src/main/java/neatlogic/module/process/condition/handler/ProcessTaskFormAttributeCondition.java b/src/main/java/neatlogic/module/process/condition/handler/ProcessTaskFormAttributeCondition.java index f021fa987..e178cc83a 100644 --- a/src/main/java/neatlogic/module/process/condition/handler/ProcessTaskFormAttributeCondition.java +++ b/src/main/java/neatlogic/module/process/condition/handler/ProcessTaskFormAttributeCondition.java @@ -283,64 +283,71 @@ public class ProcessTaskFormAttributeCondition extends ProcessTaskConditionBase JSONObject resultObj = new JSONObject(); List formAttributeList = processTaskService.getFormAttributeListByProcessTaskIdAngTagNew(processTaskStepVo.getProcessTaskId(), formTag); if (CollectionUtils.isNotEmpty(formAttributeList)) { - Map formAttributeMap = formAttributeList.stream().collect(Collectors.toMap(FormAttributeVo::getUuid, e -> e)); + Map formAttributeMap = new HashMap<>(); + for (FormAttributeVo formAttributeVo : formAttributeList) { + if (!formAttributeMap.containsKey(formAttributeVo.getUuid())) { + formAttributeMap.put(formAttributeVo.getUuid(), formAttributeVo); + } + } List processTaskFormAttributeDataList = processTaskService.getProcessTaskFormAttributeDataListByProcessTaskIdAndTagNew(processTaskStepVo.getProcessTaskId(), formTag); for (ProcessTaskFormAttributeDataVo processTaskFormAttributeDataVo : processTaskFormAttributeDataList) { FormAttributeVo formAttributeVo = formAttributeMap.get(processTaskFormAttributeDataVo.getAttributeUuid()); - if (formAttributeVo == null) { - continue; - } Object dataObj = processTaskFormAttributeDataVo.getDataObj(); - JSONObject componentObj = new JSONObject(); - componentObj.put("handler", formAttributeVo.getHandler()); - componentObj.put("uuid", formAttributeVo.getUuid()); - componentObj.put("label", formAttributeVo.getLabel()); - componentObj.put("config", formAttributeVo.getConfig()); - componentObj.put("type", formAttributeVo.getType()); - List downwardFormAttributeList = FormUtil.getFormAttributeList(componentObj, null); - if (downwardFormAttributeList.size() > 1 && dataObj instanceof JSONArray) { - // 表格组件 - JSONArray dataList = new JSONArray(); - JSONArray dataArray = JSONArray.parseArray(((JSONArray) dataObj).toJSONString()); - for (int i = 0; i < dataArray.size(); i++) { - JSONObject newRowObj = new JSONObject(); - JSONObject rowObj = dataArray.getJSONObject(i); - for (FormAttributeVo downwardFormAttribute : downwardFormAttributeList) { - Object value = rowObj.get(downwardFormAttribute.getUuid()); - if (value != null) { - IFormAttributeDataConversionHandler handler = FormAttributeDataConversionHandlerFactory.getHandler(downwardFormAttribute.getHandler()); - if (handler != null) { - Object simpleValue = handler.getSimpleValue(value); - newRowObj.put(downwardFormAttribute.getUuid(), simpleValue); - newRowObj.put(downwardFormAttribute.getKey(), simpleValue); - newRowObj.put(downwardFormAttribute.getLabel(), simpleValue); - } else { - newRowObj.put(downwardFormAttribute.getUuid(), value); - newRowObj.put(downwardFormAttribute.getKey(), value); - newRowObj.put(downwardFormAttribute.getLabel(), value); - } - } - } - dataList.add(newRowObj); - } - resultObj.put(processTaskFormAttributeDataVo.getAttributeUuid(), dataList); - } else { - // 非表格组件 + if (dataObj != null && formAttributeVo != null) { IFormAttributeDataConversionHandler handler = FormAttributeDataConversionHandlerFactory.getHandler(formAttributeVo.getHandler()); if (handler != null) { - Object simpleValue = handler.getSimpleValue(dataObj); - resultObj.put(processTaskFormAttributeDataVo.getAttributeUuid(), simpleValue); + Object enhanceReadabilityValue = handler.getEnhanceReadabilityValue(dataObj, formAttributeVo); + resultObj.put(formAttributeVo.getUuid(), enhanceReadabilityValue); + resultObj.put(formAttributeVo.getKey(), enhanceReadabilityValue); + resultObj.put(formAttributeVo.getLabel(), enhanceReadabilityValue); } else { resultObj.put(processTaskFormAttributeDataVo.getAttributeUuid(), dataObj); + resultObj.put(processTaskFormAttributeDataVo.getAttributeKey(), dataObj); + resultObj.put(processTaskFormAttributeDataVo.getAttributeLabel(), dataObj); } } -// if (Objects.equals(processTaskFormAttributeDataVo.getHandler(), FormHandler.FORMRADIO.getHandler()) -// || Objects.equals(processTaskFormAttributeDataVo.getHandler(), FormHandler.FORMCHECKBOX.getHandler()) -// || Objects.equals(processTaskFormAttributeDataVo.getHandler(), FormHandler.FORMSELECT.getHandler())) { -// Object value = FormUtil.getFormSelectAttributeValueByOriginalValue(processTaskFormAttributeDataVo.getDataObj()); -// resultObj.put(processTaskFormAttributeDataVo.getAttributeUuid(), value); +// JSONObject componentObj = new JSONObject(); +// componentObj.put("handler", formAttributeVo.getHandler()); +// componentObj.put("uuid", formAttributeVo.getUuid()); +// componentObj.put("label", formAttributeVo.getLabel()); +// componentObj.put("config", formAttributeVo.getConfig()); +// componentObj.put("type", formAttributeVo.getType()); +// List downwardFormAttributeList = FormUtil.getFormAttributeList(componentObj, null); +// if (downwardFormAttributeList.size() > 1 && dataObj instanceof JSONArray) { +// // 表格组件 +// JSONArray dataList = new JSONArray(); +// JSONArray dataArray = JSONArray.parseArray(((JSONArray) dataObj).toJSONString()); +// for (int i = 0; i < dataArray.size(); i++) { +// JSONObject newRowObj = new JSONObject(); +// JSONObject rowObj = dataArray.getJSONObject(i); +// for (FormAttributeVo downwardFormAttribute : downwardFormAttributeList) { +// Object value = rowObj.get(downwardFormAttribute.getUuid()); +// if (value != null) { +// IFormAttributeDataConversionHandler handler = FormAttributeDataConversionHandlerFactory.getHandler(downwardFormAttribute.getHandler()); +// if (handler != null) { +// Object simpleValue = handler.getSimpleValue(value); +// newRowObj.put(downwardFormAttribute.getUuid(), simpleValue); +// newRowObj.put(downwardFormAttribute.getKey(), simpleValue); +// newRowObj.put(downwardFormAttribute.getLabel(), simpleValue); +// } else { +// newRowObj.put(downwardFormAttribute.getUuid(), value); +// newRowObj.put(downwardFormAttribute.getKey(), value); +// newRowObj.put(downwardFormAttribute.getLabel(), value); +// } +// } +// } +// dataList.add(newRowObj); +// } +// resultObj.put(processTaskFormAttributeDataVo.getAttributeUuid(), dataList); // } else { -// resultObj.put(processTaskFormAttributeDataVo.getAttributeUuid(), processTaskFormAttributeDataVo.getDataObj()); +// // 非表格组件 +// IFormAttributeDataConversionHandler handler = FormAttributeDataConversionHandlerFactory.getHandler(formAttributeVo.getHandler()); +// if (handler != null) { +// Object simpleValue = handler.getSimpleValue(dataObj); +// resultObj.put(processTaskFormAttributeDataVo.getAttributeUuid(), simpleValue); +// } else { +// resultObj.put(processTaskFormAttributeDataVo.getAttributeUuid(), dataObj); +// } // } } } -- Gitee