package io.hmit.modules.fhjw.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

/**
 * @author Eve
 * @email mengmengeve@gmail.com
 * @create 2021/7/6
 */
@Data
@ApiModel(value = "评价统计表")
public class CommitteeCountListDTO {
    @ApiModelProperty(value = "评价的名字")
    private String name;

    @ApiModelProperty(value = "案件所属部门名称")
    private String deptName;

    @ApiModelProperty(value = "评价统计详情")
    private CommitteeCountDTO committeeCountDTO;

    /**
     * 组装返回的统计数据
     * @param countName
     * @param dto
     * @return
     */
    public CommitteeCountListDTO assembleCountListDTO(String countName,String deptName, CommitteeCountDTO dto){

        CommitteeCountListDTO countListDTO = new CommitteeCountListDTO();

        //为方便前端页面展示，如果查询出的总数为0，则将各项数值设置成0，不设置则默认为null
        if( dto.getTotalCount().equals(0)){
            countListDTO.setCommitteeCountDTO(new CommitteeCountDTO().assembleCountDTO());
        }else{
            countListDTO.setCommitteeCountDTO(dto);

        }
        countListDTO.setName(countName);
        countListDTO.setDeptName(deptName);

        return countListDTO;
    }
}
