package jnpf.model.personnels.vo.secondment;

import com.alibaba.fastjson.JSONArray;
import jnpf.model.cultivate.dto.offline.FtbCultivateOfflineFileDTO;
import jnpf.model.personnels.dto.salary.FtbPersonnelsSalaryInfo;
import jnpf.model.personnels.po.FtbPersonnelsSecondmentManagement;
import lombok.Data;

import java.util.Date;
import java.util.List;

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

    /** 借调前职级ID（关联职级表） */
    private String originalRankId;

    /** 借调前职级名称 */
    private String originalRank;

    /** 借调后职级ID（关联职级表） */
    private String secondedRankId;

    /** 借调后职级名称 */
    private String secondedRank;

    /** 薪资设置 */
    private String salarySetting;

    /** 是否设置薪酬：0=否，1=是 */
    private Integer isResetSalary;

    /** 薪资序列 id */
    private String payrollSequenceId;
    /** 薪资序列 id */
    private String payrollSequenceName;

    /** 调薪方式 1.加薪 2.降薪 */
    private Integer salaryType;

    /** 薪资详情 */
    private List<FtbPersonnelsSalaryInfo> salaryStructureList;

    /** 借调备注 */
    private String secondmentRemarks;

    /** 借调附件存储路径 */
    private List<FtbCultivateOfflineFileDTO> attachment;

    /** 创建时间 */
    private Date creatorTime;

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

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

    public static FtbPersonnelsSecondmentInfoVO convert(FtbPersonnelsSecondmentManagement entity) {
        if (entity == null) {
            return null;
        }
        FtbPersonnelsSecondmentInfoVO ftbPersonnelsSecondmentInfoVO = new FtbPersonnelsSecondmentInfoVO();
        ftbPersonnelsSecondmentInfoVO.setUserId(entity.getUserId());
        ftbPersonnelsSecondmentInfoVO.setUserName(entity.getUserName());
        ftbPersonnelsSecondmentInfoVO.setEmployeeId(entity.getEmployeeId());
        ftbPersonnelsSecondmentInfoVO.setOriginalOrganizationId(entity.getOriginalOrganizationId());
        ftbPersonnelsSecondmentInfoVO.setOriginalOrganization(entity.getOriginalOrganization());
        ftbPersonnelsSecondmentInfoVO.setSecondedOrganizationId(entity.getSecondedOrganizationId());
        ftbPersonnelsSecondmentInfoVO.setSecondedOrganization(entity.getSecondedOrganization());
        ftbPersonnelsSecondmentInfoVO.setOriginalPositionId(entity.getOriginalPositionId());
        ftbPersonnelsSecondmentInfoVO.setOriginalPosition(entity.getOriginalPosition());
        ftbPersonnelsSecondmentInfoVO.setSecondedPositionId(entity.getSecondedPositionId());
        ftbPersonnelsSecondmentInfoVO.setSecondedPosition(entity.getSecondedPosition());
        ftbPersonnelsSecondmentInfoVO.setOriginalRankId(entity.getOriginalRankId());
        ftbPersonnelsSecondmentInfoVO.setOriginalRank(entity.getOriginalRank());
        ftbPersonnelsSecondmentInfoVO.setSecondedRankId(entity.getSecondedRankId());
        ftbPersonnelsSecondmentInfoVO.setSecondedRank(entity.getSecondedRank());
        ftbPersonnelsSecondmentInfoVO.setSecondmentStartTime(entity.getSecondmentStartTime());
        ftbPersonnelsSecondmentInfoVO.setSecondmentEndTime(entity.getSecondmentEndTime());
        ftbPersonnelsSecondmentInfoVO.setAdvanceEndTime(entity.getAdvanceEndTime());
        ftbPersonnelsSecondmentInfoVO.setSalarySetting(entity.getSalarySetting());
        ftbPersonnelsSecondmentInfoVO.setIsResetSalary(entity.getIsResetSalary());
        ftbPersonnelsSecondmentInfoVO.setPayrollSequenceId(entity.getPayrollSequenceId());
        ftbPersonnelsSecondmentInfoVO.setPayrollSequenceName(entity.getPayrollSequenceName());
        ftbPersonnelsSecondmentInfoVO.setSalaryType(entity.getSalaryType());
        ftbPersonnelsSecondmentInfoVO.setSalaryStructureList(JSONArray.parseArray(entity.getSalaryStructureList(), FtbPersonnelsSalaryInfo.class));
        ftbPersonnelsSecondmentInfoVO.setSecondmentRemarks(entity.getSecondmentRemarks());
        ftbPersonnelsSecondmentInfoVO.setAttachment(JSONArray.parseArray(entity.getAttachment(), FtbCultivateOfflineFileDTO.class));
        ftbPersonnelsSecondmentInfoVO.setTransferStatus(entity.getTransferStatus());
        ftbPersonnelsSecondmentInfoVO.setTaskInfoId(entity.getTaskInfoId());
        ftbPersonnelsSecondmentInfoVO.setCreatorTime(entity.getCreatorTime());
        ftbPersonnelsSecondmentInfoVO.setCreatorUserId(entity.getCreatorUserId());
        ftbPersonnelsSecondmentInfoVO.setId(entity.getId());
        return ftbPersonnelsSecondmentInfoVO;
    }
}
