org.shoulder.batch.service.BatchService Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of shoulder-batch Show documentation
Show all versions of shoulder-batch Show documentation
Shoulder 扩展-批处理模块,提供批量数据导入、导出、异步校验、导入历史记录管理等能力。
package org.shoulder.batch.service;
import org.shoulder.batch.model.BatchData;
import org.shoulder.batch.model.BatchProgressRecord;
import org.shoulder.batch.service.ext.BatchTaskSliceHandler;
import org.shoulder.core.context.AppContext;
import java.util.Locale;
/**
* 批处理
*
* @author lym
*/
public interface BatchService {
/**
* 判断是否允许执行
*
* @return boolean
*/
boolean canExecute();
/**
* 批量信息
*
* @param batchData 批量/更新
* @return 批量任务标识
*/
default String doProcess(BatchData batchData) {
return this.doProcess(batchData, AppContext.getUserId(), AppContext.getLocale());
}
/**
* 批量信息
*
* @param batchData 批量/更新
* @param userId 用户信息
* @param locale 语言标识
* @return 批量任务标识
*/
default String doProcess(BatchData batchData, String userId, Locale locale) {
return this.doProcess(batchData, userId, locale, null);
}
/**
* 处理
*
* @param batchData 批量入参
* @param userId 用户信息
* @param locale 语言标识
* @param batchTaskSliceHandler 特殊业务处理器
* @return 批量任务标识
*/
String doProcess(BatchData batchData, String userId, Locale locale, BatchTaskSliceHandler batchTaskSliceHandler);
/**
* 获取批量进度与结果
*
* @param taskId 用户信息
* @return Object 批量进度或者结果
*/
BatchProgressRecord queryBatchProgress(String taskId);
}