package com.engine.recruit.service.impl;

import com.engine.core.impl.Service;
import com.engine.recruit.entity.record.ApplicantRecordPo;
import com.engine.recruit.enums.ApplicationStatusEnum;
import com.engine.recruit.enums.RecordOperateEnum;
import com.engine.recruit.service.RecruitButtonService;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.general.Util;

import java.util.Map;

/**
 * <p>聚才林招聘</p>
 * "淘汰"按钮实现类
 *
 * @author:dxfeng
 * @createTime: 2023/09/18
 * @version: 1.0
 */
public class EliminateServiceImpl extends Service implements RecruitButtonService {

    @Override
    public Map<String, Object> execute(Map<String, Object> params) {
        String billId = Util.null2String(params.get("billId"));
        RecordSet rs = new RecordSet();
        rs.executeUpdate("update uf_jcl_yppc set zt = ? where id = ? ", ApplicationStatusEnum.OBSOLETE.getValue(), billId);

        // 插入应聘过程
        ApplicantRecordPo recordPo = ApplicantRecordPo.builder()
                .billId(billId)
                .operateTime(DateUtil.getDateTime())
                .user(user)
                .recordOperateType(RecordOperateEnum.ELIMINATE)
                .build();
        recordPo.execute();

        return null;
    }
}
