package com.ruoyi.common.core.domain.entity;

import java.util.Date;
import java.util.List;
import javax.validation.constraints.*;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.ruoyi.common.enums.ExamType;
import com.ruoyi.common.enums.UserRegStatus;
import com.ruoyi.common.utils.dz.SubjectScore;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.Excel.ColumnType;
import com.ruoyi.common.annotation.Excel.Type;
import com.ruoyi.common.annotation.Excels;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.xss.Xss;

/**
 * 用户对象 sys_user
 *
 * @author ruoyi
 */
public class SysUser extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 用户ID */
//    @Excel(name = "用户序号", type = Type.EXPORT, cellType = ColumnType.NUMERIC, prompt = "用户编号")
    private Long userId;

    private String userType;

    @Excel(name = "用户类型", cellType = ColumnType.TEXT, dictType = "usercard_type", sort = 10, type = Type.EXPORT)
    private String usercardType;

    private Long userTypeId;

    /** 机构ID */
//    @Excel(name = "机构编号", type = Type.IMPORT)
    private Long deptId;

    private String wxOpenId;

    /** 用户账号 */
//    @Excel(name = "登录名称")
    private String userName;

    /** 用户昵称 */
    @Excel(name = "姓名", sort = 7, type = Type.EXPORT)
    private String nickName;

    /** 用户邮箱 */
//    @Excel(name = "用户邮箱")
    private String email;

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

    /** 用户性别 */
//    @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
    private String sex;

    /** 用户头像 */
    private String avatar;

    /** 密码 */
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private String password;

    private String password2;

    /** 账号状态（0正常 1停用） */
//    @Excel(name = "账号状态", readConverterExp = "0=正常,1=停用")
    private String status;

    /** 删除标志（0代表存在 2代表删除） */
    private String delFlag;

    /** 最后登录IP */
//    @Excel(name = "最后登录IP", type = Type.EXPORT)
    private String loginIp;

    /** 最后登录时间 */
//    @Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
    private Date loginDate;

    /** 密码最后更新时间 */
    private Date pwdUpdateDate;

    /** 机构对象 */
