package com.doumee.core.job;
|
|
import com.alibaba.fastjson.JSON;
|
import com.doumee.core.constants.Constants;
|
|
import java.util.*;
|
|
/**
|
* JOB入参
|
* @author dm
|
* @since 2025/03/31 16:44
|
*/
|
public class JobParam extends HashMap<String, Object> {
|
|
// JOB或分片ID
|
private static final String KEY_ID = "id";
|
|
// 业务时间
|
private static final String KEY_BUSINESS_TIME = "businessTime";
|
|
// 分片索引
|
private static final String KEY_SNIPPET_INDEX = "snippetIndex";
|
|
// 触发方式
|
private static final String KEY_TRIGGER_TYPE = "triggerType";
|
|
// 业务数据
|
private static final String KEY_RUNTIME_DATA = "runtimeData";
|
|
public void setId (Integer id) {
|
this.put(KEY_ID, id);
|
}
|
|
public Integer getId () {
|
return (Integer) this.get(KEY_ID);
|
}
|
|
public void setBusinessTime(Date date) {
|
this.put(KEY_BUSINESS_TIME, date);
|
}
|
|
public <T> List<T> getRuntimeData(Class<T> clazz) {
|
return JSON.parseArray((String)this.get(KEY_RUNTIME_DATA), clazz);
|
}
|
|
public void setSnippetIndex (Integer index) {
|
this.put(KEY_SNIPPET_INDEX, index);
|
}
|
|
public Integer getSnippetIndex () {
|
Object indexObject = this.get(KEY_SNIPPET_INDEX);
|
if (indexObject == null) {
|
return null;
|
}
|
return (Integer) indexObject;
|
}
|
|
public void setTriggerType (String triggerType) {
|
this.put(KEY_TRIGGER_TYPE, triggerType);
|
}
|
|
public String getTriggerType () {
|
return (String) this.get(KEY_TRIGGER_TYPE);
|
}
|
|
public Date getBusinessTime() {
|
return (Date) this.get(KEY_BUSINESS_TIME);
|
}
|
|
public void setRuntimeData(String runtimeData) {
|
this.put(KEY_RUNTIME_DATA, runtimeData);
|
}
|
}
|