package org.stm.plan.approve.event;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
import org.stm.plan.approve.service.IStPlanApproveService;
import org.stm.plan.main.entity.StPlanMan;
import org.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);
        }
    }
}
