package jnpf.model.personnels.vo.transfer;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import lombok.Data;

import java.util.Date;

@Data
public class FtbHandleTransferPageExportVO {
    /**
     * 姓名
     */
    @ExcelProperty(value = "姓名", index = 0)
    private String userName;
    /**
     * 员工ID(页面展示)
     */
    @ExcelProperty(value = "员工ID", index = 1)
    private String userCustomId;
    /**
     * 调动前组织名称
     */
    @ExcelProperty(value = "调动前组织", index = 2)
    private String oldOrganizeName;
    /**
     * 调动前岗位
     */
    @ExcelProperty(value = "调动前岗位", index = 3)
    private String oldPostName;
    /**
     * 调动前职级
     */
    @ExcelProperty(value = "调动前职级", index = 4)
    private String oldRankName;
    /**
     * 调动后组织
     */
    @ExcelProperty(value = "调动后组织", index = 5)
    private String newOrganizeName;
    /**
     * 调动后岗位
     */
    @ExcelProperty(value = "调动后岗位", index = 6)
    private String newPostName;
    /**
     * 调动后职级
     */
    @ExcelProperty(value = "调动后职级", index = 7)
    private String newRankName;

    /**
     * 办理状态审核状态(0,待审批,1审批中,2,审核通过,3,审核不通过,4,撤销,5未办理, 6手动)
     */
    @ExcelProperty(value = "办理状态", index = 10)
    private String state;
    /**
     * 调动类型0调岗1晋升2降职3调店
     */
    @ExcelProperty(value = "调动类型", index = 8)
    private String transferType;

    /**
     * 调动生效日期
     */
    @ExcelProperty(value = "调动生效日期", index = 9)
    @DateTimeFormat("yyyy-MM-dd")
    private Date effectDate;

    public static FtbHandleTransferPageExportVO convert(FtbHandleTransferPageVO ftbHandleTransferPageVO) {
        if (ftbHandleTransferPageVO == null) {
            return null;
        }
        FtbHandleTransferPageExportVO ftbHandleTransferPageExportVO = new FtbHandleTransferPageExportVO();
        ftbHandleTransferPageExportVO.setUserName(ftbHandleTransferPageVO.getUserName());
        ftbHandleTransferPageExportVO.setUserCustomId(ftbHandleTransferPageVO.getUserCustomId());
        ftbHandleTransferPageExportVO.setOldOrganizeName(ftbHandleTransferPageVO.getOldOrganizeName());
        ftbHandleTransferPageExportVO.setOldPostName(ftbHandleTransferPageVO.getOldPostName());
        ftbHandleTransferPageExportVO.setOldRankName(ftbHandleTransferPageVO.getOldRankName());
        ftbHandleTransferPageExportVO.setNewOrganizeName(ftbHandleTransferPageVO.getNewOrganizeName());
        ftbHandleTransferPageExportVO.setNewPostName(ftbHandleTransferPageVO.getNewPostName());
        ftbHandleTransferPageExportVO.setNewRankName(ftbHandleTransferPageVO.getNewRankName());
        // 办理状态审核状态(0,待审批,1审批中,2,审核通过,3,审核不通过,4,撤销,5未办理, 6手动)
        if (ftbHandleTransferPageVO.getState() == 1) {
            ftbHandleTransferPageExportVO.setState("审批中");
        } else if (ftbHandleTransferPageVO.getState() == 2) {
            ftbHandleTransferPageExportVO.setState("审核通过");
        } else if (ftbHandleTransferPageVO.getState() == 3) {
            ftbHandleTransferPageExportVO.setState("审核不通过");
        } else if (ftbHandleTransferPageVO.getState() == 4) {
            ftbHandleTransferPageExportVO.setState("已撤销");
        } else if (ftbHandleTransferPageVO.getState() == 6) {
            ftbHandleTransferPageExportVO.setState("手动办理");
        }
        // 调动类型0调岗1晋升2降职3调店
        if (ftbHandleTransferPageVO.getTransferType() == 0) {
            ftbHandleTransferPageExportVO.setTransferType("调岗");
        } else if (ftbHandleTransferPageVO.getTransferType() == 1) {
            ftbHandleTransferPageExportVO.setTransferType("晋升");
        } else if (ftbHandleTransferPageVO.getTransferType() == 2) {
            ftbHandleTransferPageExportVO.setTransferType("降职");
        } else if (ftbHandleTransferPageVO.getTransferType() == 3) {
            ftbHandleTransferPageExportVO.setTransferType("调店");
        }
        ftbHandleTransferPageExportVO.setEffectDate(ftbHandleTransferPageVO.getEffectDate());
        return ftbHandleTransferPageExportVO;
    }

}
