yangys
2025-09-13 e853c35455332a4652ec604c650ca82c411c864d
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package org.springblade.mdm.flow.service.execute;
 
import org.flowable.task.api.Task;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.support.Kv;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.mdm.commons.service.UserCommonService;
import org.springblade.mdm.flow.constants.FlowContants;
import org.springblade.mdm.flow.constants.FlowVariableContants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Map;
 
/**
 * 试切流程完成任务的实现
 */
@Service("tempFlowCompleteService")
public class TempFlowCompleteService extends AbstractFlowCompleteService {
    @Autowired
    private UserCommonService userCommonService;
    @Transactional
    @Override
    public void completeTask(String taskId, String processInstanceId, String comment, Map<String, Object> variables) {
        Task task = currentTask(taskId);
        if (StringUtil.isNoneBlank(processInstanceId, comment)) {
            taskService.addComment(taskId, processInstanceId, comment);
        }
        // 非空判断
        if (Func.isEmpty(variables)) {
            variables = Kv.create();
        }
 
        if(!variables.containsKey("assignee")) {
            throw new ServiceException("请指定流程下一步处理人");
        }
        String operateResult = this.getApproveResult(variables);
        variables.put(FlowVariableContants.LAST_STEP_USER_NICKNAME, AuthUtil.getNickName());
 
        if(task.getTaskDefinitionKey().equals("appendProgrammingTask") ) {//编制节点
            //记录实际编程员
            variables.put(FlowVariableContants.ACT_PROGRAMMER,Func.toStr(AuthUtil.getUserId()));
 
        }else if(task.getTaskDefinitionKey().equals("appendCheckTask")){
            variables.put(FlowVariableContants.ACT_CHECKER,Func.toStr(AuthUtil.getUserId()));
        }else if(task.getTaskDefinitionKey().equals("appendApproveTask")){
            variables.put(FlowVariableContants.ACT_SENIOR,Func.toStr(AuthUtil.getUserId()));
        }
 
 
        taskService.complete(taskId, variables);
    }
 
 
}