package jnpf.model.personnels.po;

import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import jnpf.base.entity.SuperBaseEntity;
import jnpf.model.enums.FtbPersonnelsAuditTaskEnum;
import jnpf.model.personnels.dto.secondment.FtbHandleSecondmentDTO;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;
import java.util.Date;

/**
 * 员工借调管理表 
 * @author admin 
 * @create 2025-09-11 
 */

@Getter
@Setter
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName ( value ="ftb_personnels_secondment_management" )
public class FtbPersonnelsSecondmentManagement extends SuperBaseEntity.SuperCUDBaseEntity<String> implements Serializable {

	private static final long serialVersionUID =  8450220908824055104L;

	/** userid */
   	@TableField(value = "F_UserId")
	private String userId;

	/** 员工姓名 */
   	@TableField(value = "F_UserName")
	private String userName;

	/** 员工ID */
   	@TableField(value = "F_EmployeeId")
	private String employeeId;

	/** 借调前组织ID（关联组织表） */
   	@TableField(value = "F_OriginalOrganizationId")
	private String originalOrganizationId;

	/** 借调前组织名称 */
   	@TableField(value = "F_OriginalOrganization")
	private String originalOrganization;

	/** 借调后组织ID（关联组织表） */
   	@TableField(value = "F_SecondedOrganizationId")
	private String secondedOrganizationId;

	/** 借调后组织名称 */
   	@TableField(value = "F_SecondedOrganization")
	private String secondedOrganization;

	/** 借调前岗位ID（关联岗位表） */
   	@TableField(value = "F_OriginalPositionId")
	private String originalPositionId;

	/** 借调前岗位名称 */
   	@TableField(value = "F_OriginalPosition")
	private String originalPosition;

	/** 借调后岗位ID（关联岗位表） */
   	@TableField(value = "F_SecondedPositionId")
	private String secondedPositionId;

	/** 借调后岗位名称 */
   	@TableField(value = "F_SecondedPosition")
	private String secondedPosition;

	/** 借调前职级ID（关联职级表） */
   	@TableField(value = "F_OriginalRankId")
	private String originalRankId;

	/** 借调前职级名称 */
   	@TableField(value = "F_OriginalRank")
	private String originalRank;

	/** 借调后职级ID（关联职级表） */
   	@TableField(value = "F_SecondedRankId")
	private String secondedRankId;

	/** 借调后职级名称 */
   	@TableField(value = "F_SecondedRank")
	private String secondedRank;

	/** 借调开始时间（格式：yyyy/mm/dd-hh:mm） */
   	@TableField(value = "F_SecondmentStartTime")
	private Date secondmentStartTime;

	/** 借调结束时间（格式：yyyy/mm/dd-hh:mm） */
   	@TableField(value = "F_SecondmentEndTime")
	private Date secondmentEndTime;

	/** 提前结束时间*/
	@TableField(value = "F_AdvanceEndTime")
	private Date advanceEndTime;

	/** 薪资设置 */
   	@TableField(value = "F_SalarySetting")
	private String salarySetting;

	/** 是否设置薪酬：0=否，1=是 */
   	@TableField(value = "F_IsResetSalary")
	private Integer isResetSalary;

	/** 薪资序列 id */
   	@TableField(value = "F_PayrollSequenceId")
	private String payrollSequenceId;

	/** 薪资序列 id */
   	@TableField(value = "F_PayrollSequenceName")
	private String payrollSequenceName;

	/** 调薪方式 1.加薪 2.降薪 */
   	@TableField(value = "F_SalaryType")
	private Integer salaryType;

	/** 薪资详情 */
   	@TableField(value = "F_SalaryStructureList")
	private String salaryStructureList;

	/** 薪资详情 */
   	@TableField(value = "F_BeforeSalaryStructureList")
	private String beforeSalaryStructureList;

	/** 借调备注 */
   	@TableField(value = "F_SecondmentRemarks")
	private String secondmentRemarks;

	/** 借调附件存储路径 */
   	@TableField(value = "F_Attachment")
	private String attachment;

	/** 启用标记 */
   	@TableField(value = "F_EnableMark")
	private Integer enableMark;

	/**  审批状态(0,待审批,1审批中,2,审核通过,3,审核不通过,4,撤销,5未办理, 6手动)
	 * {@link FtbPersonnelsAuditTaskEnum}
	 */
   	@TableField(value = "F_TransferStatus")
	private Integer transferStatus;

