package jnpf.model.personnels.vo.apply;

import com.alibaba.fastjson.JSONObject;
import io.swagger.v3.oas.annotations.media.Schema;
import jnpf.model.cultivate.resp.UserExamDetailVo;
import jnpf.model.cultivate.vo.course.web.PromotionChannelLearnCourseVO;
import jnpf.model.cultivate.vo.identify.IdentifyApplyInfoApiVo;
import jnpf.model.cultivate.vo.offline.FtbCultivateOfflineFileVO;
import jnpf.model.personnels.dto.salary.FtbPersonnelsSalaryInfo;
import jnpf.model.personnels.po.FtbPersonnelsPostApply;
import jnpf.model.personnels.vo.task.FtbPersonnelsAuditInfoVO;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

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

/**
 * @Title: FtbPersonnelsApplyWithPerVO
 * @Author:peng.hao
 * @create: 2023/12/2517:20
 */
@Data
public class FtbPersonnelsApplyWithPerVO {
    /**
     * 主键id
     */
    private  String id;
    /**
     * 系统展示申请人id
     */
    private String systemWokerId;
    /**
     * 用户id
     */
    @Schema(title = "用户id")
    private String userId;
    /**
     * 用户名称
     */
    @Schema(title = "用户名称")
    private String userName;


    /**
     * 当前岗位id
     */
    private String postId;

    /**
     * 当前岗位名称
     */
    private String postName;



    /**
     * 当前岗位职等id
     */
    @Schema(title = "当前岗位职等id")
    private String postRankId;

    /**
     * 当前岗位职等id
     */
    @Schema(title = "当前岗位职等名称")
    private String postRankName;


    /**
     * 晋升岗位id
     */
    @Schema(title = "晋升岗位id")
    private String postPromotionId;


    /**
     * 晋升岗位名称
     */
    @Schema(title = "晋升岗位名称")
    private String postPromotionName;

    /**
     * 晋升岗位职等id
     */
    private String postRankPromotionId;
    /**
     * 晋升岗位职等名称
     */
    private String postRankPromotionName;


    /**
     * 晋升原因
     */
    @Schema(title = "晋升原因")
    private String promotionReason;

    /**
     * 审核状态，0代审核,1审核通过,2审核不通过
     */
    @Schema(title = "审核状态，0代审核,1审核通过,2审核不通过")
    private Integer state;

    /**
     * 审核评语
     */
    @Schema(title = "审核评语")
    private String reviewComment;


    /**
     * 审批人id
     */
    @Schema(title = "审批人id")
    private String reviewUserId;

    /**
     * 审批人Name
     */
    @Schema(title = "审批人Name")
    private String reviewUserName;

    /**
     * 组织名称id
     */
    private String orgId;

    /**
     * 组织名称
     */
    private String orgName;
    /**
     * 晋升组织名称id
     */
    private String orgCurrentId;

    /**
     * 晋升组织名称
     */
    private String orgCurrentName;

    /**
     * 提交时间
     */
    private Date creatorTime;

    /**
     * 审核时间
     */
    private Date lastModifyTime;

    /**
     * 附件信息上限3个
     */
    List<FtbCultivateOfflineFileVO> files;

    /**
     * 考试成绩列表
     */
    private List<UserExamDetailVo> aListOfTestScores;
    /**
     * 实操鉴定列表
     */
    private List<IdentifyApplyInfoApiVo> listOfPracticalQualifications;
    /**
     * 已学习课程列表
     */
    private List<PromotionChannelLearnCourseVO> haveStudyCourseLists;


    /**
     * 审核信息 意见是否必填 是否具有填写权限 勾选权限
     */
    FtbPersonnelsAuditInfoVO auditInfo;
    /**
     * 薪酬是否符合(0,不符合,1符合)
     */
    private String payCompliance;

    /**
     * 当前薪酬
     */
    private BigDecimal currentPay;

    /**
     * 晋升后薪酬
     */
    private BigDecimal postPromotionPay;
    /**
     * 申请来源 0,员工申请,1,审批办理,2直接办理
     */
    private Integer source;

    /**
     * 任务主键id
     */
    private String taskInfoId;
    /**
     * 直属主管
     */
    private String immediateSuperId;
    /**
     * 直属主管name
     */
    private String immediateSuperName;
    /**
     * 旧直属主管
     */
    private String OldImmediateSuperId;
    /**
     * 旧直属主管name
     */
    private String OldImmediateSuperName;
    /**
     * 考情组id
     */
    private String attendanceGroup;
    /**
     * 考情组Name
     */
    private String attendanceGroupName;

    /**
     * 当前晋升角色id (v1.1)
     */
    private String roleId;
    /**
     * 当前晋升角色名称 (v1.1)
     */
    private String roleName;

    /**
     * 是否调整薪酬(0,否,1是) (v1.1)
     */
    private String isAdjustSalary;


    /**
     * 薪资结构(0,不使用,1使用) (v1.1)
     */
    private String salaryStructure;


