yangys
昨天 4ab2cb495ccece311bbd8d0ecb992c7de0bc8500
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();
    }
 
}