//    @Excels({
//        @Excel(name = "平台机构", targetAttr = "deptName", sort = 12, type = Type.EXPORT),
//        @Excel(name = "机构负责人", targetAttr = "leader", type = Type.EXPORT)
//    })
    private SysDept dept;

    /** 角色对象 */
    private List<SysRole> roles;

    /** 角色组 */
    private Long[] roleIds;

    /** 岗位组 */
    private Long[] postIds;

    /** 角色ID */
    private Long roleId;

    /** 省份 **/
    @Excel(name = "省份", sort = 1, type = Type.EXPORT)
    private String location;

    /** 考生类型 **/
    @Excel(name = "考生类型", dictType = "exam_type", sort = 11, type = Type.EXPORT)
    private ExamType examType;

    /**
     * 注册状态
     */
    private UserRegStatus regStatus;

    /**
     * 毕业年份
     */
    @Excel(name = "单招年份", sort = 2, type = Type.EXPORT)
    private Integer endYear;

    /** 邀请码 **/
    @Excel(name = "邀请码", sort = 14, type = Type.EXPORT)
    private String inviteCode;

    /** 邀请机构ID **/
    private Long inviteDeptId;

    /** 考试成绩  {} **/
    private SubjectScore scores;

    /** 考生专业类别 **/
    private Integer examMajor;

    /** 分数 */
    private Integer score;

    /** 分数锁定 */
    private Integer scoreLock;

    /** 用户位次 */
    private Integer seatInput;

    /** 考生专业类别名称 */
    private String examMajorName;

    @JsonIgnore
    private String directedStudy;

    @JsonIgnore
    private String evalCounts;

    private Integer bindStatus;
    private Long cardId;
    private Integer classSelect;

    public Integer getClassSelect() {
        return classSelect;
    }

    public void setClassSelect(Integer classSelect) {
        this.classSelect = classSelect;
    }

    /** 卡号 */
    @Excel(name = "卡号", sort = 9, type = Type.EXPORT)
    private String cardNo;

    /** 注册学校名称 */
    @Excel(name = "注册学校", sort = 3, type = Type.EXPORT)
    private String schoolName;
    /** 学校班级名称 */
    @Excel(name = "学校班级", sort = 4, type = Type.EXPORT)
    private String schoolClassName;
    /** 培训校区名称 */
    @Excel(name = "培训校区", sort = 5, type = Type.EXPORT)
    private String campusName;
    /** 校区班级名称 */
    @Excel(name = "校区班级", sort = 6, type = Type.EXPORT)
    private String campusClassName;

    /** 代理商名称 */
    @Excel(name = "平台机构", sort = 13, type = Type.EXPORT)
    private String deptName;

    /** 代理商名称（从邀请码对应的用户获取） */
    @Excel(name = "代理商名称", sort = 15, type = Type.EXPORT)
    private String agentName;

    private Long agentId;

    /** 校区id */
    @ApiModelProperty(name = "学校id")
    private Long schoolId;
    /** 校区班级ID */
    @ApiModelProperty(name = "班级ID")
    private Long classId;
    private Integer accountType;

    public Integer getAccountType() {
        return accountType;
    }

    public void setAccountType(Integer accountType) {
        this.accountType = accountType;
    }

    public Long getSchoolId() {
        return schoolId;
    }

    public void setSchoolId(Long schoolId) {
        this.schoolId = schoolId;
    }

    public Long getClassId() {
        return classId;
    }

    public void setClassId(Long classId) {
        this.classId = classId;
    }

    public SysUser()
    {

    }

    public SysUser(Long userId)
    {
        this.userId = userId;
    }

    public String getUserType() {
        return userType;
    }

    public void setUserType(String userType) {
        this.userType = userType;
    }

    public Long getUserTypeId() {
        return userTypeId;
    }

    public void setUserTypeId(Long userTypeId) {
        this.userTypeId = userTypeId;
    }

    public Long getUserId()
    {
        return userId;
    }

    public void setUserId(Long userId)
    {
        this.userId = userId;
    }

    public boolean isAdmin()
    {
        return isAdmin(this.userId);
    }

    public static boolean isAdmin(Long userId)
    {
        return userId != null && 1L == userId;
    }

    public Long getDeptId()
    {
        return deptId;
    }

    public void setDeptId(Long deptId)
    {
        this.deptId = deptId;
    }

    @Xss(message = "用户昵称不能包含脚本字符")
    @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
    public String getNickName()
    {
        return nickName;
    }

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

    public String getWxOpenId() {
        return wxOpenId;
    }

    public void setWxOpenId(String wxOpenId) {
        this.wxOpenId = wxOpenId;
    }

    @Xss(message = "用户账号不能包含脚本字符")
    @NotBlank(message = "用户账号不能为空")
    @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
    public String getUserName()
    {
        return userName;
    }

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

    @Email(message = "邮箱格式不正确")
    @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
    public String getEmail()
    {
        return email;
    }

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

    @Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符")
    public String getPhonenumber()
    {
        return phonenumber;
    }

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

    public String getSex()
    {
        return sex;
    }

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

    public String getAvatar()
    {
        return avatar;
    }

    public void setAvatar(String avatar)
    {
        this.avatar = avatar;
    }

    public String getPassword()
    {
        return password;
    }

    public void setPassword(String password)
    {
        this.password = password;
    }

    public String getPassword2() {
        return password2;
    }

    public void setPassword2(String password2) {
        this.password2 = password2;
    }

    public String getStatus()
    {
        return status;
    }

    public void setStatus(String status)
    {
        this.status = status;
    }

    public String getDelFlag()
    {
        return delFlag;
    }

    public void setDelFlag(String delFlag)
    {
        this.delFlag = delFlag;
    }

    public String getLoginIp()
    {
        return loginIp;
    }

    public void setLoginIp(String loginIp)
    {
        this.loginIp = loginIp;
    }

    public Date getLoginDate()
    {
        return loginDate;
    }

    public void setLoginDate(Date loginDate)
    {
        this.loginDate = loginDate;
    }

    public Date getPwdUpdateDate()
    {
        return pwdUpdateDate;
    }

    public void setPwdUpdateDate(Date pwdUpdateDate)
    {
        this.pwdUpdateDate = pwdUpdateDate;
    }

    public SysDept getDept()
    {
        return dept;
    }

    public void setDept(SysDept dept)
    {
        this.dept = dept;
    }

    public List<SysRole> getRoles()
    {
        return roles;
    }

    public void setRoles(List<SysRole> roles)
    {
        this.roles = roles;
    }

    public Long[] getRoleIds()
    {
        return roleIds;
    }

    public void setRoleIds(Long[] roleIds)
    {
        this.roleIds = roleIds;
    }

    public Long[] getPostIds()
    {
        return postIds;
    }

    public void setPostIds(Long[] postIds)
    {
        this.postIds = postIds;
    }

    public Long getRoleId()
    {
        return roleId;
    }

    public void setRoleId(Long roleId)
    {
        this.roleId = roleId;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public ExamType getExamType() {
        return examType;
    }

    public void setExamType(ExamType examType) {
        this.examType = examType;
    }

    public UserRegStatus getRegStatus() {
        return regStatus;
    }

    public void setRegStatus(UserRegStatus regStatus) {
        this.regStatus = regStatus;
    }

    public Integer getEndYear() {
        return endYear;
    }

    public void setEndYear(Integer endYear) {
        this.endYear = endYear;
    }

    public String getInviteCode() {
        return inviteCode;
    }

    public void setInviteCode(String inviteCode) {
        this.inviteCode = inviteCode;
    }

    public Long getInviteDeptId() {
        return inviteDeptId;
    }

    public void setInviteDeptId(Long inviteDeptId) {
        this.inviteDeptId = inviteDeptId;
    }

    public SubjectScore getScores() {
        return scores;
    }

    public void setScores(SubjectScore scores) {
        this.scores = scores;
    }

    public Integer getExamMajor() {
        return examMajor;
    }

    public void setExamMajor(Integer examMajor) {
        this.examMajor = examMajor;
    }

    public Integer getScore() {
        return score;
    }

    public void setScore(Integer score) {
        this.score = score;
    }

    public Integer getScoreLock() {
        return scoreLock;
    }

    public void setScoreLock(Integer scoreLock) {
        this.scoreLock = scoreLock;
    }

    public Integer getSeatInput() {
        return seatInput;
    }

    public void setSeatInput(Integer seatInput) {
        this.seatInput = seatInput;
    }

    public String getExamMajorName() {
        return examMajorName;
    }

    public void setExamMajorName(String examMajorName) {
        this.examMajorName = examMajorName;
    }

    public String getDirectedStudy() {
        return directedStudy;
    }

    public void setDirectedStudy(String directedStudy) {
        this.directedStudy = directedStudy;
    }

    public Long getCardId() {
        return cardId;
    }

    public void setCardId(Long cardId) {
        this.cardId = cardId;
    }

    public String getCardNo() {
        return cardNo;
    }

    public void setCardNo(String cardNo) {
        this.cardNo = cardNo;
    }

    public String getSchoolName() {
        return schoolName;
    }

    public void setSchoolName(String schoolName) {
        this.schoolName = schoolName;
    }

    public String getSchoolClassName() {
        return schoolClassName;
    }

    public void setSchoolClassName(String schoolClassName) {
        this.schoolClassName = schoolClassName;
    }

    public String getCampusName() {
        return campusName;
    }

    public void setCampusName(String campusName) {
        this.campusName = campusName;
    }

    public String getCampusClassName() {
        return campusClassName;
    }

    public void setCampusClassName(String campusClassName) {
        this.campusClassName = campusClassName;
    }

    public String getDeptName() {
        return deptName;
    }

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

    public String getAgentName() {
        return agentName;
    }

    public void setAgentName(String agentName) {
        this.agentName = agentName;
    }

    public Long getAgentId() {
        return agentId;
    }

    public void setAgentId(Long agentId) {
        this.agentId = agentId;
    }

    public String getEvalCounts() {
        return evalCounts;
    }

    public void setEvalCounts(String evalCounts) {
        this.evalCounts = evalCounts;
    }

    public Integer getBindStatus() {
        return bindStatus;
    }

    public void setBindStatus(Integer bindStatus) {
        this.bindStatus = bindStatus;
    }

    public String getCode() {
        return String.valueOf(userId);
    }

    public String getUsercardType() {
        return usercardType;
    }

    public void setUsercardType(String usercardType) {
        this.usercardType = usercardType;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("userId", getUserId())
            .append("deptId", getDeptId())
            .append("userName", getUserName())
            .append("nickName", getNickName())
            .append("email", getEmail())
            .append("phonenumber", getPhonenumber())
            .append("sex", getSex())
            .append("avatar", getAvatar())
            .append("password", getPassword())
            .append("status", getStatus())
            .append("delFlag", getDelFlag())
            .append("loginIp", getLoginIp())
            .append("loginDate", getLoginDate())
            .append("pwdUpdateDate", getPwdUpdateDate())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .append("remark", getRemark())
            .append("dept", getDept())
            .toString();
    }
}
