package com.engine.salary.cmd.siarchives;

import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.salary.mapper.siarchives.SocialSchemeMapper;
import com.engine.salary.util.SalaryAssert;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import weaver.hrm.User;

import java.util.List;
import java.util.Map;

/**
 * @Author weaver_cl
 * @Description:
 * @Date 2022/3/12
 * @Version V1.0
 **/
public class SIArchivesTipsCmd extends AbstractCommonCommand<Map<String, Object>> {

    public SIArchivesTipsCmd(Map<String, Object> params, User user) {
        this.user = user;
        this.params = params;
    }

    @Override
    public BizLogContext getLogContext() {
        return null;
    }

    @Override
    public Map<String, Object> execute(CommandContext commandContext) {

        SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
        try {
            SocialSchemeMapper socialSchemeMapper = sqlSession.getMapper(SocialSchemeMapper.class);
            List<Long> employeeIds = socialSchemeMapper.tips();
            SalaryAssert.isEmpty(employeeIds, "当前有离职人员档案存在福利缴纳起始月,未维护福利最后缴纳月，请尽快处理");

        } finally {
            sqlSession.close();
        }
        return null;
    }
}
