package com.xtd.project.activiti.event.listener;

import com.xtd.common.utils.SpringUtil;
import com.xtd.project.activiti.service.impl.LeaveNewServiceImpl;
import com.xtd.project.assets.domain.DbAssetsStock;
import com.xtd.project.assets.domain.DbAssetsStockIn;
import com.xtd.project.assets.mapper.DbAssetsStockInMapper;
import com.xtd.project.assets.mapper.DbAssetsStockMapper;
import org.activiti.engine.TaskService;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.ExecutionListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class InputRejectListener  implements ExecutionListener {
    protected final Logger logger = LoggerFactory.getLogger(LeaveNewServiceImpl.class);

    @Autowired
    private TaskService taskService;



    @Override
    public void notify(DelegateExecution delegateExecution) {
        DbAssetsStockIn formData =(DbAssetsStockIn)delegateExecution.getVariable("formData");
        //设置入库状态为已审核
        DbAssetsStockInMapper dbAssetsStockInMapper = SpringUtil.getBean(DbAssetsStockInMapper.class);
        //设置状态为不通过
        formData.setState(1);
        dbAssetsStockInMapper.updateDbAssetsStockIn(formData);
        logger.info("新增入库信息");
    }

}
