package org.springblade.audit.listener;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import lombok.extern.slf4j.Slf4j;
import org.springblade.audit.dto.FctCsComplaintDetailDTO;
import org.springblade.audit.dto.StreamDTO;
import org.springframework.stereotype.Component;

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

@Slf4j
@Component
public class StreamListener extends AnalysisEventListener<StreamDTO> {

	public List<StreamDTO> list = new ArrayList<StreamDTO>();

	public boolean sysHead = true;

	public List<String> theMonth = new ArrayList<String>();

	public StreamListener() {
	}

	@Override
	public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) { }

	@Override
	public void invoke(StreamDTO t, AnalysisContext analysisContext) {
		Integer rowIndex = analysisContext.readRowHolder().getRowIndex();
		if(rowIndex == 1){
			theMonth.add(t.getArea());
		}
		if(rowIndex > 2){
			list.add(t);
		}

	}

	@Override
	public void doAfterAllAnalysed(AnalysisContext analysisContext) {
	}


}
