package com.zd.system.api.domain;

import com.zd.common.core.annotation.Excel;
import com.zd.common.core.annotation.Excel.Type;
import com.zd.common.core.utils.StringUtils;
import org.springframework.beans.BeanUtils;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 用户对象 sys_user
 *
 * @author zd
 */
public class SysUserTeaCherByExport {
    private static final long serialVersionUID = 1L;

    /**
     * 姓名
     */
    @Excel(name = "姓名" ,type = Type.EXPORT, isRequired=true)
    private String nickName;

    /**
     * 工号
     */
    @Excel(name = "工号" ,type = Type.EXPORT, isRequired=true)
    private String userName;

    /**
     * 所在部门
     */
    @Excel(name = "所在部门" ,type = Type.EXPORT, isRequired=true)
    private String deptName;

    /**
     * 身份
     */
    @Excel(name = "身份" ,type = Type.EXPORT, isRequired=true)
    private String positionName;

    /**
     * 手机号码
     */
    @Excel(name = "手机号码" ,type = Type.EXPORT)
    private String phonenumber;

    /**
     * 邮箱
     */
    @Excel(name = "邮箱" ,type = Type.EXPORT)
    private String email;

    /**
     * 职称
     */
    @Excel(name = "职称" ,type = Type.EXPORT)
    private String category;

    /**
     * 文化程度
     */
    @Excel(name = "文化程度" ,type = Type.EXPORT)
    private String education;

    /**
     * 性别
     */
    @Excel(name = "性别" ,type = Type.EXPORT)
    private String sex;

    /**
     * 出生日期
     */
    @Excel(name = "出生日期" ,type = Type.EXPORT)
    private String dateBirth;

    /**
     * 校园卡号
     */
    @Excel(name = "校园卡号" ,type = Type.EXPORT)
    private String cardNum;

    /**
     * 在职状态
     */
    @Excel(name = "在职状态" ,type = Type.EXPORT)
    private String nature;


    public SysUserTeaCherByExport(SysUser sysUser) {
        BeanUtils.copyProperties(sysUser, this);
        if(StringUtils.isNotNull(sysUser.getSex()) && sysUser.getSex().equals("0")){
            this.sex = "男";
        }else if(StringUtils.isNotNull(sysUser.getSex()) && sysUser.getSex().equals("1")){
            this.sex = "女";
        }else{
            this.sex = "未知";
        }
        if(StringUtils.isNotNull(sysUser.getDateBirth())){
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            this.setDateBirth(sdf.format(sysUser.getDateBirth()));
        }
        if(StringUtils.isNotEmpty(sysUser.getNature()) && sysUser.getNature().equals("0")){
            this.nature = "在职";
        }else{
            this.nature = "离职";
        }

        this.deptName = sysUser.getDept() == null ? null : sysUser.getDept().getDeptName();
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getDeptName() {
        return deptName;
    }

    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }

    public String getPositionName() {
        return positionName;
    }

    public void setPositionName(String positionName) {
        this.positionName = positionName;
    }

    public String getPhonenumber() {
        return phonenumber;
    }

    public void setPhonenumber(String phonenumber) {
        this.phonenumber = phonenumber;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getDateBirth() {
        return dateBirth;
    }

    public void setDateBirth(String dateBirth) {
        this.dateBirth = dateBirth;
    }

    public String getCardNum() {
        return cardNum;
    }

    public void setCardNum(String cardNum) {
        this.cardNum = cardNum;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public String getEducation() {
        return education;
    }

    public void setEducation(String education) {
        this.education = education;
    }

    public String getNature() {
        return nature;
    }

    public void setNature(String nature) {
        this.nature = nature;
    }
}
