package cc.smtweb.system.bpm.web.sys.oneTimeService;

import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.util.JsonUtil;

/**
 * Created by Akmm at 2021/12/2 19:30
 */
public abstract class BaseOneTimeHandler {
    private OneTimeSysService service;
    //输入参数
    protected SwMap params;

    public BaseOneTimeHandler() {
    }

    public void setService(OneTimeSysService service) {
        this.service = service;
    }

    public void setParams(String inParam) {
        this.params = JsonUtil.parse(inParam, SwMap.class);
    }

    //执行
    public abstract R work() throws Exception;

    //回写进度，百分比
    protected void setProcess(int process) throws Exception {
        service.setProcess(process);
    }
}