	/** 审批id */
	@TableField(value = "F_TaskInfoId")
	private String taskInfoId;

	/**
	 * 薪资记录id
	 */
	@TableField(value = "F_SalaryRecordId")
	private String salaryRecordId;
	/**
	 * 最终审批人id
	 */
	@TableField(value = "F_LastApprovalUserId")
	private String lastApprovalUserId;

	/**
	 * 审批时间
	 */
	@TableField(value = "F_ApprovalTime")
	private Date approvalTime;


	public static FtbPersonnelsSecondmentManagement covert(FtbHandleSecondmentDTO ftbHandleSecondmentDTO) {
		if (ftbHandleSecondmentDTO == null) {
			return null;
		}
		FtbPersonnelsSecondmentManagement ftbPersonnelsSecondmentManagement = new FtbPersonnelsSecondmentManagement();
		ftbPersonnelsSecondmentManagement.setId(ftbHandleSecondmentDTO.getId());
		ftbPersonnelsSecondmentManagement.setUserId(ftbHandleSecondmentDTO.getUserId());
		ftbPersonnelsSecondmentManagement.setUserName(ftbHandleSecondmentDTO.getUserName());
		ftbPersonnelsSecondmentManagement.setEmployeeId(ftbHandleSecondmentDTO.getEmployeeId());
		ftbPersonnelsSecondmentManagement.setOriginalOrganizationId(ftbHandleSecondmentDTO.getOriginalOrganizationId());
		ftbPersonnelsSecondmentManagement.setOriginalOrganization(ftbHandleSecondmentDTO.getOriginalOrganization());
		ftbPersonnelsSecondmentManagement.setSecondedOrganizationId(ftbHandleSecondmentDTO.getSecondedOrganizationId());
		ftbPersonnelsSecondmentManagement.setSecondedOrganization(ftbHandleSecondmentDTO.getSecondedOrganization());
		ftbPersonnelsSecondmentManagement.setOriginalPositionId(ftbHandleSecondmentDTO.getOriginalPositionId());
		ftbPersonnelsSecondmentManagement.setOriginalPosition(ftbHandleSecondmentDTO.getOriginalPosition());
		ftbPersonnelsSecondmentManagement.setSecondedPositionId(ftbHandleSecondmentDTO.getSecondedPositionId());
		ftbPersonnelsSecondmentManagement.setSecondedPosition(ftbHandleSecondmentDTO.getSecondedPosition());
		ftbPersonnelsSecondmentManagement.setOriginalRankId(ftbHandleSecondmentDTO.getOriginalRankId());
		ftbPersonnelsSecondmentManagement.setOriginalRank(ftbHandleSecondmentDTO.getOriginalRank());
		ftbPersonnelsSecondmentManagement.setSecondedRankId(ftbHandleSecondmentDTO.getSecondedRankId());
		ftbPersonnelsSecondmentManagement.setSecondedRank(ftbHandleSecondmentDTO.getSecondedRank());
		ftbPersonnelsSecondmentManagement.setSecondmentStartTime(ftbHandleSecondmentDTO.getSecondmentStartTime());
		ftbPersonnelsSecondmentManagement.setSecondmentEndTime(ftbHandleSecondmentDTO.getSecondmentEndTime());
		ftbPersonnelsSecondmentManagement.setSalarySetting(ftbHandleSecondmentDTO.getSalarySetting());
		ftbPersonnelsSecondmentManagement.setIsResetSalary(ftbHandleSecondmentDTO.getIsResetSalary());
		ftbPersonnelsSecondmentManagement.setPayrollSequenceId(ftbHandleSecondmentDTO.getPayrollSequenceId());
		ftbPersonnelsSecondmentManagement.setSalaryType(ftbHandleSecondmentDTO.getSalaryType());
		ftbPersonnelsSecondmentManagement.setSalaryStructureList(JSONArray.toJSONString(ftbHandleSecondmentDTO.getSalaryStructureList()));
		ftbPersonnelsSecondmentManagement.setSecondmentRemarks(ftbHandleSecondmentDTO.getSecondmentRemarks());
		ftbPersonnelsSecondmentManagement.setAttachment(JSONArray.toJSONString(ftbHandleSecondmentDTO.getFiles()));
		ftbPersonnelsSecondmentManagement.setPayrollSequenceName(ftbHandleSecondmentDTO.getPayrollSequenceName());
		return ftbPersonnelsSecondmentManagement;
	}
}
