Ver código fonte

时间字符串处理

厚积薄发 5 anos atrás
pai
commit
868edbc88c

+ 9 - 1
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java

@@ -224,7 +224,15 @@ public class ExcelUtil<T>
                         }
                         else
                         {
-                            val = Convert.toStr(val);
+                            String dateFormat = field.getAnnotation(Excel.class).dateFormat();
+                            if(StringUtils.isNotEmpty(dateFormat))
+                            {
+                                val=DateUtils.parseDateToStr(dateFormat,(Date) val);
+                            }
+                            else 
+                            {
+                                val = Convert.toStr(val);
+                            }
                         }
                     }
                     else if ((Integer.TYPE == fieldType) || (Integer.class == fieldType))