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

import com.fasterxml.jackson.annotation.JsonIgnore;
import jnpf.model.personnels.dto.staff.roster.StaffRegularDto;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.util.Date;

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

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

    /**
     * 组织
     */
    private String organization;

    /**
     * 岗位/职等
     */
    private String  positionGrade;

    /**
     * 入职日期
     */
    private Date dateOfEntry;

    /**
     * 转正日期
     */
    private Date  conversionDate;

    /**
     * 办理日期
     */
    @JsonIgnore
    private Date  processingDate;
    /**
     * 操作人
     */
    private String operator;

    public static FtbPersonnelsRegularVO covert(StaffRegularDto dto) {
        if (dto == null) {
            return null;
        }
        FtbPersonnelsRegularVO ftbPersonnelsRegularVO = new FtbPersonnelsRegularVO();
        ftbPersonnelsRegularVO.setDateOfEntry(dto.getDateOfEntry());
        ftbPersonnelsRegularVO.setOrganization(dto.getNewOrgName());
        ftbPersonnelsRegularVO.setPositionGrade(dto.getNewPositionName()+ (StringUtils.isNotEmpty(dto.getNewRankName()) ? "/"+dto.getNewRankName() : ""));
        ftbPersonnelsRegularVO.setConversionDate(dto.getRegularDate());
        return ftbPersonnelsRegularVO;
    }
}
