From b3243b62611ec22a020e988e94b535e6e758a914 Mon Sep 17 00:00:00 2001
From: chenjiahe <763432473@qq.com>
Date: 星期一, 04 九月 2023 17:25:34 +0800
Subject: [PATCH] 新版excel

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

diff --git a/src/main/java/com/hx/util/FileUtil.java b/src/main/java/com/hx/util/FileUtil.java
index 03e7fee..69a7d41 100644
--- a/src/main/java/com/hx/util/FileUtil.java
+++ b/src/main/java/com/hx/util/FileUtil.java
@@ -1,6 +1,9 @@
 package com.hx.util;
 
+import org.apache.commons.io.FileUtils;
+
 import java.io.*;
+import java.net.URL;
 
 /**
  * 鏂囦欢璇诲彇宸ュ叿绫�
@@ -10,6 +13,23 @@
 public class FileUtil {
 
     /**
+     * @param pathUrl 缃戠粶璺緞
+     * @return 鏂囦欢
+     */
+    public static File getUrlFile(String pathUrl){
+        File temp = null;
+        try{
+            URL url = new URL(pathUrl);
+            temp = File.createTempFile("temp", ".xls");
+            FileUtils.copyURLToFile(url, temp);
+            temp.deleteOnExit();
+        }catch (Exception e){
+            throw new RuntimeException("閫氳繃URL鑾峰彇鏂囦欢鍑洪敊",e);
+        }
+        return temp;
+    }
+
+    /**
      * 璇诲彇鏂囦欢鍐呭锛屼綔涓哄瓧绗︿覆杩斿洖
      */
     public static String readFileAsString(String filePath) throws IOException {

--
Gitblit v1.8.0