    /**
     * 薪资生效日期
     */
    private Date payrollEffectiveDate;

    /**
     *  薪资详情 (v1.1)
     */
    private List<FtbPersonnelsSalaryInfo> salaryStructureList;

    /**
     *  版本号 区分是否为老版本审批数据 0为老版本 1为新版审批
     */
    private Integer versionNum;

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

    /**
     * 薪资调整原因
     */
    private String  reasonsForSalaryAdjustments;



    public static FtbPersonnelsApplyWithPerVO cultivatePromotionPostApplyWithPerVO(FtbPersonnelsPostApply vo) {
        if (vo == null) {
            return null;
        }
        FtbPersonnelsApplyWithPerVO ftbPersonnelsApplyWithPerVO = new FtbPersonnelsApplyWithPerVO();
        ftbPersonnelsApplyWithPerVO.setUserName(vo.getUserName());
        ftbPersonnelsApplyWithPerVO.setUserId(vo.getUserId());
        ftbPersonnelsApplyWithPerVO.setId(vo.getId());
        ftbPersonnelsApplyWithPerVO.setPromotionReason(vo.getPromotionReason());
        ftbPersonnelsApplyWithPerVO.setPayCompliance(vo.getPayCompliance());
        ftbPersonnelsApplyWithPerVO.setCurrentPay(vo.getCurrentPay());
        ftbPersonnelsApplyWithPerVO.setPostPromotionPay(vo.getPostPromotionPay());
        ftbPersonnelsApplyWithPerVO.setState(vo.getState());
        ftbPersonnelsApplyWithPerVO.setOrgId(vo.getOrgId());
        ftbPersonnelsApplyWithPerVO.setOrgName(vo.getOrgName());
        ftbPersonnelsApplyWithPerVO.setPostId(vo.getPostId());
        ftbPersonnelsApplyWithPerVO.setPostName(vo.getPostName());
        ftbPersonnelsApplyWithPerVO.setPostRankId(vo.getPostRankId());
        ftbPersonnelsApplyWithPerVO.setPostRankName(vo.getPostRankName());
        ftbPersonnelsApplyWithPerVO.setPostPromotionId(vo.getPostPromotionId());
        ftbPersonnelsApplyWithPerVO.setPostPromotionName(vo.getPostPromotionName());
        ftbPersonnelsApplyWithPerVO.setPostRankPromotionId(vo.getPostRankPromotionId());
        ftbPersonnelsApplyWithPerVO.setPostRankPromotionName(vo.getPostRankPromotionName());
        ftbPersonnelsApplyWithPerVO.setLastModifyTime(vo.getLastModifyTime());
        ftbPersonnelsApplyWithPerVO.setCreatorTime(vo.getCreatorTime());
        ftbPersonnelsApplyWithPerVO.setSource(vo.getSource());
        ftbPersonnelsApplyWithPerVO.setTaskInfoId(vo.getTaskInfoId());
        ftbPersonnelsApplyWithPerVO.setImmediateSuperId(vo.getImmediateSuperId());
        ftbPersonnelsApplyWithPerVO.setImmediateSuperName(vo.getImmediateSuperName());
        ftbPersonnelsApplyWithPerVO.setOldImmediateSuperId(vo.getOldImmediateSuperId());
        ftbPersonnelsApplyWithPerVO.setOldImmediateSuperName(vo.getOldImmediateSuperName());
        ftbPersonnelsApplyWithPerVO.setSystemWokerId(vo.getSystemWokerId());
        ftbPersonnelsApplyWithPerVO.setAttendanceGroup(vo.getAttendanceGroup());
        ftbPersonnelsApplyWithPerVO.setRoleId(vo.getRoleId());
        ftbPersonnelsApplyWithPerVO.setRoleName(vo.getRoleName());
        ftbPersonnelsApplyWithPerVO.setSalaryStructure(vo.getSalaryStructure());
        ftbPersonnelsApplyWithPerVO.setIsAdjustSalary(vo.getIsAdjustSalary());
        ftbPersonnelsApplyWithPerVO.setPayrollEffectiveDate(vo.getPayrollEffectiveDate());
        ftbPersonnelsApplyWithPerVO.setOrgCurrentId(vo.getOrgCurrentId());
        ftbPersonnelsApplyWithPerVO.setOrgCurrentName(vo.getOrgCurrentName());
        if(StringUtils.isNotEmpty(vo.getSalaryStructureList())){
            List<FtbPersonnelsSalaryInfo> parseArray = JSONObject.parseArray(vo.getSalaryStructureList(), FtbPersonnelsSalaryInfo.class);
            ftbPersonnelsApplyWithPerVO.setSalaryStructureList(parseArray);
        }
        ftbPersonnelsApplyWithPerVO.setVersionNum(vo.getVersionNum());
        ftbPersonnelsApplyWithPerVO.setReasonsForSalaryAdjustments(vo.getReasonsForSalaryAdjustments());
        return ftbPersonnelsApplyWithPerVO;
    }
}
