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

import cn.hutool.json.JSONUtil;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jnpf.model.personnels.dto.staff.roster.StaffBaseInfoDto;
import jnpf.model.personnels.po.FtbPersonnelsStaffGrowthLog;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

/**
 * @Author: peng.hao
 * @create: 2024/10/9
 */
@Data
public class FtbPersonnelsEmployApplyListDto {
    /**
     * 姓名
     */
    private String workName;
    /**
     * 入职所属组织
     */
    private String currOrg;

    /**
     * 入职岗位
     */
    private String currPosition;

    /**
     * 入职职等
     */
    private String currRank;

    /**
     * 入职组织名称
     */
    private String currOrgName;

    /**
     * 入职岗位名称
     */
    private String currPositionName;

    /**
     * 入职职等名称
     */
    private String currRankName;

    /**
     * 办理日期
     */
    @JsonIgnore
    private Date creationTime;

    /**
     * 入职薪酬
     */
    private BigDecimal startSalary;
    /**
     *实际入职日期
     */
    private Date actualStartDate;
    /**
     *
     *员工Id
     */
    private String employeeId;

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

    public static  FtbPersonnelsEmployApplyListDto covert(FtbPersonnelsStaffGrowthLog dto) {
        if (dto == null) {
            return null;
        }
        FtbPersonnelsEmployApplyListDto ftbPersonnelsEmployApplyListDto = new FtbPersonnelsEmployApplyListDto();
        StaffBaseInfoDto staffRegularDto = JSONUtil.toBean(dto.getDetail(), StaffBaseInfoDto.class);
        ftbPersonnelsEmployApplyListDto.setCurrOrg(staffRegularDto.getCurrOrg());
        ftbPersonnelsEmployApplyListDto.setCurrPosition(staffRegularDto.getCurrPosition());
        ftbPersonnelsEmployApplyListDto.setCurrRank(staffRegularDto.getCurrRank());
        ftbPersonnelsEmployApplyListDto.setCurrOrgName(staffRegularDto.getCurrOrgName());
        ftbPersonnelsEmployApplyListDto.setCurrPositionName(staffRegularDto.getCurrPositionName());
        ftbPersonnelsEmployApplyListDto.setCurrRankName(staffRegularDto.getCurrRankName());
        ftbPersonnelsEmployApplyListDto.setCreationTime(dto.getChangeDate());
        ftbPersonnelsEmployApplyListDto.setStartSalary(dto.getStartSalary());
        ftbPersonnelsEmployApplyListDto.setActualStartDate(staffRegularDto.getActualStartDate());
        ftbPersonnelsEmployApplyListDto.setEmployeeId(dto.getEmployeeId());
        return ftbPersonnelsEmployApplyListDto;
    }
}
