From 82e3be7117a57a4abec0e1c49a5b3bcffb588e81 Mon Sep 17 00:00:00 2001
From: czt <czt18638530771@163.com>
Date: 星期一, 12 一月 2026 18:22:30 +0800
Subject: [PATCH] 增加项目启动缓存刷新

---
 fzzy-igdss-core/src/main/java/com/fzzy/igds/utils/Base64Util.java |   58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/fzzy-igdss-core/src/main/java/com/fzzy/igds/utils/Base64Util.java b/fzzy-igdss-core/src/main/java/com/fzzy/igds/utils/Base64Util.java
index 47f7052..28baaab 100644
--- a/fzzy-igdss-core/src/main/java/com/fzzy/igds/utils/Base64Util.java
+++ b/fzzy-igdss-core/src/main/java/com/fzzy/igds/utils/Base64Util.java
@@ -1,15 +1,18 @@
 package com.fzzy.igds.utils;
 
+import lombok.extern.slf4j.Slf4j;
 import sun.misc.BASE64Decoder;
 import sun.misc.BASE64Encoder;
 
 import java.io.*;
+import java.util.Base64;
 
 /**
  * @Description 鍥剧墖Base澶勭悊
  * @Author CZT
  * @Date 2026/1/7 11:07
  */
+@Slf4j
 public class Base64Util {
 
 	public static String BASE_IMG_START = "data:image/jpg;base64,";
@@ -85,4 +88,59 @@
 		}
 	}
 
+
+	/**
+	 * base64杞负鍥剧墖
+	 *
+	 * @param path   鏂囦欢璺緞锛氬埌鏂囦欢澶瑰嵆鍙紝浠g爜閲屼細鍦ㄦ枃浠跺す閲岀敓鎴愬搴旂殑jpg鏂囦欢
+	 * @param base64
+	 * @return
+	 */
+	public static String base64ToJpg(String path, String fileName, String base64) {
+		// 鍒ゆ柇鏂囦欢璺緞鏄惁瀛樺湪
+		File filePath = new File(path);
+		if (!filePath.exists()) {
+			filePath.mkdirs();
+		}
+		// 鍒涘缓鏂囦欢
+		String jpgFile = path + "\\" + fileName + ".jpg";
+		File file = new File(jpgFile);
+		boolean jpgFileExist = false;
+		try {
+			jpgFileExist = file.createNewFile();
+			log.info("jpg鏂囦欢鍒涘缓鎴愬姛");
+		} catch (IOException e) {
+			log.info("jpg鏂囦欢鍒涘缓澶辫触");
+			e.printStackTrace();
+		}
+		if (jpgFileExist) {
+			// 瑙e瘑
+			Base64.Decoder decoder = Base64.getDecoder();
+			// 鍘绘帀base64鍓嶇紑 data:image/jpeg;base64,
+			base64 = base64.substring(base64.indexOf(",", 1) + 1, base64.length());
+			byte[] b = decoder.decode(base64);
+			// 澶勭悊鏁版嵁
+			for (int i = 0; i < b.length; ++i) {
+				if (b[i] < 0) {
+					b[i] += 256;
+				}
+			}
+			// 淇濆瓨鍥剧墖
+			try {
+				FileOutputStream out = new FileOutputStream(jpgFile);
+				out.write(b);
+				out.flush();
+				out.close();
+				// 鍐欏叆鎴愬姛杩斿洖鏂囦欢璺緞
+				return jpgFile;
+			} catch (FileNotFoundException e) {
+				log.info("鏂囦欢鏈壘鍒�");
+				e.printStackTrace();
+			} catch (IOException e) {
+				log.info("鍐欏叆澶辫触");
+				e.printStackTrace();
+			}
+		}
+		return "鏂囦欢涓嶅瓨鍦�";
+	}
 }
\ No newline at end of file

--
Gitblit v1.9.3