package com.cm.common.result;

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

/**
 * When you feel like quitting. Think about why you started
 * 当你想要放弃的时候，想想当初你为何开始
 *
 * @ClassName: UploadExcelResultDTO
 * @Description: 上传Excel结果
 * @Author: WangGeng
 * @Date: 2020/1/6 10:41 下午
 * @Version: 1.0
 **/
@ApiModel
public class UploadExcelResultDTO {

    @ApiModelProperty(name = "failedCount", value = "失败数量")
    private Integer failedCount;
    @ApiModelProperty(name = "usedTime", value = "耗时")
    private Long usedTime;
    @ApiModelProperty(name = "errorExcel", value = "错误提示Excel路径")
    private String errorExcel;

    public UploadExcelResultDTO(Integer failedCount, Long usedTime, String errorExcel) {
        this.failedCount = failedCount;
        this.usedTime = usedTime;
        this.errorExcel = errorExcel;
    }

    public Integer getFailedCount() {
        return failedCount;
    }

    public void setFailedCount(Integer failedCount) {
        this.failedCount = failedCount;
    }

    public Long getUsedTime() {
        return usedTime;
    }

    public void setUsedTime(Long usedTime) {
        this.usedTime = usedTime;
    }

    public String getErrorExcel() {
        return errorExcel == null ? "" : errorExcel.trim();
    }

    public void setErrorExcel(String errorExcel) {
        this.errorExcel = errorExcel;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("{");
        sb.append("\"failedCount\":")
                .append(failedCount);
        sb.append(",\"usedTime\":")
                .append(usedTime);
        sb.append(",\"errorExcel\":")
                .append("\"").append(errorExcel).append("\"");
        sb.append('}');
        return sb.toString();
    }
}
