diff --git a/jeecg-boot-platform/jeecg-boot-module-bpm-flowable/src/main/java/org/jeecg/modules/extbpm/process/common/expression/FlowNodeExpression.java b/jeecg-boot-platform/jeecg-boot-module-bpm-flowable/src/main/java/org/jeecg/modules/extbpm/process/common/expression/FlowNodeExpression.java index 301572a..492f442 100644 --- a/jeecg-boot-platform/jeecg-boot-module-bpm-flowable/src/main/java/org/jeecg/modules/extbpm/process/common/expression/FlowNodeExpression.java +++ b/jeecg-boot-platform/jeecg-boot-module-bpm-flowable/src/main/java/org/jeecg/modules/extbpm/process/common/expression/FlowNodeExpression.java @@ -1,5 +1,6 @@ package org.jeecg.modules.extbpm.process.common.expression; +import com.alibaba.fastjson.JSONObject; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.StringUtils; import org.jeecg.common.constant.SymbolConstant; @@ -9,7 +10,6 @@ import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; -import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -35,6 +35,37 @@ public class FlowNodeExpression { return users; } + /** + * 根据字段名称取json_data查询对应业务表单的数据 + * ${flowNodeExpression.getJsondatastring(jsonData,'supDeptleaderid')} + * @param jsonData + * @param codeName + * @return + */ + public String getJsondatastring(Object jsonData, String codeName){ + if (jsonData == null || StringUtils.isBlank(codeName)) { + return null; + } + + try { + JSONObject data; + if (jsonData instanceof JSONObject) { + data = (JSONObject) jsonData; + } else if (jsonData instanceof String) { + if (StringUtils.isBlank((String) jsonData)) { + return null; + } + data = JSONObject.parseObject((String) jsonData); + } else { + data = JSONObject.parseObject(JSONObject.toJSONString(jsonData)); + } + return data == null ? null : data.getString(codeName); + } catch (Exception e) { + log.warn("getJsondata parse failed, codeName={}, jsonData={}", codeName, jsonData, e); + return null; + } + } + /** * 查找上一级部门负责人 * ${flowNodeExpression.getLevel1DepartLeaders(applyUserId)}