yangys
3 天以前 0ecd5acd3b9f320a487c68df2ea6234b4dacb12c
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
package org.springblade.mdm.flow.service;
 
import lombok.AllArgsConstructor;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.runtime.ProcessInstance;
import org.springframework.stereotype.Service;
 
@AllArgsConstructor
@Service
public class FlowCommonService {
    private final RuntimeService runtimeService;
 
    /**
     * 根据流程实例id获取definitionKey
     * @param processInstanceId
     * @return
     */
    public String getDefinitionKey(String processInstanceId){
 
        ProcessInstance processInstance = runtimeService.createProcessInstanceQuery()
            .processInstanceId(processInstanceId)
            .singleResult();
        return processInstance.getProcessDefinitionKey();
    }
 
}