package com.xjrsoft.module.liteflow.node;

import cn.hutool.core.convert.Convert;
import com.xjrsoft.module.personnel.entity.CarMessageApply;
import com.xjrsoft.module.personnel.entity.ReservationSchool;
import com.xjrsoft.module.personnel.service.ICarMessageApplyService;
import com.xjrsoft.module.personnel.service.IReservationSchoolService;
import com.yomahub.liteflow.core.NodeComponent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * 预约进校-进校人员，通过后修改状态
 */
@Component("reservation_school_node")
public class ReservationSchoolNode extends NodeComponent {

    @Autowired
    private IReservationSchoolService reservationSchoolService;

    @Override
    public void process() throws Exception {
        // 获取表单中数据编号
        Map<String, Object> params = this.getFirstContextBean();
        Object value = util.getFormDatKey(params,"id");
        Long formId = Convert.toLong(value);
        if (formId != null) {
            // 数据处理
            ReservationSchool dataObj = reservationSchoolService.getByIdDeep(formId);
            dataObj.setStatus(1);
            dataObj.setExamStatus(1);
            reservationSchoolService.updateById(dataObj);

            reservationSchoolService.registration(dataObj);
        }
    }
}