package cn.estsh.i3plus.pojo.model.platform;

import cn.estsh.i3plus.pojo.base.annotation.AnnoOutputColumn;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import cn.estsh.i3plus.pojo.base.bean.BaseConstWords;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.platform.bean.SysDictionary;
import cn.estsh.i3plus.pojo.platform.bean.SysUser;
import cn.estsh.i3plus.pojo.platform.bean.SysUserInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @Description :
 * @Reference :
 * @Author : yunhao
 * @CreateDate : 2020-09-09
 * @Modify:
 **/
@Data
@ApiModel
public class UserExportModel extends BaseBean {

    private static final long serialVersionUID = -6597413958814715617L;

    @ApiModelProperty(value ="姓名" , access ="名称")
    private String infoName;

    @ApiModelProperty(value ="工号")
    private String infoEmpNo;

    @ApiModelProperty(value ="角色名称" , access ="角色名称")
    private String roleNameRdd;

    @ApiModelProperty(value ="登陆名称" , access ="登陆名称")
    private String userLoginName;

    @ApiModelProperty(value ="邮箱" , access ="邮箱")
    private String userEmail;

    @ApiModelProperty(value ="手机号" , access ="手机号")
    private String userPhone;

    @ApiModelProperty(value ="部门名称" , access ="部门名称")
    private String departmentNameRdd;

    @ApiModelProperty(value ="岗位名称" , access ="岗位名称")
    private String positionNameRdd;

    @ApiModelProperty(value ="组织名称" , access ="组织名称")
    private String organizeNameRdd;

    @ApiModelProperty(value ="员工类型", access ="实习、试用期、正式")
    @AnnoOutputColumn(refClass = SysDictionary.class,value = "name",refForeignKey = BaseConstWords.DICTIONARY_EMPLOYEE_TYPE)
    private Integer infoEmployeeType;

    @ApiModelProperty(value ="员工等级")
    @AnnoOutputColumn(refClass = SysDictionary.class,value = "name",refForeignKey = BaseConstWords.DICTIONARY_EMPLOYEE_GRADE)
    private Integer infoGrade;

    @ApiModelProperty(value ="性别（1.男，2.女）" , example ="1" , access ="性别（1.男，2.女）")
    @AnnoOutputColumn(refClass = SysDictionary.class,value = "name",refForeignKey = BaseConstWords.DICTIONARY_SEX)
    private Integer infoSex;

    @ApiModelProperty(value ="婚姻" , example ="1" , access ="性别（1.未知，2.已婚,3未婚）")
    @AnnoOutputColumn(refClass = SysDictionary.class,value = "name",refForeignKey = BaseConstWords.DICTIONARY_MARRIAGE)
    private Integer infoMarriage;

    @ApiModelProperty(value ="证件类型")
    @AnnoOutputColumn(refClass = SysDictionary.class,value = "name",refForeignKey = BaseConstWords.DICTIONARY_CERTIFICATE_TYPE)
    private Integer infoCardType;

    @ApiModelProperty(value ="证件编号")
    private String infoCardNumber;

    @ApiModelProperty(value ="毕业专业")
    private String infoSchoolProfession;

    @ApiModelProperty(value ="毕业院校")
    private String infoSchool;

    @ApiModelProperty(value ="学历")
    @AnnoOutputColumn(refClass = SysDictionary.class,value = "name",refForeignKey = BaseConstWords.DICTIONARY_EDUCATION)
    private Integer infoSchoolEducation;

    @ApiModelProperty(value ="毕业时间")
    private String infoSchoolLeaveDate;

    @ApiModelProperty(value ="籍贯")
    private String infoBirthplace;

    @ApiModelProperty(value ="种族")
    @AnnoOutputColumn(refClass = SysDictionary.class,value = "name",refForeignKey = BaseConstWords.DICTIONARY_NATIONALITY)
    private Integer infoRace;

    @ApiModelProperty(value ="紧急联系人")
    private String infoEmergencyContact;

