소스 검색

!146 浏览代码时间字符串处理
Merge pull request !146 from 厚积薄发/master

若依 5 년 전
부모
커밋
56a6e940c2
1개의 변경된 파일9개의 추가작업 그리고 1개의 파일을 삭제
  1. 9 1
      ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java

+ 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))