Browse Source
- 在BaseFlowOnlineService中添加获取主表名和业务数据的默认方法 - 在BaseOnlineBusinessDataExtHelper中实现表名和业务数据获取辅助方法 - 在FlowApiService中添加标题解析方法并在实现类中完善解析逻辑 - 添加FlowConstant常量定义标题模板键值 - 在FlowTaskExt模型和映射文件中添加标题模板字段 - 在FlowEntryController和FlowOperationController中处理标题模板 - 实现MultiInstanceAssigneeListener多实例会签节点审批人监听器 - 在FlowEntryServiceImpl和FlowTaskExtServiceImpl中完善多实例节点处理 - 在FlowOnlineBusinessServiceImpl中实现业务数据获取方法 - 更新相关依赖版本并调整Nacos配置 - 修改日志配置并添加应用启动成功事件监听feature/2026-07-ccc-dev
24 changed files with 353 additions and 19 deletions
@ -0,0 +1,76 @@ |
|||||||
|
package apelet.common.flow.listener; |
||||||
|
|
||||||
|
import apelet.common.core.util.ApplicationContextHolder; |
||||||
|
import apelet.common.flow.model.FlowTaskExt; |
||||||
|
import apelet.common.flow.service.FlowTaskExtService; |
||||||
|
import apelet.common.flow.util.BaseFlowIdentityExtHelper; |
||||||
|
import apelet.common.flow.util.FlowCustomExtFactory; |
||||||
|
import cn.hutool.core.collection.CollUtil; |
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.flowable.engine.delegate.DelegateExecution; |
||||||
|
import org.flowable.engine.delegate.ExecutionListener; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Set; |
||||||
|
|
||||||
|
/** |
||||||
|
* 多实例会签节点审批人监听器。 |
||||||
|
* 当多实例节点没有通过前置"会签"按钮写入 assigneeList 时, |
||||||
|
* 自动从 zz_flow_task_ext.candidate_usernames 中读取审批人列表。 |
||||||
|
* |
||||||
|
* @author guifc |
||||||
|
* @date 2025-07-29 |
||||||
|
*/ |
||||||
|
@Slf4j |
||||||
|
public class MultiInstanceAssigneeListener implements ExecutionListener { |
||||||
|
|
||||||
|
private final transient FlowTaskExtService flowTaskExtService = ApplicationContextHolder.getBean(FlowTaskExtService.class); |
||||||
|
|
||||||
|
private final transient FlowCustomExtFactory flowCustomExtFactory = ApplicationContextHolder.getBean(FlowCustomExtFactory.class); |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public void notify(DelegateExecution execution) { |
||||||
|
// 如果 assigneeList 已经存在(由前置节点的会签按钮写入),则不覆盖
|
||||||
|
if (execution.hasVariable("assigneeList")) { |
||||||
|
return; |
||||||
|
} |
||||||
|
FlowTaskExt flowTaskExt = flowTaskExtService.getByProcessDefinitionIdAndTaskId( |
||||||
|
execution.getProcessDefinitionId(), execution.getCurrentActivityId()); |
||||||
|
if (flowTaskExt == null) { |
||||||
|
return; |
||||||
|
} |
||||||
|
List<String> candidateUsernames = new ArrayList<>(); |
||||||
|
if (StrUtil.isNotBlank(flowTaskExt.getCandidateUsernames())) { |
||||||
|
candidateUsernames.addAll(StrUtil.split(flowTaskExt.getCandidateUsernames(), ",")); |
||||||
|
} else { |
||||||
|
BaseFlowIdentityExtHelper extHelper = flowCustomExtFactory.getFlowIdentityExtHelper(); |
||||||
|
if (extHelper == null) { |
||||||
|
return; |
||||||
|
} |
||||||
|
// 先看部门是否存在,通过部门id 去取用户登录名
|
||||||
|
if (StrUtil.isNotBlank(flowTaskExt.getDeptIds())) { |
||||||
|
Set<String> deptUsernameSet = extHelper.getUsernameListByDeptIds(CollUtil.newHashSet(StrUtil.split(flowTaskExt.getDeptIds(), ","))); |
||||||
|
if (CollUtil.isNotEmpty(deptUsernameSet)) { |
||||||
|
candidateUsernames.addAll(deptUsernameSet); |
||||||
|
} |
||||||
|
} |
||||||
|
// 再看角色是否存在,通过角色id 去取用户登录名
|
||||||
|
if (StrUtil.isNotBlank(flowTaskExt.getRoleIds())) { |
||||||
|
Set<String> roleUsernameSet = extHelper.getUsernameListByRoleIds(CollUtil.newHashSet(StrUtil.split(flowTaskExt.getRoleIds(), ","))); |
||||||
|
if (CollUtil.isNotEmpty(roleUsernameSet)) { |
||||||
|
candidateUsernames.addAll(roleUsernameSet); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
if (CollUtil.isEmpty(candidateUsernames)) { |
||||||
|
return; |
||||||
|
} |
||||||
|
execution.setVariable("assigneeList", candidateUsernames); |
||||||
|
log.info("MultiInstanceAssigneeListener: set assigneeList from candidate_usernames = {}", candidateUsernames); |
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue