package com.qmth.distributed.print.business.bean.dto;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;

import java.math.BigDecimal;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Description: 课程权重dto
 * @Author: CaoZixuan
 * @Date: 2024-03-01
 */
public class CourseWeightDto {

    @ApiModelProperty("课程目标id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long courseTargetId;

    @ApiModelProperty("课程目标名称")
    private String courseTargetName;

    @ApiModelProperty("毕业要求指标（评价依据）")
    private List<CourseDimensionDto> dimensionList;

    @ApiModelProperty("毕业要求指标（评价依据）解析字符串")
    private String dimensionStr;

    @ApiModelProperty("支撑毕业要求")
    private String degreeRequirement;

    @ApiModelProperty("目标整体权重")
    private BigDecimal totalWeight;

    @ApiModelProperty("目标分值统计")
    private BigDecimal totalScore;

    @ApiModelProperty("评价方式权重详情")
    private List<CourseWeightDetailDto> evaluationList;

    public CourseWeightDto() {

    }

    public CourseWeightDto(Long courseTargetId, String courseTargetName, String degreeRequirement, BigDecimal totalWeight, BigDecimal totalScore, List<CourseWeightDetailDto> evaluationList) {
        this.courseTargetId = courseTargetId;
        this.courseTargetName = courseTargetName;
        this.degreeRequirement = degreeRequirement;
        this.totalWeight = totalWeight;
        this.totalScore = totalScore;
        this.evaluationList = evaluationList;
    }

    public Long getCourseTargetId() {
        return courseTargetId;
    }

    public void setCourseTargetId(Long courseTargetId) {
        this.courseTargetId = courseTargetId;
    }

    public String getCourseTargetName() {
        return courseTargetName;
    }

    public void setCourseTargetName(String courseTargetName) {
        this.courseTargetName = courseTargetName;
    }

    public List<CourseDimensionDto> getDimensionList() {
        return dimensionList;
    }

    public void setDimensionList(List<CourseDimensionDto> dimensionList) {
        this.dimensionList = dimensionList;
    }

    public String getDimensionStr() {
        return dimensionStr;
    }

    public void setDimensionStr(String dimensionStr) {
        this.dimensionStr = dimensionStr;
    }

    public String getDegreeRequirement() {
        return degreeRequirement;
    }

    public void setDegreeRequirement(String degreeRequirement) {
        this.degreeRequirement = degreeRequirement;
    }

    public BigDecimal getTotalWeight() {
        return totalWeight;
    }

    public void setTotalWeight(BigDecimal totalWeight) {
        this.totalWeight = totalWeight;
    }

    public BigDecimal getTotalScore() {
        return totalScore;
    }

    public void setTotalScore(BigDecimal totalScore) {
        this.totalScore = totalScore;
    }

    public List<CourseWeightDetailDto> getEvaluationList() {
        return evaluationList;
    }

    public void setEvaluationList(List<CourseWeightDetailDto> evaluationList) {
        this.evaluationList = evaluationList;
    }

    // 解析指标集合
    public void analyzeDimensionStr() {
        dimensionStr = dimensionList.stream().map(e -> String.format("%s(%s)", e.getName(), e.getCode())).collect(Collectors.joining(","));
    }
}
