!168 update 优化流程办理监听,优化示例说明

Merge pull request !168 from May/new
2.X
疯狂的狮子Li 8 months ago committed by Gitee
commit cffe89ffab
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

@ -18,9 +18,14 @@ public class ProcessTaskEvent implements Serializable {
private static final long serialVersionUID = 1L;
/**
* key(key_)
* key
*/
private String keyNode;
private String key;
/**
* key
*/
private String taskDefinitionKey;
/**
* id

@ -34,13 +34,15 @@ public class FlowProcessEventHandler {
/**
*
*
* @param keyNode key(key_)
* @param key key
* @param taskDefinitionKey key
* @param taskId id
* @param businessKey id
*/
public void processTaskHandler(String keyNode, String taskId, String businessKey) {
public void processTaskHandler(String key, String taskDefinitionKey, String taskId, String businessKey) {
ProcessTaskEvent processTaskEvent = new ProcessTaskEvent();
processTaskEvent.setKeyNode(keyNode);
processTaskEvent.setKey(key);
processTaskEvent.setTaskDefinitionKey(taskDefinitionKey);
processTaskEvent.setTaskId(taskId);
processTaskEvent.setBusinessKey(businessKey);
SpringUtils.context().publishEvent(processTaskEvent);

@ -186,8 +186,8 @@ public class ActTaskServiceImpl implements IActTaskService {
}
runtimeService.updateBusinessStatus(task.getProcessInstanceId(), BusinessStatusEnum.WAITING.getStatus());
//办理监听
String keyNode = processInstance.getProcessDefinitionKey() + "_" + task.getTaskDefinitionKey();
flowProcessEventHandler.processTaskHandler(keyNode, task.getId(), processInstance.getBusinessKey());
flowProcessEventHandler.processTaskHandler(processInstance.getProcessDefinitionKey(), task.getTaskDefinitionKey(),
task.getId(), processInstance.getBusinessKey());
//办理意见
taskService.addComment(completeTaskBo.getTaskId(), task.getProcessInstanceId(), TaskStatusEnum.PASS.getStatus(), StringUtils.isBlank(completeTaskBo.getMessage()) ? "同意" : completeTaskBo.getMessage());
//办理任务

@ -136,10 +136,15 @@ public class TestLeaveServiceImpl implements ITestLeaveService {
/**
*
* @EventListener(condition = "#processTaskEvent.key=='leave1'")
* key
* if ("xxx".equals(processTaskEvent.getTaskDefinitionKey())) {
* //执行业务逻辑
* }
*
* @param processTaskEvent
*/
@EventListener(condition = "#processTaskEvent.keyNode=='leave1_Activity_14633hx'")
@EventListener(condition = "#processTaskEvent.key=='leave1' && #processTaskEvent.taskDefinitionKey=='Activity_14633hx'")
public void processTaskHandler(ProcessTaskEvent processTaskEvent) {
log.info("当前任务执行了{}", processTaskEvent.toString());
TestLeave testLeave = baseMapper.selectById(Long.valueOf(processTaskEvent.getBusinessKey()));

Loading…
Cancel
Save