package cn.com.tenlion.configcontent.pojo.dtos.contentantistop;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;

public abstract class ContentAntistopExcelListener extends AnalysisEventListener<ContentAntistopExcel> {

        private static final Logger LOG = LoggerFactory.getLogger(ContentAntistopExcelListener.class);

        private List<ContentAntistopExcel> areaExcels = new ArrayList<>(0);

        @Override
        public void invoke(ContentAntistopExcel newsAntistopExcel, AnalysisContext analysisContext) {
            areaExcels.add(newsAntistopExcel);
        }

        @Override
        public void doAfterAllAnalysed(AnalysisContext analysisContext) {
            try {
                listAreaExcel(areaExcels);
            } catch (Exception e) {
                LOG.error(e.getMessage());
            }
            areaExcels.clear();
        }

        public abstract void listAreaExcel(List<ContentAntistopExcel> newsAntistopExcels) throws Exception;

}
