package jnpf.model.personnels.vo.secondment;

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

import java.util.Date;

/**
 * @Author: peng.hao
 * @create: 2025/9/11
 */
@Data
public class FtbPersonnelsSecondRecordVO {

    /** userid */
    private String userId;

    /** 员工姓名 */
    private String userName;
    /** 员工ID */
    private String employeeId;

    /** 借调前组织ID  */
    private String originalOrganizationId;

    /** 借调前组织名称 */
    private String originalOrganization;

    /** 借调前岗位ID  */
    private String originalPositionId;

    /** 借调前岗位名称 */
    private String originalPosition;

    /** 借调后组织ID  */
    private String secondedOrganizationId;

    /** 借调后组织名称 */
    private String secondedOrganization;

    /** 借调后岗位ID  */
    private String secondedPositionId;

    /** 借调后岗位名称 */
    private String secondedPosition;

    /** 借调开始时间（格式：yyyy/mm/dd-hh:mm） */
    private Date secondmentStartTime;

    /** 借调结束时间（格式：yyyy/mm/dd-hh:mm） */
    private Date secondmentEndTime;

    /** 创建用户ID */
    private String creatorUserId;

    /** 创建用户名称 */
    private String creatorUserName;

    public static  FtbPersonnelsSecondRecordVO covert(FtbPersonnelsSecondmentManagement ftbPersonnelsSecondmentManagement) {
        if (ftbPersonnelsSecondmentManagement == null) {
            return null;
        }
        FtbPersonnelsSecondRecordVO ftbPersonnelsSecondRecordVO = new FtbPersonnelsSecondRecordVO();
        ftbPersonnelsSecondRecordVO.setUserId(ftbPersonnelsSecondmentManagement.getUserId());
        ftbPersonnelsSecondRecordVO.setUserName(ftbPersonnelsSecondmentManagement.getUserName());
        ftbPersonnelsSecondRecordVO.setEmployeeId(ftbPersonnelsSecondmentManagement.getEmployeeId());
        ftbPersonnelsSecondRecordVO.setOriginalOrganizationId(ftbPersonnelsSecondmentManagement.getOriginalOrganizationId());
        ftbPersonnelsSecondRecordVO.setOriginalOrganization(ftbPersonnelsSecondmentManagement.getOriginalOrganization());
        ftbPersonnelsSecondRecordVO.setSecondedOrganizationId(ftbPersonnelsSecondmentManagement.getSecondedOrganizationId());
        ftbPersonnelsSecondRecordVO.setSecondedOrganization(ftbPersonnelsSecondmentManagement.getSecondedOrganization());
        ftbPersonnelsSecondRecordVO.setOriginalPositionId(ftbPersonnelsSecondmentManagement.getOriginalPositionId());
        ftbPersonnelsSecondRecordVO.setOriginalPosition(ftbPersonnelsSecondmentManagement.getOriginalPosition());
        ftbPersonnelsSecondRecordVO.setSecondedPositionId(ftbPersonnelsSecondmentManagement.getSecondedPositionId());
        ftbPersonnelsSecondRecordVO.setSecondedPosition(ftbPersonnelsSecondmentManagement.getSecondedPosition());
        ftbPersonnelsSecondRecordVO.setSecondmentStartTime(ftbPersonnelsSecondmentManagement.getSecondmentStartTime());
        if (ftbPersonnelsSecondmentManagement.getAdvanceEndTime() != null ){
            ftbPersonnelsSecondRecordVO.setSecondmentEndTime(ftbPersonnelsSecondmentManagement.getAdvanceEndTime());
        }else {
            ftbPersonnelsSecondRecordVO.setSecondmentEndTime(ftbPersonnelsSecondmentManagement.getSecondmentEndTime());
        }
        ftbPersonnelsSecondRecordVO.setCreatorUserId(ftbPersonnelsSecondmentManagement.getCreatorUserId());
        return ftbPersonnelsSecondRecordVO;
    }
}
