package com.engine.salary.wrapper;

import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.entity.process.dto.SalaryAdjustmentDTO;
import com.engine.salary.sys.entity.po.SalarySysConfPO;
import com.engine.salary.sys.service.SalarySysConfService;
import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
import weaver.hrm.User;

/**
 * 流程
 * <p>Copyright: Copyright (c) 2022</p>
 * <p>Company: 泛微软件</p>
 *
 * @author qiantao
 * @version 1.0
 **/
public class ProcessWrapper extends Service {

    private SalarySysConfService getSalarySysConfService(User user) {
        return ServiceUtil.getService(SalarySysConfServiceImpl.class, user);
    }

    public SalaryAdjustmentDTO salaryAdjustment() {

        SalaryAdjustmentDTO build = SalaryAdjustmentDTO.builder().isShow("false").build();
        SalarySysConfPO needSalaryAdjustmentProcess = getSalarySysConfService(user).getOneByCode("needSalaryAdjustmentProcess");
        if (needSalaryAdjustmentProcess != null) {
            build.setIsShow(needSalaryAdjustmentProcess.getConfValue());
            SalarySysConfPO salaryAdjustmentProcessUrl = getSalarySysConfService(user).getOneByCode("salaryAdjustmentProcessUrl");
            if (salaryAdjustmentProcessUrl != null) {
                build.setUrl(salaryAdjustmentProcessUrl.getConfValue());
            }
            return build;
        }
        return build;
    }
}
