Java Code Examples for org.jeecgframework.poi.excel.entity.params.ExcelExportEntity#getSuffix()

The following examples show how to use org.jeecgframework.poi.excel.entity.params.ExcelExportEntity#getSuffix() . 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: ExportBase.java    From jeasypoi with Apache License 2.0 6 votes vote down vote up
/**
 * 获取填如这个cell的值,提供一些附加功能
 * 
 * @param entity
 * @param obj
 * @return
 * @throws Exception
 */
public Object getCellValue(ExcelExportEntity entity, Object obj) throws Exception {
	Object value;
	if (obj instanceof Map) {
		value = ((Map<?, ?>) obj).get(entity.getKey());
	} else {
		value = entity.getMethods() != null ? getFieldBySomeMethod(entity.getMethods(), obj) : entity.getMethod().invoke(obj, new Object[] {});
	}
	if (StringUtils.isNotEmpty(entity.getFormat())) {
		value = formatValue(value, entity);
	}
	if (entity.getReplace() != null && entity.getReplace().length > 0) {
		value = replaceValue(entity.getReplace(), String.valueOf(value));
	}
	if (needHanlderList != null && needHanlderList.contains(entity.getName())) {
		value = dataHanlder.exportHandler(obj, entity.getName(), value);
	}
	if (StringUtils.isNotEmpty(entity.getSuffix()) && value != null) {
		value = value + entity.getSuffix();
	}
	return value == null ? "" : value.toString();
}
 
Example 2
Source File: ExportBase.java    From easypoi with Apache License 2.0 6 votes vote down vote up
/**
 * 获取填如这个cell的值,提供一些附加功能
 * 
 * @param entity
 * @param obj
 * @return
 * @throws Exception
 */
public Object getCellValue(ExcelExportEntity entity, Object obj) throws Exception {
    Object value;
    if (obj instanceof Map) {
        value = ((Map<?, ?>) obj).get(entity.getKey());
    } else {
        value = entity.getMethods() != null ? getFieldBySomeMethod(entity.getMethods(), obj)
            : entity.getMethod().invoke(obj, new Object[] {});
    }
    if (StringUtils.isNotEmpty(entity.getFormat())) {
        value = formatValue(value, entity);
    }
    if (entity.getReplace() != null && entity.getReplace().length > 0) {
        value = replaceValue(entity.getReplace(), String.valueOf(value));
    }
    if (needHanlderList != null && needHanlderList.contains(entity.getName())) {
        value = dataHanlder.exportHandler(obj, entity.getName(), value);
    }
    if (StringUtils.isNotEmpty(entity.getSuffix()) && value != null) {
        value = value + entity.getSuffix();
    }
    return value == null ? "" : value.toString();
}
 
Example 3
Source File: ExportBase.java    From autopoi with Apache License 2.0 5 votes vote down vote up
/**
 * 获取填如这个cell的值,提供一些附加功能
 * 
 * @param entity
 * @param obj
 * @return
 * @throws Exception
 */
public Object getCellValue(ExcelExportEntity entity, Object obj) throws Exception {
	Object value;
	if (obj instanceof Map) {
		value = ((Map<?, ?>) obj).get(entity.getKey());
	} else {
		value = entity.getMethods() != null ? getFieldBySomeMethod(entity.getMethods(), obj) : entity.getMethod().invoke(obj, new Object[] {});
	}
	//update-begin-author:taoyan date:2020319 for:Excel注解的numFormat方法似乎未实现 #970
	if (StringUtils.isNotEmpty(entity.getNumFormat()) && value!=null) {
		value = new DecimalFormat(entity.getNumFormat()).format(value);
	}
	//update-end-author:taoyan date:2020319 for:Excel注解的numFormat方法似乎未实现 #970

	if (StringUtils.isNotEmpty(entity.getFormat())) {
		value = formatValue(value, entity);
	}
	if (entity.getReplace() != null && entity.getReplace().length > 0) {
		//update-begin-author:taoyan date:20180731 for:TASK #3038 【bug】Excel 导出多个值(逗号隔开的情况下,导出字典值是ID值)
		if(value == null){
			value = "";//String.valueOf(value) 如果value为null 则返回"null"
		}
		if(entity.isMultiReplace()){
			value = multiReplaceValue(entity.getReplace(), String.valueOf(value));
		}else{
			value = replaceValue(entity.getReplace(), String.valueOf(value));
		}
		//update-end-author:taoyan date:20180731 for:TASK #3038 【bug】Excel 导出多个值(逗号隔开的情况下,导出字典值是ID值)
	}
	if (needHanlderList != null && needHanlderList.contains(entity.getName())) {
		value = dataHanlder.exportHandler(obj, entity.getName(), value);
	}
	if (StringUtils.isNotEmpty(entity.getSuffix()) && value != null) {
		value = value + entity.getSuffix();
	}
	return value == null ? "" : value.toString();
}