package jnpf.model.personnels.dto.staff.employment;

import jnpf.model.personnels.dto.staff.roster.StaffPromotionDto;
import jnpf.model.personnels.dto.staff.transfer.TransferGrowthLogDto;
import jnpf.model.personnels.po.FtbPersonnelsTransferManage;
import lombok.Data;

import java.util.Date;

/**
 * @Author: peng.hao
 * @create: 2024/10/21
 */
@Data
public class FtbPersonnelsMoveLogVO {
    /**
     * 姓名
     */
    private String  name;

    /**
     * 员工ID
     */
    private String  employeeID;


    /**
     * 新所属组织 id
     */
    private String newOrg;

    /**
     * 新岗位 id
     */
    private String newPosition;

    /**
     * 新职等 id
     */
    private String newRank;

    /**
     * 新组织名称
     */
    private String newOrgName;

    /**
     * 新岗位名称
     */
    private String newPositionName;

    /**
     * 新职级名称
     */
    private String newRankName;

    /**
     * 旧所属组织 id
     */
    private String oldOrg;

    /**
     * 旧岗位 id
     */
    private String oldPosition;

    /**
     * 旧职等 id
     */
    private String oldRank;

    /**
     * 旧组织名称
     */
    private String oldOrgName;

    /**
     * 旧岗位名称
     */
    private String oldPositionName;

    /**
     * 旧职级名称
     */
    private String oldRankName;

    /**
     * 办理日期
     */
    private Date processingDate;

    /**
     * 调动类型
     */
    private String type;

    /**
     * 操作人
     */
    private String operatorId;

    /**
     * 操作人
     */
    private String operator;



    public static FtbPersonnelsMoveLogVO covert(StaffPromotionDto dto) {
        if (dto == null) {
            return null;
        }
        FtbPersonnelsMoveLogVO ftbPersonnelsPromotionLogVO = new FtbPersonnelsMoveLogVO();
        ftbPersonnelsPromotionLogVO.setNewOrg(dto.getNewOrg());
        ftbPersonnelsPromotionLogVO.setNewPosition(dto.getNewPosition());
        ftbPersonnelsPromotionLogVO.setNewRank(dto.getNewRank());
        ftbPersonnelsPromotionLogVO.setNewOrgName(dto.getNewOrgName());
        ftbPersonnelsPromotionLogVO.setNewPositionName(dto.getNewPositionName());
        ftbPersonnelsPromotionLogVO.setNewRankName(dto.getNewRankName());
        ftbPersonnelsPromotionLogVO.setOldOrg(dto.getOldOrg());
        ftbPersonnelsPromotionLogVO.setOldPosition(dto.getOldPosition());
        ftbPersonnelsPromotionLogVO.setOldRank(dto.getOldRank());
        ftbPersonnelsPromotionLogVO.setOldOrgName(dto.getOldOrgName());
        ftbPersonnelsPromotionLogVO.setOldPositionName(dto.getOldPositionName());
        ftbPersonnelsPromotionLogVO.setOldRankName(dto.getOldRankName());
        ftbPersonnelsPromotionLogVO.setType("晋升");
        ftbPersonnelsPromotionLogVO.setOperatorId(dto.getOperator());
        return ftbPersonnelsPromotionLogVO;
    }

    public static FtbPersonnelsMoveLogVO covertTransfer(TransferGrowthLogDto staffRegularDto) {
        if (staffRegularDto == null) {
            return null;
        }
        FtbPersonnelsMoveLogVO ftbPersonnelsMoveLogVO = new FtbPersonnelsMoveLogVO();
        ftbPersonnelsMoveLogVO.setNewOrg(staffRegularDto.getToOrg());
        ftbPersonnelsMoveLogVO.setNewPosition(staffRegularDto.getToPositionId());
        ftbPersonnelsMoveLogVO.setNewRank(staffRegularDto.getToRankId());
        ftbPersonnelsMoveLogVO.setNewOrgName(staffRegularDto.getToOrgName());
        ftbPersonnelsMoveLogVO.setNewPositionName(staffRegularDto.getToPositionIdName());
        ftbPersonnelsMoveLogVO.setNewRankName(staffRegularDto.getToRankIdName());
        ftbPersonnelsMoveLogVO.setOldOrg(staffRegularDto.getFromOrg());
        ftbPersonnelsMoveLogVO.setOldPosition(staffRegularDto.getFromPositionId());
        ftbPersonnelsMoveLogVO.setOldRank(staffRegularDto.getFromRankId());
        ftbPersonnelsMoveLogVO.setOldOrgName(staffRegularDto.getFromOrgName());
        ftbPersonnelsMoveLogVO.setOldPositionName(staffRegularDto.getFromPositionIdName());
        ftbPersonnelsMoveLogVO.setOldRankName(staffRegularDto.getFromRankIdName());
        ftbPersonnelsMoveLogVO.setType("调岗");
        ftbPersonnelsMoveLogVO.setOperator(staffRegularDto.getOpUserName());
        return ftbPersonnelsMoveLogVO;
    }

    public static FtbPersonnelsMoveLogVO covertPromotion(FtbPersonnelsTransferManage dto) {
        if (dto == null) {
            return null;
        }
        FtbPersonnelsMoveLogVO ftbPersonnelsMoveLogVO = new FtbPersonnelsMoveLogVO();
        ftbPersonnelsMoveLogVO.setOldOrg(dto.getBeforeOrgId());
        ftbPersonnelsMoveLogVO.setOldOrgName(dto.getBeforeOrgName());
        ftbPersonnelsMoveLogVO.setOldPosition(dto.getBeforePostId());
        ftbPersonnelsMoveLogVO.setOldPositionName(dto.getBeforePostName());
        ftbPersonnelsMoveLogVO.setOldRank(dto.getBeforeRankId());
        ftbPersonnelsMoveLogVO.setOldRankName(dto.getBeforeRankName());
        ftbPersonnelsMoveLogVO.setNewOrg(dto.getAfterOrgId());
        ftbPersonnelsMoveLogVO.setNewOrgName(dto.getAfterOrgName());
        ftbPersonnelsMoveLogVO.setNewPosition(dto.getAfterPostId());
        ftbPersonnelsMoveLogVO.setNewPositionName(dto.getAfterPostName());
        ftbPersonnelsMoveLogVO.setNewRank(dto.getAfterRankId());
        ftbPersonnelsMoveLogVO.setNewRankName(dto.getAfterRankName());
        ftbPersonnelsMoveLogVO.setProcessingDate(dto.getEffectiveDate());
        ftbPersonnelsMoveLogVO.setOperatorId(dto.getLastModifyUserId());
        return ftbPersonnelsMoveLogVO;
    }
}
