package org.jeecg.modules.stm.plan.approve.event;

import org.jeecg.modules.stm.plan.approve.service.IStPlanApproveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
import org.jeecg.modules.stm.plan.main.entity.StPlanMan;
import org.jeecg.modules.stm.plan.main.event.PlanFlagEvent;

/**
 * @Author: yzh
 * @Date 2023/7/16 11:13
 * @Description:
 */
@Component
public class PlanApproveListener implements ApplicationListener {

    @Autowired
    private IStPlanApproveService iStPlanApproveService;

    @Override
    public void onApplicationEvent(ApplicationEvent event) {
        if(event instanceof PlanFlagEvent){
           StPlanMan stPlanMan = (StPlanMan) event.getSource();
           iStPlanApproveService.approveCreate(stPlanMan);
        }
    }
}
