yangys
2025-09-13 a0f3e98fdd9472af3c78b42423a7e3fa6fb92eba
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
37
38
39
package org.springblade.mdm.flow.excution.unlock;
 
import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.delegate.DelegateExecution;
import org.springblade.mdm.flow.constants.FlowContants;
import org.springblade.mdm.flow.service.FlowProgramFileService;
import org.springblade.mdm.program.service.NcNodeService;
import org.springblade.mdm.program.service.NcProgramApprovedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
 
/**
 * 解锁完成执行的事件,功能:插入审批表数据
 */
@Slf4j
@Component("unlockFinishListener")
public class UnlockFinishListener {
    @Autowired
    private RuntimeService runtimeService;
    @Autowired
    private FlowProgramFileService flowProgramFileService;
    @Autowired
    private NcProgramApprovedService ncProgramApprovedService;
    @Autowired
    private NcNodeService ncNodeService;
    /**
     * 在流程结束时自动调用,(配置在审批结束事件的executelistener中了)
     * @param execution 执行对象
     */
    public void handle(DelegateExecution execution) {
        // 执行业务逻辑
        String instId = execution.getProcessInstanceId();
        Long nodeId = runtimeService.getVariable(execution.getId(),FlowContants.NODE_ID,Long.class);
 
        this.ncNodeService.unlock(nodeId);
    }
 
}