    @ApiModelProperty(value ="紧急联系人-电话")
    private String infoEmergencyPhone;

    @ApiModelProperty(value ="入职日期" , access ="默认当前时间")
    private String infoJoinDate;

    @ApiModelProperty(value ="离职日期" , access ="默认当前时间")
    private String infoResignationDate;

    @ApiModelProperty(value ="出生日期")
    private String infoBornDate;

    @ApiModelProperty(value ="政治面貌")
    @AnnoOutputColumn(refClass = SysDictionary.class,value = "name",refForeignKey = BaseConstWords.DICTIONARY_POLITICAL_STATUS)
    private Integer infoPoliticalStatus;

    @ApiModelProperty(value ="兴趣爱好")
    private String infoHobby;

    @ApiModelProperty(value ="家庭地址")
    private String infoFamilyAddress;

    @ApiModelProperty(value ="账号状态" , example ="-1")
    @AnnoOutputColumn(refClass = CommonEnumUtil.USER_STATUS.class)
    private Integer userStatus;

    public UserExportModel() {
    }

    public UserExportModel(SysUser sysUser, SysUserInfo sysUserInfo) {
        setSysUser(sysUser);
        setSysUserInfo(sysUserInfo);
    }

    public UserExportModel setSysUser(SysUser sysUser){
        if (sysUser != null) {
            this.userLoginName = sysUser.getUserLoginName();
            this.userPhone = sysUser.getUserPhone();
            this.userEmail = sysUser.getUserEmail();
            this.infoEmpNo = sysUser.getUserEmpNo();
            this.userStatus = sysUser.getUserStatus();
        } else {
            this.userLoginName = "用户账号不存在";
        }
        return this;
    }

    public UserExportModel setSysUserInfo(SysUserInfo sysUserInfo){
        if (sysUserInfo != null) {
            this.infoName = sysUserInfo.getName();
            this.departmentNameRdd = sysUserInfo.getDepartmentNameRdd();
            this.positionNameRdd = sysUserInfo.getPositionNameRdd();
            this.organizeNameRdd = sysUserInfo.getOrganizeNameRdd();
            this.infoEmployeeType = sysUserInfo.getUserEmployeeType();
            this.infoGrade = sysUserInfo.getUserGrade();
            this.infoSex = sysUserInfo.getUserSex();
            this.infoMarriage = sysUserInfo.getUserMarriage();
            this.infoCardType = sysUserInfo.getUserCardType();
            this.infoCardNumber = sysUserInfo.getUserCardNumber();
            this.infoSchoolProfession = sysUserInfo.getUserSchoolProfession();
            this.infoSchool = sysUserInfo.getUserSchool();
            this.infoSchoolEducation = sysUserInfo.getUserSchoolEducation();
            this.infoSchoolLeaveDate = sysUserInfo.getUserSchoolLeaveDate();
            this.infoBirthplace = sysUserInfo.getUserBirthplace();
            this.infoRace = sysUserInfo.getUserRace();
            this.infoEmergencyContact = sysUserInfo.getUserEmergencyContact();
            this.infoEmergencyPhone = sysUserInfo.getUserEmergencyPhone();
            this.infoJoinDate = sysUserInfo.getUserJoinDate();
            this.infoResignationDate = sysUserInfo.getUserResignationDate();
            this.infoBornDate = sysUserInfo.getUserBornDate();
            this.infoPoliticalStatus = sysUserInfo.getUserPoliticalStatus();
            this.infoHobby = sysUserInfo.getUserHobby();
            this.infoFamilyAddress = sysUserInfo.getUserFamilyAddress();
            this.organizeCode=sysUserInfo.getOrganizeCode();
            this.createDatetime=sysUserInfo.getCreateDatetime();
            this.createUser=sysUserInfo.getCreateUser();
            this.modifyDatetime=sysUserInfo.getModifyDatetime();
            this.modifyUser=sysUserInfo.getModifyUser();
        } else {
            this.infoName = "用户消息不存在";
        }
        return this;
    }
}
