package com.ym.mec.biz.dal.dto;

import io.swagger.annotations.ApiModelProperty;

import java.math.BigDecimal;
import java.util.Objects;

public class StudentServeExportDto{
    @ApiModelProperty(value = "学生编号", required = false)
    private Integer studentId;

    @ApiModelProperty(value = "姓名", required = false)
    private String username;

    @ApiModelProperty(value = "乐团名称", required = false)
    private String musicGroupName;

    @ApiModelProperty(value = "分部", required = false)
    private String organName;

    @ApiModelProperty(value = "服务周期开始", required = false)
    private String monday;

    @ApiModelProperty(value = "服务周期", required = false)
    private String sunday;

    @ApiModelProperty(value = "服务指标总数", required = false)
    private Integer serveTotalNum;

    @ApiModelProperty(value = "已布置", required = false)
    private Integer actualExercisesNum;

    @ApiModelProperty(value = "已提交数", required = false)
    private Integer exercisesReplyNum;

    @ApiModelProperty(value = "点评数", required = false)
    private Integer exercisesMessageNum;

    @ApiModelProperty(value = "签到次数", required = false)
    private Integer signNum;

    @ApiModelProperty(value = "课程总数", required = false)
    private Integer courseNum;

    @ApiModelProperty(value = "达标次数", required = false)
    private Integer qualifiedNum;

    @ApiModelProperty(value = "出勤率", required = false)
    private BigDecimal signRate;

    @ApiModelProperty(value = "达标率", required = false)
    private BigDecimal passRate;

    @ApiModelProperty(value = "单技课数量", required = false)
    private Integer singleNum;

    @ApiModelProperty(value = "合奏课数量", required = false)
    private Integer mixNum;

    @ApiModelProperty(value = "缺勤次数", required = false)
    private Integer notSignNum;

    @ApiModelProperty(value = "缺勤日期", required = false)
    private String notSignDate;

    @ApiModelProperty(value = "未提交作业的服务周期", required = false)
    private String notHomeworkDate;

    public Integer getStudentId() {
        return studentId;
    }

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

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getMusicGroupName() {
        return musicGroupName;
    }

    public void setMusicGroupName(String musicGroupName) {
        this.musicGroupName = musicGroupName;
    }

    public String getOrganName() {
        return organName;
    }

    public void setOrganName(String organName) {
        this.organName = organName;
    }

    public String getMonday() {
        return monday;
    }

    public void setMonday(String monday) {
        this.monday = monday;
    }

    public String getSunday() {
        return sunday;
    }

    public void setSunday(String sunday) {
        this.sunday = sunday;
    }

    public Integer getServeTotalNum() {
        return serveTotalNum;
    }

    public void setServeTotalNum(Integer serveTotalNum) {
        this.serveTotalNum = serveTotalNum;
    }

    public Integer getActualExercisesNum() {
        return actualExercisesNum;
    }

    public void setActualExercisesNum(Integer actualExercisesNum) {
        this.actualExercisesNum = actualExercisesNum;
    }

    public Integer getExercisesReplyNum() {
        return exercisesReplyNum;
    }

    public void setExercisesReplyNum(Integer exercisesReplyNum) {
        this.exercisesReplyNum = exercisesReplyNum;
    }

    public Integer getExercisesMessageNum() {
        return exercisesMessageNum;
    }

    public void setExercisesMessageNum(Integer exercisesMessageNum) {
        this.exercisesMessageNum = exercisesMessageNum;
    }

    public Integer getSignNum() {
        return signNum;
    }

    public void setSignNum(Integer signNum) {
        this.signNum = signNum;
        this.calcSignRate(courseNum);
    }

    public Integer getCourseNum() {
        return courseNum;
    }

    public void setCourseNum(Integer courseNum) {
        this.courseNum = courseNum;
        this.calcSignRate(signNum);
        this.calcPassRate(qualifiedNum);
    }

    public Integer getQualifiedNum() {
        return qualifiedNum;
    }

    public void setQualifiedNum(Integer qualifiedNum) {
        this.qualifiedNum = qualifiedNum;
        this.calcPassRate(courseNum);
    }

    public BigDecimal getSignRate() {
        return signRate;
    }

    public void setSignRate(BigDecimal signRate) {
        this.signRate = signRate;
    }

    public BigDecimal getPassRate() {
        return passRate;
    }

    public void setPassRate(BigDecimal passRate) {
        this.passRate = passRate;
    }

    public Integer getSingleNum() {
        return singleNum;
    }

    public void setSingleNum(Integer singleNum) {
        this.singleNum = singleNum;
    }

    public Integer getMixNum() {
        return mixNum;
    }

    public void setMixNum(Integer mixNum) {
        this.mixNum = mixNum;
    }

    public Integer getNotSignNum() {
        return notSignNum;
    }

    public void setNotSignNum(Integer notSignNum) {
        this.notSignNum = notSignNum;
    }

    public String getNotSignDate() {
        return notSignDate;
    }

    public void setNotSignDate(String notSignDate) {
        this.notSignDate = notSignDate;
    }

    public String getNotHomeworkDate() {
        return notHomeworkDate;
    }

    public void setNotHomeworkDate(String notHomeworkDate) {
        this.notHomeworkDate = notHomeworkDate;
    }

    private void calcSignRate(Integer param){
        if(Objects.nonNull(param)){
            if(signNum.equals(0) || courseNum.equals(0)){
                this.signRate = BigDecimal.ZERO;
            }else {
                this.signRate = new BigDecimal(signNum).divide(new BigDecimal(courseNum),BigDecimal.ROUND_HALF_UP,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(BigDecimal.ROUND_CEILING);
            }
        }
    }

    private void calcPassRate(Integer param){
        if(Objects.nonNull(param)){
            if(qualifiedNum.equals(0) || courseNum.equals(0)){
                this.passRate = BigDecimal.ZERO;
            }else {
                this.passRate = new BigDecimal(qualifiedNum).divide(new BigDecimal(courseNum),BigDecimal.ROUND_HALF_UP,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(BigDecimal.ROUND_CEILING);
            }
        }
    }
}
