Java Code Examples for org.jeecgframework.poi.excel.entity.params.ExcelImportEntity#getMethods()

The following examples show how to use org.jeecgframework.poi.excel.entity.params.ExcelImportEntity#getMethods() . 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 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 3
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 4
Source File: ImportBaseService.java    From autopoi with Apache License 2.0 5 votes vote down vote up
/**
 * 
 * @param entity
 * @param object
 * @param value
 * @throws Exception
 */
public void setValues(ExcelImportEntity entity, Object object, Object value) throws Exception {
	if (entity.getMethods() != null) {
		setFieldBySomeMethod(entity.getMethods(), object, value);
	} else {
		entity.getMethod().invoke(object, value);
	}
}
 
Example 5
Source File: ExcelImportServer.java    From autopoi with Apache License 2.0 5 votes vote down vote up
/**
 * 获取保存的真实路径
 * 
 * @param excelImportEntity
 * @param object
 * @return
 * @throws Exception
 */
private String getSaveUrl(ExcelImportEntity excelImportEntity, Object object) throws Exception {
	String url = "";
	if (excelImportEntity.getSaveUrl().equals("upload")) {
		if (excelImportEntity.getMethods() != null && excelImportEntity.getMethods().size() > 0) {
			object = getFieldBySomeMethod(excelImportEntity.getMethods(), object);
		}
		url = object.getClass().getName().split("\\.")[object.getClass().getName().split("\\.").length - 1];
		return excelImportEntity.getSaveUrl() + "/" + url.substring(0, url.lastIndexOf("Entity"));
	}
	return excelImportEntity.getSaveUrl();
}
 
Example 6
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 7
Source File: ImportBaseService.java    From jeasypoi with Apache License 2.0 5 votes vote down vote up
/**
 * 
 * @param entity
 * @param object
 * @param value
 * @throws Exception
 */
public void setValues(ExcelImportEntity entity, Object object, Object value) throws Exception {
	if (entity.getMethods() != null) {
		setFieldBySomeMethod(entity.getMethods(), object, value);
	} else {
		entity.getMethod().invoke(object, value);
	}
}
 
Example 8
Source File: ExcelImportServer.java    From jeasypoi with Apache License 2.0 5 votes vote down vote up
/**
 * 获取保存的真实路径
 * 
 * @param excelImportEntity
 * @param object
 * @return
 * @throws Exception
 */
private String getSaveUrl(ExcelImportEntity excelImportEntity, Object object) throws Exception {
	String url = "";
	if (excelImportEntity.getSaveUrl().equals("upload")) {
		if (excelImportEntity.getMethods() != null && excelImportEntity.getMethods().size() > 0) {
			object = getFieldBySomeMethod(excelImportEntity.getMethods(), object);
		}
		url = object.getClass().getName().split("\\.")[object.getClass().getName().split("\\.").length - 1];
		return excelImportEntity.getSaveUrl() + "/" + url.substring(0, url.lastIndexOf("Entity"));
	}
	return excelImportEntity.getSaveUrl();
}
 
Example 9
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 10
Source File: ImportBaseService.java    From easypoi with Apache License 2.0 5 votes vote down vote up
/**
 * 
 * @param entity
 * @param object
 * @param value
 * @throws Exception
 */
public void setValues(ExcelImportEntity entity, Object object, Object value) throws Exception {
    if (entity.getMethods() != null) {
        setFieldBySomeMethod(entity.getMethods(), object, value);
    } else {
        entity.getMethod().invoke(object, value);
    }
}
 
Example 11
Source File: ExcelImportServer.java    From easypoi with Apache License 2.0 5 votes vote down vote up
/**
 * 获取保存的真实路径
 * 
 * @param excelImportEntity
 * @param object
 * @return
 * @throws Exception
 */
private String getSaveUrl(ExcelImportEntity excelImportEntity, Object object) throws Exception {
    String url = "";
    if (excelImportEntity.getSaveUrl().equals("upload")) {
        if (excelImportEntity.getMethods() != null && excelImportEntity.getMethods().size() > 0) {
            object = getFieldBySomeMethod(excelImportEntity.getMethods(), object);
        }
        url = object.getClass().getName().split("\\.")[object.getClass().getName().split("\\.").length - 1];
        return excelImportEntity.getSaveUrl() + "/"
               + url.substring(0, url.lastIndexOf("Entity"));
    }
    return excelImportEntity.getSaveUrl();
}
 
Example 12
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);
}