ny
23 小时以前 b6f169fe43a2b13f351aefc152374fc7f0bc8cb7
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
package jnpf.flowable.model.util;
 
import cn.hutool.core.collection.CollectionUtil;
import jnpf.util.StringUtil;
 
import java.util.*;
 
public class FlowStatusHolder {
 
    private static final ThreadLocal<List<String>> TASK_LIST = new ThreadLocal<>();
 
 
    private static final ThreadLocal<Map<String, String>> DELETE_TASK_LIST = new ThreadLocal<>();
 
    public static void addTaskIdList(List<String> taskIdList) {
        if (CollectionUtil.isNotEmpty(taskIdList)) {
            List<String> taskList = getTaskList();
            taskList.addAll(taskIdList);
            TASK_LIST.set(taskList);
        }
    }
 
    public static List<String> getTaskList() {
        return TASK_LIST.get() != null ? TASK_LIST.get() : new ArrayList<>();
    }
 
    public static void addDelTaskIdList(String taskId, String flowId) {
        if (StringUtil.isNotEmpty(taskId) && StringUtil.isNotEmpty(flowId)) {
            Map<String, String> delTaskMap = getDelTaskMap();
            delTaskMap.put(taskId, flowId);
            DELETE_TASK_LIST.set(delTaskMap);
        }
    }
 
    public static Map<String, String> getDelTaskMap() {
        return DELETE_TASK_LIST.get() != null ? DELETE_TASK_LIST.get() : new HashMap<>();
    }
 
    public static void clear() {
        TASK_LIST.remove();
        DELETE_TASK_LIST.remove();
    }
 
}