From e8aeebf25875feecc63967620194df2d779ac4a6 Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Thu, 25 Jul 2024 18:22:55 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BF=AE=E5=A4=8D]=20=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E5=88=86=E6=B5=81=E8=B7=AF=E7=94=B1=E8=A7=84?= =?UTF-8?q?=E5=88=99=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1208601786417152]流程条件分流路由规则报错 http://192.168.0.96:8090/demo/rdm.html#/bug-detail/939050947543040/939050947543057/1208601786417152 --- .../ProcessTaskFormAttributeCondition.java | 135 ++++++++++++++---- .../handler/StepOperateHandler.java | 11 +- 2 files changed, 117 insertions(+), 29 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 f6d8f35b7..f4e20090d 100644 --- a/src/main/java/neatlogic/module/process/condition/handler/ProcessTaskFormAttributeCondition.java +++ b/src/main/java/neatlogic/module/process/condition/handler/ProcessTaskFormAttributeCondition.java @@ -287,14 +287,54 @@ public class ProcessTaskFormAttributeCondition extends ProcessTaskConditionBase if (formAttributeVo == null) { continue; } - 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); + 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); + } else { + newRowObj.put(downwardFormAttribute.getUuid(), 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); + } } +// 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); +// } else { +// resultObj.put(processTaskFormAttributeDataVo.getAttributeUuid(), processTaskFormAttributeDataVo.getDataObj()); +// } } } return resultObj; @@ -355,32 +395,73 @@ public class ProcessTaskFormAttributeCondition extends ProcessTaskConditionBase if (formAttributeVo == null) { continue; } - if (Objects.equals(formAttributeVo.getHandler(), FormHandler.FORMRADIO.getHandler()) - || Objects.equals(formAttributeVo.getHandler(), FormHandler.FORMCHECKBOX.getHandler()) - || Objects.equals(formAttributeVo.getHandler(), FormHandler.FORMSELECT.getHandler())) { - Object value = FormUtil.getFormSelectAttributeValueByOriginalValue(processTaskFormAttributeDataVo.getDataObj()); - //另存一份label为key的数据,给条件路由的自定义脚本消费 - resultObj.put(processTaskFormAttributeDataVo.getAttributeLabel(), value); - } else { - String data = processTaskFormAttributeDataVo.getData(); - if (StringUtils.isNotBlank(data)) { - 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); + + 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) { - if (data.contains(downwardFormAttribute.getUuid())) { - data = data.replace(downwardFormAttribute.getUuid(), downwardFormAttribute.getLabel()); + 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.getLabel(), simpleValue); + } else { + newRowObj.put(downwardFormAttribute.getLabel(), value); + } } } - processTaskFormAttributeDataVo.setData(data); + dataList.add(newRowObj); + } + resultObj.put(processTaskFormAttributeDataVo.getAttributeLabel(), dataList); + } else { + // 非表格组件 + IFormAttributeDataConversionHandler handler = FormAttributeDataConversionHandlerFactory.getHandler(formAttributeVo.getHandler()); + if (handler != null) { + Object simpleValue = handler.getSimpleValue(dataObj); + resultObj.put(processTaskFormAttributeDataVo.getAttributeLabel(), simpleValue); + } else { + resultObj.put(processTaskFormAttributeDataVo.getAttributeLabel(), dataObj); } - //另存一份label为key的数据,给条件路由的自定义脚本消费 - resultObj.put(processTaskFormAttributeDataVo.getAttributeLabel(), processTaskFormAttributeDataVo.getDataObj()); } +// if (Objects.equals(formAttributeVo.getHandler(), FormHandler.FORMRADIO.getHandler()) +// || Objects.equals(formAttributeVo.getHandler(), FormHandler.FORMCHECKBOX.getHandler()) +// || Objects.equals(formAttributeVo.getHandler(), FormHandler.FORMSELECT.getHandler())) { +// Object value = FormUtil.getFormSelectAttributeValueByOriginalValue(processTaskFormAttributeDataVo.getDataObj()); +// //另存一份label为key的数据,给条件路由的自定义脚本消费 +// resultObj.put(processTaskFormAttributeDataVo.getAttributeLabel(), value); +// } else { +// String data = processTaskFormAttributeDataVo.getData(); +// if (StringUtils.isNotBlank(data)) { +// 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); +// for (FormAttributeVo downwardFormAttribute : downwardFormAttributeList) { +// if (data.contains(downwardFormAttribute.getUuid())) { +// data = data.replace(downwardFormAttribute.getUuid(), downwardFormAttribute.getLabel()); +// } +// } +// processTaskFormAttributeDataVo.setData(data); +// } +// //另存一份label为key的数据,给条件路由的自定义脚本消费 +// resultObj.put(processTaskFormAttributeDataVo.getAttributeLabel(), processTaskFormAttributeDataVo.getDataObj()); +// } } } return resultObj; diff --git a/src/main/java/neatlogic/module/process/operationauth/handler/StepOperateHandler.java b/src/main/java/neatlogic/module/process/operationauth/handler/StepOperateHandler.java index cd61c3cec..83905f117 100644 --- a/src/main/java/neatlogic/module/process/operationauth/handler/StepOperateHandler.java +++ b/src/main/java/neatlogic/module/process/operationauth/handler/StepOperateHandler.java @@ -1,5 +1,6 @@ package neatlogic.module.process.operationauth.handler; +import com.alibaba.fastjson.JSONObject; import neatlogic.framework.auth.core.AuthActionChecker; import neatlogic.framework.common.constvalue.SystemUser; import neatlogic.framework.config.ConfigManager; @@ -7,13 +8,15 @@ import neatlogic.framework.dao.mapper.UserMapper; import neatlogic.framework.dto.UserVo; import neatlogic.framework.process.auth.PROCESSTASK_MODIFY; import neatlogic.framework.process.constvalue.*; -import neatlogic.framework.process.dto.*; +import neatlogic.framework.process.dto.ProcessTaskStepRelVo; +import neatlogic.framework.process.dto.ProcessTaskStepUserVo; +import neatlogic.framework.process.dto.ProcessTaskStepVo; +import neatlogic.framework.process.dto.ProcessTaskVo; import neatlogic.framework.process.exception.operationauth.*; import neatlogic.framework.process.operationauth.core.OperationAuthHandlerBase; import neatlogic.framework.process.operationauth.core.OperationAuthHandlerType; import neatlogic.framework.process.operationauth.core.TernaryPredicate; import neatlogic.module.process.service.ProcessTaskService; -import com.alibaba.fastjson.JSONObject; import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Component; @@ -80,6 +83,10 @@ public class StepOperateHandler extends OperationAuthHandlerBase { } else if (checkIsWorker(processTaskStepVo, userUuid)) { return true; } + // 条件节点没有地方设置查看权限,默认所有人都有查看权限 + if (Objects.equals(processTaskStepVo.getHandler(), ProcessStepHandlerType.CONDITION.getHandler())) { + return true; + } //5.判断当前用户是否有当前步骤“查看节点信息”操作权限,如果没有,则提示“您的'查看节点信息'操作未获得授权”; boolean flag = checkOperationAuthIsConfigured(processTaskVo, processTaskStepVo, operationType, userUuid); if (flag) { -- Gitee