org.jeecgframework.poi.handler.inter.IExcelDataHandler Java Examples

The following examples show how to use org.jeecgframework.poi.handler.inter.IExcelDataHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CellValueServer.java    From autopoi with Apache License 2.0 6 votes vote down vote up
/**
 * 获取cell的值
 * 
 * @param object
 * @param excelParams
 * @param cell
 * @param titleString
 */
public Object getValue(IExcelDataHandler dataHanlder, Object object, Cell cell, Map<String, ExcelImportEntity> excelParams, String titleString) throws Exception {
	ExcelImportEntity entity = excelParams.get(titleString);
	String xclass = "class java.lang.Object";
	if (!(object instanceof Map)) {
		Method setMethod = entity.getMethods() != null && entity.getMethods().size() > 0 ? entity.getMethods().get(entity.getMethods().size() - 1) : entity.getMethod();
		Type[] ts = setMethod.getGenericParameterTypes();
		xclass = ts[0].toString();
	}
	Object result = getCellValue(xclass, cell, entity);
	if (entity != null) {
		result = hanlderSuffix(entity.getSuffix(), result);
		//update-begin-author:taoYan date:20180807 for:多值替换
		result = replaceValue(entity.getReplace(), result,entity.isMultiReplace());
		//update-end-author:taoYan date:20180807 for:多值替换
	}
	result = hanlderValue(dataHanlder, object, result, titleString);
	return getValueByType(xclass, result, entity);
}
 
Example #2
Source File: CellValueServer.java    From easypoi with Apache License 2.0 6 votes vote down vote up
/**
 * 获取cell的值
 * 
 * @param object
 * @param excelParams
 * @param cell
 * @param titleString
 */
public Object getValue(IExcelDataHandler dataHanlder, Object object, Cell cell,
                       Map<String, ExcelImportEntity> excelParams, String titleString)
                                                                                      throws Exception {
    ExcelImportEntity entity = excelParams.get(titleString);
    String xclass = "class java.lang.Object";
    if (!(object instanceof Map)) {
        Method setMethod = entity.getMethods() != null && entity.getMethods().size() > 0 ? entity
            .getMethods().get(entity.getMethods().size() - 1) : entity.getMethod();
        Type[] ts = setMethod.getGenericParameterTypes();
        xclass = ts[0].toString();
    }
    Object result = getCellValue(xclass, cell, entity);
    if (entity != null) {
        result = hanlderSuffix(entity.getSuffix(), result);
        result = replaceValue(entity.getReplace(), result);
    }
    result = hanlderValue(dataHanlder, object, result, titleString);
    return getValueByType(xclass, result, entity);
}
 
Example #3
Source File: CellValueServer.java    From jeasypoi with Apache License 2.0 6 votes vote down vote up
/**
 * 获取cell的值
 * 
 * @param object
 * @param excelParams
 * @param cell
 * @param titleString
 */
public Object getValue(IExcelDataHandler dataHanlder, Object object, Cell cell, Map<String, ExcelImportEntity> excelParams, String titleString) throws Exception {
	ExcelImportEntity entity = excelParams.get(titleString);
	String xclass = "class java.lang.Object";
	if (!(object instanceof Map)) {
		Method setMethod = entity.getMethods() != null && entity.getMethods().size() > 0 ? entity.getMethods().get(entity.getMethods().size() - 1) : entity.getMethod();
		Type[] ts = setMethod.getGenericParameterTypes();
		xclass = ts[0].toString();
	}
	Object result = getCellValue(xclass, cell, entity);
	if (entity != null) {
		result = hanlderSuffix(entity.getSuffix(), result);
		result = replaceValue(entity.getReplace(), result);
	}
	result = hanlderValue(dataHanlder, object, result, titleString);
	return getValueByType(xclass, result, entity);
}
 
Example #4
Source File: CellValueServer.java    From autopoi with Apache License 2.0 5 votes vote down vote up
/**
 * 获取cell值
 * 
 * @param dataHanlder
 * @param object
 * @param entity
 * @param excelParams
 * @param titleString
 * @return
 */
