From e7c3ff19f5abea1f1510503b46f99c6ad3870410 Mon Sep 17 00:00:00 2001
From: chenjiahe <763432473@qq.com>
Date: 星期五, 19 八月 2022 18:28:46 +0800
Subject: [PATCH] 判断excel文件

---
 src/main/java/com/hx/util/ExcelUtil.java |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/hx/util/ExcelUtil.java b/src/main/java/com/hx/util/ExcelUtil.java
index a6dfaac..d0b4f6d 100644
--- a/src/main/java/com/hx/util/ExcelUtil.java
+++ b/src/main/java/com/hx/util/ExcelUtil.java
@@ -705,4 +705,18 @@
 		return "";
 	}
 
+	/**
+	 * p鍒ゆ柇鏄惁excel鏂囦欢
+	 * @param file
+	 * @return
+	 */
+	public static boolean isExcel(MultipartFile file){
+		String fileName = file.getOriginalFilename();
+		if (!fileName.matches("^.+\\.(?i)(xls)$") && !fileName.matches("^.+\\.(?i)(xlsx)$")) {
+			return false;
+		}
+		return true;
+	}
+
+
 }
\ No newline at end of file

--
Gitblit v1.8.0