package com.kingdee.eas.custom.compensation.startingsalary.backgroundtransaction;

import com.kingdee.bos.BOSException;
import com.kingdee.bos.Context;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.eas.hr.emp.ContractLimitTypeEnum;
import com.kingdee.eas.hr.emp.ContractTempletFactory;
import com.kingdee.eas.hr.emp.ContractTempletInfo;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


public class BasicSalaryParameters {
    //校验薪酬分组编码
    private String recBenefitGroupNumber;

    //校验薪酬项目编码 附加工资(GYT048_ref),
    //保密费（GYT009_ref）,岗位工资(GYT007_ref),约定加班费(GYT010_refcom),绩效工资基数(GYT004_ref),
    //月工资标准(GYT005_ref)，基本工资(GYT006_ref),绩效工资基数（GYT018_ref）
    private String recBenefitNumber;

    // 合同期限类型
    private ContractLimitTypeEnum contractLimitType;

    //transferSalary	月工资标准
    //transferBaseSalary	基本工资
    //transferPositionSalary	岗位工资
    //transferPerfSalaryBas	绩效工资基数
    //transferConfidentialFee	保密费
    //transferAgreedOvertimePay	加班费
    //transferOtherSubsidy	其他补贴

    private Map<String, Map<String,String>> transferSalary;

    // 合同薪酬值 ，应 对应薪酬确认单 的 字段  transferSalary
    private List<String> conteateSalaryList;


    private ContractTempletInfo contractTempletInfo;

    //	员工调整项目映射表编号
    private String empAdjustItemMappingTableNumber;

    private Context context;


    BasicSalaryParameters(Context context){

        context = context;
        // 001 实习期  003 正式
        recBenefitGroupNumber = "001,003";
        recBenefitNumber = "GYT054_ref,GYT052_ref,GYT055_refcom,GYT053_ref,GYT050_ref,GYT051_ref,GYTCMP207_ref" +
                ",GYT009_ref,GYT007_ref,GYT010_refcom,GYT004_ref,GYT005_ref,GYT006_ref,GYTCMP206_ref";
        transferSalary = new HashMap<String, Map<String,String>>();
        //key 前加s 表示试用期的  加z 表示正式期的
        Map<String, String> sy = new HashMap<String, String>();
        sy.put("GYT054_ref", "stransferConfidentialFee");//实习期保密费
        sy.put("GYT052_ref", "stransferPositionSalary");//实习期岗位工资
        sy.put("GYT055_refcom", " ");//实习期约定加班费
        sy.put("GYT053_ref", "stransferPerfSalaryBas");//实习期绩效工资基数
        sy.put("GYT050_ref", "stransferSalary");//实习期月工资标准
        sy.put("GYT051_ref", "stransferBaseSalary");//实习期基本工资
        sy.put("GYTCMP207_ref", "stransferOtherSubsidy");//试用期其他补贴

        Map<String, String> zs = new HashMap<String, String>();
        zs.put("GYT009_ref", "ztransferConfidentialFee");//正式期保密费
        zs.put("GYT007_ref", "ztransferPositionSalary");//正式期岗位工资
        zs.put("GYT010_refcom", "ztransferAgreedOvertimePay");//正式期约定加班费
        zs.put("GYT004_ref", "ztransferPerfSalaryBas");//正式期绩效工资基数
        zs.put("GYT005_ref", "ztransferSalary");//正式期月工资标准
        zs.put("GYT006_ref", "ztransferBaseSalary");//正式期基本工资
        zs.put("GYTCMP206_ref", "ztransferOtherSubsidy");//正式期绩效工资基数
        transferSalary.put("003", sy );
        transferSalary.put("001", zs);


        conteateSalaryList = new ArrayList<String>();
        conteateSalaryList.add("stransferSalary");//实习期月工资标准
        conteateSalaryList.add("ztransferSalary");//正式期月工资标准
        conteateSalaryList.add("stransferBaseSalary");//实习期基本工资
        conteateSalaryList.add("ztransferBaseSalary");//正式期基本工资
        conteateSalaryList.add("stransferPositionSalary");//实习期岗位工资
        conteateSalaryList.add("ztransferPositionSalary");//正式期岗位工资
        conteateSalaryList.add("stransferPerfSalaryBas");//实习期绩效工资基数
        conteateSalaryList.add("ztransferPerfSalaryBas");//正式期绩效工资基数
        conteateSalaryList.add("stransferConfidentialFee");//实习期保密费
        conteateSalaryList.add("ztransferConfidentialFee");//正式期保密费
        conteateSalaryList.add("stransferAgreedOvertimePay");//实习期加班费
        conteateSalaryList.add("ztransferAgreedOvertimePay");//=正式期加班费
        conteateSalaryList.add("stransferOtherSubsidy");//实习期其他补贴
        conteateSalaryList.add("ztransferOtherSubsidy");//正式期其他补贴

        //默认为固定期限
        contractLimitType = ContractLimitTypeEnum.FIXED_LIMIT;

        this.empAdjustItemMappingTableNumber = "001";

        // 006 ;
        try {
            //默认合同模版 006
            contractTempletInfo = ContractTempletFactory.getLocalInstance(context).getContractTempletInfo("where number = '006'");
        } catch (BOSException e) {
            throw new RuntimeException(e);
        } catch (EASBizException e) {
            throw new RuntimeException(e);
        }


    }

    public ContractTempletInfo getContractTempletInfo() {
        return contractTempletInfo;
    }
    public void setContractTempletInfo(String number) {
        try {
            this.contractTempletInfo =  contractTempletInfo = ContractTempletFactory
                    .getLocalInstance(context).getContractTempletInfo("where number = '"+number+"'");
        } catch (BOSException e) {
            throw new RuntimeException(e);
        } catch (EASBizException e) {
            throw new RuntimeException(e);
        }

    }

    public ContractLimitTypeEnum getContractLimitType() {
        return contractLimitType;
    }
    public void setContractLimitType(ContractLimitTypeEnum contractLimitType) {
        this.contractLimitType = contractLimitType;
    }


    public String getRecBenefitGroupNumber() {
        return recBenefitGroupNumber;
    }
    public void setRecBenefitGroupNumber(String recBenefitGroup) {
        this.recBenefitGroupNumber = recBenefitGroup;
    }

    public String getRecBenefitNumber() {
        return recBenefitNumber;
    }

    public void setRecBenefitNumber(String recBenefitNumber) {
        this.recBenefitNumber = recBenefitNumber;
    }

    public Map<String, Map<String,String>> getTransferSalary() {
        return transferSalary;
    }
    public void setTransferSalary(Map<String, Map<String,String>> transferSalary) {
        this.transferSalary = transferSalary;
    }

    public List<String> getConteateSalaryList() {
        return conteateSalaryList;
    }
    public void setConteateSalaryList(List<String> conteateSalaryList) {
        this.conteateSalaryList = conteateSalaryList;
    }

    public String getEmpAdjustItemMappingTableNumber() {
        return empAdjustItemMappingTableNumber;
    }
    public void setEmpAdjustItemMappingTableNumber(String empAdjustItemMappingTableNumber) {
        this.empAdjustItemMappingTableNumber = empAdjustItemMappingTableNumber;
    }
}
