package weaver.formmode.recruit.modeexpand.position;

import weaver.conn.RecordSet;
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.soa.workflow.request.RequestInfo;

import java.util.HashMap;
import java.util.Map;

/**
 * @author:dxfeng
 * @createTime: 2024/03/14
 * @version: 1.0
 */
public class OpenPositionModeExpand extends AbstractModeExpandJavaCodeNew {

    @Override
    public Map<String, String> doModeExpand(Map<String, Object> param) {
        String tableName = "uf_jcl_zp_zpzw";
        BaseBean baseBean = new BaseBean();

        Map<String, String> resultMap = new HashMap<>(16);
        try {
            int billId;
            int modeId;
            RequestInfo requestInfo = (RequestInfo) param.get("RequestInfo");
            if (requestInfo != null) {
                billId = Util.getIntValue(requestInfo.getRequestid());
                modeId = Util.getIntValue(requestInfo.getWorkflowid());
                if (billId > 0 && modeId > 0) {
                    RecordSet rs = new RecordSet();
                    // 更新招聘状态为招聘中
                    rs.executeUpdate("update " + tableName + " set zpzt = ? where id = ?", 0, billId);
                }
            }

        } catch (Exception e) {
            baseBean.writeLog(e);
            resultMap.put("errmsg", e.getMessage());
            resultMap.put("flag", "false");
        }
        return resultMap;
    }

}
