diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysListenerController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysListenerController.java new file mode 100755 index 00000000..ffcdd9f7 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysListenerController.java @@ -0,0 +1,104 @@ +package com.ruoyi.web.controller.system; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.system.domain.SysListener; +import com.ruoyi.system.service.ISysListenerService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 流程监听Controller + * + * @author Tony + * @date 2022-12-25 + */ +@RestController +@RequestMapping("/system/listener") +public class SysListenerController extends BaseController +{ + @Autowired + private ISysListenerService sysListenerService; + + /** + * 查询流程监听列表 + */ + @PreAuthorize("@ss.hasPermi('system:listener:list')") + @GetMapping("/list") + public TableDataInfo list(SysListener sysListener) + { + startPage(); + List list = sysListenerService.selectSysListenerList(sysListener); + return getDataTable(list); + } + + /** + * 导出流程监听列表 + */ + @PreAuthorize("@ss.hasPermi('system:listener:export')") + @Log(title = "流程监听", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, SysListener sysListener) + { + List list = sysListenerService.selectSysListenerList(sysListener); + ExcelUtil util = new ExcelUtil(SysListener.class); + util.exportExcel(response, list, "流程监听数据"); + } + + /** + * 获取流程监听详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:listener:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(sysListenerService.selectSysListenerById(id)); + } + + /** + * 新增流程监听 + */ + @PreAuthorize("@ss.hasPermi('system:listener:add')") + @Log(title = "流程监听", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody SysListener sysListener) + { + return toAjax(sysListenerService.insertSysListener(sysListener)); + } + + /** + * 修改流程监听 + */ + @PreAuthorize("@ss.hasPermi('system:listener:edit')") + @Log(title = "流程监听", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody SysListener sysListener) + { + return toAjax(sysListenerService.updateSysListener(sysListener)); + } + + /** + * 删除流程监听 + */ + @PreAuthorize("@ss.hasPermi('system:listener:remove')") + @Log(title = "流程监听", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(sysListenerService.deleteSysListenerByIds(ids)); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysListener.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysListener.java new file mode 100755 index 00000000..f61d1790 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysListener.java @@ -0,0 +1,126 @@ +package com.ruoyi.system.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 流程监听对象 sys_listener + * + * @author Tony + * @date 2022-12-25 + */ +public class SysListener extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 表单主键 */ + private Long id; + + /** 名称 */ + @Excel(name = "名称") + private String name; + + /** 监听类型 */ + @Excel(name = "监听类型") + private String type; + + /** 事件类型 */ + @Excel(name = "事件类型") + private String eventType; + + /** 值类型 */ + @Excel(name = "值类型") + private String valueType; + + /** 执行内容 */ + @Excel(name = "执行内容") + private String value; + + /** 状态 */ + @Excel(name = "状态") + private Integer status; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setName(String name) + { + this.name = name; + } + + public String getName() + { + return name; + } + public void setType(String type) + { + this.type = type; + } + + public String getType() + { + return type; + } + public void setEventType(String eventType) + { + this.eventType = eventType; + } + + public String getEventType() + { + return eventType; + } + public void setValueType(String valueType) + { + this.valueType = valueType; + } + + public String getValueType() + { + return valueType; + } + public void setValue(String value) + { + this.value = value; + } + + public String getValue() + { + return value; + } + public void setStatus(Integer status) + { + this.status = status; + } + + public Integer getStatus() + { + return status; + } + + @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(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysListenerMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysListenerMapper.java new file mode 100755 index 00000000..44e849e2 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysListenerMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.ruoyi.system.domain.SysListener; + +/** + * 流程监听Mapper接口 + * + * @author Tony + * @date 2022-12-25 + */ +public interface SysListenerMapper +{ + /** + * 查询流程监听 + * + * @param id 流程监听主键 + * @return 流程监听 + */ + public SysListener selectSysListenerById(Long id); + + /** + * 查询流程监听列表 + * + * @param sysListener 流程监听 + * @return 流程监听集合 + */ + public List selectSysListenerList(SysListener sysListener); + + /** + * 新增流程监听 + * + * @param sysListener 流程监听 + * @return 结果 + */ + public int insertSysListener(SysListener sysListener); + + /** + * 修改流程监听 + * + * @param sysListener 流程监听 + * @return 结果 + */ + public int updateSysListener(SysListener sysListener); + + /** + * 删除流程监听 + * + * @param id 流程监听主键 + * @return 结果 + */ + public int deleteSysListenerById(Long id); + + /** + * 批量删除流程监听 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteSysListenerByIds(Long[] ids); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysListenerService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysListenerService.java new file mode 100755 index 00000000..a98a3ab5 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysListenerService.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.service; + +import java.util.List; +import com.ruoyi.system.domain.SysListener; + +/** + * 流程监听Service接口 + * + * @author Tony + * @date 2022-12-25 + */ +public interface ISysListenerService +{ + /** + * 查询流程监听 + * + * @param id 流程监听主键 + * @return 流程监听 + */ + public SysListener selectSysListenerById(Long id); + + /** + * 查询流程监听列表 + * + * @param sysListener 流程监听 + * @return 流程监听集合 + */ + public List selectSysListenerList(SysListener sysListener); + + /** + * 新增流程监听 + * + * @param sysListener 流程监听 + * @return 结果 + */ + public int insertSysListener(SysListener sysListener); + + /** + * 修改流程监听 + * + * @param sysListener 流程监听 + * @return 结果 + */ + public int updateSysListener(SysListener sysListener); + + /** + * 批量删除流程监听 + * + * @param ids 需要删除的流程监听主键集合 + * @return 结果 + */ + public int deleteSysListenerByIds(Long[] ids); + + /** + * 删除流程监听信息 + * + * @param id 流程监听主键 + * @return 结果 + */ + public int deleteSysListenerById(Long id); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysListenerServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysListenerServiceImpl.java new file mode 100755 index 00000000..15ac3c70 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysListenerServiceImpl.java @@ -0,0 +1,96 @@ +package com.ruoyi.system.service.impl; + +import java.util.List; +import com.ruoyi.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.system.mapper.SysListenerMapper; +import com.ruoyi.system.domain.SysListener; +import com.ruoyi.system.service.ISysListenerService; + +/** + * 流程监听Service业务层处理 + * + * @author Tony + * @date 2022-12-25 + */ +@Service +public class SysListenerServiceImpl implements ISysListenerService +{ + @Autowired + private SysListenerMapper sysListenerMapper; + + /** + * 查询流程监听 + * + * @param id 流程监听主键 + * @return 流程监听 + */ + @Override + public SysListener selectSysListenerById(Long id) + { + return sysListenerMapper.selectSysListenerById(id); + } + + /** + * 查询流程监听列表 + * + * @param sysListener 流程监听 + * @return 流程监听 + */ + @Override + public List selectSysListenerList(SysListener sysListener) + { + return sysListenerMapper.selectSysListenerList(sysListener); + } + + /** + * 新增流程监听 + * + * @param sysListener 流程监听 + * @return 结果 + */ + @Override + public int insertSysListener(SysListener sysListener) + { + sysListener.setCreateTime(DateUtils.getNowDate()); + return sysListenerMapper.insertSysListener(sysListener); + } + + /** + * 修改流程监听 + * + * @param sysListener 流程监听 + * @return 结果 + */ + @Override + public int updateSysListener(SysListener sysListener) + { + sysListener.setUpdateTime(DateUtils.getNowDate()); + return sysListenerMapper.updateSysListener(sysListener); + } + + /** + * 批量删除流程监听 + * + * @param ids 需要删除的流程监听主键 + * @return 结果 + */ + @Override + public int deleteSysListenerByIds(Long[] ids) + { + return sysListenerMapper.deleteSysListenerByIds(ids); + } + + /** + * 删除流程监听信息 + * + * @param id 流程监听主键 + * @return 结果 + */ + @Override + public int deleteSysListenerById(Long id) + { + return sysListenerMapper.deleteSysListenerById(id); + } +} diff --git a/ruoyi-system/src/main/resources/mapper/system/SysListenerMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysListenerMapper.xml new file mode 100755 index 00000000..6e07b27c --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/SysListenerMapper.xml @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + select id, + name, + type, + event_type, + value_type, + value, + create_time, + update_time, + create_by, + update_by, + status, + remark + from sys_listener + + + + + + + + insert into sys_listener + + name, + type, + event_type, + value_type, + value, + create_time, + update_time, + create_by, + update_by, + status, + remark, + + + #{name}, + #{type}, + #{eventType}, + #{valueType}, + #{value}, + #{createTime}, + #{updateTime}, + #{createBy}, + #{updateBy}, + #{status}, + #{remark}, + + + + + update sys_listener + + name = #{name}, + type = #{type}, + event_type = #{eventType}, + value_type = #{valueType}, + value = #{value}, + create_time = #{createTime}, + update_time = #{updateTime}, + create_by = #{createBy}, + update_by = #{updateBy}, + status = #{status}, + remark = #{remark}, + + where id = #{id} + + + + delete + from sys_listener + where id = #{id} + + + + delete from sys_listener where id in + + #{id} + + + \ No newline at end of file diff --git a/ruoyi-ui/src/api/system/listener.js b/ruoyi-ui/src/api/system/listener.js new file mode 100755 index 00000000..cec029c9 --- /dev/null +++ b/ruoyi-ui/src/api/system/listener.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询流程监听列表 +export function listListener(query) { + return request({ + url: '/system/listener/list', + method: 'get', + params: query + }) +} + +// 查询流程监听详细 +export function getListener(id) { + return request({ + url: '/system/listener/' + id, + method: 'get' + }) +} + +// 新增流程监听 +export function addListener(data) { + return request({ + url: '/system/listener', + method: 'post', + data: data + }) +} + +// 修改流程监听 +export function updateListener(data) { + return request({ + url: '/system/listener', + method: 'put', + data: data + }) +} + +// 删除流程监听 +export function delListener(id) { + return request({ + url: '/system/listener/' + id, + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/components/Process/common/parseElement.js b/ruoyi-ui/src/components/Process/common/parseElement.js index 63cf336e..4786f983 100644 --- a/ruoyi-ui/src/components/Process/common/parseElement.js +++ b/ruoyi-ui/src/components/Process/common/parseElement.js @@ -32,7 +32,9 @@ export function documentationParse(obj) { export function conditionExpressionParse(obj) { if ('conditionExpression' in obj) { - obj.conditionExpression = obj.conditionExpression.body + if (obj.conditionExpression) { + obj.conditionExpression = obj.conditionExpression.body + } } return obj } diff --git a/ruoyi-ui/src/components/Process/components/nodePanel/property/executionListener.vue b/ruoyi-ui/src/components/Process/components/nodePanel/property/executionListener.vue index 32df63c1..43a1ebc6 100644 --- a/ruoyi-ui/src/components/Process/components/nodePanel/property/executionListener.vue +++ b/ruoyi-ui/src/components/Process/components/nodePanel/property/executionListener.vue @@ -76,13 +76,13 @@ export default { { label: '表达式', value: 'expression' }, { label: '委托表达式', value: 'delegateExpression' } ], - tooltip: `类:示例 com.company.MyCustomListener,自定义类必须实现 org.flowable.engine.delegate.TaskListener 接口
+ tooltip: `类:示例 com.company.MyCustomListener,自定义类必须实现 org.flowable.engine.delegate.ExecutionListener 接口
表达式:示例 \${myObject.callMethod(task, task.eventName)}
- 委托表达式:示例 \${myListenerSpringBean} ,该 springBean 需要实现 org.flowable.engine.delegate.TaskListener 接口 + 委托表达式:示例 \${myListenerSpringBean} ,该 springBean 需要实现 org.flowable.engine.delegate.ExecutionListener 接口 ` }, { - label: 'java 类名', + label: '值', name: 'className', xType: 'input', rules: [{ required: true, message: '请输入', trigger: ['blur', 'change'] }] diff --git a/ruoyi-ui/src/components/Process/components/nodePanel/property/taskListener.vue b/ruoyi-ui/src/components/Process/components/nodePanel/property/taskListener.vue index ed12232f..c579103e 100644 --- a/ruoyi-ui/src/components/Process/components/nodePanel/property/taskListener.vue +++ b/ruoyi-ui/src/components/Process/components/nodePanel/property/taskListener.vue @@ -81,21 +81,25 @@ export default { { label: '类', value: 'class' }, { label: '表达式', value: 'expression' }, { label: '委托表达式', value: 'delegateExpression' } - ] + ], + tooltip: `类:示例 com.company.MyCustomListener,自定义类必须实现 org.flowable.engine.delegate.TaskListener 接口
+ 表达式:示例 \${myObject.callMethod(task, task.eventName)}
+ 委托表达式:示例 \${myListenerSpringBean} ,该 springBean 需要实现 org.flowable.engine.delegate.TaskListener 接口 + ` }, { - label: 'java 类名', + label: '值', name: 'className', xType: 'input', rules: [{ required: true, message: '请输入', trigger: ['blur', 'change'] }] }, - { - xType: 'slot', - label: '参数', - width: 120, - slot: true, - name: 'params' - } + // { + // xType: 'slot', + // label: '参数', + // width: 120, + // slot: true, + // name: 'params' + // } ] } ] diff --git a/ruoyi-ui/src/components/Process/components/nodePanel/startEnd.vue b/ruoyi-ui/src/components/Process/components/nodePanel/startEnd.vue index 987cf965..b0515acc 100644 --- a/ruoyi-ui/src/components/Process/components/nodePanel/startEnd.vue +++ b/ruoyi-ui/src/components/Process/components/nodePanel/startEnd.vue @@ -54,12 +54,12 @@ export default { name: 'executionListener', label: '执行监听器' }, - { - xType: 'input', - name: 'initiator', - label: '发起人', - show: !!_this.showConfig.initiator - }, + // { + // xType: 'input', + // name: 'initiator', + // label: '发起人', + // show: !!_this.showConfig.initiator + // }, // { // xType: 'input', // name: 'formKey', diff --git a/ruoyi-ui/src/components/Process/customPanel/CustomContextPad.js b/ruoyi-ui/src/components/Process/customPanel/CustomContextPad.js index 1670c0c1..7a0f100d 100644 --- a/ruoyi-ui/src/components/Process/customPanel/CustomContextPad.js +++ b/ruoyi-ui/src/components/Process/customPanel/CustomContextPad.js @@ -362,7 +362,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) { translate('Append Gateway') ), 'append.append-user-task': appendAction( - 'bpmn:Task', + 'bpmn:UserTask', 'bpmn-icon-user-task', '添加用户任务' ), diff --git a/ruoyi-ui/src/components/Process/index.vue b/ruoyi-ui/src/components/Process/index.vue index 701d874a..54d85ac4 100644 --- a/ruoyi-ui/src/components/Process/index.vue +++ b/ruoyi-ui/src/components/Process/index.vue @@ -53,7 +53,6 @@ import customTranslate from './common/customTranslate' import Modeler from 'bpmn-js/lib/Modeler' import panel from './PropertyPanel' -import BpmData from './BpmData' import getInitStr from './flowable/init' // 引入flowable的节点文件 import FlowableModule from './flowable/flowable.json' @@ -167,58 +166,6 @@ export default { console.error(err.message, err.warnings) } }, - // 调整左侧工具栏排版 - adjustPalette() { - try { - // 获取 bpmn 设计器实例 - const canvas = this.$refs.canvas - const djsPalette = canvas.children[0].children[1].children[4] - const djsPalStyle = { - width: '130px', - padding: '5px', - background: 'white', - left: '20px', - borderRadius: 0 - } - for (var key in djsPalStyle) { - djsPalette.style[key] = djsPalStyle[key] - } - const palette = djsPalette.children[0] - const allGroups = palette.children - allGroups[0].style['display'] = 'none' - // 修改控件样式 - for (var gKey in allGroups) { - const group = allGroups[gKey] - for (var cKey in group.children) { - const control = group.children[cKey] - const controlStyle = { - display: 'flex', - justifyContent: 'flex-start', - alignItems: 'center', - width: '100%', - padding: '5px' - } - if ( - control.className && - control.dataset && - control.className.indexOf('entry') !== -1 - ) { - const controlProps = new BpmData().getControl( - control.dataset.action - ) - control.innerHTML = `
${ - controlProps['title'] - }
` - for (var csKey in controlStyle) { - control.style[csKey] = controlStyle[csKey] - } - } - } - } - } catch (e) { - console.log(e) - } - }, // 对外 api getProcess() { const element = this.getProcessElement() diff --git a/ruoyi-ui/src/views/system/listener/index.vue b/ruoyi-ui/src/views/system/listener/index.vue new file mode 100755 index 00000000..a4e6f45b --- /dev/null +++ b/ruoyi-ui/src/views/system/listener/index.vue @@ -0,0 +1,335 @@ + + +