package cn.com.qmth.stmms.ms.core.domain;

import cn.com.qmth.stmms.ms.core.domain.user.Role;
import cn.com.qmth.stmms.ms.core.vo.Subject;
//import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * @Description: 操作日志 entity
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2019/10/19
 */
@Entity
@Table(name = "mark_log")
@DynamicInsert
@DynamicUpdate
public class MarkLog implements Serializable {

    private static final long serialVersionUID = -8376036816154911286L;

    private Long id;
    @NotNull
//    @ApiModelProperty(value = "操作人id", example = "1")
    private Long createUserId;
    @NotNull
//    @ApiModelProperty(value = "操作人")
    private String createUserName;
    @NotNull
//    @ApiModelProperty(value = "角色")
    private String createRole;
//    @ApiModelProperty(value = "科目")
    private String subject;
    @NotNull
//    @ApiModelProperty(value = "准考证号")
    private String examNumber;
    @NotNull
//    @ApiModelProperty(value = "学生姓名")
    private String studentName;
    @NotNull
//    @ApiModelProperty(value = "操作类型，1：分档，2：打分，3：回评档位，4：回评分数，5：档位打回，6：档位打回回评，7：一键定档，8：标准卷设置", example = "2")
    private Integer operType;
//    @ApiModelProperty(value = "操作前数据")
    private String operDataBefore;
//    @ApiModelProperty(value = "操作后数据")
    private String operDataAfter;
//    @Temporal(value = TemporalType.DATE)
    @NotNull
//    @ApiModelProperty(value = "操作时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    @NotNull
    private Long workId;

    private String workName;
//    @NotNull
    private Long paperId;
//    @ApiModelProperty(value = "备注")
    private String remark;
    @NotNull
    @Enumerated(value = EnumType.ORDINAL)
//    @ApiModelProperty(value = "阶段", example = "3")
    private MarkStage stage;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date loginTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date logoutTime;

    public MarkLog() {

    }

    public MarkLog(Long createUserId, String createUserName, Role createRole,
                   Subject subject, String examNumber, String studentName,
                   Integer operType, Long workId, Long paperId, MarkStage stage, String operDataBefore, String operDataAfter, String remark, String workName) {
        this.createUserId = createUserId;
        this.createUserName = createUserName;
        this.createRole = createRole.getName();
        this.subject = subject.toString();
        this.examNumber = examNumber;
        this.studentName = studentName;
        this.operType = operType;
        this.workId = workId;
        this.paperId = paperId;
        this.stage = stage;
        this.operDataAfter = operDataAfter;
        this.operDataBefore = operDataBefore;
        this.remark = remark;
        this.workName = workName;
        this.createTime = new Date();
    }

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public MarkStage getStage() {
        return stage;
    }

    public void setStage(MarkStage stage) {
        this.stage = stage;
    }

    @Id
    @GeneratedValue
    @Column(name = "id")
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Basic
    @Column(name = "create_user_id")
    public Long getCreateUserId() {
        return createUserId;
    }

    public void setCreateUserId(Long createUserId) {
        this.createUserId = createUserId;
    }

    @Basic
    @Column(name = "create_user_name")
    public String getCreateUserName() {
        return createUserName;
    }

    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }

    @Basic
    @Column(name = "create_role")
    public String getCreateRole() {
        return createRole;
    }

    public void setCreateRole(String createRole) {
        this.createRole = createRole;
    }

    @Basic
    @Column(name = "subject")
    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    @Basic
    @Column(name = "exam_number")
    public String getExamNumber() {
        return examNumber;
    }

    public void setExamNumber(String examNumber) {
        this.examNumber = examNumber;
    }

    @Basic
    @Column(name = "student_name")
    public String getStudentName() {
        return studentName;
    }

    public void setStudentName(String studentName) {
        this.studentName = studentName;
    }

    @Basic
    @Column(name = "oper_type")
    public Integer getOperType() {
        return operType;
    }

    public void setOperType(Integer operType) {
        this.operType = operType;
    }

    @Basic
    @Column(name = "oper_data_before")
    public String getOperDataBefore() {
        return operDataBefore;
    }

    public void setOperDataBefore(String operDataBefore) {
        this.operDataBefore = operDataBefore;
    }

    @Basic
    @Column(name = "oper_data_after")
    public String getOperDataAfter() {
        return operDataAfter;
    }

    public void setOperDataAfter(String operDataAfter) {
        this.operDataAfter = operDataAfter;
    }

    @Basic
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Basic
    @Column(name = "work_name")
    public String getWorkName() {
        return workName;
    }

    public void setWorkName(String workName) {
        this.workName = workName;
    }

    @Basic
    @Column(name = "work_id")
    public Long getWorkId() {
        return workId;
    }

    public void setWorkId(Long workId) {
        this.workId = workId;
    }

    @Basic
    @Column(name = "paper_id")
    public Long getPaperId() {
        return paperId;
    }

    public void setPaperId(Long paperId) {
        this.paperId = paperId;
    }

    @Basic
    @Column(name = "remark")
    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Date getLoginTime() {
        return loginTime;
    }

    public void setLoginTime(Date loginTime) {
        this.loginTime = loginTime;
    }

    public Date getLogoutTime() {
        return logoutTime;
    }

    public void setLogoutTime(Date logoutTime) {
        this.logoutTime = logoutTime;
    }
}
