package jnpf.model.personnels.po;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import jnpf.base.entity.SuperBaseEntity;
import jnpf.model.personnels.dto.salary.FtbPersonnelsSalaryInfo;
import jnpf.model.personnels.vo.regular.FtbPersonnelsRegularInfoVO;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 转正管理 
 * @author admin
 * @create 2024-02-01 
 */

@Getter
@Setter
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName(value = "ftb_personnels_regular_management")
public class FtbPersonnelsRegularManagement extends SuperBaseEntity.SuperCUDBaseEntity<String>  {



    /**
     * 系统展示userId
     */
    @TableField(value = "F_SystemWokerId")
    private String systemWokerId;

    /**
     * 用户id
     */
    @TableField(value = "F_UserId")
    private String userId;
    /**
     * 手机号
     */
    @TableField(value = "F_PhoneNumber")
    private String phoneNumber;

    /**
     * 用户姓名
     */
    @TableField(value = "F_UserName")
    private String userName;

    /**
     * 入职日期
     */
    @TableField(value = "F_DateOfEntry")
    private Date dateOfEntry;

    /**
     * 工号
     */
    @TableField(value = "F_JobNumber")
    private String jobNumber;

    /**
     * 试用期
     */
    @TableField(value = "F_Probation")
    private String probation;

    /**
     * 试用期
     */
    @TableField(value = "F_ProbationPeriodDay")
    private String probationPeriodDay;

    /**
     * 直属主管
     */
    @TableField(value = "F_ImmediateSuperId")
    private String immediateSuperId;

    /**
     * 直属主管name
     */
    @TableField(value = "F_ImmediateSuperName")
    private String immediateSuperName;

    /**
     * 计划转正日期
     */
    @TableField(value = "F_SchedConverDate")
    private Date schedConverDate;

    /**
     * 实际转正日期
     */
    @TableField(value = "F_ActualConverDate")
    private Date actualConverDate;

    /**
     * 所属组织id
     */
    @TableField(value = "F_OrgId")
    private String orgId;

    /**
     * 所属组织名称
     */
    @TableField(value = "F_OrgName")
    private String orgName;
    /**
     * 入职岗位id
     */
    @TableField(value = "F_OnboardPostId")
    private String onboardPostId;

    /**
     * 入职岗位名称
     */
    @TableField(value = "F_OnboardPostName")
    private String onboardPostName;

    /**
     * 入职职等id
     */
    @TableField(value = "F_OnboardGradeId")
    private String onboardGradeId;

    /**
     * 入职职等name
     */
    @TableField(value = "F_OnboardGradeName")
    private String onboardGradeName;


    /**
     * 转正岗位id
     */
    @TableField(value = "F_RegularPostId")
    private String regularPostId;

    /**
     * 转正岗位名称
     */
    @TableField(value = "F_RegularPostName")
    private String regularPostName;

    /**
     * 转正职等id
     */
    @TableField(value = "F_RegularGradeId")
    private String regularGradeId;

    /**
     * 转正职等name
     */
    @TableField(value = "F_RegularGradeName")
    private String regularGradeName;

    /** 入职薪酬 */
    @TableField(value = "F_StartingSalary")
    private BigDecimal startingSalary;

    /**
     * 转正薪酬
     */
    @TableField(value = "F_regularSalary")
    private BigDecimal regularSalary;

    /**
     * 转正备注
     */
    @TableField(value = "F_RemarksConver")
    private String remarksConver;


    /** 转正审批状态(0,待审批,1审批中,2,审核通过,3,审核不通过,4,撤销,5未办理, 6手动转正,) */
    @TableField(value = "F_TransferStatus")
    private Integer transferStatus;

    /**
     * 申请来源 0,员工申请,1,审批办理,2直接办理
     */
    @TableField(value = "F_ApplicationSource")
    private Integer applicationSource;

    /**
     * 是否有效(1无效,0有效)
     */
    @TableField(value = "F_EnableMark")
	private Long enableMark;

    /**
     * 审批id
     */
    @TableField(value = "F_TaskInfoId")
	private String taskInfoId;


    /**
     * 是否调整薪酬(0,否,1是)
     */
    @TableField(value = "F_IsAdjustSalary")
	private String isAdjustSalary;


    /**
     * 薪资结构(0,不使用,1使用)
     */
    @TableField(value = "F_SalaryStructure")
	private String salaryStructure;

    /**
     * 薪资生效日期
     */
    @TableField(value = "F_PayrollEffectiveDate")
	private Date payrollEffectiveDate;

    /**
     *  薪资详情 (v1.1)
     */
    @TableField(value = "F_SalaryStructureList")
    private String salaryStructureList;

    /**
     *  版本号 区分是否为老版本审批数据 0为老版本 1为新版审批
     */
    @TableField(value = "F_VersionNum")
    private Integer versionNum;

    /**
     * 薪资调整原因
     */
    @TableField(value = "F_ReasonsForSalary")
    private String  reasonsForSalaryAdjustments;
    /**
     * 班组id
     */
    @TableField(value = "F_TeamID")
    private String teamID;
    /**
     * 班组名称
     */
    @TableField(value = "F_TeamName")
    private String teamName;
    /**
     * 调薪方式 1.加薪 2.降薪
     */
    @TableField(value = "F_SalaryType")
    private Integer salaryType;


