From 8247ccb1b4d8dfa5e1e8644cde340c43c2dffe00 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期三, 23 十月 2024 10:15:25 +0800
Subject: [PATCH] web分布式文件系统,增加一个分析文件hash值集合的方法

---
 pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/dyFile/FileOperate.java  |   30 ++++++++++++++++++++++++++++++
 pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/dyFile/FileConstant.java |    2 ++
 pms-parent/pms-web-other/src/main/java/com/dy/pmsOther/dyFm/FmCtrl.java       |   19 ++++++++++++++++++-
 3 files changed, 50 insertions(+), 1 deletions(-)

diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/dyFile/FileConstant.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/dyFile/FileConstant.java
index c3d1ea3..a14b0af 100644
--- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/dyFile/FileConstant.java
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/dyFile/FileConstant.java
@@ -12,6 +12,8 @@
 	public static final String fmPostMapping_parsePathList_paramName = "filePaths" ;//鍙傛暟鍚嶇О
 	public static final String fmPostMapping_parseHashcode = "parseHashcode" ;//鏂规硶璺緞
 	public static final String fmPostMapping_parseHashcode_paramName = "hashCode" ;//鍙傛暟鍚嶇О
+	public static final String fmPostMapping_parseHashcodeList = "parseHashcodeList" ;//鏂规硶璺緞
+	public static final String fmPostMapping_parseHashcodeList_paramName = "hashCodes" ;//鍙傛暟鍚嶇О
 
 	public static final String fileRequestMapping = "file" ;//controller 璺緞
 	public static final String filePostMapping_photo = "savePhoto" ;//鏂规硶璺緞
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/dyFile/FileOperate.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/dyFile/FileOperate.java
index bde0f4e..c30a98e 100644
--- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/dyFile/FileOperate.java
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/dyFile/FileOperate.java
@@ -276,6 +276,36 @@
 		return rvo ;
 	}
 
+
+	/**
+	 * 瑙f瀽鏂囦欢鍝堝笇鍊�
+	 * @param fmUrl
+	 * @param hashCodes
+	 * @return
+	 */
+	public  List<FileRestVo> parseHashcode(String fmUrl, List<Integer> hashCodes){
+		List<FileRestVo> rList = null ;
+		if(hashCodes != null && hashCodes.size() > 0) {
+			// 鍑嗗璇锋眰鏁版嵁
+			MultiValueMap<String, Object> multipartRequestData = new LinkedMultiValueMap<>();
+			multipartRequestData.add(FileConstant.fmPostMapping_parseHashcodeList_paramName, hashCodes);
+
+			// 璁剧疆璇锋眰澶撮儴锛岃繖閲屽亣璁炬湇鍔″櫒鎺ユ敹multipart/form-data绫诲瀷鐨勬暟鎹�
+			HttpHeaders headers = new HttpHeaders();
+			headers.setContentType(MediaType.MULTIPART_FORM_DATA);
+
+			// 灏佽璇锋眰浣�
+			HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(multipartRequestData, headers);
+
+			String webUrl = fmUrl + "/" + FileConstant.fmRequestMapping + "/" + FileConstant.fmPostMapping_parseHashcodeList;
+			// 鍙戦�丳OST璇锋眰
+			FileRestVo[] rvos = restTemplate.postForObject(webUrl, requestEntity, FileRestVo[].class);
+			rList = Arrays.asList(rvos) ;
+		}
+		return rList ;
+	}
+
+
 	/**
 	 * 瑙f瀽鏂囦欢鏂囦欢璺緞涓殑鍝堝笇鍊煎苟杩斿洖鍥剧墖瀹屾暣璺緞
 	 * @param fmUrl
diff --git a/pms-parent/pms-web-other/src/main/java/com/dy/pmsOther/dyFm/FmCtrl.java b/pms-parent/pms-web-other/src/main/java/com/dy/pmsOther/dyFm/FmCtrl.java
index df8e93d..c4b85b9 100644
--- a/pms-parent/pms-web-other/src/main/java/com/dy/pmsOther/dyFm/FmCtrl.java
+++ b/pms-parent/pms-web-other/src/main/java/com/dy/pmsOther/dyFm/FmCtrl.java
@@ -10,7 +10,7 @@
 import java.util.List;
 
 /**
- * 鍗曠偣鐧诲綍锛�
+ * 鍒嗗竷寮弚eb鏂囦欢绯荤粺绠$悊绯荤粺
  */
 @Slf4j
 @RestController
@@ -130,4 +130,21 @@
     }
 
 
+    /**
+     * 瑙f瀽鍝堝笇鍊硷紝璁$畻鍑鸿鍝堝笇鍊煎搴旂殑鏂囦欢鏈嶅姟鍣ㄥ睘鎬�
+     * @param hashCodes
+     * @return
+     */
+    @PostMapping(path = "parseHashcodeList")
+    public FileRestVo[] parseHashcodeList(List<Integer> hashCodes){
+        List<FileRestVo> rList = new ArrayList<FileRestVo>() ;
+        if(hashCodes != null && hashCodes.size() > 0){
+            for (Integer hashCode : hashCodes){
+                rList.add(parseHashcode(hashCode)) ;
+            }
+        }
+        return rList.toArray(new FileRestVo[0]) ;
+    }
+
+
 }

--
Gitblit v1.8.0