package com.ankaibei.workFlow.common.flow.util;

import cn.hutool.core.lang.Assert;
import com.ankaibei.workFlow.common.flow.base.service.BaseFlowOnlineService;
import com.ankaibei.workFlow.common.flow.model.FlowWorkOrder;
import lombok.extern.slf4j.Slf4j;

/**
 * 面向在线表单工作流的业务数据扩展帮助实现类。
 *
 * @author Buzhanyi
 * @date 2022-09-25
 */
@Slf4j
public class BaseOnlineBusinessDataExtHelper {

    private BaseFlowOnlineService onlineBusinessService;

    /**
     * 设置在线表单的业务处理服务。
     *
     * @param onlineBusinessService 在线表单业务处理服务实现类。
     */
    public void setOnlineBusinessService(BaseFlowOnlineService onlineBusinessService) {
        this.onlineBusinessService = onlineBusinessService;
    }

    public void updateFlowStatus(FlowWorkOrder workOrder) {
        Assert.notNull(workOrder.getOnlineTableId());
        if (this.onlineBusinessService != null && workOrder.getBusinessKey() != null) {
            onlineBusinessService.updateFlowStatus(workOrder);
        }
    }
}