public Object getValue(IExcelDataHandler dataHanlder, Object object, SaxReadCellEntity cellEntity, Map<String, ExcelImportEntity> excelParams, String titleString) {
	ExcelImportEntity entity = excelParams.get(titleString);
	Method setMethod = entity.getMethods() != null && entity.getMethods().size() > 0 ? entity.getMethods().get(entity.getMethods().size() - 1) : entity.getMethod();
	Type[] ts = setMethod.getGenericParameterTypes();
	String xclass = ts[0].toString();
	Object result = cellEntity.getValue();
	result = hanlderSuffix(entity.getSuffix(), result);
	//update-begin-auhtor:taoyan date:20180807 for:多值替换
	result = replaceValue(entity.getReplace(), result,entity.isMultiReplace());
	//update-end-auhtor:taoyan date:20180807 for:多值替换
	result = hanlderValue(dataHanlder, object, result, titleString);
	return getValueByType(xclass, result, entity);
}
 
Example #5
Source File: CellValueServer.java    From autopoi with Apache License 2.0 5 votes vote down vote up
/**
 * 调用处理接口处理值
 * 
 * @param dataHanlder
 * @param object
 * @param result
 * @param titleString
 * @return
 */
private Object hanlderValue(IExcelDataHandler dataHanlder, Object object, Object result, String titleString) {
	if (dataHanlder == null || dataHanlder.getNeedHandlerFields() == null || dataHanlder.getNeedHandlerFields().length == 0) {
		return result;
	}
	if (hanlderList == null) {
		hanlderList = Arrays.asList(dataHanlder.getNeedHandlerFields());
	}
	if (hanlderList.contains(titleString)) {
		return dataHanlder.importHandler(object, titleString, result);
	}
	return result;
}
 
Example #6
Source File: CellValueServer.java    From easypoi with Apache License 2.0 5 votes vote down vote up
/**
 * 调用处理接口处理值
 * 
 * @param dataHanlder
 * @param object
 * @param result
 * @param titleString
 * @return
 */
private Object hanlderValue(IExcelDataHandler dataHanlder, Object object, Object result,
                            String titleString) {
    if (dataHanlder == null || dataHanlder.getNeedHandlerFields() == null
        || dataHanlder.getNeedHandlerFields().length == 0) {
        return result;
    }
    if (hanlderList == null) {
        hanlderList = Arrays.asList(dataHanlder.getNeedHandlerFields());
    }
    if (hanlderList.contains(titleString)) {
        return dataHanlder.importHandler(object, titleString, result);
    }
    return result;
}
 
Example #7
Source File: CellValueServer.java    From easypoi with Apache License 2.0 5 votes vote down vote up
/**
 * 获取cell值
 * @param dataHanlder
 * @param object
 * @param entity
 * @param excelParams
 * @param titleString
 * @return
 */
public Object getValue(IExcelDataHandler dataHanlder, Object object,
                       SaxReadCellEntity cellEntity,
                       Map<String, ExcelImportEntity> excelParams, String titleString) {
    ExcelImportEntity entity = excelParams.get(titleString);
    Method setMethod = entity.getMethods() != null && entity.getMethods().size() > 0 ? entity
        .getMethods().get(entity.getMethods().size() - 1) : entity.getMethod();
    Type[] ts = setMethod.getGenericParameterTypes();
    String xclass = ts[0].toString();
    Object result = cellEntity.getValue();
    result = hanlderSuffix(entity.getSuffix(), result);
    result = replaceValue(entity.getReplace(), result);
    result = hanlderValue(dataHanlder, object, result, titleString);
    return getValueByType(xclass, result, entity);
}
 
Example #8
Source File: CellValueServer.java    From jeasypoi with Apache License 2.0 5 votes vote down vote up
/**
 * 获取cell值
 * 
 * @param dataHanlder
 * @param object
 * @param entity
 * @param excelParams
 * @param titleString
 * @return
 */
public Object getValue(IExcelDataHandler dataHanlder, Object object, SaxReadCellEntity cellEntity, Map<String, ExcelImportEntity> excelParams, String titleString) {
	ExcelImportEntity entity = excelParams.get(titleString);
	Method setMethod = entity.getMethods() != null && entity.getMethods().size() > 0 ? entity.getMethods().get(entity.getMethods().size() - 1) : entity.getMethod();
	Type[] ts = setMethod.getGenericParameterTypes();
	String xclass = ts[0].toString();
	Object result = cellEntity.getValue();
	result = hanlderSuffix(entity.getSuffix(), result);
	result = replaceValue(entity.getReplace(), result);
	result = hanlderValue(dataHanlder, object, result, titleString);
	return getValueByType(xclass, result, entity);
}
 
