All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.zznote.basecommon.common.excel.DefautExcelResult Maven / Gradle / Ivy

The newest version!
package com.zznote.basecommon.common.excel;

import cn.hutool.core.util.StrUtil;
import lombok.Setter;

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

/**
 * 默认excel返回对象
 *
 * @author Yjoioooo
 * @author Lion Li
 */
public class DefautExcelResult implements ExcelResult {

    /**
     * 数据对象list
     */
    @Setter
    private List list;

    /**
     * 错误信息列表
     */
    @Setter
    private List errorList;

    public DefautExcelResult() {
        this.list = new ArrayList<>();
        this.errorList = new ArrayList<>();
    }

    public DefautExcelResult(List list, List errorList) {
        this.list = list;
        this.errorList = errorList;
    }

    public DefautExcelResult(ExcelResult excelResult) {
        this.list = excelResult.getList();
        this.errorList = excelResult.getErrorList();
    }

    @Override
    public List getList() {
        return list;
    }

    @Override
    public List getErrorList() {
        return errorList;
    }

    /**
     * 获取导入回执
     *
     * @return 导入回执
     */
    @Override
    public String getAnalysis() {
        int successCount = list.size();
        int errorCount = errorList.size();
        if (successCount == 0) {
            return "读取失败,未解析到数据";
        } else {
            if (errorCount == 0) {
                return StrUtil.format("恭喜您,全部读取成功!共{}条", successCount);
            } else {
                return "";
            }
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy