package cn.com.qmth.stmms.biz.mark.model;

import java.io.Serializable;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.apache.commons.lang.StringUtils;

import cn.com.qmth.stmms.biz.utils.ScoreItem;

/**
 * 试评任务表
 *
 * @author luoshi
 */
@Entity
@Table(name = "m_trial_library")
public class TrialLibrary implements Serializable {

    private static final long serialVersionUID = 6791719880545458247L;

    @Id
    @GeneratedValue
    private Integer id;

    /**
     * 考试ID
     */
    @Column(name = "exam_id")
    private Integer examId;

    /**
     * 科目代码
     */
    @Column(name = "subject_code")
    private String subjectCode;

    /**
     * 大题序号
     */
    @Column(name = "group_number")
    private Integer groupNumber;

    /**
     * 考生编号
     */
    @Column(name = "student_id")
    private Integer studentId;

    /**
     * 准考证号
     */
    @Column(name = "exam_number")
    private String examNumber;

    /**
     * 考生密号
     */
    @Column(name = "secret_number")
    private String secretNumber;

    @Column(name = "marker_id", nullable = true)
    private Integer markerId;

    /**
     * 评卷时间
     */
    @Column(name = "marker_time")
    private Date markerTime;

    /**
     * 评卷员给分总分
     */
    @Column(name = "marker_score")
    private Double markerScore;

    /**
     * 评卷员给分明细
     */
    @Column(name = "marker_score_list")
    private String markerScoreList;

    /**
     * 未作答的步骤数量
     */
    @Column(name = "unanswered_count", nullable = true)
    private Integer unansweredCount;

    @Transient
    private String markerLoginName;

    public Integer getId() {
        return id;
    }

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

    public Integer getExamId() {
        return examId;
    }

    public void setExamId(Integer examId) {
        this.examId = examId;
    }

    public String getSubjectCode() {
        return subjectCode;
    }

    public void setSubjectCode(String subjectCode) {
        this.subjectCode = subjectCode;
    }

    public Integer getStudentId() {
        return studentId;
    }

    public void setStudentId(Integer studentId) {
        this.studentId = studentId;
    }

    public String getExamNumber() {
        return examNumber;
    }

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

    public String getSecretNumber() {
        return secretNumber;
    }

    public void setSecretNumber(String secretNumber) {
        this.secretNumber = secretNumber;
    }

    public Integer getGroupNumber() {
        return groupNumber;
    }

    public void setGroupNumber(Integer groupNumber) {
        this.groupNumber = groupNumber;
    }

    public Integer getMarkerId() {
        return markerId;
    }

    public void setMarkerId(Integer markerId) {
        this.markerId = markerId;
    }

    public Date getMarkerTime() {
        return markerTime;
    }

    public void setMarkerTime(Date markerTime) {
        this.markerTime = markerTime;
    }

    public Double getMarkerScore() {
        return markerScore;
    }

    public void setMarkerScore(Double markerScore) {
        this.markerScore = markerScore;
    }

    public String getMarkerScoreList() {
        return markerScoreList;
    }

    public void setMarkerScoreList(String markerScoreList) {
        this.markerScoreList = markerScoreList;
    }

    public List<ScoreItem> getScoreList() {
        List<ScoreItem> list = new LinkedList<ScoreItem>();
        if (StringUtils.isNotBlank(markerScoreList)) {
            try {
                String[] values = markerScoreList.split(",");
                for (String value : values) {
                    ScoreItem item = ScoreItem.parse(value, false);
                    if (item != null) {
                        list.add(item);
                    }
                }
            } catch (Exception e) {
            }
        }
        return list;
    }

    public String getMarkerLoginName() {
        return markerLoginName;
    }

    public void setMarkerLoginName(String markerLoginName) {
        this.markerLoginName = markerLoginName;
    }

    public Integer getUnansweredCount() {
        return unansweredCount;
    }

    public void setUnansweredCount(Integer unansweredCount) {
        this.unansweredCount = unansweredCount;
    }

}
