package com.ssj.service.conch.parents.v2.dto;

import com.alibaba.fastjson.annotation.JSONField;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * @author yrf
 * @description
 * @time 2019/9/18 19:40
 */
public class KnowledgePointProportionDTO implements Serializable {

    private static final long serialVersionUID = 6935623534574752903L;

    private String knowledgeName;
    private BigDecimal proportion;

    /**
     * 此知识点涉及次数
     */
    @JSONField(serialize = false)
    private Integer countNum = 0;

    /**
     * 所有知识点涉及总次数(每个知识点涉及次数之和)
     */
    @JSONField(serialize = false)
    private Integer allTotalCount = 0;

    public String getKnowledgeName() {
        return knowledgeName;
    }

    public void setKnowledgeName(String knowledgeName) {
        this.knowledgeName = knowledgeName;
    }

    public BigDecimal getProportion() {
        if (proportion == null) {
            proportion = new BigDecimal(countNum * 1.0 / allTotalCount).setScale(2, BigDecimal.ROUND_DOWN);
        }
        return proportion;
    }

    public void setProportion(BigDecimal proportion) {
        this.proportion = proportion;
    }

    public Integer getCountNum() {
        return countNum;
    }

    public void setCountNum(Integer countNum) {
        this.countNum = countNum;
    }

    public Integer getAllTotalCount() {
        return allTotalCount;
    }

    public void setAllTotalCount(Integer allTotalCount) {
        this.allTotalCount = allTotalCount;
    }
}
