feat: 监听器处理

rf
tony 2022-12-16 14:53:07 +08:00
parent a899003440
commit 15fd39fe98
4 changed files with 70 additions and 19 deletions

View File

@ -0,0 +1,37 @@
package com.ruoyi.flowable.listener;
import com.alibaba.fastjson2.JSON;
import lombok.extern.slf4j.Slf4j;
import org.flowable.common.engine.api.delegate.Expression;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.ExecutionListener;
import org.springframework.stereotype.Component;
/**
*
*
* Java
*
*
*
*
*
*
*
*
* @author Xuan xuan
* @date 2022/12/16
*/
@Slf4j
@Component
public class FlowExecutionListener implements ExecutionListener {
/**
*
*/
private Expression param;
@Override
public void notify(DelegateExecution execution) {
log.info("执行监听器:{}", JSON.toJSONString(execution));
}
}

View File

@ -0,0 +1,31 @@
package com.ruoyi.flowable.listener;
import com.alibaba.fastjson2.JSON;
import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.delegate.TaskListener;
import org.flowable.task.service.delegate.DelegateTask;
import org.springframework.stereotype.Component;
/**
*
*
* create:
* assignment
* complete
* deletecompleteTask
*
* @author Xuan xuan
* @date 2021/4/20
*/
@Slf4j
@Component
public class FlowTaskListener implements TaskListener{
@Override
public void notify(DelegateTask delegateTask) {
log.info("任务监听器:{}", JSON.toJSONString(delegateTask));
// TODO 获取事件类型 delegateTask.getEventName(),可以通过监听器给任务执行人发送相应的通知消息
}
}

View File

@ -1,18 +0,0 @@
package com.ruoyi.flowable.listener;
import org.flowable.engine.delegate.TaskListener;
import org.flowable.task.service.delegate.DelegateTask;
import org.springframework.stereotype.Component;
/**
* @author Xuan xuan
* @date 2021/4/20
*/
public class UserTaskListener implements TaskListener{
@Override
public void notify(DelegateTask delegateTask) {
}
}

View File

@ -193,7 +193,8 @@ public class FlowDefinitionServiceImpl extends FlowServiceFactory implements IFl
if (Objects.nonNull(processDefinition) && processDefinition.isSuspended()) { if (Objects.nonNull(processDefinition) && processDefinition.isSuspended()) {
return AjaxResult.error("流程已被挂起,请先激活流程"); return AjaxResult.error("流程已被挂起,请先激活流程");
} }
// // 加入多实例用户到流程变量中
// variables.put("userList", sysUserService.selectUserList(null));
// 设置流程发起人Id到流程中 // 设置流程发起人Id到流程中
SysUser sysUser = SecurityUtils.getLoginUser().getUser(); SysUser sysUser = SecurityUtils.getLoginUser().getUser();
identityService.setAuthenticatedUserId(sysUser.getUserId().toString()); identityService.setAuthenticatedUserId(sysUser.getUserId().toString());