houzhongyi
2024-07-11 e7c1260db32209a078a962aaa0ad5492c35774fb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package com.iailab.module.bpm.framework.flowable.core.candidate.expression;
 
import com.iailab.framework.common.util.collection.SetUtils;
import com.iailab.framework.common.util.number.NumberUtils;
import com.iailab.module.bpm.service.task.BpmProcessInstanceService;
import org.flowable.engine.impl.persistence.entity.ExecutionEntityImpl;
import org.flowable.engine.runtime.ProcessInstance;
import org.springframework.stereotype.Component;
 
import javax.annotation.Resource;
import java.util.Set;
 
/**
 * 分配给发起人审批的 Expression 流程表达式
 *
 * @author iailab
 */
@Component
public class BpmTaskAssignStartUserExpression {
 
    @Resource
    private BpmProcessInstanceService processInstanceService;
 
    /**
     * 计算审批的候选人
     *
     * @param execution 流程执行实体
     * @return 发起人
     */
    public Set<Long> calculateUsers(ExecutionEntityImpl execution) {
        ProcessInstance processInstance = processInstanceService.getProcessInstance(execution.getProcessInstanceId());
        Long startUserId = NumberUtils.parseLong(processInstance.getStartUserId());
        return SetUtils.asSet(startUserId);
    }
 
}