    /**
     * 薪资序列 id
     */
    @TableField(value = "F_PayrollSequenceId")
    private String payrollSequenceId;

    /**
     * 薪资序列
     *  1职级标准 2自定义标准
     */
    @TableField(value = "F_PayrollSequence")
    private Integer payrollSequence;

    /**
     * 薪资记录id
     */
    @TableField(value = "F_SalaryRecordId")
    private String salaryRecordId;

    /**
     * 薪资序列名称
     */
    @TableField(value = "F_PayrollSequenceName")
    private String payrollSequenceName;

    public static FtbPersonnelsRegularInfoVO coverFtbPersonnelsRegularInfoVO(FtbPersonnelsRegularManagement management) {
        if (management == null) {
            return null;
        }
        FtbPersonnelsRegularInfoVO ftbPersonnelsRegularInfoVO = new FtbPersonnelsRegularInfoVO();
        ftbPersonnelsRegularInfoVO.setUserId(management.getUserId());
        ftbPersonnelsRegularInfoVO.setUserName(management.getUserName());
        ftbPersonnelsRegularInfoVO.setDateOfEntry(management.getDateOfEntry());
        ftbPersonnelsRegularInfoVO.setJobNumber(management.getJobNumber());
        ftbPersonnelsRegularInfoVO.setProbation(management.getProbation());
        ftbPersonnelsRegularInfoVO.setImmediateSuperId(management.getImmediateSuperId());
        ftbPersonnelsRegularInfoVO.setImmediateSuperName(management.getImmediateSuperName());
        ftbPersonnelsRegularInfoVO.setSchedConverDate(management.getSchedConverDate());
        ftbPersonnelsRegularInfoVO.setActualConverDate(management.getActualConverDate());
        ftbPersonnelsRegularInfoVO.setOrgId(management.getOrgId());
        ftbPersonnelsRegularInfoVO.setOrgName(management.getOrgName());
        ftbPersonnelsRegularInfoVO.setRegularPostId(management.getRegularPostId());
        ftbPersonnelsRegularInfoVO.setRegularPostName(management.getRegularPostName());
        ftbPersonnelsRegularInfoVO.setRegularGradeId(management.getRegularGradeId());
        ftbPersonnelsRegularInfoVO.setRegularGradeName(management.getRegularGradeName());
        ftbPersonnelsRegularInfoVO.setStartingSalary(management.getStartingSalary());
        ftbPersonnelsRegularInfoVO.setRegularSalary(management.getRegularSalary());
        ftbPersonnelsRegularInfoVO.setRemarksConver(management.getRemarksConver());
        ftbPersonnelsRegularInfoVO.setCreatorTime(management.getCreatorTime());
        ftbPersonnelsRegularInfoVO.setCreatorUserId(management.getCreatorUserId());
        ftbPersonnelsRegularInfoVO.setApplicationSource(management.getApplicationSource());
        ftbPersonnelsRegularInfoVO.setId(management.getId());
        ftbPersonnelsRegularInfoVO.setProbationPeriodDay(management.getProbationPeriodDay());
        ftbPersonnelsRegularInfoVO.setSystemWokerId(management.getSystemWokerId());
        ftbPersonnelsRegularInfoVO.setTaskInfoId(management.getTaskInfoId());
        ftbPersonnelsRegularInfoVO.setTransferStatus(management.getTransferStatus());
        ftbPersonnelsRegularInfoVO.setIsAdjustSalary(management.getIsAdjustSalary());
        ftbPersonnelsRegularInfoVO.setSalaryStructure(management.getSalaryStructure());
        ftbPersonnelsRegularInfoVO.setPayrollEffectiveDate(management.getPayrollEffectiveDate());
        if(StringUtils.isNotEmpty(management.getSalaryStructureList())){
            List<FtbPersonnelsSalaryInfo> parseArray = JSONObject.parseArray(management.getSalaryStructureList(), FtbPersonnelsSalaryInfo.class);
            ftbPersonnelsRegularInfoVO.setSalaryStructureList(parseArray);
        }
        ftbPersonnelsRegularInfoVO.setOnboardPostId(management.getOnboardPostId());
        ftbPersonnelsRegularInfoVO.setOnboardPostName(management.getOnboardPostName());
        ftbPersonnelsRegularInfoVO.setOnboardGradeId(management.getOnboardGradeId());
        ftbPersonnelsRegularInfoVO.setOnboardGradeName(management.getOnboardGradeName());
        ftbPersonnelsRegularInfoVO.setVersionNum(management.getVersionNum());
        ftbPersonnelsRegularInfoVO.setReasonsForSalaryAdjustments(management.getReasonsForSalaryAdjustments());
        ftbPersonnelsRegularInfoVO.setTeamID(management.getTeamID());
        ftbPersonnelsRegularInfoVO.setTeamName(management.getTeamName());
        ftbPersonnelsRegularInfoVO.setSalaryType(management.getSalaryType());
        ftbPersonnelsRegularInfoVO.setPayrollSequence(management.getPayrollSequence());
        ftbPersonnelsRegularInfoVO.setPayrollSequenceId(management.getPayrollSequenceId());
        ftbPersonnelsRegularInfoVO.setPayrollSequenceName(management.getPayrollSequenceName());
        return ftbPersonnelsRegularInfoVO;
    }
}
