Commit ce298e84 by guojuxing

excel导出修改:判空

parent 63e3bb66
...@@ -54,6 +54,9 @@ public class DownloadUtils { ...@@ -54,6 +54,9 @@ public class DownloadUtils {
* @date 2017年3月16日 上午11:45:45 * @date 2017年3月16日 上午11:45:45
*/ */
protected String convertProperty(T bean, String propertyName, Object property) { protected String convertProperty(T bean, String propertyName, Object property) {
if (property == null) {
return "";
}
try { try {
Class clazz = getPropertyType(bean, propertyName); Class clazz = getPropertyType(bean, propertyName);
if (Date.class.equals(clazz)) { if (Date.class.equals(clazz)) {
...@@ -67,7 +70,7 @@ public class DownloadUtils { ...@@ -67,7 +70,7 @@ public class DownloadUtils {
LOGGER.info("bean:" + bean + ",Property:" + propertyName + e.getMessage(), e); LOGGER.info("bean:" + bean + ",Property:" + propertyName + e.getMessage(), e);
return null; return null;
} }
return property == null ? "" : property.toString(); return property.toString();
} }
protected Class getPropertyType(T bean, String propertyName) { protected Class getPropertyType(T bean, String propertyName) {
...@@ -112,6 +115,9 @@ public class DownloadUtils { ...@@ -112,6 +115,9 @@ public class DownloadUtils {
} }
protected String convertPropertyOfDouble(Object bean, String propertyName, Object property) { protected String convertPropertyOfDouble(Object bean, String propertyName, Object property) {
if (property == null) {
return "";
}
try { try {
Class clazz = getPropertyTypeOfDouble(bean, propertyName); Class clazz = getPropertyTypeOfDouble(bean, propertyName);
if (Date.class.equals(clazz)) { if (Date.class.equals(clazz)) {
...@@ -125,7 +131,7 @@ public class DownloadUtils { ...@@ -125,7 +131,7 @@ public class DownloadUtils {
LOGGER.info("bean:" + bean + ",Property:" + propertyName + e.getMessage(), e); LOGGER.info("bean:" + bean + ",Property:" + propertyName + e.getMessage(), e);
return null; return null;
} }
return property == null ? "" : property.toString(); return property.toString();
} }
protected Class getPropertyTypeOfDouble(Object bean, String propertyName) { protected Class getPropertyTypeOfDouble(Object bean, String propertyName) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment