package com.lz.common.utils.excel;

import com.lz.common.utils.StringUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * @BelongsProject: ltapi
 * @BelongsPackage: com.lz.lt.api.common.util.excel
 * @Author: gui.quanwang
 * @CreateTime: 2018-11-27 16:45
 * @Description: excel错误日志记录
 * @注意：本内容仅限于杭州霖梓网络科技有限公司内部传阅，禁止外泄以及用于其他的商业目的
 */
public class ExcelLogs {

    /**
     * 是否出错
     */
    private Boolean hasError;

    /**
     * excel集合
     */
    private List<ExcelLog> logList;

    public ExcelLogs() {
        super();
        hasError = false;
    }

    /**
     * @return the hasError
     */
    public Boolean getHasError() {
        return hasError;
    }

    /**
     * @param hasError the hasError to set
     */
    public void setHasError(Boolean hasError) {
        this.hasError = hasError;
    }

    /**
     * @return the logList
     */
    public List<ExcelLog> getLogList() {
        return logList;
    }

    /**
     * @param logList the logList to set
     */
    public void setLogList(List<ExcelLog> logList) {
        this.logList = logList;
    }

    /**
     * 获取错误excel集合
     * @return
     */
    public List<ExcelLog> getErrorLogList() {
        List<ExcelLog> errList = new ArrayList<>();
        for (ExcelLog log : this.logList) {
            if (log != null && StringUtil.isNotBlank(log.getLog())) {
                errList.add(log);
            }
        }
        return errList;
    }

    @Override
    public String toString() {
        return "ExcelLogs{" +
                "hasError=" + hasError +
                ", logList=" + logList +
                '}';
    }
}
