mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-08 12:39:05 +08:00
✨ #5595 【需求】协同管理工作流支持流程节点执行回调
(cherry picked from commit b8de059c6f3e042b7fd1e91177ed36ba1e141f44)
This commit is contained in:
1 parent
e9b77a8e09
commit
6d56f5e213
3 files changed
+50
-1
No files matched your search
+4
-1
@@ -5,6 +5,8 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.pig4cloud.pigx.common.security.util.SecurityUtils;
|
||||
import com.pig4cloud.pigx.flow.engine.service.NodeTaskCompleteNotifyService;
|
||||
import com.pig4cloud.pigx.flow.task.api.feign.RemoteFlowTaskService;
|
||||
import com.pig4cloud.pigx.flow.task.dto.*;
|
||||
import com.pig4cloud.pigx.flow.task.utils.NodeUtil;
|
||||
@@ -119,7 +121,6 @@ public class FlowProcessEventListener implements FlowableEventListener {
|
||||
processNodeRecordParamDto.setNodeName(activityName);
|
||||
|
||||
remoteFlowTaskService.endNodeEvent(processNodeRecordParamDto);
|
||||
|
||||
}
|
||||
|
||||
if (event.getType().toString().equals(FlowableEngineEventType.VARIABLE_UPDATED.toString())) {
|
||||
@@ -193,6 +194,8 @@ public class FlowProcessEventListener implements FlowableEventListener {
|
||||
|
||||
remoteFlowTaskService.taskEndEvent(processNodeRecordAssignUserParamDto);
|
||||
|
||||
|
||||
SpringUtil.getBean(NodeTaskCompleteNotifyService.class).sendNotify(SecurityUtils.getToken(),processNodeRecordAssignUserParamDto);
|
||||
}
|
||||
if (event.getType().toString().equals(FlowableEngineEventType.TASK_ASSIGNED.toString())) {
|
||||
// 任务被指派了人员
|
||||
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package com.pig4cloud.pigx.flow.engine.service;
|
||||
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.pig4cloud.pigx.common.core.util.RetOps;
|
||||
import com.pig4cloud.pigx.common.security.util.NonWebTokenContextHolder;
|
||||
import com.pig4cloud.pigx.flow.task.api.feign.RemoteFlowTaskService;
|
||||
import com.pig4cloud.pigx.flow.task.dto.ProcessNodeRecordAssignUserParamDto;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 节点任务完成通知处理
|
||||
*
|
||||
* @author lengleng
|
||||
* @date 2024/7/9
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class NodeTaskCompleteNotifyService {
|
||||
|
||||
private final RemoteFlowTaskService remoteFlowTaskService;
|
||||
|
||||
@Async
|
||||
public void sendNotify(String token, ProcessNodeRecordAssignUserParamDto taskCompleteParamDto) {
|
||||
NonWebTokenContextHolder.setToken(token);
|
||||
RetOps.of(remoteFlowTaskService.queryNodeOriData(taskCompleteParamDto.getFlowId(), taskCompleteParamDto.getNodeId()))
|
||||
.getData()
|
||||
.ifPresent(node -> {
|
||||
if (Validator.isUrl(node.getEventConfig())) {
|
||||
HttpResponse response = HttpRequest.post(node.getEventConfig())
|
||||
.body(JSONUtil.toJsonStr(taskCompleteParamDto))
|
||||
.timeout(10000)
|
||||
.execute();
|
||||
log.debug("节点任务完成通知处理完成:{},数据:{}", response.getStatus(), taskCompleteParamDto);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
+2
@@ -29,6 +29,8 @@ public class Node {
|
||||
@JsonProperty("childNode")
|
||||
private Node children;
|
||||
|
||||
private String eventConfig;
|
||||
|
||||
private Integer assignedType;
|
||||
|
||||
private Boolean multiple;
|
||||
|
||||
Reference in new issue
Block a user