package cn.com.countrygarden.bi.main.model.performance;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.util.Date;

/**
 * 分数统计
 * 
 * @author 59434
 * @version 2018-4-8 15:11:44
 * 
 */

public class PerformanceStatistics implements Comparable<PerformanceStatistics>{

	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long statisticsId;	//分数统计编号
	private Long elementId;	//指标编号
	private Integer year;	//年份
	private Integer month;	//月份
	private String quarter;	//季度
	private float averageScore;	//平均分
	private float actualAverageScore; //最终平均分（用于总指标时，有计算加减分总分平均分）
	private Date createdDate;	//创建日期
	private String createdBy;	//创建人
	private Date updateDate;	//更新日期
	private String updateBy;	//更新人

	public PerformanceStatistics() {
	}

	public PerformanceStatistics(Long elementId, Integer year, String quarter) {
		this.elementId = elementId;
		this.year = year;
		this.quarter = quarter;
	}

	public void setStatisticsId(Long statisticsId){
		this.statisticsId = statisticsId;
	}
	
	public Long getStatisticsId(){
		return statisticsId;
	}

	public void setElementId(Long elementId){
		this.elementId = elementId;
	}
	
	public Long getElementId(){
		return elementId;
	}
	
	public void setYear(Integer year){
		this.year = year;
	}
	
	public Integer getYear(){
		return year;
	}
	
	public void setMonth(Integer month){
		this.month = month;
	}
	
	public Integer getMonth(){
		return month;
	}

	public String getQuarter() {
		return quarter;
	}

	public void setQuarter(String quarter) {
		this.quarter = quarter;
	}

	public void setAverageScore(float averageScore){
		this.averageScore = averageScore;
	}
	
	public float getAverageScore(){
		return averageScore;
	}

	public float getActualAverageScore() {
		return actualAverageScore;
	}

	public void setActualAverageScore(float actualAverageScore) {
		this.actualAverageScore = actualAverageScore;
	}

	public void setCreatedDate(Date createdDate){
		this.createdDate = createdDate;
	}
	
	public Date getCreatedDate(){
		return createdDate;
	}
	
	public void setCreatedBy(String createdBy){
		this.createdBy = createdBy;
	}
	
	public String getCreatedBy(){
		return createdBy;
	}
	
	public void setUpdateDate(Date updateDate){
		this.updateDate = updateDate;
	}
	
	public Date getUpdateDate(){
		return updateDate;
	}
	
	public void setUpdateBy(String updateBy){
		this.updateBy = updateBy;
	}
	
	public String getUpdateBy(){
		return updateBy;
	}

	@Override
	public int compareTo(PerformanceStatistics performanceStatistics) {
       int num = 0;
       int thisParam = Integer.parseInt(this.quarter);
       int nextParam = Integer.parseInt(performanceStatistics.quarter);

       if(nextParam < thisParam)
       	   num = 1;
       else if(nextParam > thisParam)
		   num =  -1;

		return num;
	}
}