From 6a9148db96ae24cb932ee50e9427269569348868 Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期一, 28 四月 2025 09:14:53 +0800
Subject: [PATCH] 手册,海康接口调整
---
ycl-common/src/main/java/utils/file/FileUtils.java | 49 ++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 40 insertions(+), 9 deletions(-)
diff --git a/ycl-common/src/main/java/utils/file/FileUtils.java b/ycl-common/src/main/java/utils/file/FileUtils.java
index 9aa3e7b..6cb97d1 100644
--- a/ycl-common/src/main/java/utils/file/FileUtils.java
+++ b/ycl-common/src/main/java/utils/file/FileUtils.java
@@ -3,6 +3,7 @@
import config.PlatformConfig;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
+import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ArrayUtils;
@@ -16,16 +17,17 @@
/**
* 鏂囦欢澶勭悊宸ュ叿绫�
- *
+ *
* @author ruoyi
*/
+@Slf4j
public class FileUtils
{
public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+";
/**
* 杈撳嚭鎸囧畾鏂囦欢鐨刡yte鏁扮粍
- *
+ *
* @param filePath 鏂囦欢璺緞
* @param os 杈撳嚭娴�
* @return
@@ -72,6 +74,35 @@
}
/**
+ * 浠庡瓧绗︿覆涓彁鍙栨棩鏈熼儴鍒�
+ *
+ * @param inputString 杈撳叆瀛楃涓�
+ * @return 鎻愬彇鐨勬棩鏈熷瓧绗︿覆锛屽鏋滄湭鎵惧埌鍒欒繑鍥� ""
+ */
+ public static String extractDateFromString(String inputString) {
+ // 浣跨敤姝e垯琛ㄨ揪寮忔潵鍖归厤鏃ユ湡鏍煎紡 YYYY-MM-DD
+ String datePattern = "(\\d{4}-\\d{2}-\\d{2})";
+ java.util.regex.Pattern pattern = java.util.regex.Pattern.compile(datePattern);
+ java.util.regex.Matcher matcher = pattern.matcher(inputString);
+ if (matcher.find()) {
+ return matcher.group(1);
+ }
+ return "";
+ }
+ public static String getImgName(String url) {
+
+ // 鎵惧埌鏈�鍚庝竴涓枩鏉犵殑浣嶇疆
+ int lastSlashIndex = url.lastIndexOf('/');
+ if(lastSlashIndex == -1){
+ return "";
+ }
+ // 鎻愬彇浠庢渶鍚庝竴涓枩鏉犱箣鍚庣殑閮ㄥ垎
+ return url.substring(lastSlashIndex + 1);
+ }
+
+
+
+ /**
* 鍐欐暟鎹埌鏂囦欢涓�
*
* @param data 鏁版嵁
@@ -100,7 +131,7 @@
/**
* 鍒犻櫎鏂囦欢
- *
+ *
* @param filePath 鏂囦欢
* @return
*/
@@ -118,7 +149,7 @@
/**
* 鏂囦欢鍚嶇О楠岃瘉
- *
+ *
* @param filename 鏂囦欢鍚嶇О
* @return true 姝e父 false 闈炴硶
*/
@@ -129,7 +160,7 @@
/**
* 妫�鏌ユ枃浠舵槸鍚﹀彲涓嬭浇
- *
+ *
* @param resource 闇�瑕佷笅杞界殑鏂囦欢
* @return true 姝e父 false 闈炴硶
*/
@@ -153,7 +184,7 @@
/**
* 涓嬭浇鏂囦欢鍚嶉噸鏂扮紪鐮�
- *
+ *
* @param request 璇锋眰瀵硅薄
* @param fileName 鏂囦欢鍚�
* @return 缂栫爜鍚庣殑鏂囦欢鍚�
@@ -223,7 +254,7 @@
/**
* 鑾峰彇鍥惧儚鍚庣紑
- *
+ *
* @param photoByte 鍥惧儚鏁版嵁
* @return 鍚庣紑鍚�
*/
@@ -252,7 +283,7 @@
/**
* 鑾峰彇鏂囦欢鍚嶇О /profile/upload/2022/04/16/ruoyi.png -- ruoyi.png
- *
+ *
* @param fileName 璺緞鍚嶇О
* @return 娌℃湁鏂囦欢璺緞鐨勫悕绉�
*/
@@ -270,7 +301,7 @@
/**
* 鑾峰彇涓嶅甫鍚庣紑鏂囦欢鍚嶇О /profile/upload/2022/04/16/ruoyi.png -- ruoyi
- *
+ *
* @param fileName 璺緞鍚嶇О
* @return 娌℃湁鏂囦欢璺緞鍜屽悗缂�鐨勫悕绉�
*/
--
Gitblit v1.8.0