From 00d3a4abb14ad49291d3b365e6b81986df601fc2 Mon Sep 17 00:00:00 2001 From: fuliqi <fuliqi@qq.com> Date: 星期四, 09 一月 2025 15:36:23 +0800 Subject: [PATCH] 扩展内置监听器注入字段 --- flowable/src/main/java/com/ycl/service/impl/SysListenerServiceImpl.java | 11 +++ flowable/src/main/java/com/ycl/domain/dto/FlowListenerFieldDTO.java | 15 +++++ flowable/src/main/java/com/ycl/domain/entity/SysListener.java | 110 ++++++++++++++++++++---------------- flowable/src/main/resources/mapper/SysListenerMapper.xml | 4 + 4 files changed, 89 insertions(+), 51 deletions(-) diff --git a/flowable/src/main/java/com/ycl/domain/dto/FlowListenerFieldDTO.java b/flowable/src/main/java/com/ycl/domain/dto/FlowListenerFieldDTO.java new file mode 100644 index 0000000..3c13a83 --- /dev/null +++ b/flowable/src/main/java/com/ycl/domain/dto/FlowListenerFieldDTO.java @@ -0,0 +1,15 @@ +package com.ycl.domain.dto; + +import lombok.Data; + +//鎵╁睍鐨勫唴缃洃鍚櫒娉ㄥ叆瀛楁 +@Data +public class FlowListenerFieldDTO { + private String name; + //绫诲瀷 + private String fieldType; + //瀛楃涓插�� + private String string; + //琛ㄨ揪寮忓�� + private String expression; +} diff --git a/flowable/src/main/java/com/ycl/domain/entity/SysListener.java b/flowable/src/main/java/com/ycl/domain/entity/SysListener.java index a54d394..71ca9dc 100644 --- a/flowable/src/main/java/com/ycl/domain/entity/SysListener.java +++ b/flowable/src/main/java/com/ycl/domain/entity/SysListener.java @@ -2,8 +2,11 @@ import com.ycl.common.annotation.Excel; import com.ycl.common.core.domain.BaseEntity; +import com.ycl.domain.dto.FlowListenerFieldDTO; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; + +import java.util.List; /** * 娴佺▼鐩戝惉瀵硅薄 sys_listener @@ -41,86 +44,95 @@ /** 鐘舵�� */ @Excel(name = "鐘舵��") private Integer status; + /** 榛樿鐨勬敞鍏ュ瓧娈� */ + private String fieldsStr; + /** 榛樿鐨勬敞鍏ュ瓧娈� */ + private List<FlowListenerFieldDTO> fields; - public void setId(Long id) - { + public Long getId() { + return id; + } + + public void setId(Long id) { this.id = id; } - public Long getId() - { - return id; + public String getName() { + return name; } - public void setName(String name) - { + + public void setName(String name) { this.name = name; } - public String getName() - { - return name; + public String getType() { + return type; } - public void setType(String type) - { + + public void setType(String type) { this.type = type; } - public String getType() - { - return type; + public String getEventType() { + return eventType; } - public void setEventType(String eventType) - { + + public void setEventType(String eventType) { this.eventType = eventType; } - public String getEventType() - { - return eventType; + public String getValueType() { + return valueType; } - public void setValueType(String valueType) - { + + public void setValueType(String valueType) { this.valueType = valueType; } - public String getValueType() - { - return valueType; + public String getValue() { + return value; } - public void setValue(String value) - { + + public void setValue(String value) { this.value = value; } - public String getValue() - { - return value; + public Integer getStatus() { + return status; } - public void setStatus(Integer status) - { + + public void setStatus(Integer status) { this.status = status; } - public Integer getStatus() - { - return status; + public String getFieldsStr() { + return fieldsStr; + } + + public void setFieldsStr(String fieldsStr) { + this.fieldsStr = fieldsStr; + } + + public List<FlowListenerFieldDTO> getFields() { + return fields; + } + + public void setFields(List<FlowListenerFieldDTO> fields) { + this.fields = fields; } @Override public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("name", getName()) - .append("type", getType()) - .append("eventType", getEventType()) - .append("valueType", getValueType()) - .append("value", getValue()) - .append("createTime", getCreateTime()) - .append("updateTime", getUpdateTime()) - .append("createBy", getCreateBy()) - .append("updateBy", getUpdateBy()) - .append("status", getStatus()) - .append("remark", getRemark()) - .toString(); + return "SysListener{" + + "id=" + id + + ", name='" + name + '\'' + + ", type='" + type + '\'' + + ", eventType='" + eventType + '\'' + + ", valueType='" + valueType + '\'' + + ", value='" + value + '\'' + + ", status=" + status + + ", fieldsStr='" + fieldsStr + '\'' + + ", fields=" + fields + + '}'; } } diff --git a/flowable/src/main/java/com/ycl/service/impl/SysListenerServiceImpl.java b/flowable/src/main/java/com/ycl/service/impl/SysListenerServiceImpl.java index f0a6259..f13526f 100644 --- a/flowable/src/main/java/com/ycl/service/impl/SysListenerServiceImpl.java +++ b/flowable/src/main/java/com/ycl/service/impl/SysListenerServiceImpl.java @@ -1,6 +1,9 @@ package com.ycl.service.impl; +import com.alibaba.fastjson2.JSONArray; import com.ycl.common.utils.DateUtils; +import com.ycl.common.utils.StringUtils; +import com.ycl.domain.dto.FlowListenerFieldDTO; import com.ycl.domain.entity.SysListener; import com.ycl.mapper.SysListenerMapper; import com.ycl.service.ISysListenerService; @@ -41,7 +44,13 @@ */ @Override public List<SysListener> selectSysListenerList(SysListener sysListener) { - return sysListenerMapper.selectSysListenerList(sysListener); + List<SysListener> sysListeners = sysListenerMapper.selectSysListenerList(sysListener); + sysListeners.forEach(listener ->{ + if(StringUtils.isNotBlank(listener.getFieldsStr())) { + listener.setFields(JSONArray.parseArray(listener.getFieldsStr(), FlowListenerFieldDTO.class)); + } + }); + return sysListeners; } /** diff --git a/flowable/src/main/resources/mapper/SysListenerMapper.xml b/flowable/src/main/resources/mapper/SysListenerMapper.xml index 379533b..c8b8c7b 100644 --- a/flowable/src/main/resources/mapper/SysListenerMapper.xml +++ b/flowable/src/main/resources/mapper/SysListenerMapper.xml @@ -16,6 +16,7 @@ <result property="createBy" column="create_by"/> <result property="updateBy" column="update_by"/> <result property="status" column="status"/> + <result property="fieldsStr" column="fields"/> <result property="remark" column="remark"/> </resultMap> @@ -31,7 +32,8 @@ create_by, update_by, status, - remark + remark, + fields from sys_listener </sql> -- Gitblit v1.8.0