package com.kingdee.eas.custom.recuritment.service;

import com.kingdee.bos.BOSException;
import com.kingdee.bos.Context;
import com.kingdee.bos.bsf.service.app.IHRMsfService;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.eas.custom.recuritment.task.RecuritmentFacadeControllerBean;
import com.kingdee.shr.base.syssetting.exception.SHRWebException;
import com.kingdee.shr.recuritment.IResumeState;
import com.kingdee.shr.recuritment.ResumeStateFactory;
import com.kingdee.shr.recuritment.ResumeStateInfo;
import com.kingdee.shr.recuritment.service.SelectNextStageService;
import org.apache.log4j.Logger;

import java.util.Map;

/**
 * @author 青梧
 * @version 1.0
 * @description: 生成录用报批
 * @date 2025/9/1 16:41
 */
public class GenerateHireApprovalService implements IHRMsfService {
    private static final Logger logger = Logger.getLogger(GenerateHireApprovalService.class);

    @Override
    public Object process(Context ctx, Map<String, Object> map) throws EASBizException, BOSException {
        //简历ID
        String resumeBaseRecId = map.get("resumeBaseRecId").toString();
        logger.error("resumeBaseRecId:{}" + resumeBaseRecId);
        IResumeState iResumeState = ResumeStateFactory.getLocalInstance(ctx);
        //"0009" 录用报批状态
        ResumeStateInfo resumeStateInfo = iResumeState.getResumeStateInfo("where number = '0009'");
        String resumeStateId = resumeStateInfo.getId().toString();
        String errorMsg = null;
        try {
            errorMsg = SelectNextStageService.getInstance().dealNext(ctx, resumeBaseRecId, resumeStateId, "resumeList");
            logger.error("errorMsg:{}" + errorMsg);
        } catch (SHRWebException e) {
            throw new RuntimeException(e);
        }
        return errorMsg;
    }
}
