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
package jnpf.flowable.job;
 
import jnpf.flowable.model.trigger.TimeTriggerModel;
import jnpf.util.JsonUtil;
import jnpf.util.RedisUtil;
import jnpf.util.StringUtil;
import lombok.extern.slf4j.Slf4j;
 
/**
 * 类的描述
 *
 * @author JNPF@YinMai Info. Co., Ltd
 * @version 5.0.x
 * @since 2024/9/20 10:22
 */
@Slf4j
public class TriggerJobUtil {
    public static final String TRIGGER_MODEL = "trigger_model";
 
    public static TimeTriggerModel getModel(TimeTriggerModel model, RedisUtil redisUtil) {
        String hashValues = redisUtil.getHashValues(TRIGGER_MODEL, model.getId());
        TimeTriggerModel timeTriggerModel = StringUtil.isNotEmpty(hashValues) ? JsonUtil.getJsonToBean(hashValues, TimeTriggerModel.class) : null;
        return timeTriggerModel;
    }
 
    public static void insertModel(TimeTriggerModel model, RedisUtil redisUtil) {
        String id = model.getId();
        redisUtil.insertHash(TRIGGER_MODEL, id, JsonUtil.getObjectToString(model));
    }
 
    public static void removeModel(TimeTriggerModel model, RedisUtil redisUtil) {
        redisUtil.removeHash(TRIGGER_MODEL, model.getId());
    }
 
}