From 0561f9033014f831d7193a3222539b44b991dda8 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期二, 22 十月 2024 17:02:03 +0800 Subject: [PATCH] Fm中增加分析hash值集合功能方法 --- pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/dyFile/FileConstant.java | 2 ++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/dyFile/FileOperate.java | 28 ++++++++++++++++++++++++++++ pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/FmCtrl.java | 6 +++--- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/dyFile/FileConstant.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/dyFile/FileConstant.java index 2450546..c9d7f6a 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/dyFile/FileConstant.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/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/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/dyFile/FileOperate.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/dyFile/FileOperate.java index ae52a49..f4132ec 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/dyFile/FileOperate.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/dyFile/FileOperate.java @@ -277,6 +277,34 @@ } /** + * 瑙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 * @param filePath diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/FmCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/FmCtrl.java index 4e22515..64d7d15 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/FmCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/FmCtrl.java @@ -134,15 +134,15 @@ * @param hashCodes * @return 鏂囦欢鏈嶅姟鍣ㄥ睘鎬у璞¢泦鍚� */ - @PostMapping(path = "parseHashcodes") - public List<FileRestVo> parseHashcodes(List<Integer> hashCodes){ + @PostMapping(path = "parseHashcodeList") + public FileRestVo[] parseHashcodeList(List<Integer> hashCodes){ List<FileRestVo> reList = new ArrayList<>() ; if(hashCodes != null && hashCodes.size() > 0){ for(Integer hashCode : hashCodes){ reList.add(parseHashcode(hashCode)) ; } } - return reList ; + return reList.toArray(new FileRestVo[0]) ; } -- Gitblit v1.8.0