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

import jnpf.model.personnels.po.FtbPersonnelsPostApply;
import lombok.Data;

import java.util.Date;

@Data
public class StaffPromotionDto {

    /**
     * 新所属组织 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 String immediateSuperId;
    /**
     * 直属主管name
     */
    private String immediateSuperName;
    /**
     * 旧直属主管
     */
    private String OldImmediateSuperId;
    /**
     * 旧直属主管name
     */
    private String OldImmediateSuperName;
    /**
     * 实际入职日期
     */
    private Date actualStartDate;
    /**
     * 备注
     */
    private String remarks;
    /**
     * 操作人
     */
    private String operator;

    /**
     *
     * @param dto
     * @param actualStartDate
     * @return
     */

    public static StaffPromotionDto cover(FtbPersonnelsPostApply dto, Date actualStartDate) {
        if (dto == null) {
            return null;
        }
        StaffPromotionDto staffPromotionDto = new StaffPromotionDto();
        staffPromotionDto.setRemarks(dto.getPromotionReason());
        staffPromotionDto.setOldOrg(dto.getOrgId());
        staffPromotionDto.setOldOrgName(dto.getOrgName());
        staffPromotionDto.setOldPosition(dto.getPostId());
        staffPromotionDto.setOldPositionName(dto.getPostName());
        staffPromotionDto.setOldRank(dto.getPostRankId());
        staffPromotionDto.setOldRankName(dto.getPostRankName());
        staffPromotionDto.setNewPosition(dto.getPostPromotionId());
        staffPromotionDto.setNewPositionName(dto.getPostPromotionName());
        staffPromotionDto.setNewRank(dto.getPostRankPromotionId());
        staffPromotionDto.setNewRankName(dto.getPostRankPromotionName());
        staffPromotionDto.setNewOrg(dto.getOrgCurrentId());
        staffPromotionDto.setNewOrgName(dto.getOrgCurrentName());
        staffPromotionDto.setImmediateSuperId(dto.getImmediateSuperId());
        staffPromotionDto.setImmediateSuperName(dto.getImmediateSuperName());
        staffPromotionDto.setOldImmediateSuperId(dto.getOldImmediateSuperId());
        staffPromotionDto.setOldImmediateSuperName(dto.getOldImmediateSuperName());
        staffPromotionDto.setActualStartDate(actualStartDate);
        staffPromotionDto.setOperator(dto.getCreatorUserId());
        return staffPromotionDto;
    }
}
