seven.wapperInt.Wrapper Maven / Gradle / Ivy
Show all versions of ExcelReads Show documentation
package seven.wapperInt;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.ss.usermodel.Cell;
import seven.ExcelSuperInterface;
import seven.callBack.DataFilterColumnInterface;
import seven.callBack.DataFilterInterface;
import seven.callBack.DataFilterProcessInterface;
import seven.config.Config;
import java.io.Serializable;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
//=======================================================
// .----.
// _.'__ `.
// .--(^)(^^)---/#\
// .' @ /###\
// : , #####
// `-..__.-' _.-\###/
// `;_: `"'
// .'"""""`.
// /, ya , \\
// //狗神保佑 \\
// `-._______.-'
// ___`. | .'___
// (______|______)
//=======================================================
/**
* @author Seven
* 2016年4月12日-下午4:08:08
*/
@SuppressWarnings("all")
public abstract class Wrapper implements Serializable, ExcelSuperInterface {
protected Config config = new Config();
protected DecimalFormat df = new DecimalFormat("0");
private static final String BLANK="";
protected String getCellFormatValue(Cell cell) {
String cellValue;
if (cell != null) {
switch (cell.getCellType()) {
case NUMERIC:
cellValue = df.format(cell.getNumericCellValue());
break;
case FORMULA: {
if (HSSFDateUtil.isCellDateFormatted(cell)) {
Date date = cell.getDateCellValue();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
cellValue = sdf.format(date);
} else {
cellValue = String.valueOf(cell.getStringCellValue());
}
break;
}
case STRING:
cellValue = cell.getStringCellValue();
break;
case ERROR:
case BLANK:
default:
cellValue = BLANK;
}
} else {
cellValue = BLANK;
}
return cellValue;
}
public Wrapper(Consumer consumer) {
consumer.accept(this.config);
}
/**
* 生成数据包,返回打包好的数据
*
* @return List
* @throws Exception
*/
public abstract List Create() throws Exception;
public abstract List