package com.malk.shantai.event;

import com.malk.delegate.DDEvent;
import com.malk.shantai.service.StDingProcService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;

@Slf4j
@Service
@Primary
public class StDingEventImpl implements DDEvent {

    @Autowired
    private StDingProcService stDingProcService;

    // 付款单流程CODE
    private static String DING_PROC_FKD_CODE="PROC-EF26A43D-1A5D-41A6-80F4-265FF373236D";

    @Override
    public void executeEvent_Task_Finish(String processInstanceId, String processCode, boolean isAgree, String remark) {
        // 审批任务回调执行业务逻辑
        if(DING_PROC_FKD_CODE.equals(processCode)){
            log.info("衫泰审批任务完成回调，processInstanceId：{},processCode：{},isAgree：{},remark：{}",processInstanceId,processCode,isAgree,remark);
            stDingProcService.fkdSync(processInstanceId);
        }
    }

    @Override
    public void executeEvent_Task_Start(String processInstanceId, String processCode) {

    }

    @Override
    public void executeEvent_Task_Redirect(String processInstanceId, String processCode) {

    }

    @Override
    public void executeEvent_Instance_Finish(String processInstanceId, String processCode, boolean isAgree, boolean isTerminate, String staffId) {

    }

    @Override
    public void executeEvent_Instance_Start(String processInstanceId, String processCode) {

    }
}