Example #9
Source File: CellValueServer.java    From jeasypoi with Apache License 2.0 5 votes vote down vote up
/**
 * 调用处理接口处理值
 * 
 * @param dataHanlder
 * @param object
 * @param result
 * @param titleString
 * @return
 */
private Object hanlderValue(IExcelDataHandler dataHanlder, Object object, Object result, String titleString) {
	if (dataHanlder == null || dataHanlder.getNeedHandlerFields() == null || dataHanlder.getNeedHandlerFields().length == 0) {
		return result;
	}
	if (hanlderList == null) {
		hanlderList = Arrays.asList(dataHanlder.getNeedHandlerFields());
	}
	if (hanlderList.contains(titleString)) {
		return dataHanlder.importHandler(object, titleString, result);
	}
	return result;
}
 
Example #10
Source File: ExcelListEntity.java    From easypoi with Apache License 2.0 4 votes vote down vote up
public ExcelListEntity(List<?> list, Class<?> clazz, IExcelDataHandler dataHanlder, int headRows) {
    this.list = list;
    this.clazz = clazz;
    this.headRows = headRows;
    setDataHanlder(dataHanlder);
}
 
Example #11
Source File: ExcelBaseParams.java    From autopoi with Apache License 2.0 4 votes vote down vote up
public IExcelDataHandler getDataHanlder() {
	return dataHanlder;
}
 
Example #12
Source File: ExcelListEntity.java    From easypoi with Apache License 2.0 4 votes vote down vote up
public ExcelListEntity(List<?> list, Class<?> clazz, IExcelDataHandler dataHanlder) {
    this.list = list;
    this.clazz = clazz;
    setDataHanlder(dataHanlder);
}
 
Example #13
Source File: ExcelBaseParams.java    From easypoi with Apache License 2.0 4 votes vote down vote up
public void setDataHanlder(IExcelDataHandler dataHanlder) {
    this.dataHanlder = dataHanlder;
}
 
Example #14
Source File: ExcelBaseParams.java    From easypoi with Apache License 2.0 4 votes vote down vote up
public IExcelDataHandler getDataHanlder() {
    return dataHanlder;
}
 
Example #15
Source File: ExcelListEntity.java    From jeasypoi with Apache License 2.0 4 votes vote down vote up
public ExcelListEntity(List<?> list, Class<?> clazz, IExcelDataHandler dataHanlder, int headRows) {
	this.list = list;
	this.clazz = clazz;
	this.headRows = headRows;
	setDataHanlder(dataHanlder);
}
 
Example #16
Source File: ExcelListEntity.java    From jeasypoi with Apache License 2.0 4 votes vote down vote up
public ExcelListEntity(List<?> list, Class<?> clazz, IExcelDataHandler dataHanlder) {
	this.list = list;
	this.clazz = clazz;
	setDataHanlder(dataHanlder);
}
 
Example #17
Source File: ExcelBaseParams.java    From jeasypoi with Apache License 2.0 4 votes vote down vote up
public void setDataHanlder(IExcelDataHandler dataHanlder) {
	this.dataHanlder = dataHanlder;
}
 
Example #18
Source File: ExcelBaseParams.java    From jeasypoi with Apache License 2.0 4 votes vote down vote up
public IExcelDataHandler getDataHanlder() {
	return dataHanlder;
}
 
Example #19
Source File: ExcelListEntity.java    From autopoi with Apache License 2.0 4 votes vote down vote up
public ExcelListEntity(List<?> list, Class<?> clazz, IExcelDataHandler dataHanlder, int headRows) {
	this.list = list;
	this.clazz = clazz;
	this.headRows = headRows;
	setDataHanlder(dataHanlder);
}
 
Example #20
Source File: ExcelListEntity.java    From autopoi with Apache License 2.0 4 votes vote down vote up
public ExcelListEntity(List<?> list, Class<?> clazz, IExcelDataHandler dataHanlder) {
	this.list = list;
	this.clazz = clazz;
	setDataHanlder(dataHanlder);
}
 
Example #21
Source File: ExcelBaseParams.java    From autopoi with Apache License 2.0 4 votes vote down vote up
public void setDataHanlder(IExcelDataHandler dataHanlder) {
	this.dataHanlder = dataHanlder;
}